// JScript File
 function SpellsPerYear_fn(textbox,rowid)
 {
   //ctl00_BodyContentPH_Min1
if (document.getElementById("ctl00_BodyContentPH_total"+rowid).value!="" && document.getElementById("ctl00_BodyContentPH_Min"+rowid).value!="")
   {
   var minValue;
   minvalue= document.getElementById("ctl00_BodyContentPH_total"+rowid).value /document.getElementById("ctl00_BodyContentPH_Min"+rowid).value;
 document.getElementById("ctl00_BodyContentPH_Spell" + rowid).value = minvalue;
   }
 }
function CheckMaximumLength(txt,mlen,Len)
{
        var keycode;
		if (window.event) keycode = window.event.keyCode;
		else if (txt) keycode = txt.which;
		else return true;
		if(document.selection)
		{
	        var selection=document.selection.createRange();
	        var selected_text = selection.text;		
		}
		else if(document.getSelection)
		{ 
		   var start = txt.selectionStart;
           var end = txt.selectionEnd;
           var selected_text = txt.value.substring(start, end);
		}						
		if( ((txt.value).length==0 || selected_text != "") && (keycode == 32))
		{			
			return false;
		}
		if(keycode == 60||keycode == 62)
		{
			return false;
		}
		  if(keycode==45 || keycode==95)
		    {
		        return false;
		    }
      if (txt.value.length>(mlen-1))
      {
        var desc = txt.value;
        var descstr = desc.substring(0,mlen);
        var control=txt;
        document.getElementById(control.id).value = descstr; 
       alert(Len + " " +  mlen);     
        return false;
      }
}
function chkMaxLen(e,ctrl,length,len)
{
    var keycode;
     var Len=len;
		if (window.event) keycode = window.event.keyCode;
		else if (e) keycode = e.which;
		else return true;
		if(document.selection)
		{
		    var selection=document.selection.createRange();
		    var selected_text = selection.text;
		}
		else if(document.getSelection)
		{ 
		   var start = ctrl.selectionStart;
           var end = ctrl.selectionEnd;
           var selected_text = ctrl.value.substring(start, end);
		}
		if(keycode==0 || keycode==8)
		{
		    return true;
		}
		if(ctrl.value != ''){
		    var CtrlLen = ctrl.value.length;
		    var LastChr = ctrl.value.substring(CtrlLen-1, CtrlLen);
		    if(keycode == 35 && LastChr == '&'){
		        return false;
		    }
		}		
		return CheckMaximumLength(ctrl,length,Len);
}
   function chckMaxLength(para,Length)
   {     
        var keycode;
		if (window.event) keycode = window.event.keyCode;
		else if (para) keycode = para.which;
		else return true;
		var selection=document.selection.createRange();
		var selected_text = selection.text;						
		if( ((para.value).length==0 || selected_text != "") && (keycode == 32))
		{			
			return false;
		}
		if(keycode == 60||keycode == 62)
		{
			return false;
		}
      if (para.value.length>249)
      {
        var desc = para.value;
        var descstr = desc.substring(0,250);
        var control=para;
        document.getElementById(control.id).value = descstr; 
        alert(Length);     
        return false;
      }
    } 
    //Added by Manjula.P on 21-Jan2014
