//----------------------------------------------------------------------------------------------------------------
//---Author:			Chris Lomonico
//---Date Created:		7/23/2002
//---Purpose:			To provide general scripting for the site
//----------------------------------------------------------------------------------------------------------------
//---Declare globals
var iBrowserMajVer	= false;
var bDHTML			= false;
var bLayers			= false;
var bAll			= false;
var bByID			= false;
var remember		= new Array();
var remember2		= new Array();
var checkIt;
//----------------------------------------------------------------------------------------------------------------
//---this fuction handles the display of the menuitems
//---it is passed the name, level and an reference to the parent object
function showMenu(name,lvl,obj){
	if (!bDHTML) return;
	checkUserInput();
	if (remember[lvl] && remember[lvl] == name) return;
	if (remember[lvl]){closeAll(lvl);}
	if(name){
		var x			= getObjRef(name,1);
		x.visibility	= 'visible';
		remember[lvl]	= name;
	}
	if(obj.parentNode){
		y	= obj.parentNode;
	}else if (obj.parentElement){
		 y = obj.parentElement;
	}else{ 
		return;
	}
	if(y.className){return;}
	y.className			= 'over';
	if (remember2[lvl]) remember2[lvl].className = '';
	remember2[lvl] = y;
	
}
//----------------------------------------------------------------------------------------------------------------
//---this fuction closes the menu items in the instance where the
//---user either selected to display a new menu item or 
//---has choosen to let the menu item's display timeout  
//---the menu items at the specified level are closed
function closeAll(lvl){
	for (i=remember.length - 1;i>=lvl;i--){
		if (remember[i]){
			var x			= getObjRef(remember[i],1);
			x.visibility	= 'hidden';
		}
		remember[i] = null;
		if (remember2[i]){
			remember2[i].className	= '';
			remember2[i]			= null;
		}
	}
}
//----------------------------------------------------------------------------------------------------------------
//---Checks to see if the user has just left the menu item hanging there, if
//---so it closes em
function checkUserInput(){
	if(checkIt)clearTimeout(checkIt);
	checkIt	 = setTimeout('closeAll(1)',5000);
	return true;
}

//----------------------------------------------------------------------------------------------------------------
//---this function performs a basic check in order to determine 
//---how the browser accesses the objects within it
function setDOMType(){
	if(document.getElementById){
		bDHTML	= true;
		bByID	= true; 
	}else{
		if(document.all){
			bDHTML	= true;
			bAll	= true;
		}else{
			if((navigator.appName.indexOf('Netscape') >=0)&&(parseInt(navigator.appVersion) == 4)){
				bLayers = true;
				bDHTML = true;
			}
		}
	}
	return true;
}
//----------------------------------------------------------------------------------------------------------------
//---Depenedent upon the type of browser,the function reutrns a reference to the 
//---object that has the id that is passed in.  If the second param is set
//---to true, the function grabs a reference to the style of the object
function getObjRef(id,bStyle) {
	if(bStyle){
		if(bLayers){return document.layers[id];	}	
		if(bByID){return document.getElementById(id).style;}
		if(bAll){return document.all[id].style;}
	}else{
		if(bLayers){document.layers[id];}	
		if(bByID){return document.getElementById(id);}
		if(bAll){return document.all[id];}
	}
	//---makes it to here then something is screwed
	return null;
}
