var siteurl = "/";
var siteurlpics = "../Images/";

if (!siteurlpics) var siteurlpics = siteurl;

//Mouseover images topnav with drop down menu
//this version has been modified to accomodate the use of mouseovers (using images) in the top nav and not css properties
//for ns6.x and ie4+ while using layers for ns4.x
//this version uses mouseover images for the topnav for ns4.x, ie4+ and ns6.x while integrating the topnav
//with the drop down menu. 
 
//revisions 
//last modified by ejc on 08/31/01
//revised dropdown border format for ie, ns4.x and ns6   						                            05/10/01
//got rid of the top and bottom spacer for functionality in ie     				                      05/10/01
//using css properties for top nav color change and not div's anymore   		                    05/10/01
//meshed topnav css properties with dropdown menu for ie4+				 		                          05/10/01 n/a
//meshed topnav css properties with dropdown menu for ns6						                            05/16/01 n/a
//revised the code that generates the border around that drop down layer 
//that is looks the same in all 3 browsers										                                  05/23/01
//edited the topnav characteristics to allow for the use of mouseovers in the topnav            08/02/01
//removed the need for the spacer image used in conjunction with the mouseout effect in ns4.x   08/31/01

function open1Window(url, name){popupWin = window.open(url, name, 'width=520,height=388,left=20,top=20');}
function open2Window(url, name){url = url;popupWin = window.open(url, name, 'width=310,height=270,left=20,top=20');}
function open3Window(url, name){url = siteurl + url;popupWin = window.open(url, name, 'width=500,height=550,scrollbars=yes,left=20,top=20');}
function open3Window(url, name){url = siteurl + url;popupWin = window.open(url, name, 'width=500,height=420,left=20,top=20');}
function opengeneralofferWindow(url, name){url =  url;popupWin = window.open(url, name, 'width=600,height=540,resizable=yes,scrollbars=yes,left=20,top=20');}

function prepGetCookie()
{
  if(location.href.indexOf("") != -1)
  {
    var existence = getCookie2('cookie_general_offer');    //look for a cookie with a specified name
    if(existence == null)
      popupWin = window.open(url, name, 'width=600,height=540,scrollbars=yes,left=20,top=20');
    else {
      // must decode url?pdf=whatever.pdf and make that open in a new window
    }
  }
}
// Retrieve a named cookie value
function getCookie2(name) {
	var dc = document.cookie;
	
	// find beginning of cookie value in document.cookie
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	}
	else begin += 2;
	
	// find end of cookie value
	var end = document.cookie.indexOf(";", begin);
	if (end == -1) end = dc.length;
	// return cookie value
	return unescape(dc.substring(begin + prefix.length, end));
}



function lnOverCol()
{ var inc, endInc=arguments.length;
  for (inc=0; inc<endInc; inc++) 
  {var id = arguments[inc];if(document.all)document.all(id).style.background = '#A6AEBF';
    else if(document.getElementById)document.getElementById(id).style.background = '#A6AEBF';
  }
}

function lnOutCol()
{ var inc, endInc=arguments.length;
  for (inc=0; inc<endInc; inc++) 
  {var id = arguments[inc];if(document.all)document.all(id).style.background = '#647294';
    else if(document.getElementById)document.getElementById(id).style.background = '#647294';
  }
}

var showurl="";
var loaded = false;
var domOver = null;
var worldOver = null;
var activeImg = 'forms';
var activeExt = 'jpg';

//this function will clear the timeout then set the <td> color for ie and ns6 to the off state and it'll hide the dropdown's too
//ed add to send file extension arg to original  ('gif' or 'jpg')
function timedHideDropDown2(whichTd, fExt)
{
  topImg = whichTd;
  extOI = fExt;
  clearTimeout(domOver);
  domOver = setTimeout("hidePopupsNow2(topImg, extOI)",300);
}

function timedHideDropDown(whichTd)
{
  topImg = whichTd;
  clearTimeout(domOver);
  domOver = setTimeout("hidePopupsNow(topImg)",300);
}

//used for ns4.x and making the moused over divs disappear promptly.
function hidePopupsNow(actvImg)
{ 
  //name for the image and the active image for use and hiding it is the actvImg variable
  if(currSec != actvImg)
    changeImages(actvImg+'img',siteurlpics+ 'nav_'+actvImg +'.gif');
  if(!document.all && document.getElementById)
//    window.ActiveMenu.style.visibility = 'hidden';
    window.hideMenu(window.ActiveMenu);
  else if(document.layers)
    hideMenu(window.ActiveMenu);
  else if(document.all)
    window.hideMenu(window.ActiveMenu);
}

//ed add to send file extension arg to original  ('gif' or 'jpg') -- used for ns4.x and making the moused over divs disappear promptly.
function hidePopupsNow2(actvImg, fExt)
{ 
  //alert('hide called with img='+actvImg+' ext='+fExt);
  //name for the image and the active image for use and hiding it is the actvImg variable
  if(currSec != actvImg) {
	if(fExt=='gif') {
		changeImages(actvImg+'img',siteurlpics+ 'nav_'+actvImg +'.gif');
	}
	else {
		changeImages(actvImg+'img',siteurlpics+ 'nav_'+actvImg +'.jpg');
	}
  }
  if(!document.all && document.getElementById)
    window.hideMenu(window.ActiveMenu);
  else if(document.layers)
    hideMenu(window.ActiveMenu);
  else if(document.all)
    window.hideMenu(window.ActiveMenu);
}

//this function will clear the timeout then set the <td> color for ie and ns6 to the off state and it'll hide the dropdown's too
function timedHideWorld() {
  clearTimeout(worldOver);
  worldOver = setTimeout("hideWorldNow()",300);
}


//set the variable currSec which is set the location.href
var currSec='';
//if (document.location.href.indexOf('/company/') != -1) currSec="company";
//else if (document.location.href.indexOf('/careers/') != -1) currSec="company";
//else if (document.location.href.indexOf('/contact/') != -1) currSec="company";
//else if (document.location.href.indexOf('/services/') != -1) currSec="products";
//else if (document.location.href.indexOf('/news_home/') != -1) currSec="news";
//else if (document.location.href.indexOf('/support/') != -1) currSec="support";
//else if (document.location.href.indexOf('/resources/') != -1) currSec="resources";
//else if (document.location.href.indexOf('/work/') != -1) currSec="industries";
//else currSec="";

