var isNav, isIE, isN6;
var coll = "";
var styleObj = "";
var currSub = "none"
var name = "none"
var timer;




// submenu, stop timer when moused over
function stopClock(){
	clearTimeout( timer );
	
}


//timer function - hides submenu when time is up
function setClock(){
	//alert( "set clock");
	//if( currSub != "none" )
	timer = setTimeout( "hide(currSub)", 200 );
}




if( navigator.appName == "Netscape"){
	if ( parseInt( navigator.appVersion ) >= 5 ){
		isN6 = true;
		//styleObj = ".style";
		//coll = "getElementById(";
		//styleObj = ").style";
	}
	else
		isNav = true;
	
}
else{
	isIE = true;
	coll = "all.";
	styleObj = ".style";
}


function menuOver ( name, src ){
	sm = "sub" + name
	if( currSub != "none")
			hide( currSub );
	show( sm );
	currSub = sm;
	page = name;
	//hide if onMouseOut detected
	if ( src.indexOf( "On") < 0 ){
		//if( currSub != "none")
			//hide( currSub );
	}
	src = "images/topnav/" + src;
	rollOver( name, src, "" )


}

function getObject( obj ){
	var theObj, temp;
	//if( isN6 ){
		//theObj = document.getElementById( obj )
		//alert( theObj );
	//}
	if(typeof obj == "string"){
		if( isN6 ){
			theObj = document.getElementById( obj ).style;
			//theObj = eval("document."+obj+".style");
			//alert( theObj );
		}
		else
			theObj = eval("document."+coll+obj+styleObj);
	}else{
		theObj = obj;
	}
	return theObj;
}


function rollOver( imageName, imageSrc, layer ){
	
		if( isNav ){
			if( layer != "" ){
				var obj = eval("document."+layer+".document");
				obj.images[imageName].src = imageSrc;
			}
			else
				document.images[imageName].src = imageSrc;
		}
		else{
			document[imageName].src = imageSrc;
		}
}


function hide( obj ){
		var theObj = getObject(obj);
		theObj.visibility = "hidden";

}


function show( obj ){
		var theObj = getObject(obj);
		theObj.visibility = "visible";
}