//       function chckMaxLength500(para,Length)
//   {     
//        var keycode;
//		if (window.event) keycode = window.event.keyCode;
//		else if (para) keycode = para.which;
//		else return true;
//		
//		var selection=document.selection.createRange();
//		var selected_text = selection.text;						
//		
//		if( ((para.value).length==0 || selected_text != "") && (keycode == 32))
//		{			
//			return false;
//		}
//		if(keycode == 60||keycode == 62)
//		{
//			return false;
//		}
//      
//      if (para.value.length>249)
//      {
//        var desc = para.value;
//        var descstr = desc.substring(0,499);
//        var control=para;
//        document.getElementById(control.id).value = descstr; 
//        alert(Length);     
//        return false;
//      }
    //} 
    //************************************************
    function chckMaxLengthForLeaveType(para)
    {    
        var keycode;
		if (window.event) keycode = window.event.keyCode;
		else if (para) keycode = para.which;
		else return true;
		var selection=document.selection.createRange();
		var selected_text = selection.text;						
		if( ((para.value).length==0 || selected_text != "") && (keycode == 32))
		{			
			return false;
		}
		if(keycode == 60||keycode == 62)
		{
			return false;
		}
      if (para.value.length>19)
      {
        var desc = para.value;
        var descstr = desc.substring(0,20);
        var control=para;
        document.getElementById(control.id).value = descstr; 
        alert("Maximum length is 20");
        return false;
      }
    }  
    //System Settings Reset Password MaxLength
    function chckMaxLengthForResetPassword(para)
    {    
      if (para.value.length>9)
      {
        var desc = para.value;
        var descstr = desc.substring(0,10);
        var control=para;
        document.getElementById(control.id).value = descstr; 
        alert("Maximum length is 10");
        return false;
      }
    } 
    function Valiadteltgt(e,val)
    {
        var keycode;
		if (window.event) keycode = window.event.keyCode;
		else if (e) keycode = e.which;
		else return true;
		if(document.selection)
		{
		    var selection=document.selection.createRange();
		    var selected_text = selection.text;
		}
		else if(document.getSelection)
		{ 
		   var start = val.selectionStart;
           var end = val.selectionEnd;
           var selected_text = val.value.substring(start, end);
		}					
		if( ((val.value).length==0 || selected_text != "") && (keycode == 32))
		{			
			return false;
		}
		if(keycode == 60||keycode == 62)
		{
			return false;
		}
		if(val.value != ''){
		    var CtrlLen = val.value.length;
		    var LastChr = val.value.substring(CtrlLen-1, CtrlLen);
		    if(keycode == 35 && LastChr == '&'){
		        return false;
		    }
		}
    }
    //Leave policy master
    //validating null Policy name
    function FieldValidation(LeavePolicy)
    {
    var leavepol=document.aspnetForm.ctl00_BodyContentPH_txt_PolicyName.value;
    var policyname=trim(leavepol);
    if (policyname=="")
        {
            alert(LeavePolicy);
            document.aspnetForm.ctl00_BodyContentPH_txt_PolicyName.focus();
            return false;
        }    
    }