function keepTop()
{if(currSec != "")changeImages(currSec+'img',siteurlpics +'nav_'+ currSec+'_over.gif');}

//ed add to send file extension to original ('gif' or 'jpg')
function keepTop2(fExt) {
	//alert('top called with ext='+fExt);
	if(currSec != "") {
		if(fExt == 'gif')
			changeImages(currSec+'img',siteurlpics +'nav_'+ currSec+'_over.gif');
		else
			changeImages(currSec+'img',siteurlpics +'nav_'+ currSec+'_over.jpg');
	}
}

//ed add to send file extension to original ('gif' or 'jpg')
function activePic2(img, fExt)
{
  //mouseover the top and hide other active img/lyr if on, if not already set then company is set as the default
  //alert('newimg='+img+' newext='+fExt);
  hidePopupsNow2(activeImg, activeExt);
  keepTop2(fExt);
  clearTimeout(domOver);
  activeImg = img;
  activeExt = fExt;
  //alert('curimg='+activeImg+' curext='+activeExt);
}

function activePic(img)
{
  //mouseover the top and hide other active img/lyr if on, if not already set then company is set as the default
  hidePopupsNow(activeImg);
  keepTop();
  clearTimeout(domOver);
  activeImg = img;
}


if(!document.all && document.getElementById)
  var spacerWidth = window.innerWidth;
else
  var spacerWidth = 600;

//this var may be scrapped after reparsing.  
var popupDivs = "";
 

function changeImages() {
  for (var i=0; i<changeImages.arguments.length; i+=2) {
    document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
  }
}

function changeImages2() {
  for (var i=0; i<changeImages2.arguments.length; i+=3) {
    if (document.all || document.getElementById) {
      document[changeImages2.arguments[i]].src = changeImages2.arguments[i+1];
	}
	
    if (document.layers && changeImages2.arguments[i+2] != "") {
	  document[changeImages2.arguments[i+2]].document[changeImages2.arguments[i]].src = changeImages2.arguments[i+1];
    } else if (document.layers && changeImages2.arguments[i+2] == "") {
      document[changeImages2.arguments[i]].src = changeImages2.arguments[i+1];
	  }
  }
}


function newImage(arg){if (document.images){rslt = new Image();rslt.src = arg;return rslt;}}
//function preloadImages(){if(document.images){var imgFiles = preloadImages.arguments;for (var i=0; i<imgFiles.length; i+=2){eval(arguments[i]+' = new Image()');eval(arguments[i]+'.src = "'+arguments[i+1]+'"');}}}
//preloadImages('sitemap','../images/toolbar/sitemap_over.gif','industriesimg','../images/main_nav/company_on.gif','servicesimg','../images/main_nav/products_on.gif','industries','../images/main_nav/industries_on.gif','newsimg','../images/main_nav/news_on.gif','supportimg');

var param = "";
function toggleVisibility() 
{
  var inc, endInc=arguments.length;
  for (inc=0; inc<endInc; inc+=2) 
  {
    var id = arguments[inc];
    if (arguments[inc+1] == 'hidden')param="hidden";
    else if(arguments[inc+1]=='visible')param="visible";
    if (document.getElementById) 
	  eval("document.getElementById(id).style.visibility = \"" + param + "\"");
    else
	{
      if (document.layers) 
        document.layers[id].visibility = param;
      else if (document.all) 
        eval("document.all." + id + ".style.visibility = \"" + param + "\"");
      }
   }
}

function is_nav5_or_up(){
if((navigator.appName=="Netscape") && (parseInt(navigator.appVersion) >= 5))
 var navNet=navigator.appName=="Netscape";
 var navInt=parseInt(navigator.appVersion) >= 5;
 var is_nav5up=(navInt&&navNet);
  return is_nav5up;
}

 
///////////////////////////////////////////////////////////////////////////////////////////////
/**
 * by gary smith, July 1997
 * Copyright (c) 1997-1999 Netscape Communications Corp.
 * Netscape grants you a royalty free license to use or modify this
 * software provided that this copyright notice appears on all copies.
 * This software is provided "AS IS," without a warranty of any kind.
 * ------------------------------------------------------------------
 * DOM functionality by Eric Chaudry (ericc@atre.net), Atre Net Inc. August 2001
 */
