window.status="Menu System Loading..."
var IE5up = document.getElementById&&document.all;
var NS6up = document.getElementById&&!document.all;
var NS4 = document.layers;
var IE4 = document.all&&!window.print;
var AllReady = "false"; //gets set to true once the page has loaded, keeps errors from occuring if the menus are called before they load
var w; //holds the value for the active menus width
var loc; //holds the value for the active menus left position
var nloc = 0 //holds the value for the new location of the active menu position
var nwidth; //the nWidth is used to keep the menus from going past the right edge of the page
var totalwidth//the total available width of the page

//reloads netscape 4.x browsers if they are resized
if(document.layers) { 
var xX = innerWidth;
var yY = innerHeight; 
	onresize= function(){ 
		if(xX!= innerWidth || yY!= innerHeight) history.go(0); 
	}
}

// markwidth used when page is centered to keep menu items centered as well
function markwidth(){
	nloc=parseInt( (totalwidth-pagewidth)/2 )
	if(document.layers){
	nloc=nloc-8; //because netscape is stupid
	}
	for(i=0;i<items.length;i++){
		if(NS4){
			document.layers[items[i][2]].left=document.layers[items[i][2]].left+nloc;
		}
		if(IE4){
			document.all[items[i][2]].style.left=document.all[items[i][2]].style.left+nloc;
		}
		if(IE5up||NS6up){
			document.getElementById(items[i][2]).style.left=(parseInt(items[i][1]))+nloc;
		}
	}	
}

function HideMenu(menulayer){
	if (AllReady=="true"){
		if(IE5up||NS6up){
			document.getElementById(menulayer).style.visibility="hidden";
		}
		else if(NS4){
			document.layers[menulayer].visibility="hidden";
		}
		else if(IE4){
			document.all[menulayer].style.visibility="hidden";
		}
	}
	else{
	}
}

function ShowMenu(menulayer){
	if (AllReady=="true"){
		for(n=0;n<items.length;n++){
			for(i=1;i<items[n].length;i++){
				if(items[n][2]==menulayer){
				loc=parseInt(items[n][1]);
				}
			}
		}
		
		
		// start settings to calculate and assign nWidth if needed
		if(NS4){
			w = parseInt(document.layers[menulayer].clip.width);
		}
		if(IE4){
			w = parseInt(document.all[menulayer].offsetWidth);
		}
		if(IE5up||NS6up){
			w = parseInt(document.getElementById(menulayer).offsetWidth);
		}
		if((w+loc+nloc)>pagewidth+nloc){
			nWidth=parseInt(((pagewidth+nloc)-(w)));
			if(NS4){
				document.layers[menulayer].left=nWidth;
			}
			if(IE4){
				document.all[menulayer].style.left=nWidth;
			}
			if(IE5up||NS6up){
				document.getElementById(menulayer).style.left=nWidth;
			}
		}
		// end settings to calculate and assign nWidth if needed
		
		if(IE5up||NS6up){
			document.getElementById(menulayer).style.visibility="visible";
		}
		else if(NS4){
			document.layers[menulayer].visibility="visible";
		}
		else if(IE4){
			document.all[menulayer].style.visibility="visible";
		}
	}
	else{
	}
}

function SetTrue(){
AllReady = "true"
window.status="Menu System Now Loaded"
ClearStatus();
	if(pagecenter==true){
		findwidth();
	}
}

function ClearStatus(){
setTimeout("window.status=''",2000);
}
window.onload=SetTrue;
