
window.onerror = null;
 var menuActive = 0;
 var menuOn = 0;
 var onLayer;
 var timeOn = null   ; // LAYER SWITCHING CODE

if (document.layers) {
  layerRef="document.layers";
  styleSwitch="";
}
else {
  layerRef="top";
  styleSwitch=".style";
}
 

// SHOW MENU
function showLayer(layerName){
  if (timeOn != null) {
    clearTimeout(timeOn);
    hideLayer(onLayer);
  }
  myElement = document.getElementById(layerName);
  myElement.style.visibility = "visible";
  onLayer = layerName
}

// HIDE MENU
function hideLayer(layerName){
  if (menuActive == 0) {
    myElement = document.getElementById(layerName);
    myElement.style.visibility = "hidden";
  }
}

// TIMER FOR BUTTON MOUSE OUT
function btnTimer() {
  timeOn = setTimeout("btnOut()",200)
}

// BUTTON MOUSE OUT
function btnOut(layerName) {
  if (menuActive == 0) {
    hideLayer(onLayer);
  }
}

// MENU MOUSE OVER 
function menuOver(itemName) {
  clearTimeout(timeOn);
  menuActive = 1;
  showLayer(layerName)
}

// MENU MOUSE OUT 
function menuOut(itemName) {
  menuActive = 0; 
  timeOn = setTimeout("hideLayer(onLayer)", 1000);
}	 														  
  
function checkLocation(tabName, tabOffset) {
  var winWidth = 0, sideWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    winWidth = window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth ) ) {
    //IE 6+ in 'standards compliant mode'
    winWidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth ) ) {
    //IE 4 compatible
    winWidth = document.body.clientWidth;
  }
  sideWidth = Math.round((winWidth - 750) / 2);
  if (sideWidth < 0) {
    winOffset = tabOffset + 5;
  } else {  
    winOffset = sideWidth + tabOffset - 5;
  } 
  myElement = document.getElementById(tabName);
  myElement.style.left = winOffset;
}

function selLink(whichline) {
  with (whichline) {
    if (whichline.value != "nolink") { 
	  currPath = String(window.location);
	  x = currPath.lastIndexOf('/');
	  pathName = currPath.substring(0,x);
      pathName += whichline.value;
	  window.open(pathName, "content");
	}  
  }
}