function Menu(label) { 

  keepTop2(activeExt);
  this.version = "1.41 [menu.js; Menu; 010802]";
  this.type = "Menu";
  this.fontSize = 10 +'px';
  this.fontWeight = "plain";
  this.fontFamily = "Arial,Verdana,Helvetica,sans-serif";
  this.fontColor = "#000000" //"#ffffff";
  this.fontColorHilite = "#ffffff";
  this.bgColor = "#CBD6E6";						        //ns4 bottom and right container border color
  this.menuBorder = 1;
  this.menuItemWidth = 150;
  this.menuItemBorder = 1; //1;
  this.menuItemBgColor = "ivory"; //"#CBD6E6"; //#737D94";				    //item color before mouseing over it for the first time
  this.menuLiteBgColor = "#ffffff";				    //ns4 top and left container border color
  this.menuItemMouseOutColor = "ivory"; //#CBD6E6";// "#737D94";
  this.menuItemMouseOverColor = "#1B877D"; //"#4A73C6"; //"#9CA6B5";
  this.menuBorderBgColor = "#5A6B7B";			    //ns4 no effect		for item highlighting.
  this.menuHiliteBgColor = this.menuBorderBgColor;				//item m/o color ns4
  this.containerBorderColor = "#5A6B7B";			//ns4 no effect
  this.menuContainerBgColor =  this.containerBorderColor;   //"#0000FF";			//ns4 perimeter color for whole container
  this.menuPanelBgColor = "#5A6B7B";          //bgcolor for the bg panel for which all items are placed on top of; this has the lowest z index -->>> 1

  // set the border variables for netscape 4.x set the type of border (solid) and the width of the border
	//without setting the specific variables for ns4.x, the drop down border will appear different --> not the wanted effect
	this.ns4PanelBorderTop = 'solid '+this.containerBorderColor+';'
	this.ns4PanelBorderTopWidth = 0 +'px';
	this.ns4PanelBorderBottom = 'solid '+this.containerBorderColor+';'
	this.ns4PanelBorderBottomWidth = 0+'px';
	this.ns4PanelBorderLeft = 'solid '+this.containerBorderColor+';'
	this.ns4PanelBorderLeftWidth = 0 +'px';
	this.ns4PanelBorderRight = 'solid '+this.containerBorderColor+';'
	this.ns4PanelBorderRightWidth = 0 +'px';	
	
    // set the border variables for ie and ns6, set the type of border (solid) and the width of the border	
	this.panelBorderTop = 'solid '+this.containerBorderColor+';'
	this.panelBorderTopWidth = 0 +'px';
	this.panelBorderBottom = 'solid '+this.containerBorderColor+';'
	this.panelBorderBottomWidth = 0 +'px';
	this.panelBorderLeft = 'solid '+this.containerBorderColor+';'
	this.panelBorderLeftWidth = 0 +'px';
	this.panelBorderRight = 'solid '+this.containerBorderColor+';'
	this.panelBorderRightWidth = 0 +'px';	

	
	this.domCellWidth = 142 +'px';							//used for ie4+ and for ns6, this must be less that the overall div width so the border around the div is visible on all sides.
	this.domCellHeight = 19 +'px';							//used for ie4+ and for ns6
	this.itemBoxHeight = 19;										//used in ns4.x only for the box height of each cell for the drop down.
	this.indentTextFromLeft = 14;								//used in ns4.x only for the text placement from left 
	this.paddingInItemFromTop = 4 +'px';				//used in ns4.x only for text positioning within the drop down nav
	
  this.childMenuIcon = "../images/arrow_off.gif";
  this.childMenuIconHilite = "../images/arrow_on.gif";
  this.items = new Array();
  this.actions = new Array();
  this.colors = new Array();
  this.mouseovers = new Array();
  this.mouseouts = new Array();
  this.childMenus = new Array();
  this.addMenuItem = addMenuItem;
  this.addMenuSeparator = addMenuSeparator;
  this.writeMenus = writeMenus;
  this.showMenu = showMenu;
  this.onMenuItemOver = onMenuItemOver;
  this.onMenuItemOut = onMenuItemOut;
  this.onMenuItemDown = onMenuItemDown;
  this.onMenuItemAction = onMenuItemAction;
  this.hideMenu = hideMenu;
  this.hideChildMenu = hideChildMenu;
  this.mouseTracker = mouseTracker;
  this.setMouseTracker = setMouseTracker;
  if (!window.menus){
    window.menus = new Array();
	}
  this.label = label || "menuLabel" + window.menus.length;
  window.menus[this.label] = this;
  window.menus[window.menus.length] = this;
  if (!window.activeMenus) window.activeMenus = new Array();
  if (!window.menuContainers) window.menuContainers = new Array();
  if (!window.mDrag) {
    window.mDrag    = new Object();
    mDrag.startMenuDrag = startMenuDrag;
    mDrag.doMenuDrag    = doMenuDrag;
    this.setMouseTracker();
  }
  if (window.MenuAPI) MenuAPI(this);
}

function addMenuItem(label, action, color, mouseover, mouseout) {
    this.items[this.items.length] = label;
    this.actions[this.actions.length] = action;
    this.colors[this.colors.length] = color;
    this.mouseovers[this.mouseovers.length] = mouseover;
    this.mouseouts[this.mouseouts.length] = mouseout;
}

function addMenuSeparator() {
    this.items[this.items.length] = "separator";
    this.actions[this.actions.length] = "";
    this.menuItemBorder = 0;
}


var rootUrl = '';
function statusLocation(zx9)
{ 
  if((navigator.appName.indexOf("crosoft") != -1) && (navigator.appVersion.indexOf("4.01") != -1)) {rootUrl="";}
  else
  {
    this.zx9 = zx9
    totalUrl = document.location.href;
    if(totalUrl.indexOf('/devsite/') != -1)
    {
     tmpUrl = totalUrl.search('/devsite/') + 9;
     rootUrl = totalUrl.slice(0,tmpUrl);
     rootUrl =  zx9;
    }
    else
    {
     tmpUrl = totalUrl.search('.com/') + 5;
     rootUrl = totalUrl.slice(0,tmpUrl);
    }
   }
  return rootUrl;
} 


