var woms = new Array();
window.onload = womGo;

function womGo(){
  for(var i = 0;i < woms.length;i++)
    eval(woms[i]);
}

function womAdd(func){
  woms[woms.length] = func;
}

function setupRollover(thisImage,imagePrefix) {
	thisImage.outImage = new Image();
	thisImage.outImage.src = "/gfx/" + imagePrefix + "-off.png";
	thisImage.onmouseout = rollOut;
	
	thisImage.overImage = new Image()
	thisImage.overImage.src = "/gfx/" + imagePrefix + "-on.png";
	thisImage.onmouseover = rollOver;
	thisImage.onmouseup = rollOver;
	
	thisImage.clickImage = new Image()
	thisImage.clickImage.src = "/gfx/" + imagePrefix + "-down.png";
	thisImage.onmousedown = mouseDown;
}

function rollOut() {
	this.src = this.outImage.src;
}

function rollOver() {
	this.src = this.overImage.src;
}

function mouseDown() {
	this.src = this.clickImage.src;
}

function reloadPage() {
	document.location.reload();
}

function switchElements(visibleID,invisibleID,milliseconds) {
	var period = Math.round(milliseconds / 2);
	opacity(visibleID,100,0,period);
	setTimeout("document.getElementById('" + visibleID + "').style.display = 'none'",period);
	setTimeout("document.getElementById('" + invisibleID + "').style.display = 'block'",period);
	setTimeout("opacity('" + invisibleID + "',0,100," + period + ")",period);
}

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) {
        	setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
}

//change the opacity for different browsers 
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style;
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
}

function create_request_string(theForm) { 
	var reqStr = ""; 
	
	for(i=0; i < theForm.elements.length; i++) { 
		isFormObject = false; 
		
		switch (theForm.elements[i].tagName) { 
		case "INPUT": 
			switch (theForm.elements[i].type) { 
			case "text": 
			case "hidden": 
				reqStr += theForm.elements[i].name + "=" + encodeURIComponent(theForm.elements[i].value); 
				isFormObject = true; 
				break; 
			case "checkbox": 
				if (theForm.elements[i].checked) { 
					reqStr += theForm.elements[i].name + "=" + theForm.elements[i].value; 
				} else { 
					reqStr += theForm.elements[i].name + "="; 
				} 
				isFormObject = true; 
				break; 
			case "radio": 
				if (theForm.elements[i].checked) { 
					reqStr += theForm.elements[i].name + "=" + theForm.elements[i].value; 
					isFormObject = true;
				}
				break;
			} 
			break; 
		case "TEXTAREA": 
			reqStr += theForm.elements[i].name + "=" + encodeURIComponent(theForm.elements[i].value); 
			isFormObject = true; 
			break; 
		case "SELECT": 
			var sel = theForm.elements[i]; 
			reqStr += sel.name + "=" + sel.options[sel.selectedIndex].value; 
			isFormObject = true; 
			break; 
		} 
		
		if ((isFormObject) && ((i+1)!= theForm.elements.length)) { 
			reqStr += "&"; 
		}	
	} 
	
	return reqStr;
}