function BaseUrl()
{
    return window.location.protocol + '//' + window.location.hostname + '/';
}



function adminDiscipline(id,disid){

    

    

    if(id ==14)

    {



    document.getElementById('othersec').style.display='block';

    document.getElementById('otherdiscipline').style.display='block';

    document.getElementById('discipline').style.display='none';

    

    var url = BaseUrl()+'candidate/getOthereSector/'+id; // JIS PHP FILE SE RESULT LENE HAI

    var pars = 'id='+id; // greeting-name FILED KA NAAM

    var target = 'OtherSectorText'; // JIS DIV ME RESULT SHOW KARWANA HAI

    var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});

    }

    else

    {

    document.getElementById('otherdiscipline').style.display='none';

    document.getElementById('discipline').style.display='block';    

    document.getElementById('othersec').style.display='none';

    var url = BaseUrl()+'candidate/getDiscipline/'+id+'/'+disid; // JIS PHP FILE SE RESULT LENE HAI

    var pars = 'id='+id; // greeting-name FILED KA NAAM

    var target = 'discipline'; // JIS DIV ME RESULT SHOW KARWANA HAI

    var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});

    }

}







function __discipline(id,disid){

    

    if(id ==14)

    {



    document.getElementById('othersec').style.display='block';

    document.getElementById('otherdiscipline').style.display='block';

    document.getElementById('discipline').style.display='none';

    

    var url = BaseUrl()+'recruiter/getOthereSector/'+id; // JIS PHP FILE SE RESULT LENE HAI

    var pars = 'id='+id; // greeting-name FILED KA NAAM

    var target = 'OtherSectorText'; // JIS DIV ME RESULT SHOW KARWANA HAI

    var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});

    }

    else

    {

    document.getElementById('otherdiscipline').style.display='none';

    document.getElementById('discipline').style.display='block';    

    document.getElementById('othersec').style.display='none';   

    var url = BaseUrl()+'candidate/getDiscipline/'+id+'/'+disid; // JIS PHP FILE SE RESULT LENE HAI

    var pars = 'id='+id; // greeting-name FILED KA NAAM

    var target = 'discipline'; // JIS DIV ME RESULT SHOW KARWANA HAI

    var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});

    }

}





/*

function OtherSector(SectorId)

{

//var url = 'http://www.skyscraperjobs.net/candidate/getOthereSector/'+SectorId; // JIS PHP FILE SE RESULT LENE HAI

var url = 'http://sujendra/skyscraperjobs/candidate/getOthereSector/'+SectorId; // JIS PHP FILE SE RESULT LENE HAI

//alert(url)

    var pars = 'id='+SectorId; // greeting-name FILED KA NAAM

    var target = 'OtherSectorText'; // JIS DIV ME RESULT SHOW KARWANA HAI

    var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});



}*/



function OtherDiscipline(DisId)

{



    if(DisId=='Other')

    {

        document.getElementById('otherdiscipline').style.display='block';

        

        }

    else

    {

    document.getElementById('otherdiscipline').style.display='none';

    var url = BaseUrl()+'candidate/getOthereDiscipline/'+DisId; // JIS PHP FILE SE RESULT LENE HAI

    var pars = 'id='+DisId; // greeting-name FILED KA NAAM

    var target = 'OtherDisciplineText'; // JIS DIV ME RESULT SHOW KARWANA HAI

    var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});

    }

}

/*This function is seperate for Candidate Salary listing*/

function __setSalaryValCandidate(positionType,minSalaryValue,maxSalaryValue){



    var pageUrl = BaseUrl()+'candidate/getSalaryVals/'+positionType+'/'+minSalaryValue+'/'+maxSalaryValue;  // 

    var params = 'positionType='+positionType; // greeting-name FILED KA NAAM

    var target = 'minSalary'; // JIS DIV ME RESULT SHOW KARWANA HAI

    $('progressBar').style.display = 'inline';

    new Ajax.Request(  pageUrl,  { method: 'get', parameters: params, onFailure: ReportError,  

                                onComplete: function(request) { 

                                                                ProcessSalaryResultsCandidate(request.responseText);

                                                                $('progressBar').style.display = 'none';

                                                               },  

                                          evalScript: false

                                          }  

                             ); 

}

function ProcessSalaryResultsCandidate(responseText){

    var salaryCombos = responseText.split("~~");

        

    document.form.minSalary.innerHTML = salaryCombos[0];

    document.form.maxSalary.innerHTML = salaryCombos[1];

    

}







