﻿// JScript File

function VerifyJobSearch()
{

    var ddlCategory = document.getElementById(ClientIDs.ddlCategory);
    var ddlLocation = document.getElementById(ClientIDs.ddlLocation);
    var ddlJobType = document.getElementById(ClientIDs.ddlJobType);
    
    if (ddlLocation.options[ddlLocation.selectedIndex].value == "") {
        alert("You must select a location to proceed");
        return false;
    }
      
    if (ddlJobType.options[ddlJobType.selectedIndex].value == "") {
        alert("You must select a job type to proceed");
        return false;
    }
            
    if (ddlCategory.options[ddlCategory.selectedIndex].value == "") {
        alert("You must select a category to proceed");
        return false;
    }
    
    return true;
        
}

function VerifyJobSearchResults() {


    var chk;

    var chkNumb = "";
    blnAtLeastOneCheckboxChecked = false;
    for (x = 1; x < 100; x++)
    {
         chkNumb = x;
         if (x < 10) chkNumb = "0" + x;
         chk = document.getElementById("ctl00_MainContent_rptJob_ctl" + chkNumb + "_chkJob01");
         if (chk == null) break;
         if (chk.checked) blnAtLeastOneCheckboxChecked = true;
    }

    if (blnAtLeastOneCheckboxChecked == false) 
    {
        alert("You must check the checkbox for at least one of the listed jobs.");
    }
    
    return blnAtLeastOneCheckboxChecked;

}

function VerifyApply()
{

    var txtLastName = document.getElementById(ClientIDs.txtLastName);
    var txtFirstName = document.getElementById(ClientIDs.txtFirstName);
    var txtEmail = document.getElementById(ClientIDs.txtEmail);
    var txtCell = document.getElementById(ClientIDs.txtCell);
    
    if (txtFirstName.value == "") {
        alert("You must enter a first name to proceed");
        return false;
    }
        
    if (txtLastName.value == "") {
        alert("You must enter a last name to proceed");
        return false;
    }
    
    if (txtEmail.value == "") {
        alert("You must enter a email to proceed");
        return false;
    }
    
//    if (txtCell.value == "") {
//        alert("You must enter a cell phone to proceed");
//        return false;
//    }
        
    return true;
        
}

function VerifyRequestInfo()
{
    
    var txtName = document.getElementById(ClientIDs.txtName);
    var txtCompany = document.getElementById(ClientIDs.txtCompany);
    var txtAreaCode = document.getElementById(ClientIDs.txtAreaCode);
    var txtPhonePrefix = document.getElementById(ClientIDs.txtPhonePrefix);
    var txtPhoneSuffix = document.getElementById(ClientIDs.txtPhoneSuffix);
    var txtEmail = document.getElementById(ClientIDs.txtEmail);
    var txtPositions = document.getElementById(ClientIDs.txtPositions);
    
   
    if (txtName.value == "") {
        alert("You must enter your name to proceed");
        return false;
    }
        
    if (txtCompany.value == "") {
        alert("You must enter your company to proceed");
        return false;
    }
    
    if (txtAreaCode.value == "") {
        alert("You must enter your area code to proceed");
        return false;
    }

    if (txtPhonePrefix.value == "") {
        alert("You must enter your full phone number to proceed");
        return false;
    }
    
    if (txtPhoneSuffix.value == "") {
        alert("You must enter your full phone number to proceed");
        return false;
    }
            
    if (txtEmail.value == "") {
        alert("You must enter your email address to proceed");
        return false;
    }

    if (txtPositions.value == "") {
        alert("You must enter positions you would like to fill to proceed");
        return false;
    }
     
    return true;
}

function VerifyHRRoundtableRSVP()
{
    
    var txtYourName = document.getElementById(ClientIDs.txtYourName);
    var txtCompany = document.getElementById(ClientIDs.txtCompany);
    var txtPhone = document.getElementById(ClientIDs.txtPhone);
    var txtEmail = document.getElementById(ClientIDs.txtEmail);
    
   
    if (txtYourName.value == "") {
        alert("You must enter your name to proceed");
        return false;
    }
        
    if (txtCompany.value == "") {
        alert("You must enter your company to proceed");
        return false;
    }
    
    if (txtPhone.value == "") {
        alert("You must enter your phone number to proceed");
        return false;
    }
    
    if (txtEmail.value == "") {
        alert("You must enter your email address to proceed");
        return false;
    }
        
    return true;
}

function redirectToPage(pageName)
{
    window.location.replace(pageName);
}

function SetUniqueRadioButton(nameregex, current)
{

   re = new RegExp(nameregex);
   for(i = 0; i < document.forms[0].elements.length; i++)
   {
      elm = document.forms[0].elements[i]
      if (elm.type == 'radio')
      {
         if (re.test(elm.name))
         {
            elm.checked = false;
         }
      }
   }
   current.checked = true;
}