function trim(string){
// remove leading spaces
while(string.substr(0,1)==" ")
string = string.substring(1,string.length) ;
// remove trailing spaces
while(string.substr(string.length-1,1)==" ")
string = string.substring(0,string.length-2) ;
return string;
}
//validating days < 365
 function chkMaxvalue(textbox,rowid)
 {     
       var control=textbox; 
       var appDay = control.value;                                                                        
          if (control.value!="")
          {                                             
                  if((appDay==0))                 
                    {
                      alert("App Days should not be zero");            
                      document.getElementById(control.id).focus();
                      return false;
                    }
                  else
                  {                   
                    if((appDay.charAt(0)==0) && (appDay.charAt(1)==0))                 
                    {
                      alert("Invalid entry");
                      document.getElementById(control.id).focus();
                      return false;
                    }
                       if(control.value>365)
                       {
                         alert("Maximum Value is 365");            
                         document.getElementById(control.id).focus();
                         return false;
                       }
                       else
                       {                       
                               if(appDay.match(/([1-3][0-6][0-5])/))                                                                                
                               {
                                    return true;
                               }    
                               else
                               {                                      
                                      if(appDay%0.5!=0)
                                       {
                                            alert("Invalid entry");
                                            document.getElementById(control.id).focus();
                                            return false;
                                       }
                               }                                          
                       }
                 } 
          }
          else
          {
              if (document.getElementById("ctl00$BodyContentPH$Applicable" + rowid).checked == true)
                {
                  alert("Applicable Days/Year should not be empty");
                  document.getElementById(control.id).focus();
                  return false;
                  }
          } 
          var checkValue=ApplyMaxDayValidate(rowid);
          if(checkValue!=false)
          {
             chkMinAppDayValue(rowid);            
          }
          ///
          else
          {
            document.getElementById("ctl00$BodyContentPH$Max" + rowid).value = 0.0;
            document.getElementById("ctl00$BodyContentPH$Min" + rowid).value = 0.0;
            document.getElementById("ctl00$BodyContentPH$Spell" + rowid).value = 0.0;
          }
           if(document.getElementById("ctl00$BodyContentPH$Max" + rowid).value!="" && document.getElementById("ctl00_BodyContentPH_Min"+rowid).value!="" && document.getElementById("ctl00$BodyContentPH$Spell" + rowid).value!="")
           {
            ApplySpellsAppDayValidate(rowid);
           }
      }
 function ApplySpellsAppDayValidate(rowid)
 {
        var ctrl = "";    
        ctrl += "ctl00_BodyContentPH_total"+rowid;        
        var ctrl1 = "";
        ctrl1 += "ctl00_BodyContentPH_Spell"+rowid;
        var ctrl3 = "";
        ctrl3 += "ctl00_BodyContentPH_Min"+rowid;
        var val3=  parseFloat(document.getElementById(ctrl3).value) 
        var val=  parseFloat(document.getElementById(ctrl1).value)
        var val1=  parseFloat(document.getElementById(ctrl).value) 
        if(val > (val1/val3))
          {            
                alert('Spells per year Should be lesser than App Days');              
                document.getElementById(ctrl1).focus();
                return false;
          }                    
 }
 function chkAppDayValue(textbox,rowid)
 {    
     var appDay = document.getElementById("ctl00_BodyContentPH_total"+rowid).value;          
       if(appDay>365 || appDay=="" || appDay==0)
       {
         return false;
       }        
        if(appDay.match(/([1-3][0-6][0-5])/))                                                                                
          {
          }        
        else
          {           
               if((appDay.charAt(0)==0) && (appDay.charAt(1)==0))                 
                {                     
                     document.getElementById("ctl00_BodyContentPH_total"+rowid).focus();
                     return false;
                }
                if(appDay%0.5!=0)
                {                   
                   document.getElementById("ctl00_BodyContentPH_total"+rowid).focus();
                   return false;
                }
            }         
      var control=textbox;
      var maxDay = control.value;
      if (control.value!="")
      {
              if(maxDay==0)  
              {
              }
              else
              {
                    if((maxDay.charAt(0)==0) && (maxDay.charAt(1)==0))                 
                     {
                         alert("Invalid entry");
                         document.getElementById(control.id).focus();
                         return false;
                     }              
              }
            if (control.value>365)
              {
                alert("Maximum Value is 365");            
                document.getElementById(control.id).focus();
                return false;
              }
            else
            {                           
//                   if(maxDay.match(/([1-3][0-6][0-5])/))                                                                                
//                    {                        
//                        //return true; // no return for continuation
//                    }    
//                    else
//                    {                    
                         if(maxDay%0.5!=0)
                           {                           
                                 alert("Invalid entry");
                                 document.getElementById(control.id).focus();
                                 return false;
                           }
//                     }                                                            
            }
      } 
      else
      {
          alert("Max Days per Spell should not be empty");
          document.getElementById(control.id).focus();
          return true;
      }         
      if(control.value!=0)
      {         
         ApplyMaxDayValidate(rowid);
      }
      // check max and minimum
      var minDays=document.getElementById("ctl00_BodyContentPH_Min"+rowid).value;
      if(maxDay!="" && minDays!="")
      {
      ApplyMinMaxValidate(rowid);
      }                  
 }
 function chkMinMaxValue(textbox,rowid)
 { 
    var maxDay = document.getElementById("ctl00_BodyContentPH_Max"+rowid).value;
   if (parseFloat(document.getElementById("ctl00_BodyContentPH_Max"+rowid).value)>parseFloat(document.getElementById("ctl00_BodyContentPH_total"+rowid).value) || document.getElementById("ctl00_BodyContentPH_Max"+rowid).value>365 || document.getElementById("ctl00_BodyContentPH_Max"+rowid).value==""  )
   {      
     return false;
   }
   //if(maxDay.match(/([1-3][0-6][0-5])/))                                                                                
        //  {
        //  }        
  // else
          //{
            if(maxDay%0.5!=0)
              {                   
                   document.getElementById("ctl00_BodyContentPH_Max"+rowid).focus();
                   return false;
               }
               if(maxDay==0)  
              {
              }
              else
              {
                    if((maxDay.charAt(0)==0) && (maxDay.charAt(1)==0))                 
                     {
                         document.getElementById("ctl00_BodyContentPH_Max"+rowid).focus();
                         return false;
                     }              
              }
           // }         
      var control=textbox;
      var minDay = control.value;
      if (control.value!="")
      {
        if(minDay==0)  
         {
         }
        else
            {
                    if((minDay.charAt(0)==0) && (minDay.charAt(1)==0))                 
                     {
                         alert("Invalid entry");
                         document.getElementById(control.id).focus();
                         return false;
                     }              
             }
          if (control.value>365)
          {          
            alert("Maximum Value is 365");            
            document.getElementById(control.id).focus();
            return false;
          }
          else
            {                   
                  // if(minDay.match(/([1-3][0-6][0-5])/))                                                                                
                    //{
                        //return true; // no return for continuation
                    //}    
                    //else
                    //{
                         if(minDay%0.5!=0)
                           {                                 
                                 alert("Invalid entry");
                                 document.getElementById(control.id).focus();
                                 return false;
                           }
                     //}                                                            
            }
      }
      else
      {
          alert("Min Days per Spell should not be empty");
          document.getElementById(control.id).focus();
          return false;
      }        
      if(document.getElementById("ctl00_BodyContentPH_Max"+rowid).value!=0)
      {    
         ApplyMinMaxValidate(rowid);   
      }
      else
      {
        chkMinAppDayValue(rowid)
      }
 }
 function chkMinAppDayValue(rowid)
 {
        var ctrl = "";
        ctrl += "ctl00_BodyContentPH_total"+rowid;
        var ctrl1 = "";
        ctrl1 += "ctl00_BodyContentPH_Min"+rowid;
        var val=  parseFloat(document.getElementById(ctrl1).value)
        var val1=  parseFloat(document.getElementById(ctrl).value) 
        if( val >0 && val1>0 )
        {
            if( val > val1 )
            {            
                alert('Min Days/Spell Should be lesser than App Days');                
                document.getElementById("ctl00$BodyContentPH$Min" + rowid).value = 0.0;
                document.getElementById("ctl00$BodyContentPH$Spell" + rowid).value = 0.0;              
                document.getElementById(ctrl1).focus();
                return false;
            }
        }          
 }
 function chkMaxLOP(textbox,rowid)
 {  
   var control=textbox; 
   var maxLop = control.value;                                                                          
      if (control.value!="")
      {
         if(maxLop==0)  
         {
         }
        else
            {
                    if((maxLop.charAt(0)==0) && (maxLop.charAt(1)==0))                 
                     {
                         alert("Invalid entry");
                         document.getElementById(control.id).focus();
                         return false;
                     }  
            }                     
          if (control.value>365)
          {
            alert("Maximum LOP is 365");            
            document.getElementById(control.id).focus();
            return false;
          }
          else
          {            
              //if(maxLop.match(/([1-3][0-6][0-5])/))                                                                                
                // {
                  //  return true;
                 //}    
               //else
                 //{
                   if(maxLop%0.5!=0)
                     {
                       alert("Invalid entry");
                       document.getElementById(control.id).focus();
                       return false;
                    }
                //}                                          
          }
      }    
 }
 function chkSpells(textbox,rowid)
 { 
 var minDay = document.getElementById("ctl00_BodyContentPH_Min"+rowid).value;
   if (parseFloat(document.getElementById("ctl00_BodyContentPH_Min"+rowid).value)>parseFloat(document.getElementById("ctl00_BodyContentPH_Max"+rowid).value) || document.getElementById("ctl00_BodyContentPH_Min"+rowid).value>365 || document.getElementById("ctl00_BodyContentPH_Min"+rowid).value==""  )
   {          
     return false;
   }
   //if(minDay.match(/([1-3][0-6][0-5])/))                                                                                
        //  {
        //  }        
  // else
          //{
            if(minDay%0.5!=0)
              {                   
                   document.getElementById("ctl00_BodyContentPH_Min"+rowid).focus();
                   return false;
               }
               if(minDay==0)  
              {
              }
              else
              {
                    if((minDay.charAt(0)==0) && (minDay.charAt(1)==0))                 
                     {
                         document.getElementById("ctl00_BodyContentPH_Min"+rowid).focus();
                         return false;
                     }              
              }
           // }      
 var control=textbox; 
 if (document.getElementById("ctl00_BodyContentPH_Spell"+rowid).value=="")
   {
     alert("Spells per year should not be empty");
     document.getElementById(control.id).focus();
     return false;
     //return false
   }  
      if (control.value!="")
      {         
             var ctrl = "";
            ctrl += "ctl00_BodyContentPH_total"+rowid;
            var ctrl1 = "";
            ctrl1 += "ctl00_BodyContentPH_Spell"+rowid;
           var ctrl3 = "";
           ctrl3 += "ctl00_BodyContentPH_Min"+rowid;
            var val3=  parseFloat(document.getElementById(ctrl3).value) 
            var val=  parseFloat(document.getElementById(ctrl1).value)
            var val1=  parseFloat(document.getElementById(ctrl).value) 
           var CountFactorValue=document.getElementById("ctl00_BodyContentPH_hdnCountFactor"+rowid).value;
//           alert(CountFactorValue);
           if(CountFactorValue!="True")
           {  
//           alert(val1/val3);                   
            if(val > (val1/val3))
             {            
                alert('Spells per year Should be lesser than App Days');              
                document.getElementById(ctrl1).focus();
                return false;
             }  
           }                  
      } 
      else
       {
          alert("Spells per year should not be empty");
          document.getElementById(control.id).focus();
          return false;
       }
 }
 function chkMAccDays(textbox,rowid)
 {
    var control=textbox; 
    var maxAccday = control.value;
      if (control.value!="")
      {
        if(maxAccday==0)  
         {
         }
        else
            {
                    if((maxAccday.charAt(0)==0) && (maxAccday.charAt(1)==0))                 
                     {
                         alert("Invalid entry");
                         document.getElementById(control.id).focus();
                         return false;
                     }  
            }                     
          if (control.value>365)
          {
            alert("Maximum value is 365");            
            document.getElementById(control.id).focus();
            return false;
          }
          else
          {      
//              if(maxAccday.match(/([1-3][0-6][0-5])/))                                                                                
//                 {
//                    return true;
//                 }    
//               else
//                 {
                   if(maxAccday%0.5!=0)
                     {
                       alert("Invalid entry");
                       document.getElementById(control.id).focus();
                       return false;
                    }
//                }                                          
          }
      }    
 }
 function chkAppAfterDays(textbox,rowid)
 {   
    var control=textbox; 
    var maxAppAftday = control.value;
      if (control.value!="")
      {
         if(maxAppAftday==0)  
         {
         }
        else
            {
                    if((maxAppAftday.charAt(0)==0) && (maxAppAftday.charAt(1)==0))                 
                     {
                         alert("Invalid entry");
                         document.getElementById(control.id).focus();
                         return false;
                     }  
            }                     
          if (control.value>365)
          {
            alert("Maximum value is 365");            
            document.getElementById(control.id).focus();
            return false;
          }
          else
          {            
//              if(maxAppAftday.match(/([1-3][0-6][0-5])/))                                                                                
//                 {
//                    return true;
//                 }    
//               else
//                 {
                   if(maxAppAftday%0.5!=0)
                     {
                       alert("Invalid entry");
                       document.getElementById(control.id).focus();
                       return false;
                    }
//                }                                          
          }
      }    
 }
 function chkCalcFactor(textbox,rowid)
 {      
    var control=textbox; 
    var calcFactor = control.value;
      if (control.value!="")
      {
         if(calcFactor==0)  
         {
         }
        else
            {
                    if((calcFactor.charAt(0)==0) && (calcFactor.charAt(1)==0))                 
                     {
                         alert("Invalid entry");
                         document.getElementById(control.id).focus();
                         return false;
                     }  
            }                     
          if (control.value>365)
          {
            alert("Maximum value is 365");            
            document.getElementById(control.id).focus();
            return false;
          }
          else
          {            
//              if(calcFactor.match(/([1-3][0-6][0-5])/))                                                                                
//                 {
//                    return true;
//                 }    
//               else
//                 {
                   if(calcFactor%0.5!=0)
                     {
                       alert("Invalid entry");
                       document.getElementById(control.id).focus();
                       return false;
                    }
//                }                                          
          }
      }    
}
function chkWorkDays(textbox,rowid)
 {     
    var control=textbox; 
    var workDays = control.value;
      if (control.value!="")
      {
         if(workDays==0)  
         {
         }
        else
            {
                    if((workDays.charAt(0)==0) && (workDays.charAt(1)==0))                 
                     {
                         alert("Invalid entry");
                         document.getElementById(control.id).focus();
                         return false;
                     }  
            }                     
          if (control.value>365)
          {
            alert("Maximum value is 365");            
            document.getElementById(control.id).focus();
            return false;
          }
          else
          {            
//              if(workDays.match(/([1-3][0-6][0-5])/))                                                                                
//                 {
//                    return true;
//                 }    
//               else
//                 {
                   if(workDays%0.5!=0)
                     {
                       alert("Invalid entry");
                       document.getElementById(control.id).focus();
                       return false;
                    }
//                }                                          
          }
      }    
}
 //validating Permission duration in hh:mm format
 function chkPermission(textbox,Permission)
 {
    var control=textbox;
    var Pervalue=control.value;
    if(Pervalue!=null && Pervalue!=""  )
    {
        var data = Pervalue.split(':')
        if(Pervalue.indexOf(':')<0)
        {
            alert(Permission);
            document.getElementById(control.id).focus();
            return false;
        }
        if(data[0]=="" || data[1]=="")
        {
            alert(Permission);
            document.getElementById(control.id).focus();
            return false;
        }
    }
 }
 //freezing LOP days textbox when selecting LOP applicable - NO option
 function chkRadiobut(rowid,radiobut)
 {
    var butradio=radiobut;
    var ctrl = "";
    ctrl += "ctl00_BodyContentPH_MaxLOP"+rowid;
    if (butradio=="0")
    {
        document.getElementById(ctrl).disabled = true;
        document.getElementById(ctrl).value='0.0';
    }
    else if(butradio=="1")
    {
        document.getElementById(ctrl).disabled = false;
    }
    //return false;
 }
 //validating Min days/spell < Max value/spell 
    function ApplyMinMaxValidate(rowid)
    {
        var ctrl = "";
        ctrl += "ctl00_BodyContentPH_Max"+rowid;
        var ctrl1 = "";
        ctrl1 += "ctl00_BodyContentPH_Min"+rowid;
        var val=  parseFloat(document.getElementById(ctrl1).value)
        var val1=  parseFloat(document.getElementById(ctrl).value)          
        if(val>0 && val1>0)   
        {  
            if( val > val1 )
            {
                alert('Min Days/Spell Should be lesser than Max Days/Spell');                
                document.getElementById("ctl00$BodyContentPH$Min" + rowid).value = 0.0;
                document.getElementById("ctl00$BodyContentPH$Spell" + rowid).value = 0.0;        
                document.getElementById(ctrl1).focus();
             return false;
            }
        }
    }
    //validating Max days/spell < App Days 
    function ApplyMaxDayValidate(rowid)
    {      
       var ctrl = "";
        ctrl += "ctl00_BodyContentPH_total"+rowid;
        var ctrl1 = "";
        ctrl1 += "ctl00_BodyContentPH_Max"+rowid;
        var val=  parseFloat(document.getElementById(ctrl1).value)
        var val1=  parseFloat(document.getElementById(ctrl).value)
        if(val>0 && val1>0)   
        {     
        if( val > val1 )
        {            
        alert('Max Days/Spell Should be lesser than App Days');              
        document.getElementById(ctrl1).focus();
        return false;
        }
        }          
}
function chkcarryover(chkbox,rowid)
{
 var chkcarry="ctl00_BodyContentPH_Carry"+rowid;
 var ctrMAccdays="ctl00_BodyContentPH_Acc"+rowid;
 var ctrcalfact="ctl00_BodyContentPH_calcFactor"+rowid;
 var ctrmindays="ctl00_BodyContentPH_MinWorkedDays"+rowid;
 var ctrwkday = "ctl00_BodyContentPH_chkWeekDays"+rowid;
 var ctrwkoff = "ctl00_BodyContentPH_chkWeekOff"+rowid;
 var ctrleave = "ctl00_BodyContentPH_chkLeave"+rowid;
 var ctrholiday = "ctl00_BodyContentPH_chkHolidays"+rowid;
  if(document.getElementById(chkcarry).checked)
 {    
    document.getElementById(ctrMAccdays).disabled=false;
    document.getElementById(ctrcalfact).disabled=false;
    document.getElementById(ctrmindays).disabled=false;
    document.getElementById(ctrwkday).disabled=false;
    document.getElementById(ctrwkoff).disabled=false;
    document.getElementById(ctrleave).disabled=false;
    document.getElementById(ctrholiday).disabled=false;       
 }
  else
  {
    document.getElementById(ctrMAccdays).disabled=true;
    document.getElementById(ctrcalfact).disabled=true;
    document.getElementById(ctrmindays).disabled=true;
    document.getElementById(ctrwkday).disabled=true;
    document.getElementById(ctrwkoff).disabled=true;
    document.getElementById(ctrleave).disabled=true;
    document.getElementById(ctrholiday).disabled=true;
  }
}