function writeMenus(container) {									
    if (!container && document.layers) {					
        if (eval("document.width")) { 						
            container = new Layer(1000);					
        }
    } else if (!container && document.all) {			
        if (!document.all["menuContainer"]) {
            document.writeln('<SPAN ID="menuContainer"></SPAN>');   
		}
        container = document.all["menuContainer"];
    } else if (!container && document.getElementById) {				
        if(!document.getElementById("menuContainer")){
		    document.writeln('<div id="menuContainer" style="cursor:pointer; z-index:6" onClick="onMenuItemAction(null,this);"></div>');
		}
		isit = document.getElementById('menuContainer');			
	    container = document.getElementById("menuContainer")
		 mytext='';
    }
    if (!container && !window.delayWriteMenus) {
        window.delayWriteMenus = this.writeMenus;
        window.menuContainerBgColor = this.menuContainerBgColor;
        setTimeout('delayWriteMenus()', 3000);
        return;
    }
    container.isContainer = "menuContainer" + menuContainers.length;
    menuContainers[menuContainers.length] = container;
    container.menus = new Array();
    for (var i=0; i<window.menus.length; i++)
        container.menus[i] = window.menus[i];
    window.menus.length = 0;
    var countMenus = 0;
    var countItems = 0;
    var top = 0;
    var content = '';
    var proto;
	document.exportContainer = container;
	if(document.all || document.getElementById)
	{ 
      for (var i=0; i < container.menus.length; i++, countMenus++) {
        var menu = container.menus[i];
        proto = menu.prototypeStyles || this.prototypeStyles || menu;
        content += '<DIV ID="menuLayer'+ countMenus +'" STYLE="width:144; background-color:'+this.menuPanelBgColor+'; border-top:' +this.panelBorderTop+ '; border-top-width:' +this.panelBorderTopWidth+ '; border-right:' +this.panelBorderRight+ '; border-right-width:' +this.panelBorderRightWidth+ '; border-bottom:' +this.panelBorderBottom+ '; border-bottom-width:' +this.panelBorderBottomWidth+ '; border-left:' +this.panelBorderLeft+ '; border-left-width:' +this.panelBorderLeftWidth+ '; cursor:hand; position:absolute; left:10; top:'+ (i * 100) +';visibility:hidden; z-index:3;">\n'
        		   + '<table cellspacing="1" cellpadding="1" border="0" width="144px">\n';
  		var x=i;
      for (var i=0,y=0; i<menu.items.length, y<menu.actions.length; i++, y++) {
      var item = menu.items[i];
		  var myaction = menu.actions[y];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
		  content += '<tr><td bgcolor="'+this.menuItemBgColor+'" height="'+this.domCellHeight+'" width="'+this.domCellWidth+'" nowrap id="menuTD' + countItems + '" onclick="(' + myaction + ');" style="padding-left: 12px; padding-right: 6px; color:'+this.fontColor+'; font-family:'+this.fontFamily+';font-weight:'+this.fontWeight+';font-size:'+this.fontSize+';" onmouseover="clearTimeout(domOver); style.color=\'' + this.fontColorHilite + '\';  bgColor=\''+this.menuItemMouseOverColor+'\'; window.status=\'' + statusLocation(item) + '\';" onmouseout="timedHideDropDown2(activeImg, activeExt); style.color=\'' + this.fontColor + '\'; bgColor=\''+this.menuItemMouseOutColor+'\';">'+item+'</td></tr>\n';
          proto.menuItemHeight = defaultHeight;
          proto.menuItemIndent = defaultIndent;
          countItems++;
        }
        content += '</table></div>\n';
        var i=x;
      }
	}
	else if(document.layers)
	{
      for (var i=0; i<container.menus.length; i++, countMenus++) {
        var menu = container.menus[i];
        proto = menu.prototypeStyles || this.prototypeStyles || menu;
        content += ''+
        '<DIV ID="menuLayer'+ countMenus +'" STYLE="cursor:hand;position:absolute;left:10;top:'+ (i * 100) +';visibility:hidden;z-index:3;">\n';
		if(document.layers)
		content += ''+
        '    <DIV ID="menuLite'+ countMenus +'" STYLE="cursor:hand;position:absolute;left:0;top:0; visibility:hide;z-index:3;" onMouseOut="hideMenu(this);">\n'+
        '    <DIV ID="menuFg'  + countMenus +'" STYLE="cursor:hand;position:absolute;left:' +this.ns4PanelBorderLeftWidth+ ';top:' +this.ns4PanelBorderTopWidth+ '; visibility:hide; z-index:3;">\n'+
        '';
        var x=i;
        for (var i=0; i<menu.items.length; i++) {
            var item = menu.items[i];						
            var childMenu = false;
            var defaultHeight = this.itemBoxHeight;
            var defaultIndent = this.indentTextFromLeft;
            if (item.label) {
                item = item.label;
                childMenu = true;
            } else if (item.indexOf(".gif") != -1 && item.indexOf("<IMG") == -1) {
                item = '<IMG SRC="' + item + '" NAME="menuItem'+ countItems +'Img">';
                defaultIndent = 0;
                if (document.layers) {
                    defaultHeight = null;
                }
            }
            proto.menuItemHeight = proto.menuItemHeight || defaultHeight;
            proto.menuItemIndent = proto.menuItemIndent || defaultIndent;
            var itemProps = 'visibility:hide;font-Family:' + proto.fontFamily +';font-Weight:' + proto.fontWeight + ';fontSize:' + proto.fontSize + ';';
            var dTag    = '<DIV ID="menuItem'+ countItems +'" STYLE="cursor:hand;position:absolute;left:0;top:'+ (i * proto.menuItemHeight) +';'+ itemProps +'">';
            var dText   = '<DIV ID="menuItemText'+ countItems +'" STYLE="padding-top:'+this.paddingInItemFromTop+';cursor:hand;position:absolute;left:' + proto.menuItemIndent + ';top:0;color:'+ proto.fontColor +';">&#160;&#160;&#160;&#160;'+ item +'</DIV>\n'+
			              '<DIV ID="menuItemHilite'+ countItems +'" STYLE="padding-top:'+this.paddingInItemFromTop+';cursor:hand;position:absolute; left:'+proto.menuItemIndent+'; top:0; color:'+ proto.fontColorHilite +';visibility:hidden;">&#160;&#160;&#160;&#160;'+ item +'</DIV>';
            if (item == "separator") {
                content += ( dTag + '<DIV ID="menuSeparator'+ countItems +'" STYLE="cursor:hand;position:absolute;left:1;top:2;"></DIV>\n<DIV ID="menuSeparatorLite'+ countItems +'" STYLE="cursor:hand;position:absolute;left:1;top:2;"></DIV>\n</DIV>');
            } else if (childMenu) {
                content += ( dTag + dText + '<DIV ID="childMenu'+ countItems +'" STYLE="cursor:hand;position:absolute;left:0;top:3;'+ itemProps +'"><IMG SRC="'+ proto.childMenuIcon +'"></DIV>\n</DIV>');
            } else {
                content += ( dTag + dText + '</DIV>');
            }
            countItems++;
        }
        content += '      <DIV ID="focusItem'+ countMenus +'" STYLE="cursor:hand;position:absolute;left:0;top:0;visibility:hide;" onClick="onMenuItemAction(null,this);">&nbsp;</DIV>\n';
        content += '   </DIV>\n  </DIV>\n</DIV>\n';
        i=x;
      }
	}	
    if (!container) return;
    if (container.innerHTML) {
        container.innerHTML=content;
    }
	else if((document.layers || document.all) && !is_nav5_or_up() ){
        container.document.open("text/html");
        container.document.writeln(content);
        container.document.close();
    }
  else if(is_nav5_or_up())
	{
		while (container.hasChildNodes())
		  container.removeChild(container.firstChild);
		var r=container.ownerDocument.createRange();
		r.selectNodeContents(container);
		r.collapse(true);
		var df=r.createContextualFragment(content);
		container.appendChild(df);
	}
    if (document.all) {
      var menuCount = 0;
      for (var x=0; x<container.menus.length; x++) {
          var menu = container.document.all("menuLayer" + x);
          container.menus[x].menuLayer = menu;
          container.menus[x].menuLayer.Menu = container.menus[x];
          container.menus[x].menuLayer.Menu.container = menu;
	  }
	}	
    else if (document.getElementById) {
	  var menuCount = 0;
	  for (var j=0; j<container.menus.length; j++) {
	    var menu = document.getElementById("menuLayer" + j);
        container.menus[j].menuLayer = menu;
        container.menus[j].menuLayer.Menu = container.menus[j];
        container.menus[j].menuLayer.Menu.container = container;	
      }
	}	
   else if(document.layers) {
    if (container.document.layers) {
        container.clip.width = window.innerWidth;
        container.clip.height = window.innerHeight;
//        container.onmouseout = this.hideMenu;
//instead of hiding the drop down in ns4.x as soon as it is moused off of, send the action listener to a function that does the job.
        container.onmouseout = timedHideDropDown(activeImg);
        container.menuContainerBgColor = this.menuContainerBgColor;
        for (var i=0; i<container.document.layers.length; i++) {
            proto = container.menus[i].prototypeStyles || this.prototypeStyles || container.menus[i];
            var menu = container.document.layers[i];
            container.menus[i].menuLayer = menu;
            container.menus[i].menuLayer.Menu = container.menus[i];
            container.menus[i].menuLayer.Menu.container = container;
            var body = menu.document.layers[0].document.layers[0];
            body.clip.width = proto.menuWidth || body.clip.width;
            body.clip.height = proto.menuHeight || body.clip.height;
            for (var n=0; n<body.document.layers.length-1; n++) {
                var l = body.document.layers[n];
                l.Menu = container.menus[i];
                l.menuHiliteBgColor = proto.menuHiliteBgColor;
                l.document.bgColor = proto.menuItemBgColor;
                l.saveColor = proto.menuItemBgColor;
                l.mouseout  = l.Menu.mouseouts[n];
                l.mouseover = l.Menu.mouseovers[n];
                l.onmouseover = proto.onMenuItemOver;
                l.onclick = proto.onMenuItemAction;
                l.action = container.menus[i].actions[n];
                l.focusItem = body.document.layers[body.document.layers.length-1];
                l.clip.width = proto.menuItemWidth || body.clip.width + proto.menuItemIndent;
                l.clip.height = proto.menuItemHeight || l.clip.height;
                if (n>0) l.top = body.document.layers[n-1].top + body.document.layers[n-1].clip.height + proto.menuItemBorder;
                l.hilite = l.document.layers[1];
                l.document.layers[1].isHilite = true;
                if (l.document.layers[0].id.indexOf("menuSeparator") != -1) {
                    l.hilite = null;
                    l.clip.height -= l.clip.height / 2;
                    l.document.layers[0].document.bgColor = proto.bgColor;
                    l.document.layers[0].clip.width = l.clip.width -2;
                    l.document.layers[0].clip.height = 1;
                    l.document.layers[1].document.bgColor = proto.menuLiteBgColor;
                    l.document.layers[1].clip.width = l.clip.width -2;
                    l.document.layers[1].clip.height = 1;
                    l.document.layers[1].top = l.document.layers[0].top + 1;
                } else if (l.document.layers.length > 2) {
                    l.childMenu = container.menus[i].items[n].menuLayer;
                    l.icon = proto.childMenuIcon;
                    l.iconHilite = proto.childMenuIconHilite;
                    l.document.layers[2].left = l.clip.width -13;
                    l.document.layers[2].top = (l.clip.height / 2) -4;
                    l.document.layers[2].clip.left += 3;
                    l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu;
                }
            }
            body.document.bgColor = proto.bgColor;
            body.clip.width  = l.clip.width +1;
            body.clip.height = l.top + l.clip.height +1;
            body.document.layers[n].clip.width = body.clip.width;
            body.document.layers[n].captureEvents(Event.MOUSEDOWN);
            body.document.layers[n].onmousedown = proto.onMenuItemDown;
            //body.document.layers[n].onfocus = proto.onMenuItemDown;
            body.document.layers[n].onmouseout = proto.onMenuItemOut;
            body.document.layers[n].Menu = l.Menu;
            body.document.layers[n].top = -30;
            menu.document.bgColor = proto.menuBorderBgColor;
            menu.document.layers[0].document.bgColor = proto.menuLiteBgColor;
            menu.document.layers[0].clip.width = body.clip.width +1;
            menu.document.layers[0].clip.height = body.clip.height +1;
            menu.clip.width = body.clip.width + (proto.menuBorder * 2) -1;
            menu.clip.height = body.clip.height + (proto.menuBorder * 2) -1;
            if (menu.Menu.enableTracker) {
                menu.Menu.disableHide = true;
                setMenuTracker(menu.Menu);
            }
        }
    }
  }
  window.wroteMenu = true;
}

