function gotoJobSearchSelect(){
	if(document.newsearchform.narrowcode.options[document.newsearchform.narrowcode.selectedIndex].value == ""){
		alert("Please select a job category.");
		document.newsearchform.narrowcode.focus();
		return false;
	}
	else{
		var strNarrowDesc;
		strNarrowDesc = document.newsearchform.narrowcode.options[document.newsearchform.narrowcode.selectedIndex].text;
		document.newsearchform.narrowdesc.value = strNarrowDesc;
 
		return true;
	}
	

}

function openTinyWin(strUrl,strWindowName,strWidth,strHeight){		
			
	 var subWin = window.open(strUrl,strWindowName,
							"toolbar=no,scrollbars=no," + 
								"resizable=no,width=" + strWidth + "," +
									"height=" + strHeight + ",left=0,top=0");		
		
	if(subWin!=null) subWin.focus;
	    	
}

function getResults(){



	if(document.resultform.narrowcode.options[document.resultform.narrowcode.selectedIndex].value == ""){
		alert("Please select a job category.");
		document.resultform.narrowcode.focus();
	}
	else{
	
	
		var strNarrowDesc;
		
		strNarrowDesc = document.resultform.narrowcode.options[document.resultform.narrowcode.selectedIndex].text;
		
		document.resultform.narrowdesc.value = strNarrowDesc;


		document.resultform.action = "/jobsearchwizard/layoutscripts/jswl_searchresult.asp";
		
		document.resultform.target="_self";
		document.resultform.submit();
	}
	

}


function openCommonWindow(strUrl,strWidth,strHeight){		
		
		 var subWin = window.open(strUrl,"SalWizWindow",
								"toolbar=yes,scrollbars=yes," + 
									"resizable=yes,width=" + strWidth + "," +
										"height=" + strHeight + ",left=0,top=0");		
	
		if(subWin!=null) subWin.focus();
    	
}	

function becomeMember(){
	var bSubmit;
	bSubmit=true;
	if(document.resultform.emailAddress.value.length==0){
		alert("Please enter your email address.");
		document.resultform.emailAddress.focus();
		bSubmit = false;
	}
	else{
		if(!GoodEmailAddress(document.resultform.emailAddress.value)){
			alert("Invalid Email address.");
			document.resultform.emailAddress.focus();
			bSubmit = false;
		}
	}
	if(bSubmit){
		document.resultform.signupemail.value = document.resultform.emailAddress.value;
		document.resultform.confirmemail.value = document.resultform.emailAddress.value;
		document.resultform.username.value = document.resultform.emailAddress.value;
		document.resultform.action = "http://secure.salary.com/mysalary/layoutscripts/msll_login.asp";
		document.resultform.method="post";
		document.resultform.target="_self";
		document.resultform.submit();


	}
		
}
	
function GoodEmailAddress(strEmail){
	strEmail = trim(strEmail);
	if (strEmail.indexOf(" ")>0 && strEmail.indexOf(" ")<strEmail.length-1){return false;}
	if (strEmail.length < 5) {return false;}
	if (strEmail.indexOf("@") < 1) {return false;}//there must be at least one '@'
	//there can not be two '@' or more
	if (strEmail.indexOf(".",strEmail.indexOf("@")) < strEmail.indexOf("@")){return false;}
	if (strEmail.lastIndexOf("@") != strEmail.indexOf("@")) {return false;}
	if (strEmail.lastIndexOf(".") == strEmail.length-1) {return false;}
	return true;	
}			
			


function trim(strValue) {
	return trimRight(trimLeft(strValue));	
}

function trimLeft(strValue) {
	if (strValue == null) return null;
	if (strValue.length == 0) return strValue;
	for (i=0; i<strValue.length; i++) {
		if (strValue.charAt(i) != ' ')
			return strValue.substr(i);
	}
	return "";
}

function trimRight(strValue) {	
	if (strValue == null) return null;
	if (strValue.length == 0) return strValue;
	for (i=strValue.length-1; i>=0; i--) {
		if (strValue.charAt(i) != ' ')
			return strValue.substring(0, i+1);
	}
	return "";
}

function openPSRpopWindow(strHostName){
var strHeight = "700";
var strWidth = "840";
var popunder= strHostName + "/salaryreport/layoutscripts/srpl_overview.asp?r=salfrln";
//var popunder="/salaryreport/layoutscripts/srpl_overview.asp"

PSRWindow=window.open(popunder,"PSRWindow",
								"toolbar=yes,scrollbars=yes,status=yes," + 
									"resizable=yes,width=" + strWidth + "," +
										"height=" + strHeight + ",left=0,top=0");
PSRWindow.focus();
}

function Register()
{

    if(document.resultform.jswupdatefreq.checked)
    {
        document.resultform.jswupdatefreqinterval.value=document.resultform.select_jswupdatefreqinterval.value
    }
    else
    {
        document.resultform.jswupdatefreqinterval.value="-1|||mm";
    }
    
    document.resultform.narrowcode.value=document.resultform.narrowcodeforjobalerts.value;
    document.resultform.zipcode.value=document.resultform.zipcodeforjobalerts.value;
    document.resultform.metrocode.value=document.resultform.metrocodeforjobalerts.value;
    document.resultform.narrowdesc.value = document.resultform.narrowcodeforjobalerts.options[document.resultform.narrowcodeforjobalerts.selectedIndex].text;
    document.resultform.action = "http://secure.salary.com/mysalary/layoutscripts/msll_addeditregistration.asp";
    //document.resultform.action = "http://localhost:8555/mysalary/layoutscripts/msll_addeditregistration.asp";

	document.resultform.method="get";
	document.resultform.target="_self";
	document.resultform.submit();

}





function selectNarrowList(theType, strJobCode)
{
    var iSelectedIndex = 0;
    var objSJ = document.getElementById("jobcode");
    objSJ.length=0;
    objSJ.options[0] = new Option("Select one -------------------->", "", false, false);

    if (theType != "")
    {
        var temp;
        var temp2;  
        var temp3;  
        var iIndex;
        for(var i=0; i<U.length; i++)
        {   
            if(U[i].indexOf(theType + "^") >= 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++;
            }
        }
    }
    objSJ.options[iSelectedIndex].selected = true;


}

function prepop()
{
	var objSN = document.resultform.narrowcode;
	var objJC = document.getElementById("jobcode");
	
	selectNarrowList(objSN.options[objSN.selectedIndex].value, objJC.options[objJC.selectedIndex].value);
}