// Fix New Monster Global Navigation Bar issues
function fixGlobalNavigation()
{
	var BROWSER_NAME = "Microsoft Internet Explorer";

	if(navigator.appName != BROWSER_NAME)
	{
		moveMainNavBar("inMainNav", "-20px");
		updateElementHeight("", "30px");
		
		// Runtime CSS fix for Opera and Firefox
		document.write("<style>");
		
		document.write("#inMainnavigation li ul{");
		document.write("margin-top: 0px;");
		document.write("}");
		
		document.write("#inMainnavigation li ul iframe {");
		document.write("width: 10px;");
		document.write("}");
		
		document.write("</style>");
	}
	else
	{
		moveMainNavBar("logo", "8px");
		
		// Runtime CSS fix for Inernet Explorer
		document.write("<style>");
		
		document.write("#inMainnavigation li ul li a, #inMainnavigation li.current ul li a{");
		document.write("padding-top: 6px;");
		document.write("height: 24px;");
		document.write("}");
		
		document.write("#inMainnavigation li ul li a:hover{");
		document.write("color: #cccccc;");
		document.write("background-color: #cccccc;");
		document.write("background-image: none;");
		document.write("}");
		
		document.write("#inMainnavigation li a{");
		document.write("height: 24px;");
		document.write("}");
		
		document.write("#inMainnavigation li ul{");
		document.write("margin-top: 0px;");
		document.write("}");
		
		document.write("#inMainnavigation li ul iframe {");
		document.write("width: 180px;");
		document.write("}");
		
		document.write("</style>");
	}
}

function moveMainNavBar(element, value)
{
	var NAVIGATION_ID = element;
	var bar = document.getElementById(NAVIGATION_ID);
	if(bar != null)
	{
		bar.style.marginLeft = value;
	}
}

function updateElementHeight(element, value)
{
	var NAVIGATION_ID = element;
	var bar = document.getElementById(NAVIGATION_ID);
	if(bar != null)
	{
		bar.style.height = value;
	}
}


<!--//--><![CDATA[//><!--

  //The hover function for the main navigation
  sfHover = function() {
  	var sfEls = document.getElementById("inMainNav").getElementsByTagName("LI");
  	for (var i=0; i<sfEls.length; i++) {
  		if(sfEls[i].className != "current")
  		{
  			sfEls[i].onmouseover=function() {
  				this.className+=" sfhover";
  			}
  			sfEls[i].onmouseout=function() {
  				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
  			}
  		}
  	}
  }
  if (window.attachEvent) window.attachEvent("onload", sfHover);

  //The new window function called by all pages
  var newwindow;
  function popit(url,winHeight,winWidth){
  	newwindow=window.open(url,null,"height=" + winHeight + ",width=" + winWidth + ",status=yes,toolbar=no,menubar=no,location=no,resizable=yes");
  	if (window.focus) {
  		newwindow.focus()
  	}
  }

  //Clears the search box.
  function CheckSearch(searchControl, defaultText)
  	{
  		if (searchControl.value == defaultText)
  		{
  			searchControl.value = "";
  		}
  	}

//--><!]]>

/***************************
Additional functions to keep top level elements highlighted
on secondary nav roll-over
***************************/
function showTopLevelHighlight(e) {
    var topLi, topA;

    if (e["target"]) {
        topLi = e["target"].parentNode.parentNode.parentNode;
    } else if (e["srcElement"]) {
        topLi = e["srcElement"].parentNode.parentNode.parentNode;
    }

	//e.style.height = "22px"

    topA = topLi.getElementsByTagName("A")[0];

	topA.style.backgroundColor = "transparent";
    topA.style.backgroundImage = "url(./images/hover_Tab_left.gif)";
    topA.style.backgroundRepeat = "no-repeat";
    topA.style.backgroundPositionX = "left";
    topA.style.backgroundPositionY = "top";
}

function hideTopLevelHighlight(e) {
    var topLi, topA;

    if (e["target"]) {
        topLi = e["target"].parentNode.parentNode.parentNode;
    } else if (e["srcElement"]) {
        topLi = e["srcElement"].parentNode.parentNode.parentNode;
    }

    topA = topLi.getElementsByTagName("A")[0];

    topA.style.backgroundImage = "";
}

function initTopLevelHighlightEvents() {
    var isDom2 = (window.addEventListener) ? true : false;

    var mainNavUl = document.getElementById("inMainnavigation");
    var topLevels = mainNavUl.getElementsByTagName("LI");
    var secondLevelLinks;
    var i, j;

    for (i = 0; i < topLevels.length; i++) {
        if (topLevels[i].getElementsByTagName("UL").length == 0) continue;

        secondLevelLinks = topLevels[i].getElementsByTagName("UL")[0].getElementsByTagName("A");

        for (j = 0; j < secondLevelLinks.length; j++) {
            if (isDom2) {
                secondLevelLinks[j].addEventListener("mouseover", showTopLevelHighlight, false);
                secondLevelLinks[j].addEventListener("mouseout", hideTopLevelHighlight, false);
            } else {
                secondLevelLinks[j].attachEvent("onmouseover", showTopLevelHighlight);
                secondLevelLinks[j].attachEvent("onmouseout", hideTopLevelHighlight);
            }
        }
    }
}

var temp_onload = window.onload;
window.onload = function ()
{
	//Are there any exising onload functions?
	//NO
	if (typeof temp_onload != "function")
	{
		initTopLevelHighlightEvents();
	}
	//YES
	else
	{
		temp_onload();
		initTopLevelHighlightEvents();
	}
}

  
  var FIREFOX = "Netscape";
	   var OPERA = "Opera";
	   
		var JOB_FAIRS = "http://resources.monster.com/job%2dfairs";
		var url = new String(window.location.href);
		url = url.toLowerCase();
		   
	   if(navigator.appName == FIREFOX || navigator.appName == OPERA)
	   {
	     var inMainNav = document.getElementById("inMainNav");
	     if(inMainNav != null)
	     {
				//inMainNav.style.position = "relative";
				//inMainNav.style.right = "45px";
       }
     }
     
		if(navigator.appName == FIREFOX && url.indexOf(JOB_FAIRS) <= -1)
	   {
	     var header = document.getElementById("header");
	     if(header != null)
	     {
	       header.style.position = "relative";
	       header.style.bottom = "10px";
       }
     }
  
 function moveMainNavBar(element, value)
  {
  	var NAVIGATION_ID = element;
  	var bar = document.getElementById(NAVIGATION_ID);
  	if(bar != null)
  	{
  		bar.style.marginLeft = value;
  	}
  }
  
  function updateElementHeight(element, value)
  {
  	var NAVIGATION_ID = element;
  	var bar = document.getElementById(NAVIGATION_ID);
  	if(bar != null)
  	{
  		bar.style.height = value;
  	}
  }
  