// JavaScript Document
// global menu also uses some code found in atc_menu1.js
var onMenu = false;
var delay = 100;
var stID = 0;
var dropList = new Array("ncnewDrop","nwDrop","mupDrop","scswwDrop","sewDrop","ilmnDrop");
var subList = new Array("ncnewSub1","ncnewSub2","ncnewSub12","ncnewSub6","ncnewSub8","nwSub1","nwSub2","mupSub1","mupSub2","scswwSub2","scswwSub3","scswwSub4","scswwSub5","scswwSub6","scswwSub9","scswwSub10","scswwSub11","scswwSub12","scswwSub14","scswwSub15","scswwSub20","sewSub3","sewSub4","ilmnSub1");

function openDrop(menuID){
	//alert(menuID);
	document.getElementById(menuID).style.display = "inline";
	closeAllDropsBut(menuID);
}
function closeAllDropsBut(elem){
	for (i=0;i<dropList.length; i++){
		if (elem != dropList[i]){
			//alert(elem+" "+subList[i]);
			closeDrop(dropList[i]);
		}
	}
}
function closeDrop(menuID){
	document.getElementById(menuID).style.display = "none";
	closeSubs();
}
function closeSubs(){
	for (k=0;k<subList.length; k++){
		document.getElementById(subList[k]).style.display = "none";
	}
}
function swapStyle(elem,styleName){
	document.getElementById(elem).className = styleName;
}

function swapImage(elem,newImg){
	document.getElementById(elem).src = newImg;
}

function setMaskState(elem,vis){
	document.getElementById(elem).style.visibility = vis;
}

function rollOn(elem,hoverStyle){
	swapStyle(elem,hoverStyle);
	clearDelay();
}
function rollOff(elem,staticStyle,menuID){
	swapStyle(elem,staticStyle);
	setDelay(menuID);
}
function menuCheck(menuID){
	if (onMenu == false){
		closeDrop(menuID);
		stID = 0;
	}else{
		clearDelay();
	}
}
function clearDelay(){
	onMenu=true;
	clearTimeout(stID);
	stID = 0;
}
function setDelay(menuID){
	onMenu=false;
	var relay = function(){//allows setTimeout to pass variables
		menuCheck(menuID);
	}
	if(stID == 0){
		stID = setTimeout(relay,delay);
		//stID = setTimeout("menuCheck('"+menuID+"','"+clipRect+"','"+maskID+"')",delay);
	}else{
		clearTimeout(stID);
		stID = setTimeout(relay,delay);
		//stID = setTimeout("menuCheck('"+menuID+"','"+clipRect+"','"+maskID+"')",delay);
	}
}

function openSub(elem){
	document.getElementById(elem).style.display = "inline";
	closeAllSubsBut(elem);
}

function closeAllSubsBut(elem){
	for (j=0;j<subList.length; j++){
		//alert(elem+" "+subList[i]);
		if (elem != subList[j]){
			document.getElementById(subList[j]).style.display = "none";
		}
	}
}

function goPage(pURL){
	document.location = pURL;
}

//------------------------------------------------rollover/preload code----------------------------------
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


MM_preloadImages('images/btn_NCNEW.gif,images/btn_NCNEWO.gif,images/btn_NW.gif,images/btn_NWO.gif,images/btn_MUP.gif,images/btn_MUPO.gif,images/btn_SCSWW.gif,images/btn_SCSWWO.gif,images/btn_SEW.gif,images/btn_SEWO.gif,images/btn_ILMN.gif,images/btn_ILMNO.gif');