function Search()
{
	if(document.getElementById("SearchInput").value!="")
		document.getElementById("SearchForm").submit();
	else
		alert("Please input search data.");
}


function submitNavSearchFrm(strDestinationHost)
{
	var strKeyword, strNarrowCode;
	strKeyword = document.navsearchfrm.searchtextvalue.value;
	strNarrowCode = ""
	if ((document.navsearchfrm.searchtextvalue.value == "") || (document.navsearchfrm.searchtextvalue.value == "Enter keyword"))
	{
		alert("Please enter a keyword and click go.");
		return;
	}
		document.navsearchfrm.target='_self';
		document.navsearchfrm.method='get';
		
		document.navsearchfrm.action = 'http://'+strDestinationHost+'/sitesearch/layoutscripts/sisl_display.asp';
		document.navsearchfrm.submit();
}


function emptyEmailSearchText() {
	if (document.newmemberemailbox.myhremail.value == "Enter your email") 
			document.newmemberemailbox.myhremail.value = "";	
}
function defaultEmailSearchText() {
	if (document.newmemberemailbox.myhremail.value == "")  {
			document.newmemberemailbox.myhremail.value = "Enter your email";
	}
}


function emptyArticleSearchText() {
	if (document.subarticlesearchform.searchtextvalue.value == "Search Advice") 
			document.subarticlesearchform.searchtextvalue.value = "";	
}
function defaultArticleSearchText() {
	if (document.subarticlesearchform.searchtextvalue.value == "")  {
			document.subarticlesearchform.searchtextvalue.value = "Search Advice";
	}
}

function SubArticleSearch(strDestinationHost)
{
	var strKeyword
	strKeyword = document.subarticlesearchform.searchtextvalue.value;
	if ((document.subarticlesearchform.searchtextvalue.value == "") || (document.subarticlesearchform.searchtextvalue.value == "Search Advice"))
	{
		alert("Please enter a keyword and click go.");
		return;
	}
		document.subarticlesearchform.target='_self';
		document.subarticlesearchform.method='get';
		
		document.subarticlesearchform.action = 'http://'+strDestinationHost+'/sitesearch/layoutscripts/sisl_display.asp';
		document.subarticlesearchform.submit();
}


function gotoEducation_1(){
		
    var strNarrowCode = "";
    var strJobCode = "";
    var strLocation = "";
	
    strNarrowCode =  document.edusearchform.narrowcode.options[document.edusearchform.narrowcode.selectedIndex].value;
	
    if(strNarrowCode==""){
		
        alert("Please select a job category.");
        document.edusearchform.narrowcode.focus();
    }
    else
    {
        strJobCode = document.edusearchform.jobcode.options[document.edusearchform.jobcode.selectedIndex].value
       
        if( strJobCode == "" )
        {
            strLocation  = "/learning/layouthtmls/leal_narrowbrief_" + strNarrowCode + ".html";
        }
        else
        {
            strLocation  = "/learning/layouthtmls/leal_searchjob_" + strJobCode + ".html";
        }
		
        document.edusearchform.narrowcode.options[0].selected = true;
        window.location.href=strLocation ;
    }
}

function selectNarrowList(strNarrowCode, strJobCode){
    var iSelectedIndex = 0;
    var objSJ = document.edusearchform.jobcode;

    objSJ.length=0;
    objSJ.options[0] = new Option("Select a job title", "", false, false);

    if (strNarrowCode != "")
    {
        var temp;
        var temp2;  
        var temp3;  
        var iIndex;
        for(var i=0; i<U.length; i++)
        {   
            if(U[i].indexOf(strNarrowCode + "^") >= 0)
            {
                temp = U[i];
                break;
            }
        }
        
        if (i<U.length)
        {
            iIndex = temp.indexOf("^");
            temp = temp.substring(iIndex + 1, temp.length);
            temp2 = temp.split("/");
            var k = 1;
            var n = -1;
            for (i=0; i<temp2.length; i++)
            {
                do{
                    n++;
                }while(V[n].indexOf(temp2[i] + "^") < 0)
                temp3 = V[n].split("^");
                if ((strJobCode) && (strJobCode == temp3[0]))
                    iSelectedIndex = k;
                objSJ.options[k] = new Option(temp3[1], temp3[0], false, false);
                k++;
            }
        }
    }
}

