NS4 = (document.layers) ? 1 : 0;
IE4 = (document.all) ? 1 : 0;
NS6 = (document.getElementById) ? 1 : 0;
browsergood = (NS4 || IE4 || NS6) ? 1 : 0;
wereloaded = 0;
isloaded = false;

if(document.all && !document.getElementById) { // some sort of safety feature for older browsers
    document.getElementById = function(id) {
         return document.all[id];
    }
}

function getloaded(){
	if (document.body && typeof document.body.clientWidth!='undefined') w = document.body.clientWidth;
	if (typeof window.innerWidth!='undefined') w = window.innerWidth-16;
	w = Math.round(w/2);
	if (w==0) wereloaded = 0;
	//alert ("1/2 Screen is " + w);
	isloaded=true;
}

function lay_act(imgName) {
	if (document.images) {
		//imgOn = eval(imgName + "on.src");
		//document [imgName].src = imgOn;
		if (isloaded){
			nolayers();
			if (imgName=='link2'){layernameon('menu1',17,123)}
			if (imgName=='link3'){layernameon('menu2',17,123)}
			if (imgName=='link4'){layernameon('menu3',17,123)}
			if (imgName=='link5'){layernameon('menu4',17,123)}
			if (imgName=='link6'){layernameon('menu5',17,123)}
			if (imgName=='link7'){layernameon('menu6',17,123)}
			if (imgName=='link8'){layernameon('menu7',17,123)}
			resettime();
			}
		}
	}
function lay_inact(imgName) {
	if (document.images) {
		//imgOff = eval(imgName + "off.src");
		//document [imgName].src = imgOff;
		if (browsergood==1&&isloaded==1){
			timetogo=0;
			window.setTimeout("updatetimer()",2000);
			}
		}
	}

function updatetimer(){
	if(timetogo==0) {
		nolayers();
	}
}

function settimer(){
	window.setTimeout("updatetimer()",2000);
	timetogo=0;
}

function resettime(){
	timetogo=1;
}

function layernameon(menuName,leftloc,toploc)
	{
	nolayers();
//	leftloc = w - 384 + leftloc;
	NS4 = (document.layers) ? 1 : 0;
	IE4 = (document.all) ? 1 : 0;
	NS6 = (document.getElementById) ? 1 : 0;
	browsergood = (NS4 || IE4 || NS6) ? 1 : 0;
	if (NS4) {
		alert ("ns4");
		document.layers[menuName].visibility = "show";
		document.layers[menuName].left = leftloc;
		document.layers[menuName].top = toploc;
	}
	if (IE4) {
		toploc = toploc - 5; // just change the width for the 16px difference
	}
	if (NS6) {
		//alert ("ns6" + menuName);
		document.getElementById(menuName).style.visibility = "visible";
		document.getElementById(menuName).style.left = leftloc+"px";
		document.getElementById(menuName).style.top = toploc+"px";
	}
}

function nolayers()
	{
	NS4 = (document.layers) ? 1 : 0;
	NS6 = (document.getElementById) ? 1 : 0;
	//if (document.getElementById) NS4 = 1;
	if (NS4){
		for (i = 0; i < document.layers.length; i++) {
			document.layers[i].visibility = 'hide';
		}
	}
	if (NS6) {
		for (i=1; i<8; i++) {
			mylayer="menu"+i;
			document.getElementById(mylayer).style.visibility = "hidden";
		}
	}
}
