//###############################
//# Declarations                #
//###############################

//###############################
//# Functions                   #
//###############################
function _Job_mfJobSearch(pstrComponentName, pstrWebPage)
{


  var strKeyword = document.getElementById('txtJobSearch_' + pstrComponentName).value;
  var strCountyId = document.getElementById('cboCounty_' + pstrComponentName).value;
  var strCategoryId = document.getElementById('cboCategory_' + pstrComponentName).value;
  var strSalaryFrom = document.getElementById('txtSalaryFrom_' + pstrComponentName).value;
  var strSalaryTo = document.getElementById('txtSalaryTo_' + pstrComponentName).value;
  var strSalaryType = document.getElementById('cboSalaryType_' + pstrComponentName).value;
  var strContract = document.getElementById('chkContract_' + pstrComponentName).checked;
  var strPartTime = document.getElementById('chkPart-Time_' + pstrComponentName).checked;
  var strPermanent = document.getElementById('chkPermanent_' + pstrComponentName).checked;
  var strTemporary = document.getElementById('chkTemporary_' + pstrComponentName).checked;
  var strTempPerm = document.getElementById('chkTempPerm_' + pstrComponentName).checked;
  var strSalaryString = '';
  var strJobType = '';
  var strErrors = '';
  

    if (pstrWebPage != '')
    {
      if (strSalaryFrom != '' || strSalaryTo != '')
       {
        if( isNaN(strSalaryFrom) )
          strErrors = 'You must enter numbers in both of the Salary fields without punctuation';
          
        if( isNaN(strSalaryTo) )
          strErrors = 'You must enter numbers in both of the Salary fields without punctuation';
        
        if (strErrors != '')
         {
            alert(strErrors);
            strErrors = '';
            return false;
          }
         else
         {
          strSalaryString = '&SalaryFrom=' + strSalaryFrom + '&SalaryTo=' + strSalaryTo + '&SalaryType=' + strSalaryType
          }
       } 
       
      if (strContract)
        strJobType = strJobType + '1,';
      if (strPartTime)
        strJobType = strJobType + '2,';     
      if (strPermanent)
        strJobType = strJobType + '3,';
      if (strTemporary)
        strJobType = strJobType + '4,'; 
      if (strTempPerm)
        strJobType = strJobType + '5,';
        
        if( strJobType != '')
          strJobType = strJobType.substring(0, strJobType.length-1);           
        
      window.location.href=pstrWebPage + '?Keyword=' + strKeyword + '&CountyId=' + strCountyId + '&CategoryId=' + strCategoryId + strSalaryString + '&JobType=' + strJobType;
    }
    else
    {
      alert('We are unable to dislpay matching products because a Default Job List page has not been selected within the Jobs administration system!');
    }
  
}