function gotoJobSearchSelect(){
    return true;
	
}
function emptyJSWText() {

		if (document.jobsearchform.JobKeyword.value == "Enter a Keyword")
			document.jobsearchform.JobKeyword.value = "";
	}
function defaultJSWText() {
		if (document.jobsearchform.JobKeyword.value == "")  {
				document.jobsearchform.JobKeyword.value = "Enter a Keyword";
		}
	}
	
function checknewmemberemail() {
		if (document.newmemberemailbox.myhremail.value == "" || document.newmemberemailbox.myhremail.value == "Enter your email")  {
				alert("Please enter your email.");
				return ;
		}
		
		

	document.newmemberemailbox.submit();
	}
	
	
	
function selectSearchByField_sh(strValue){
	var source, obj;
	
	
	
	obj = document.getElementById("txtKeyword");
	if(!obj){
		obj = document.getElementById("cmbJobCategory");
	}
	
	if(strValue == 1){
		if(obj.tagName == "INPUT"){
			var parentObj = obj.offsetParent;
			parentObj.removeChild(obj);
			
			var newObj = document.createElement("SELECT");
			newObj.id = "cmbJobCategory";
			newObj.setAttribute("defaultValue", obj.getAttribute("defaultValue"));
			newObj.setAttribute("userValue", obj.value);
			newObj.className = "objInitialInput txtWidth253";
			
			newObj.options[newObj.options.length] = new Option("Choose a Job Category ----------------->","");
			for(var i = 0; i < aNarrowCode.length ; i ++){
				newObj.options[newObj.options.length] = new Option(aNarrowDesc[i],aNarrowCode[i]);
			}
			parentObj.appendChild(newObj);
			
			document.getElementById("divselectSearchByField_1").style.display= "none";
			document.getElementById("divselectSearchByField_0").style.display= "";
		}
	}
	else if(strValue == 0){

		if(obj.tagName == "SELECT"){
			
			var parentObj = obj.offsetParent;
			parentObj.removeChild(obj);
			
			var newObj = document.createElement("INPUT");
			newObj.id = "txtKeyword";
			newObj.setAttribute("defaultValue", obj.getAttribute("defaultValue"));
			
			if( obj.getAttribute("userValue") != obj.getAttribute("defaultValue")){
			
				newObj.value = obj.getAttribute("userValue");
				newObj.className = "objInitialInput txtKeyword ";
			}
			else{
			
				newObj.value = obj.getAttribute("defaultValue");
				newObj.className = "objInitialInput txtKeywordEmpty txtWidth253";
			}
			
			//newObj.attachEvent("onkeydown",txtKeyword_OnKeyDown);
			try{
				newObj.addEventListener("focus", txtKeyword_OnFocus, false);
				newObj.addEventListener("blur", txtKeyword_OnBlur, false);
			}
			catch(e){
				newObj.onfocus = txtKeyword_OnFocus;
				newObj.onblur = txtKeyword_OnBlur;
			}
			parentObj.appendChild(newObj);
			
			document.getElementById("divselectSearchByField_1").style.display= "";
			document.getElementById("divselectSearchByField_0").style.display= "none";
		}
	}
}