function __setSalaryValOld(positionType){



    var url =  BaseUrl()+'recruiter/getSalaryVals/'+positionType; // JIS PHP FILE SE RESULT LENE HAI

    var pars = 'positionType='+positionType; // greeting-name FILED KA NAAM

    var target = 'Minsalary'; // JIS DIV ME RESULT SHOW KARWANA HAI

    var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});

}

function __setRecruiterSalaryVal(positionType){



    var url = BaseUrl()+'recruiter/getRecruiterSalaryMinVal/'+positionType; // JIS PHP FILE SE RESULT LENE HAI

    var pars = 'positionType='+positionType; // greeting-name FILED KA NAAM

    var target = 'Minsalary'; // MinsalaryJIS DIV ME RESULT SHOW KARWANA HAI

    var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});



    __setRecruiterSalaryVal1(positionType);



}



function __setRecruiterSalaryVal1(positionType){



    var url = BaseUrl()+'recruiter/getRecruiterSalaryMaxVals/'+positionType; // JIS PHP FILE SE RESULT LENE HAI

    var pars = 'positionType='+positionType; // greeting-name FILED KA NAAM

    var target1 = 'Maxsalary'; // JIS DIV ME RESULT SHOW KARWANA HAI

    var myAjax = new Ajax.Updater(target1, url, {method: 'get', parameters: pars});

}



////////////////



function setRecruiterSalaryValEdit(positionType,minsal,maxsal){



    var url = BaseUrl()+'recruiter/getRecruiterSalaryMinValue/'+positionType+'/'+minsal+'/'+maxsal; // JIS PHP FILE SE RESULT LENE HAI

    var pars = 'positionType='+positionType; // greeting-name FILED KA NAAM

    var target = 'Minsalary'; // MinsalaryJIS DIV ME RESULT SHOW KARWANA HAI

    var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});



    __setRecruiterSalaryVal1edit(positionType,maxsal);



}



function __setRecruiterSalaryVal1edit(positionType,maxsal){



    var url = BaseUrl()+'recruiter/getRecruiterSalaryMaxValues/'+positionType+'/'+maxsal; // JIS PHP FILE SE RESULT LENE HAI

    var pars = 'positionType='+positionType; // greeting-name FILED KA NAAM

    var target1 = 'Maxsalary'; // JIS DIV ME RESULT SHOW KARWANA HAI

    var myAjax = new Ajax.Updater(target1, url, {method: 'get', parameters: pars});

}



/////////////



function __setRecruiterSalaryValOld(positionType){

     return false;



    var pageUrl = BaseUrl()+'recruiter/getRecruiterSalaryVals/'+positionType; // JIS PHP FILE SE RESULT LENE HAI

    var params = 'positionType='+positionType; // greeting-name FILED KA NAAM

    var target = 'Minsalary'; // JIS DIV ME RESULT SHOW KARWANA HAI

    

    new Ajax.Request(  pageUrl,  { method: 'get', parameters: params, onFailure: ReportError,  

                                onComplete: function(request) { 

                                                                ProcessSalaryResults(request.responseText);

                                                                //$('progressBar').style.display = 'none';

                                                               },  

                                          evalScript: false

                                          }  

                             ); 

}

function ProcessSalaryResults(responseText){

    

    var salaryCombos = responseText.split("~~");

    document.getElementById('Minsalary').innerHTML = salaryCombos[0];

    document.getElementById('Maxsalary').innerHTML = salaryCombos[1];

    return true;

    

}

function ProcessSalaryResultsNew(responseText){

    

    /*var salaryCombos = responseText.split("~~");

    alert(salaryCombos[0]);

    alert(salaryCombos[1]);

     return false;*/

        

    

    selectbox = document.getElementById( "Minsalary")

    var salArr = responseText.split( "~~" );

    var splitSalarr1 = salArr[0].split( "|" );

    for (var i=0; i < splitSalarr1.length;++i){

        var optn = document.createElement("OPTION");

        optn.text = splitSalarr1[i];

        optn.value = splitSalarr1[i];

        selectbox.options.add(optn);

    }

    //alert(optn);

    selectbox1 = document.getElementById( "Maxsalary")

    var splitSalarr2 = salArr[1].split( "|" );

    for (var j=0; j < splitSalarr2.length;++j){

        var optn1 = document.createElement("OPTION");

        optn.text = splitSalarr2[j];

        optn.value = splitSalarr2[j];

        selectbox1.options.add(optn1);

    }

        

}

