﻿//////////////////////////////Body Onload COODING START HERE////////////////////////////
$(document).ready(function() {
//////////////////////////////Body Onload COODING START HERE////////////////////////////
 
    HideExtraEducation();
 
	$('#lkMoreEd').click(function() {
	  return lkMoreEd_click($(this));
	});//$('#lkMoreEd').click(function() {
 
  

 //////////////////////////////Body Onload COODING END HERE////////////////////////////
});//$(document).ready(function() {
//////////////////////////////Body Onload COODING END HERE////////////////////////////




//================================================================
function HideExtraEducation(){

	$('#EdM1').addClass("WHidden");
	$('#EdM2').addClass("WHidden");

}//function HideExtraEducation{

//================================================================
function lkMoreEd_click(lkMoreEd){

  var EdM1 = $('#EdM1');
  var EdM2 = $('#EdM2');
  
 
  if ( EdM1.css('display')== 'none'){
        EdM1.removeClass("WHidden")
        return false
  }//// if ( EdM2.css('display')== 'none'){
  
  if ( EdM2.css('display')== 'none'){
        EdM2.removeClass("WHidden")
        lkMoreEd.addClass("WHidden")
        return false
  }// if ( EdM2.css('display')== 'none'){
  
  
  return false
}//function lkMoreEd_click(){