function selectLocationField_sh(strValue){
	var source, obj;
	
	
	
	obj = document.getElementById("txtZipCode");
	if(!obj){
		obj = document.getElementById("cmbStateMetro");
	}
	
	if(strValue == 1){
		if(obj.tagName == "INPUT"){
			
			
			
			var parentObj = obj.offsetParent;
			parentObj.removeChild(obj);
			
			var newObj = document.createElement("SELECT");
			newObj.id = "cmbStateMetro";
			newObj.userValue = obj.value;
			newObj.className = "objInitialInput txtWidth253";
			
			newObj.options[newObj.options.length] = new Option("Choose a State/Metro ----------------->","");
			for(var i = 0; i < aMetroCode.length ; i ++){
				newObj.options[newObj.options.length] = new Option(aMetroDesc[i],aMetroCode[i]);
			}
						
			parentObj.appendChild(newObj);
			
			document.getElementById("divselectLocationField_1").style.display= "none";
			document.getElementById("divselectLocationField_0").style.display= "";
		}
	}
	else if(strValue == 0){

		if(obj.tagName == "SELECT"){
			
			var parentObj = obj.offsetParent;
			parentObj.removeChild(obj);
			
			var newObj = document.createElement("INPUT");
			newObj.id = "txtZipCode";
			newObj.className = "objInitialInput txtWidth253";
			newObj.maxLength = 5;
			if(obj.userValue != "")
				newObj.value = obj.userValue;
			
			parentObj.appendChild(newObj);
			
			document.getElementById("divselectLocationField_1").style.display= "";
			document.getElementById("divselectLocationField_0").style.display= "none";

		}
	}
}



function txtKeyword_OnFocus(event){
	var txtObj = document.getElementById("txtKeyword");
	if(txtObj.value == txtObj.getAttribute("defaultValue")){
		txtObj.className = "objInitialInput txtKeyword txtWidth253";
		txtObj.value = "";
	}
}

function txtKeyword_OnBlur(event){
	var txtObj = document.getElementById("txtKeyword");
	if(txtObj.value == ""){
		txtObj.className = "objInitialInput txtKeywordEmpty txtWidth253";
		txtObj.value = txtObj.getAttribute("defaultValue");
	}
}


function postForm_sh(){
	var objKeyword = document.getElementById("txtKeyword");
	var objJobCategory = document.getElementById("cmbJobCategory");
	var objZipCode = document.getElementById("txtZipCode");
	var objStateMetro = document.getElementById("cmbStateMetro");
	var objSearchByOption_0 = document.getElementById("rdbSearchByOption_0");
	var objLocationOption_0 = document.getElementById("rdbLocationOption_0");
	var objSearchByOption_1 = document.getElementById("rdbSearchByOption_1");
	var objLocationOption_1 = document.getElementById("rdbLocationOption_1");
	
	
	var objHiddenKeyword = document.getElementById("hdKeyword");
	var objHiddenJobCategory = document.getElementById("hdJobCategory");
	var objHiddenZipCode = document.getElementById("hdZipCode");
	var objHiddenStateMetro = document.getElementById("hdStateMetro");
	var objHiddenSearchByOption = document.getElementById("hdSearchByOption");
	var objHiddenLocationOption = document.getElementById("hdLocationOption");


	if (objSearchByOption_0.parentNode.style.display=="none")
		objHiddenSearchByOption.value = "0";
	else
		objHiddenSearchByOption.value = "1";


	if(objLocationOption_0)
    {
	    if (objLocationOption_0.parentNode.style.display=="none")
		    objHiddenLocationOption.value = "0";
	    else
		    objHiddenLocationOption.value = "1";
    }else
    {
        objHiddenLocationOption.value = "1";
    }

	
	if(objKeyword){
		if(objKeyword.value == ""){
			alert("Please enter a valid keyword");
			return(false);
		}
		else{
			objHiddenKeyword.value = objKeyword.value;
		}
	}
	
	if(objJobCategory){
		if(objJobCategory.value == ""){
			alert("Please enter a valid job category");
			return(false);
		}
		else{
			objHiddenJobCategory.value = objJobCategory.value;
            document.getElementById("hdNarrowDesc").value = aNarrowDesc[document.getElementById("cmbJobCategory").selectedIndex-1];
		}
	}
	//Uncomment the block below if zip code become required
	/*if(objZipCode){
		if(objZipCode.value!="")
		{
			if((isNaN(objZipCode.value)) || (!validateZipCode(objZipCode.value))){
				alert("Please enter a valid zip code");
				return(false);
			}
			else{
				objHiddenZipCode.value = objZipCode.value;
			}
		}
	}*/
	
	if(objZipCode){
		if (objZipCode.value == "")
			objHiddenZipCode.value = "Enter Zip Code";
		else
			objHiddenZipCode.value = objZipCode.value;
	}
	
	//Uncomment the block below if State/Metro code become required
	/*if(objStateMetro){
		if(objStateMetro.value == ""){
			alert("Please enter a valid state/metro");
			return(false);
		}
		else{
			objHiddenStateMetro.value = objStateMetro.value;
		}
	}*/
	if(objStateMetro){
		if (objStateMetro.value != "")
		{
			var arrMetro = getMetroCodeDetails(objStateMetro.value);
			if(arrMetro)
			{
				if(arrMetro.length==8)
				{
					objHiddenZipCode.value = arrMetro[3];
				}
			}
		}
	}

	if(objStateMetro){
		objHiddenStateMetro.value = objStateMetro.value;
	}

	/*var strBrowser = new String(navigator.userAgent);
	if (strBrowser.toUpperCase().indexOf("MSIE") >= 0)
	{
		objSearchByOption_0.style.visibility = "hidden";
		objLocationOption_0.style.visibility = "hidden";
		objSearchByOption_1.style.visibility = "hidden";
		objLocationOption_1.style.visibility = "hidden";
		objSearchByOption_0.checked = true;
		objLocationOption_0.checked = true;
	}*/
	
	document.getElementById("mainform").submit();
}


