function initMenu()
{
	var nodes = document.getElementById("navigation").getElementsByTagName("li");
	for (var i=0; i<nodes.length; i++)
	{
		nodes[i].onmouseover = function()
		{
			this.className += " hover";
		}
		nodes[i].onmouseout = function()
		{
			this.className = this.className.replace(" hover", "");
		}
	}
}
if (document.all && !window.opera) attachEvent("onload", initMenu);

function openWindow(url, windowName, featureString) 
{
	if (featureString == "")
	{
		featureString = "width=780,height=580,status=yes,scrollbars=yes,minimize=yes,top=10,left=10,resizable=1,toolbar=1,location=1,menubar=1";
	}

	winname = open (url, windowName, featureString);
	if (!winname) {
		alert("The window could not be opened. Please check if you have a popup blocker installed that may be preventing the window from opening. Try holding down the Ctrl key on your keyboard while clicking on the link.");
	}else 
	{
		winname.focus();
	}				
}

function clearLogin(e)
	{
		if (e.value == "(Email Address)")
			e.value = "";
	}
	
function defaultLogin(e)
{	
	if (e.value.length == 0)
	{
		e.value = "(Email Address)";
	}	
}
function defaultKeyword(e)
{
	if (e.value.length == 0)
	{
		e.value = "(Keywords)";
	}	
}
function submitPage(e, textbox)
{
	var key_enter= 13; // 13 = Enter
	var evt = (window.event==null) ? e : window.event;
	var code = evt.which ? evt.which : evt.keyCode
	
	if (key_enter==code)
	{
		if(textbox.id != 'txtPassword')
			return false;					
	}
}

function OpenEmailWindow(companyID, pageTitle, referer)
{
	var encodedResource = encodeURIComponent(referer)
	window.open('EmailForm.aspx?CompanyID='+companyID+'&PageTitle='+pageTitle+'&referer='+encodedResource,'','width=420,resizable=1,height=360,top=10,left=10,scrollbars=no');
}
	
function searchJobs(prefix)
{
	var strLink;
	strLink = "VacancySearch.aspx?";
	strLink += "BusinessUnitID=" + document.getElementById(prefix + "ddlBusinessUnit").value;
	strLink += "&DivisionID=" + document.getElementById(prefix + "ddlDivision").value;
	strLink += "&LocationID=" + document.getElementById(prefix + "ddlLocation").value;
	if(document.getElementById(prefix + "txtKeyword").value != "(Keywords)")
		strLink += "&Keyword=" + document.getElementById(prefix + "txtKeyword").value;
	window.location = strLink;
}

function goToPage(id)
{						
	document.getElementById("htxtPage").value=id;
	if(document.getElementById("htxtPage").value!="" )
		{	
			if(fnisInteger(document.getElementById("htxtPage").value)==true)				
			{
				try
				{	
				__doPostBack("lnkPages","");
				}
				catch(Exception)
				{}
			}
		}
}

function fnisInteger(s)
{
	var i;
	for (i = 0; i < s.length; i++)
	{   
		// Check that current character is number.
		var c = s.charAt(i);
		if (((c < "0") || (c > "9"))) return false;
	}
	// All characters are numbers.
	return true;
}
