

function setOpacity(value,object) {
	if(document.getElementById){
		var idElement = document.getElementById(object);
	} else if (document.all){
		var idElement = document.object;
	}
	if(value == 0) idElement.style.display = 'none';
	if(value > 0) idElement.style.display = 'block';
	idElement.style.opacity = value/10;
	idElement.style.filter = 'alpha(opacity='+(value*10)+')';
}




var t;

function fadeIn(fiLevel,fiObject) {
	if(fiLevel < 21){
		setOpacity(fiLevel,fiObject);
		var fiLevelNew= fiLevel+1;
		t = setTimeout("fadeIn("+fiLevelNew+",'"+fiObject+"')",10);
	}
}

function fadeOut(foLevel,foObject) {
	if(foLevel > -1){
		setOpacity(foLevel,foObject);
		var foLevelNew = foLevel-1;
		t = setTimeout("fadeOut("+foLevelNew+",'"+foObject+"')",10);
	}
}



function fadeImage(objectA,objectB,images,c){
	var imageArr = images.split('~');
	var numpix = imageArr.length;
	if(numpix > 1) var image = imageArr[c];
	else var image = images;
	c++;
	if(c >= numpix) c =0;
	object = objectA; nextobject = objectB; 
	if(document.getElementById){
		var imgElement = document.getElementById(object);
	} else if (document.all){
		var imgElement = document.object;
	}
	if(image !=''){
		var imageArrArr = image.split('|');
		var imagejpg = imageArrArr[0];
		var link = imageArrArr[1];
		var imgsize = imageArrArr[2];
		var timing = imageArrArr[3];
		if(imgsize == 'big')
		var imagepath = "..\/Images\/Homepage\/Big\/"+imagejpg; 
		else var imagepath = "..\/Images\/Homepage\/Small\/"+imagejpg; 
		if(link) imgElement.href = link;
		imgElement.style.zIndex = 1;
		t2 = setTimeout("fadeIn(0,\'"+object+"\')",250);
		t3 = setTimeout("fadeOut(20,\'"+object+"\')",timing);
		imgElement.style.backgroundImage='url('+imagepath+')';
		t4 = setTimeout("fadeImage('"+objectB+"','"+objectA+"','"+images+"',"+c+")",timing);
	}
}



 function isInt(x) {
   var y=parseInt(x);
   if (isNaN(y)) return false;
   return x==y && x.toString()==y.toString();
 }





function showHide(theitem,state){
	if(document.getElementById){
		var theblock = document.getElementById(theitem)
	} else if (document.all){
		var theblock = document.theitem
	}
	if(state == "show"){
		clearTimeout(t);
		theblock.style.display = "block";
		alert(theitem,state);
	} else {
		clearTimeout(t);
		theblock.style.display = "none";
		alert(theitem,state);
	}
}




function showHideDelay(theitem,state,delay){
	if(state == 'show'){
		clearTimeout(t);
  	 	t = setTimeout('showHide(\''+theitem+'\',\''+state+'\')', delay);
    } else {
		clearTimeout(t);
    }
}






function showHideMultiple(theItems,theStates){
	if(theItems && theStates){
		var theItemsArr = theItems.split(",");
		var theStatesArr = theStates.split(",");
		var arlen = theItemsArr.length;
		var count;
		var multiblock;
		for(count = 0; count <= arlen; count++){
			var currentElement = theItemsArr[count];
			var currentState = theStatesArr[count];
			if(currentElement){
				if(document.getElementById){
					multiblock = document.getElementById(currentElement);
				} else if (document.all){
					multiblock = document.currentElement;
				} // if
				if(currentState == "show"){
					clearTimeout(t);
					if(multiblock) multiblock.style.display = "block";
				} else {
					clearTimeout(t);
					if(multiblock) multiblock.style.display = "none";
				} // if
			} // if
		} // for loop
	} // if
}








function logoutConfirm(thepage) {
	var answer = confirm("Are you sure you want to logout?")
	if (answer){
		window.location = thepage;
	} else {
		exit();
	}
}





function confirmIt(thepage,themessage) {
	var answer = confirm(themessage)
	if (answer){
		window.location = thepage;
	} else {
		exit();
	}
}




function swapImage(object,image){
	if(document.getElementById){
		var idElement = document.getElementById(object)
	} else if (document.all){
		var idElement = document.object
	}
	idElement.style.backgroundImage='url('+image+')';
}



function focusFindIt(){
	if(document.getElementById){
		var searchwindow = document.getElementById('findit');
	} else if(document.all){
		var searchwindow = document.findit;
	}
	searchwindow.style.color = 'black';
	searchwindow.style.cursor = 'hand';
	searchwindow.value ='';
}



startList = function() {
	if (document.all && document.getElementById) {
		navRoot = document.getElementById("navigation");
		navSubOne = document.getElementById("puzzlenav");
		navSubTwo = document.getElementById("infonav");	
		hideItOne = document.getElementById("featured1a");	
		hideItTwo = document.getElementById("featured1b");	
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
		for (i=0; i<navSubOne.childNodes.length; i++) {
			node = navSubOne.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
					hideItOne.style.display = 'none';
					hideItTwo.style.display = 'none';
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
					hideItOne.style.display = 'block';
					hideItTwo.style.display = 'block';
				}
			}
		}
		for (i=0; i<navSubTwo.childNodes.length; i++) {
			node = navSubTwo.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}



window.onload=startList;