function open_eLearnersWindow(strAdsServerHost, strURL){
	var newWindow;
	var strAdsURL;
	strAdsURL = strAdsServerHost + strURL;
	newWindow = window.open(strAdsURL, 
						"elearningjoblist",
							"toolbar=yes,scrollbars=yes," +
								"resizable=yes,width=860," +
									"height=640,left=0,top=0");
	if(newWindow!=null) newWindow.focus();
}


function ChangeDegreelevel()
{
    if(document.searcheducationform.degreelevelcode.value!="000")
    {
        document.searcheducationform.narrowcode.disabled=false;
    }
    else
    {
        var newOpt = null;
        document.searcheducationform.narrowcode.disabled=true;
        document.searcheducationform.narrowcode.value="000";
        document.searcheducationform.subjectcode.disabled=true;
        newOpt = new Option("- Select a Subject - ","000", false, false);
        document.searcheducationform.subjectcode.options[0] = newOpt;
        document.searcheducationform.subjectcode.value="000";
    }

}
function ChangeDegreelevel_Widget()
{
    if(document.searcheducationform_Widget.degreelevelcode.value!="000")
    {
        document.searcheducationform_Widget.narrowcode.disabled=false;
    }
    else
    {
        var newOpt = null;
        document.searcheducationform_Widget.narrowcode.disabled=true;
        document.searcheducationform_Widget.narrowcode.value="000";
        document.searcheducationform_Widget.subjectcode.disabled=true;
        newOpt = new Option("- Select a Subject - ","000", false, false);
        document.searcheducationform_Widget.subjectcode.options[0] = newOpt;
        document.searcheducationform_Widget.subjectcode.value="000";
    }

}