function onMenuItemOver(e, l, a) { 
    clearTimeout(domOver);
    l = l || this;
    a = a || window.ActiveMenuItem;
    window.status = ''; 
    if (document.layers) {
        if (a) {
            a.document.bgColor = a.saveColor;
            if (a.hilite) a.hilite.visibility = "hidden";
            if (a.childMenu) a.document.layers[1].document.images[0].src = a.icon;
        } else {
            a = new Object();
        }
        if (this.mouseover && this.id != a.id) {
            if (this.mouseover.length > 4) {
                var ext = this.mouseover.substring(this.mouseover.length-4);
                if (ext == ".gif" || ext == ".jpg") {
                    this.document.layers[1].document.images[0].src = this.mouseover;
                } else {
                    eval("" + this.mouseover);
                }
            }
        }
        if (l.hilite) {
            l.document.bgColor = l.menuHiliteBgColor;
            l.zIndex = 1;
            l.hilite.visibility = "inherit";
            l.hilite.zIndex = 2;
            l.document.layers[1].zIndex = 1;
            l.focusItem.zIndex = this.zIndex +2;
        }
        l.focusItem.top = this.top;
        l.Menu.hideChildMenu(l);
    }
    window.ActiveMenuItem = l;
}
function onMenuItemOut(e, l, a) { 
	//alert(e);
	//alert(l);
	//alert(a);
  timedHideDropDown2(activeImg,activeExt);
  l = l || this;
  a = a || window.ActiveMenuItem;
  if (l.id.indexOf("focusItem")) { 
    if (a && l.top) {
      l.top = -30;
 	  if (a.mouseout && a.id != l.id) {
		if (a.mouseout.length > 4) {
		  var ext = a.mouseout.substring(a.mouseout.length-4);
		  if (ext == ".gif" || ext == ".jpg") {
			a.document.layers[1].document.images[0].src = a.mouseout;
  		  } else
			 eval("" + a.mouseout);
  		  }
		}
      } else if (a && l.style) { 
          document.onmousedown=null;
            window.event.cancelBubble=true;
	        if (l.mouseout) {
				if (l.mouseout.length > 4) {
					var ext = l.mouseout.substring(l.mouseout.length-4);
					if (ext == ".gif" || ext == ".jpg") {
						l.document.images[l.id + "Img"].src = l.mouseout;
					} else {
						eval("" + l.mouseout);
					}
				}
			}
		}
    }
}

