﻿//////////////////////////////COODING START HERE////////////////////////////
$(document).ready(function() {
//////////////////////////////COODING START HERE////////////////////////////
// 
// $('#dtPickerFrm1').get(0).value = '14-Sep-2009';
// $('#dtPickerTo1').get(0).value = '18-Sep-2009';
// 
//alert(WvalidateFromToDates('dtPickerFrm1','dtPickerTo1'));
//  


// 
// $('#dtPickerFrm1').get(0).value = '14-Sep-2009';
// $('#dtPickerTo1').get(0).value = 'Sep asdf1 S';
// 
//alert(WvalidateAlpha('dtPickerTo1'));
//  



 //////////////////////////////COODING END HERE////////////////////////////
});//$(document).ready(function() {
//////////////////////////////COODING END HERE////////////////////////////


function Validate_ApplicationDetail(){


    if ($('#cmbJobID').css('display') != undefined) {
        if (WIsEmptyValue('cmbJobID') == true){
          LogError("Position Applied For information must be given.");
        }//if (WIsEmptyValue('cmbJobID') == true){
    }//if ($('#cmbJobID').css('display') != undefined) {
    
    

    if(WIsEmptyValue('txtFName')){
      LogError("First Name must be given.");
    }else if (!WvalidateAlpha('txtFName')){
      LogError("Invalid First Name Format.");
    }


    if (WvalidateAlpha('txtMName') == false  && WIsEmptyValue('txtMName') == false){
      LogError("Invalid Middle Name Format.");
    }


    if(WIsEmptyValue('txtLName')){
      LogError("Last Name must be given.");
    }else if (!WvalidateAlpha('txtLName')){
      LogError("Invalid Last Name Format.");
    }


    if(WIsEmptyValue('cmbGender')){
      LogError("Gender must be Specified.");
    }
     

    if(WIsEmptyValue('dtPickerBirthDt')){
      LogError("Date of Birth must be given.");
    }else if (!WvalidateDate('dtPickerBirthDt')){
      LogError("Invalid Birth Date Format.");
    }else if (!WvalidateIsPastDate('dtPickerBirthDt')){
      LogError("Birth Date cannot be greater than or equal to Current Date.");
    }


    if(WIsEmptyValue('txtFathName')){
      LogError("Father's Name must be given.");
    }else if (!WvalidateAlpha('txtFathName')){
      LogError("Invalid Father's Name Format.");
    }


    if (WvalidateEmail('txtEmail') == false  && WIsEmptyValue('txtEmail') == false){
      LogError("Invalid Email Format.");
    }


    if(WIsEmptyValue('txtNIC')){
      LogError("CNIC number must be given.");
    }else if (!WvalidateCNIC('txtNIC')){
      LogError("Invalid CNIC Number Format.");
    }



    if(!WIsEmptyValue('dtPickerNICExpDt')){

           if (!WvalidateDate('dtPickerNICExpDt')){
              LogError("Invalid CNIC Expiry Date Format.");
            }else if (!WvalidateIsFutureDate('dtPickerNICExpDt')){
              LogError("CNIC Expiry Date cannot be lower than or equal to Current Date.");
            }
            
    }//if(!WIsEmptyValue('dtPickerNICExpDt')){



    if(!WIsEmptyValue('dtPickerPassExpDt')){

           if (!WvalidateDate('dtPickerPassExpDt')){
              LogError("Invalid Passport Expiry Date Format.");
            }else if (!WvalidateIsFutureDate('dtPickerPassExpDt')){
              LogError("Passport Expiry Date cannot be lower than or equal to Current Date.");
            }
            
    }//if(!WIsEmptyValue('dtPickerPassExpDt')){


     
    if (WIsEmptyValue('dtPickerPassExpDt') == false  && WIsEmptyValue('txtPassNo') == true){
      LogError("Passport # must be given if Passport Expiry Date is mentioned.");
    }
       
    if (WIsEmptyValue('txtSal') == false  && WvalidateInteger('txtSal') == false){
      LogError("Expected Salary must be given in whole numbers and should be in Valid format.");
    }


    if ($('#txtTotalExp').get(0).value > 50){
      LogError("Total Experience Must Be Less Then 50 Years.");
    }


    if(WIsEmptyValue('txtLn1')){
      LogError("Line 1 of Mailing Address must be given.");
    }
     

    if(WIsEmptyValue('cmbCntry')){
      LogError("Country Information of Mailing Address must be given.");
    }
     

    if(WIsEmptyValue('cmbCty')){
      LogError("City Information of Mailing Address must be given.");
    }
     

    if  (   (WIsEmptyValue('txtOpLn1') == false || WIsEmptyValue('txtOpLn2') == false)
            &&
            (WIsEmptyValue('cmbOpCntry') == true || WIsEmptyValue('cmbOpCty') == true)
        ){
        
                LogError("City and Country Information must be given if other Permanent Address Details are mentioned.");
    }//if  (   (WIsEmptyValue('txtOpLn1') == false || WIsEmptyValue('txtOpLn2') == false)
     
              

    if  (   (WIsEmptyValue('cmbOpCntry') == false || WIsEmptyValue('cmbOpCty') == false)
            &&
            (WIsEmptyValue('txtOpLn1') == true && WIsEmptyValue('txtOpLn2') == true)
        ){
        
                LogError("Information in Line 1 / Line 2 of Permanent Address must be given if City & Country are mentioned.");

    }//if  (   (WIsEmptyValue('cmbOpCntry') == false || WIsEmptyValue('cmbOpCty') == false)
  


}//function Validate_ApplicationDetail(){