function ChangeNarrow()
{
    
    var strNarrowCode;
    var objField = document.searcheducationform.narrowcode;
    strNarrowCode = objField.options[objField.selectedIndex].value;
    var ajaxRequest;
    try
    {
        ajaxRequest = new XMLHttpRequest();
    }
    catch (e)
    {
        try
        {
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser doesn't support ajax!");
                return false;
            }
        }
    }
    

    ajaxRequest.open("get","/Education/AjaxRefreshSubject.asp?narrowcode="+strNarrowCode,false);
    ajaxRequest.send(null);

    var str_dopeResult = ""; 
    if(ajaxRequest.readyState == 4) 
    { 
        str_dopeResult = ajaxRequest.responseText; 
        document.getElementById("div_subject").innerHTML = str_dopeResult; 
    } 
   
}

function ChangeNarrow_Widget()
{
    
    var strNarrowCode;
    var objField = document.searcheducationform_Widget.narrowcode;
    strNarrowCode = objField.options[objField.selectedIndex].value;
    var ajaxRequest;
    try
    {
        ajaxRequest = new XMLHttpRequest();
    }
    catch (e)
    {
        try
        {
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser doesn't support ajax!");
                return false;
            }
        }
    }
    

    ajaxRequest.open("get","/Education/AjaxRefreshSubject.asp?narrowcode="+strNarrowCode,false);
    ajaxRequest.send(null);

    var str_dopeResult = ""; 
    if(ajaxRequest.readyState == 4) 
    {   
        str_dopeResult = ajaxRequest.responseText; 
        if(navigator.appName.indexOf("Microsoft")!=-1)//isIE
        {
            document.getElementById("div_subject_Widget").innerHTML = str_dopeResult.replace("width: 240px;","width: 200px;"); 
        }
        else//FF
        {
            document.getElementById("subjectcode_wgt").innerHTML = str_dopeResult.replace("<select name=\"subjectcode\" id=\"subjectcode\" style=\"width: 240px;\" class=\"SelectBoxContent\">","").replace("</select>",""); 
            document.getElementById("subjectcode_wgt").disabled=false;
        }
    } 
   
}




function SearchEducation()
{
	var txtObj = document.getElementById("degreelevelcode");
	if(txtObj.value == "000"){
		alert('Please choose a degree level.');
		return;
	}
	
	txtObj = document.getElementById("narrowcode");
	if(txtObj.value == "000"){
		alert('Please choose a category.');
		return;
	}
	
	txtObj = document.getElementById("subjectcode");
	if(txtObj.value == "000"){
		alert('Please choose a subject.');
		return;
	}
	
	document.searcheducationform.target="_self";
	document.searcheducationform.method="post";
	document.searcheducationform.action = "/Education/EducationResult.asp";
	document.searcheducationform.submit();
}

function SearchEducation_Widget()
{
    
	var txtObj = document.searcheducationform_Widget.degreelevelcode;
	if(txtObj.value == "000"){
		alert('Please choose a degree level.');
		return;
	}
	
	txtObj = document.searcheducationform_Widget.narrowcode;
	if(txtObj.value == "000"){
		alert('Please choose a category.');
		return;
	}
	
	
	//txtObj = document.searcheducationform_Widget.subjectcode;//doesn't work on home page because top edu form
	txtObj = document.getElementById("subjectcode_wgt");
    
   
    if(txtObj != null)
    {
	
	    if(txtObj.value == "000"){
		    alert('Please choose a subject.');
		    return;
	    }
	}
	
	document.searcheducationform_Widget.target="_self";
	document.searcheducationform_Widget.method="post";
	document.searcheducationform_Widget.action = "/Education/EducationResult.asp";
	document.searcheducationform_Widget.submit();
}

				function txtKeyword_OnFocus1(obj){
					var txtObj = obj;
					if(txtObj.value == txtObj.getAttribute("defaultValue")){
						txtObj.className = "objInitialInput txtKeyword txtWidth253";
						txtObj.value = "";
					}
				}
				
				function txtKeyword_OnBlur1(obj){
					var txtObj = obj;
					if(txtObj.value == ""){
						txtObj.className = "objInitialInput txtKeywordEmpty txtWidth253";
						txtObj.value = txtObj.getAttribute("defaultValue");
					}
				}

