 // JavaScript Document

//Controls the left navigation fly-out boxes
//

var timer;
var thismenu;

function resetmenu () {
	document.getElementById(thismenu).style.left= "-5000px";
	thismenu = null;
}





function viewnav (state,whichblock) {
//Apply this to all links that will display a sub-navigation fly-out
	
	//var lastblock = whichblock;
	var thisblock = "dropnav-" + whichblock;
	
	//var navlocation = (window.innerWidth/2)-330; //Works in MOZ only
	var navlocation = (document.body.clientWidth/2)-321; //Works in MOZ and IE
	
	
	switch (state) {
		
		case "open":

				clearTimeout(timer);
				
				
				
				if (thismenu != null && thisblock != thismenu) {
					resetmenu();			
				}
				
				document.getElementById(thisblock).style.display = "block";
				document.getElementById(thisblock).style.left = navlocation + "px";
				//document.getElementById(thisblock).style.posLeft = navlocation + "px";
				thismenu = thisblock;
				//document.getElementById(thisblock).style.listStyle = "none";
				
			
			break;
			
			
		case "close":
			timer = setTimeout("resetmenu()",500);
			break;
			
		}	
		
	
}