function onMenuItemAction(e, l) {
    l = window.ActiveMenuItem;
    if (!l) return;
    if (!ActiveMenu.Menu.disableHide) 
      hideActiveMenus(ActiveMenu.menuLayer);
    if (l.action) {
        eval("" + l.action);
    }
}

function showMenu(menu, x, y, child) {
  document.showMenuMenu = menu;
	document.showMenuX = x;
	document.showMenuY = y;
	document.showMenuChild = child;
  if (!window.wroteMenu) 
	{
	  return;
    }
    if (document.layers) {
        if (menu) {
            var l = menu.menuLayer || menu;
            if (typeof(menu) == "string") {
                for (var n=0; n < menuContainers.length; n++) {
                    l = menuContainers[n].menus[menu];
                    for (var i=0; i<menuContainers[n].menus.length; i++) {
                        if (menu == menuContainers[n].menus[i].label) l = menuContainers[n].menus[i].menuLayer;
                        if (l) break;
                    }
                }
				if (!l) return;
            }
            l.Menu.container.document.bgColor = null;
            l.left = 1;
            l.top = 1;
            hideActiveMenus(l);
            if (this.visibility) l = this;
            window.ActiveMenu = l;
            window.releaseEvents(Event.MOUSEMOVE|Event.MOUSEUP);
            setTimeout('if(window.ActiveMenu)window.ActiveMenu.Menu.setMouseTracker();', 300);
        } else {
            var l = child;
        }
        if (!l) return;
        for (var i=0; i<l.layers.length; i++) {                
            if (!l.layers[i].isHilite) 
                l.layers[i].visibility = "inherit";
            if (l.layers[i].document.layers.length > 0) 
                showMenu(null, "relative", "relative", l.layers[i]);
        }
        if (l.parentLayer) {
            if (x != "relative") 
                l.parentLayer.left = x || window.pageX || 0;
            if (l.parentLayer.left + l.clip.width > window.innerWidth) 
                l.parentLayer.left -= (l.parentLayer.left + l.clip.width - window.innerWidth);
            if (y != "relative") 
                l.parentLayer.top = y || window.pageY || 0;
            if (l.parentLayer.isContainer) {
                l.Menu.xOffset = window.pageXOffset;
                l.Menu.yOffset = window.pageYOffset;
                l.parentLayer.clip.width = window.ActiveMenu.clip.width +2;
                l.parentLayer.clip.height = window.ActiveMenu.clip.height +2;
                if (l.parentLayer.menuContainerBgColor) l.parentLayer.document.bgColor = l.parentLayer.menuContainerBgColor;
            }
        }
        l.visibility = "inherit";
        if (l.Menu) l.Menu.container.visibility = "inherit";
    } 
	else if (document.all) {					//detection of ie
        var l = menu.menuLayer || menu;
        hideActiveMenus(l);
        if (typeof(menu) == "string") {								// ??
            l = document.all[menu];
            for (var n=0; n < menuContainers.length; n++) {
                l = menuContainers[n].menus[menu];
                for (var i=0; i<menuContainers[n].menus.length; i++) {
                    if (menu == menuContainers[n].menus[i].label) l = menuContainers[n].menus[i].menuLayer;
                    if (l) break;
                }
            }
        }
        window.ActiveMenu = l;								//menuLayer[i] is active
        l.style.visibility = "inherit";
        if (x != "relative") 
            l.style.pixelLeft = x || (window.pageX + document.body.scrollLeft) || 0;
        if (y != "relative") 
            l.style.pixelTop = y || (window.pageY + document.body.scrollTop) || 0;
        l.Menu.xOffset = document.body.scrollLeft;
        l.Menu.yOffset = document.body.scrollTop;
    }
	else if (document.getElementById) 
	{
        var l = menu.menuLayer || menu;
	    hideActiveMenus(l);												//hide any currently active menus
        if (typeof(menu) == "string") {								// ??
            l = document.getElementById(menu);
            for (var n=0; n < menuContainers.length; n++) {
                l = menuContainers[n].menus[menu];
                for (var i=0; i<menuContainers[n].menus.length; i++) {
                    if (menu == menuContainers[n].menus[i].label) l = menuContainers[n].menus[i].menuLayer;
                    if (l) break;
                }
            }
         }	
        window.ActiveMenu = l;										//menuLayer[i] is active
        l.style.visibility = "inherit";
        if (x != "relative") 
            l.style.left = x || 0;
        if (y != "relative") 
            l.style.top = y || 0;
        l.Menu.xOffset = document.body.scrollLeft;
        l.Menu.yOffset = document.body.scrollTop;
    }
    if (menu) {
        window.activeMenus[window.activeMenus.length] = l;
    }
}