function removeOptionLast()

{

  var elSel = document.getElementById('selectX');

  if (elSel.length > 0)

  {

    elSel.remove(elSel.length - 1);

  }

}

function ReportError(responseText)  

 {  

  alert(responseText);  

 }  

 

 

 

 

 

 /* showing list of region based on CountryId */

function __listRegion(countryId,regionId){

    //alert(countryId,regionId);

    var url = BaseUrl()+'candidate/listRegion/'+countryId+'/'+regionId; // JIS PHP FILE SE RESULT LENE HAI

    

    var pars = 'id='+countryId; // greeting-name FILED KA NAAM

    var target = 'region'; // JIS DIV ME RESULT SHOW KARWANA HAI

    var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});



}



 /* showing list of region based on CountryId */

function __listArea(regionId ,areaId){

    

    var url = BaseUrl()+'candidate/listArea/'+regionId+'/'+areaId; // JIS PHP FILE SE RESULT LENE HAI

    var pars = 'id='+regionId; // greeting-name FILED KA NAAM

    var target = 'area'; // JIS DIV ME RESULT SHOW KARWANA HAI

    var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});



}



/*This function is seperate for Candidate Salary listing*/

function setExistingSal(positionType,minSalaryValue,maxSalaryValue){

    

var pageUrl = BaseUrl()+'recruiter/getSalaryVals/'+positionType+'/'+minSalaryValue+'/'+maxSalaryValue;  // JIS PHP FILE SE RESULT LENE HAI

    var params = 'positionType='+positionType; // greeting-name FILED KA NAAM

    

    $('progressBar').style.display = 'inline';

    new Ajax.Request(  pageUrl,  { method: 'get', parameters: params, onFailure: ReportError,  

                                onComplete: function(request) 

                                { 

                                    

                                    ProcessSalaryResultsCandidate(request.responseText);

                                                                $('progressBar').style.display = 'none';

                                                               },  

                                          evalScript: false

                                          }  

                             ); 

}

function ProcessSalaryResultsCandidate(responseText){

    

    //alert(responseText)

    var salaryCombos = responseText.split("~~");

    

    document.getElementById('minSalary').innerHTML = salaryCombos[0];

    document.getElementById('maxSalary').innerHTML = salaryCombos[1];

    

    //alert(document.getElementById('minSalary').innerHTML)

}



function ReportError(responseText)  

 {  

  alert(responseText);  

 }  



/* showing online status sign */

function __disciplineSearch(id, disid)
{
    disid = disid || '';

    if (id == 14 || id == 'Other') {
        document.getElementById('othersec').style.display = '';
        document.getElementById('disciplineDiv').style.display = 'none';
        document.getElementById('otherdiscipline').style.display = '';

        // JIS PHP FILE SE RESULT LENE HAI
        var url = BaseUrl() + 'recruiter/getDiscipline/' + id;

        // greeting-name FILED KA NAAM
        var pars = 'id=' + id;

        // JIS DIV ME RESULT SHOW KARWANA HAI
        var target = 'discipline';

        var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});

    } else {
        if (id != '') {
            document.getElementById('otherdiscipline').style.display = 'none';
            document.getElementById('othersec').style.display = 'none';
            document.getElementById('disciplineDiv').style.display = '';
        }

        // JIS PHP FILE SE RESULT LENE HAI
        var url = BaseUrl() + 'recruiter/getDiscipline/' + id + '/' + disid;

        // greeting-name FILED KA NAAM
        var pars = 'id=' + id;

        // JIS DIV ME RESULT SHOW KARWANA HAI
        var target = 'discipline';

        var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});
    }
}

function OtherDisciplineNew(DisId)

{

    //alert(DisId);

    if(DisId=='Other' || DisId == '14' || DisId == '138')

    {

        document.getElementById('otherdiscipline').style.display='';

        

    }

    else

    {

    document.getElementById('otherdiscipline').style.display='none';

    var url = BaseUrl()+'recruiter/getOthereDiscipline/'+DisId; // JIS PHP FILE SE RESULT LENE HAI

    var pars = 'id='+DisId; // greeting-name FILED KA NAAM

    var target = 'otherdisciplinetxt'; // JIS DIV ME RESULT SHOW KARWANA HAI

    var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});

    }

}



