﻿function LoadControl()
{
        FillSlyExpCtrl("ddlMinExperience", true, null, null);
        FillSlyExpCtrl("ddlMaxExperience", true, null, null);
        ChangeColorAndSetIndex("ddlMinExperience", null, 0, "From");
        ChangeColorAndSetIndex("ddlMaxExperience", null, 0, "To");
        FillSlyExpCtrl("ddlMinSal", true, null, null);
        FillSlyExpCtrl("ddlMaxSal", true, null, null);
        ChangeColorAndSetIndex("ddlMinSal", null, 0, "From");
        ChangeColorAndSetIndex("ddlMaxSal", null, 0, "To");
}

function clickButton(e, buttonid)
{ 
    var bt = window.document.getElementById(buttonid);
    if (bt)
    { 
        if(navigator.appName.indexOf("Netscape")>(-1)) { if (e.keyCode == 13) { LoadURL(); return false; } } 
        if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)) {  if (event.keyCode == 13) { LoadURL(); return false; } } 
    } 
} 

function filtervalue() {
    var common = "a,an,the,is,of,are,was,were,shall,will,should,would,can,could,may,might,am,by,to,you,me,he,she,it,we,all,they,how,in,to,for,job,jobs"; 
     var sentence=document.getElementById("txtKeyword").value; 
        var wordArr = sentence.match(/\w+/g),
        commonObj = {},
        uncommonArr = [],
        word, i;

    common = common.split(',');
    for ( i = 0; i < common.length; i++ ) {
        commonObj[ common[i].trim() ] = true;
    }
    
    for ( i = 0; i < wordArr.length; i++ ) {
        word = wordArr[i].trim().toLowerCase();
        if ( !commonObj[word] ) {
            uncommonArr.push(word);
        }
    }
    return LoadURL(uncommonArr.join(" "));
}

function LoadURL(Keyword)
{
    var linkSrc = "http://jobsearch.gobananas.in/?JSR*qsAjs=";
    var tmpObj = document.getElementById("chkKeyword");
    linkSrc += "&qsSkill=" + Keyword.value.replace("#", "srp");
    linkSrc += "&qsDesignation=" + document.getElementById("txtDesc").value.replace("#", "srp");
    linkSrc += "&qsLocation=" + document.getElementById("txtLoc").value.replace("#", "srp");
    tmpObj = document.getElementById("ddlFunctionalArea");
    linkSrc += "&qsFunctionalArea=" + (tmpObj.selectedIndex >= 0 ? (tmpObj.options[tmpObj.selectedIndex].text!="--Select--" ? tmpObj.options[tmpObj.selectedIndex].text : "" ) : "" );
    tmpObj = document.getElementById("ddlIndustry");
    linkSrc += "&qsIndustry=" + (tmpObj.selectedIndex >= 0 ? (tmpObj.options[tmpObj.selectedIndex].text!="--Select--" ? tmpObj.options[tmpObj.selectedIndex].text : "" ) : "" );
    tmpObj = document.getElementById("ddlMinExperience");
    linkSrc += "&qsMinExpYear=" + (tmpObj.selectedIndex != 0 ? tmpObj.options[tmpObj.selectedIndex].value : "" );
    tmpObj = document.getElementById("ddlMaxExperience");
    linkSrc += "&qsMaxExpYear=" + (tmpObj.selectedIndex != 0 ? tmpObj.options[tmpObj.selectedIndex].value : "" );
    tmpObj = document.getElementById("ddlMinSal");
    linkSrc += "&qsMinSalary=" + (tmpObj.selectedIndex != 0 ? tmpObj.options[tmpObj.selectedIndex].value : "" );
    tmpObj = document.getElementById("ddlMaxSal");
    linkSrc += "&qsMaxSalary=" + (tmpObj.selectedIndex != 0 ? tmpObj.options[tmpObj.selectedIndex].value : "" );
    tmpObj = document.getElementById("lstFresh");
    linkSrc += "&qsDiff=" + (tmpObj.selectedIndex != 0 ? tmpObj.options[tmpObj.selectedIndex].value : "" );
    tmpObj = document.getElementsByName("1");
    linkSrc += "&qsIndT=" + ( tmpObj[0].checked ? "" : tmpObj[1].checked ? "C" : tmpObj[2].checked ? "F" : "" );
    window.location = linkSrc;
    return false;
}

