/******************************************************************************** 
Nav1.js - This is the javascript for the dropdown menus on the top navigation bar.
********************************************************************************/

var inmenu=false;
var lastmenu=0;
var timeoutlen=500;
var lImgPath="assets/images/";

/*******************
Offset timeout for dropdowns if Safari, since Safari 
has problem with dropdowns over an iFrame.
*******************/
if(getBrowser()=="Safari"){
	timeoutlen=3500;
}

/*******************
Mouseover Preloads
*******************/

nav1Opt1on = new Image(); nav1Opt1on.src = lImgPath + "nav-information-mo.gif"; 
nav1Opt1off = new Image(); nav1Opt1off.src = lImgPath + "nav-information.gif"; 
			
nav1Opt2on = new Image(); nav1Opt2on.src = lImgPath + "nav-products-mo.gif"; 
nav1Opt2off = new Image(); nav1Opt2off.src = lImgPath + "nav-products.gif"; 
			
nav1Opt3on = new Image(); nav1Opt3on.src = lImgPath + "nav-contact-mo.gif"; 
nav1Opt3off = new Image(); nav1Opt3off.src = lImgPath + "nav-contact.gif"; 


/*******************
Methods for top navigation bar dropdowns
*******************/

function menu(current,x,y) {
   if (!document.getElementById) return;
   inmenu = true;
   oldmenu = lastmenu;
   lastmenu = current;
  
   if (oldmenu) erase(oldmenu);
   rollOver(current,true);
   box = document.getElementById(current+"-dropdown");
   box.style.visibility = "visible";
   box.style.left = x;
   box.style.top = y;
   box.style.width = "108px";
}

function erase(current) {
	currSplit = current.split("-dropdown");
	current = currSplit[0];

   if (!document.getElementById) return;
   if (inmenu && lastmenu.indexOf(current)>-1) {
	  return;
   }
   rollOver(current,false);
   box=document.getElementById(current+"-dropdown");
   box.style.visibility="hidden";
}

function timeout(current) {
   inmenu=false;
   window.setTimeout("erase('" + current + "');",timeoutlen);
}

function activate(menu,item) {
   if (!document.getElementById) return;
   inmenu=true;
   lastmenu=menu;
   obj=document.getElementById(item);
}

function deactivate(menu,item) {
   if (!document.getElementById) return;
   timeout(menu);
   obj=document.getElementById(item);
}