function hideMenu(e) {
    window.status="";  // path code
    var l = e || window.ActiveMenu;
    if (!l) return true;
    if (l.menuLayer) {
        l = l.menuLayer;
    } else if (this.visibility) {
        l = this;
    }
    if (l.menuLayer) {
        l = l.menuLayer;
    }
    var a = window.ActiveMenuItem;													//a is set to the array menu item
    document.saveMousemove = document.onmousemove;
    document.onmousemove = mouseTracker;
	if (a && document.layers) {
        a.document.bgColor = a.saveColor;
        a.focusItem.top = -30;
        if (a.hilite) a.hilite.visibility = "hidden";
        if (a.childMenu) a.document.layers[1].document.images[0].src = a.icon;
        if (mDrag.oldX <= e.pageX+3 && mDrag.oldX >= e.pageX-3 && mDrag.oldY <= e.pageY+3 && mDrag.oldY >= e.pageY-3) 
//	    if(e.onclick==true)
  		  {
          if (a.action && window.ActiveMenu) 
  		      setTimeout('window.ActiveMenu.Menu.onMenuItemAction();', 2);
        } 


		else if (document.saveMousemove == mDrag.doMenuDrag) 
		{
      if (window.ActiveMenu) return true;
    }
    } else if (window.ActiveMenu && document.all) {
        document.onmousedown=null;										//executes when moving from one link to another w/in same container
        if (a) {
            a.style.backgroundColor = a.saveColor;
            if (a.hilite) a.hilite.style.visibility = "hidden";
        }
	    if (document.saveMousemove == mDrag.doMenuDrag) {
            return true;
        }
	} else if(a && document.getElementById) {
	    document.onmousedown=null;
        if (a) { 															//allows moused over color to change back when menu disappears.
            a.style.backgroundColor = a.saveColor;
            if (a.hilite) a.hilite.style.visibility = "hidden";
        }
		if (document.saveMousemove == mDrag.doMenuDrag) return true;
	}
    if (window.ActiveMenu) {												//ns6 enters this
        if (window.ActiveMenu.Menu) 										//ns6 enters this too
		{
            if (window.ActiveMenu.Menu.disableHide && !(is_nav5_or_up()))
			  return true;
			else if (is_nav5_or_up()) 
 			  if(a) 
				return true;
            e = window.event || e;
        }
    }
    hideActiveMenus(l);
    return true;
}

function hideChildMenu(menuLayer) {
    var l = menuLayer || this;
    for (var i=0; i < l.Menu.childMenus.length; i++) {
        if (document.layers) {
            l.Menu.childMenus[i].visibility = "hidden";
        } else if (document.all) {
            l.Menu.childMenus[i].style.visibility = "hidden";
        } else if (is_nav5_or_up()) {
		    l.Menu.childMenus[i].style.visibility = "hidden";
		}
        l.Menu.childMenus[i].Menu.hideChildMenu(l.Menu.childMenus[i]);
    }
    if (l.childMenu) {
        if (document.layers) {
            l.Menu.container.document.bgColor = null;
            l.Menu.showMenu(null,null,null,l.childMenu.layers[0]);
            l.childMenu.zIndex = l.parentLayer.zIndex +1;
            l.childMenu.top = l.top + l.parentLayer.top + l.Menu.menuLayer.top;
            if (l.childMenu.left + l.childMenu.clip.width > window.innerWidth) {
                l.childMenu.left = l.parentLayer.left - l.childMenu.clip.width + l.Menu.menuLayer.top + 15;
                l.Menu.container.clip.left -= l.childMenu.clip.width;
            } else if (l.Menu.childMenuDirection == "left") {
                l.childMenu.left = l.parentLayer.left - l.parentLayer.clip.width;
                l.Menu.container.clip.left -= l.childMenu.clip.width;
            } else {
                l.childMenu.left = l.parentLayer.left + l.parentLayer.clip.width  + l.Menu.menuLayer.left -5;
            }
            l.Menu.container.clip.width += l.childMenu.clip.width +100;
            l.Menu.container.clip.height += l.childMenu.clip.height;
            l.document.layers[1].zIndex = 0;
            l.document.layers[1].document.images[0].src = l.iconHilite;
            l.childMenu.visibility = "inherit";
        } else if (document.all) {
            l.childMenu.style.zIndex = l.Menu.menuLayer.style.zIndex +1;
            l.childMenu.style.pixelTop = l.style.pixelTop + l.Menu.menuLayer.style.pixelTop;
            if (l.childMenu.style.pixelLeft + l.childMenu.style.pixelWidth > document.width) {
                l.childMenu.style.pixelLeft = l.childMenu.style.pixelWidth + l.Menu.menuLayer.style.pixelTop + 15;
            } else if (l.Menu.childMenuDirection == "left") {
            } else {
                l.childMenu.style.pixelLeft = l.Menu.menuLayer.style.pixelWidth + l.Menu.menuLayer.style.pixelLeft -5;
            }
            l.childMenu.style.visibility = "inherit";
        } else if (document.getElementById) {
            l.childMenu.style.zIndex = l.Menu.menuLayer.style.zIndex +3;
            l.childMenu.style.top = l.style.top + l.Menu.menuLayer.style.top;
            if (l.childMenu.style.left + l.childMenu.style.width > document.width) {
                l.childMenu.style.left = l.childMenu.style.width + l.Menu.menuLayer.style.top + 15;
            } else if (l.Menu.childMenuDirection == "left") {
            } else {
                l.childMenu.style.left = l.Menu.menuLayer.style.width + l.Menu.menuLayer.style.left -5;
            }
            l.childMenu.style.visibility = "inherit";
        }
		
        if (!l.childMenu.disableHide) 
            window.activeMenus[window.activeMenus.length] = l.childMenu;
    }
}