function Validate_Education(){


    if(WIsEmptyValue('cmbDegree1')){
      LogError("You must enter at least one Degree Information.");
    }else if (WIsOtherSelected('cmbDegree1') == true  && WIsEmptyValue('txtDegree1')  == true ){
      LogError("Please specify Degree information.");
    }



    if(WIsEmptyValue('cmbInst1')){
      LogError("Please enter Institute information.");
    }else if (WIsOtherSelected('cmbInst1') == true  && WIsEmptyValue('txtInst1') == true){
      LogError("Please specify Institute information.");
    }



    if(WIsEmptyValue('cmbCntry1')){
      LogError("Please enter Country information of the Institute.");
    }
 

    if(WIsEmptyValue('cmbCty1')){
      LogError("Please enter City information of the Institute.");
    }
 


    if  (   (WIsEmptyValue('txtGrd') == true && WIsEmptyValue('txtGPA1') == true && WIsEmptyValue('cmbDiv1') == true) ){    
        LogError("Please Enter atleast a grade or GPA or division for the selected Degree.");

    }else{
           
        if (WvalidateGrade('txtGrd') == false  && WIsEmptyValue('txtGrd') == false){
          LogError("Invalid Grade Format.");
        }
        
        if (WvalidateGPA('txtGPA1') == false  && WIsEmptyValue('txtGPA1') == false){
          LogError("GPA must be given in Valid format.");
        }

    }//if  (   (WIsEmptyValue('txtGrd') == true && WIsEmptyValue('txtGPA1') == true && WIsEmptyValue('cmbDiv1') == true) ){    



    // Check for Passing Year Format
    if (WIsEmptyValue('txtYr1')){
         LogError("Please enter the passing year for the degree earned.");

    }else{

        if (!WvalidateYear('txtYr1')){
                LogError("Degree Passing Year must be given in YYYY format.");
        }else{ 
         
                strYear1 = $('#txtYr1').get(0).value;
                CrntDate = new Date( );
                CrntYear = CrntDate.format("yyyy");
                MinYear = '1900'
                
	            if ( strYear1 > CrntYear){
                        LogError("Degree Passing Year must not be greater than Current Year.");
	            }else if ( strYear1 < MinYear){
                        LogError("Degree Passing Year must not be less than " + MinYear + ".");
                }    
        }
    	
    }//if (WIsEmptyValue('txtYr1')){



    //START:====================================Degree 2nd panel Validation
    if (WIsEmptyValue('cmbDegree2')==false && WIsOtherSelected('cmbDegree2')== false ){

	    if (WIsEmptyValue('cmbInst2')){
                LogError("Please enter Institute Information.");
	    }else{ 
		        if (WIsOtherSelected('cmbInst2') == true  && WIsEmptyValue('txtInst2') == true){
                        LogError("Please enter Institute Information.");
		        }//if (WIsOtherSelected('cmbInst2') == true  && WIsEmptyValue('txtInst2') == true){
    		    
	    }//if (WIsEmptyValue('cmbInst2')){     

        if(WIsEmptyValue('cmbCntry2')){
          LogError("Please enter Country Information of the Institute.");
        }
         

        if(WIsEmptyValue('cmbCty2')){
          LogError("Please enter City Information of the Institute.");
        }
             
        if  (   (WIsEmptyValue('txtGrd2') == true && WIsEmptyValue('txtGPA2') == true && WIsEmptyValue('cmbDiv2') == true) ){    
            LogError("Please Enter atleast a grade or GPA or division for the selected Degree.");

        }else{
               
            if (WvalidateGrade('txtGrd2') == false  && WIsEmptyValue('txtGrd2') == false){
              LogError("Invalid Grade Format.");
            }
            
            if (WvalidateGPA('txtGPA2') == false  && WIsEmptyValue('txtGPA2') == false){
              LogError("GPA must be given in Valid format.");
            }

        }//if  (   (WIsEmptyValue('txtGrd2') == true && WIsEmptyValue('txtGPA2') == true && WIsEmptyValue('cmbDiv2') == true) ){    
        
        // Check for Passing Year Format
        if (WIsEmptyValue('txtYr2')){
             LogError("Please enter the passing year for the degree earned.");

        }else{

            if (!WvalidateYear('txtYr2')){
                    LogError("Degree Passing Year must be given in YYYY format.");
            }else{ 
             
                    strYear1 = $('#txtYr2').get(0).value;
                    CrntDate = new Date( );
                    CrntYear = CrntDate.format("yyyy");
                    MinYear = '1900'
                    
	                if ( strYear1 > CrntYear){
                            LogError("Degree Passing Year must not be greater than Current Year.");
	                }else if ( strYear1 < MinYear){
                            LogError("Degree Passing Year must not be less than " + MinYear + ".");
                    }    
            }
        	
        }//if (WIsEmptyValue('txtYr2')){

    }else if (WIsOtherSelected('cmbDegree2') == true  && WIsEmptyValue('txtDegree2')  == true ){
      LogError("Please specify degree information.");
    }else if (WIsEmptyValue('cmbDegree2') == true && WIsEmptyValue('cmbInst2') == false ){
      LogError("Please select degree information.");
    }else if (WIsEmptyValue('cmbDegree2') == true && WIsEmptyValue('cmbCntry2') == false ){
      LogError("Please select degree information.");
    }else if (WIsEmptyValue('cmbDegree2') == true && WIsEmptyValue('cmbCty2') == false ){
      LogError("Please select degree information.");
    }else if (WIsEmptyValue('cmbDegree2') == true && WIsEmptyValue('txtGrd2') == false ){
      LogError("Please select degree information.");
    }else if (WIsEmptyValue('cmbDegree2') == true && WIsEmptyValue('txtGPA2') == false ){
      LogError("Please select degree information.");
    }else if (WIsEmptyValue('cmbDegree2') == true && WIsEmptyValue('cmbDiv2') == false ){
      LogError("Please select degree information.");
    }else if (WIsEmptyValue('cmbDegree2') == true && WIsEmptyValue('cmbEdPos2') == false ){
      LogError("Please select degree information.");
    }else if (WIsEmptyValue('cmbDegree2') == true && WIsEmptyValue('txtYr2') == false ){
      LogError("Please select degree information.");
    }//if (!WIsEmptyValue('cmbDegree2')){

    //END:======================================Degree 2nd panel Validation




    //START:====================================Degree 3rd panel Validation
    if (WIsEmptyValue('cmbDegree3')==false && WIsOtherSelected('cmbDegree3')== false ){

	    if (WIsEmptyValue('cmbInst3')){
                LogError("Please enter Institute Information.");
	    }else{ 
		        if (WIsOtherSelected('cmbInst3') == true  && WIsEmptyValue('txtInst3') == true){
                        LogError("Please enter Institute Information.");
		        }//if (WIsOtherSelected('cmbInst3') == true  && WIsEmptyValue('txtInst3') == true){
    		    
	    }//if (WIsEmptyValue('cmbInst3')){     

        if(WIsEmptyValue('cmbCntry3')){
          LogError("Please enter Country Information of the Institute.");
        }
         

        if(WIsEmptyValue('cmbCty3')){
          LogError("Please enter City Information of the Institute.");
        }
             
        if  (   (WIsEmptyValue('txtGrd3') == true && WIsEmptyValue('txtGPA3') == true && WIsEmptyValue('cmbDiv3') == true) ){    
            LogError("Please Enter atleast a grade or GPA or division for the selected Degree.");

        }else{
               
            if (WvalidateGrade('txtGrd3') == false  && WIsEmptyValue('txtGrd3') == false){
              LogError("Invalid Grade Format.");
            }
            
            if (WvalidateGPA('txtGPA3') == false  && WIsEmptyValue('txtGPA3') == false){
              LogError("GPA must be given in Valid format.");
            }

        }//if  (   (WIsEmptyValue('txtGrd3') == true && WIsEmptyValue('txtGPA3') == true && WIsEmptyValue('cmbDiv3') == true) ){    
        
        // Check for Passing Year Format
        if (WIsEmptyValue('txtYr3')){
             LogError("Please enter the passing year for the degree earned.");

        }else{

            if (!WvalidateYear('txtYr3')){
                    LogError("Degree Passing Year must be given in YYYY format.");
            }else{ 
             
                    strYear1 = $('#txtYr3').get(0).value;
                    CrntDate = new Date( );
                    CrntYear = CrntDate.format("yyyy");
                    MinYear = '1900'
                    
	                if ( strYear1 > CrntYear){
                            LogError("Degree Passing Year must not be greater than Current Year.");
	                }else if ( strYear1 < MinYear){
                            LogError("Degree Passing Year must not be less than " + MinYear + ".");
                    }    
            }
        	
        }//if (WIsEmptyValue('txtYr3')){

    }else if (WIsOtherSelected('cmbDegree3') == true  && WIsEmptyValue('txtDegree3')  == true ){
      LogError("Please specify degree information.");
    }else if (WIsEmptyValue('cmbDegree3') == true && WIsEmptyValue('cmbInst3') == false ){
      LogError("Please select degree information.");
    }else if (WIsEmptyValue('cmbDegree3') == true && WIsEmptyValue('cmbCntry3') == false ){
      LogError("Please select degree information.");
    }else if (WIsEmptyValue('cmbDegree3') == true && WIsEmptyValue('cmbCty3') == false ){
      LogError("Please select degree information.");
    }else if (WIsEmptyValue('cmbDegree3') == true && WIsEmptyValue('txtGrd3') == false ){
      LogError("Please select degree information.");
    }else if (WIsEmptyValue('cmbDegree3') == true && WIsEmptyValue('txtGPA3') == false ){
      LogError("Please select degree information.");
    }else if (WIsEmptyValue('cmbDegree3') == true && WIsEmptyValue('cmbDiv3') == false ){
      LogError("Please select degree information.");
    }else if (WIsEmptyValue('cmbDegree3') == true && WIsEmptyValue('cmbEdPos3') == false ){
      LogError("Please select degree information.");
    }else if (WIsEmptyValue('cmbDegree3') == true && WIsEmptyValue('txtYr3') == false ){
      LogError("Please select degree information.");
    }//if (!WIsEmptyValue('cmbDegree3')){

    //END:====================================Degree 3rd panel Validation




}//function Validate_Education(){