function hideActiveMenus(l) {
    if (!window.activeMenus) return;
    for (var i=0; i < window.activeMenus.length; i++) {
        if (!activeMenus[i]) return;
        if (activeMenus[i].visibility && activeMenus[i].Menu) {
            activeMenus[i].visibility = "hidden";
            activeMenus[i].Menu.container.visibility = "hidden";
            activeMenus[i].Menu.container.clip.left = 0;
        } else if (activeMenus[i].style && document.all) {
            activeMenus[i].style.visibility = "hidden";
        } else if (activeMenus[i].style || document.getElementById){
		    activeMenus[i].style.visibility = "hidden";
		}
    }
    document.onmousemove = mouseTracker;
    window.activeMenus.length = 0;
}

function mouseTracker(e) {
    e = e || window.Event || window.event;
    window.pageX = e.pageX || e.clientX || e.X;
    window.pageY = e.pageY || e.clientY || e.Y;
}

function setMouseTracker() {
    if (document.captureEvents) {
        document.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
    }
    document.onmousemove = this.mouseTracker;
    document.onmouseup = this.hideMenu;
}

function setMenuTracker(menu) {
    if (!window.menuTrackers) window.menuTrackers = new Array();
    menuTrackers[menuTrackers.length] = menu;
    window.menuTrackerID = setInterval('menuTracker()',10);
}

function menuTracker() { 
    for (var i=0; i < menuTrackers.length; i++) {
        if (!isNaN(menuTrackers[i].xOffset) && document.layers) {
            var off = parseInt((menuTrackers[i].xOffset - window.pageXOffset) / 10);
            if (isNaN(off)) off = 0;
            if (off < 0) {
                menuTrackers[i].container.left += -off;
                menuTrackers[i].xOffset += -off;
            } else if (off > 0) {
                menuTrackers[i].container.left += -off;
                menuTrackers[i].xOffset += -off;
            }
        }
        if (!isNaN(menuTrackers[i].yOffset) && document.layers) {
            var off = parseInt((menuTrackers[i].yOffset - window.pageYOffset) / 10);
            if (isNaN(off)) off = 0;
            if (off < 0) {
                menuTrackers[i].container.top += -off;
                menuTrackers[i].yOffset += -off;
            } else if (off > 0) {
                menuTrackers[i].container.top += -off;
                menuTrackers[i].yOffset += -off;
            }
        }
        if (!isNaN(menuTrackers[i].xOffset) && document.all) {
            var off = parseInt((menuTrackers[i].xOffset - document.all.scrollLeft) / 10);
            if (isNaN(off)) off = 0;
            if (off < 0) {
                menuTrackers[i].menuLayer.style.pixelLeft += -off;
                menuTrackers[i].xOffset += -off;
            } else if (off > 0) {
                menuTrackers[i].menuLayer.style.pixelLeft += -off;
                menuTrackers[i].xOffset += -off;
            }
        }
        if (!isNaN(menuTrackers[i].yOffset) && document.all) {
            var off = parseInt((menuTrackers[i].yOffset - document.all.scrollTop) / 10);
            if (isNaN(off)) off = 0;
            if (off < 0) {
                menuTrackers[i].menuLayer.style.pixelTop += -off;
                menuTrackers[i].yOffset += -off;
            } else if (off > 0) {
                menuTrackers[i].menuLayer.style.pixelTop += -off;
                menuTrackers[i].yOffset += -off;
            }
        }
        if (!isNaN(menuTrackers[i].xOffset) && document.getElementById) {
            var off = parseInt((menuTrackers[i].xOffset - document.getElementById.scrollLeft) / 10);
            if (isNaN(off)) off = 0;
            if (off < 0) {
                menuTrackers[i].menuLayer.style.left += -off;
                menuTrackers[i].xOffset += -off;
            } else if (off > 0) {
                menuTrackers[i].menuLayer.style.left += -off;
                menuTrackers[i].xOffset += -off;
            }
        }
        if (!isNaN(menuTrackers[i].yOffset) && document.getElementById) {
            var off = parseInt((menuTrackers[i].yOffset - document.getElementById.scrollTop) / 10);
            if (isNaN(off)) off = 0;
            if (off < 0) {
                menuTrackers[i].menuLayer.style.top += -off;
                menuTrackers[i].yOffset += -off;
            } else if (off > 0) {
                menuTrackers[i].menuLayer.style.top += -off;
                menuTrackers[i].yOffset += -off;
            }
        }		
    }
}

function onMenuItemDown(e, l) {
    l = l || window.ActiveMenuItem || this;
    if (!l.Menu) {
    } else {
        if (document.layers) {
            mDrag.dragLayer = l.Menu.container;
            mDrag.startMenuDrag(e);
        } else if (document.all){
            mDrag.dragLayer = l.Menu.container.style;
            mDrag.startMenuDrag(e);
            window.event.cancelBubble=true;
        } else if (document.getElementById) {
		    return null;
		}
    }
}

function startMenuDrag(e) {
    if (document.layers) {
        if (e.which > 1) {
            if (window.ActiveMenu) ActiveMenu.Menu.container.visibility = "hidden";
            window.ActiveMenu = null;
            return true;
        }
        document.captureEvents(Event.MOUSEMOVE);
        var x = e.pageX;
        var y = e.pageY;
    } else if(document.all) {
        var x = window.event.clientX;
        var y = window.event.clientY;
    } else if(document.getElementById) {
	    return null;
	}
    mDrag.offX = x;
    mDrag.offY = y;
    mDrag.oldX = x;
    mDrag.oldY = y;
    if (!ActiveMenu.Menu.disableDrag) document.onmousemove = mDrag.doMenuDrag;
    return false;
}

function doMenuDrag(e) {
    if (document.layers) {
        mDrag.dragLayer.moveBy(e.pageX-mDrag.offX,e.pageY-mDrag.offY);
        mDrag.offX = e.pageX;
        mDrag.offY = e.pageY;
    } else if(document.all){
        mDrag.dragLayer.pixelLeft = window.event.offsetX;
        mDrag.dragLayer.pixelTop  = window.event.offsetY;
        return false; //for IE
    } else if(document.getElementById) {
	    return null;
	}
}



function onLoad(){loadMenus();}


