﻿// JScript Files



function checkempty()
{	
   
    if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtemailid'), "UserName mustn't be empty.", document.getElementById('txtemailiderr')))
    {if(isValidEmail(document.getElementById('ctl00_CPHDrukAir_txtemailid'), "Invalid Email", document.getElementById('txtemailiderr')))
	{if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtpassword'), "Password mustn't be empty.", document.getElementById('txtpassworderr')))
    {if (isEmpty(document.getElementById('txtconpassword'),"Confirm Password mustn't be empty.", document.getElementById('txtconpassworderr')))
    {if (validatePwd(document.getElementById('ctl00_CPHDrukAir_txtpassword'),document.getElementById('txtconpassword'),"Password you have Enter is Not Match", document.getElementById('txtconpassworderr')))
    {if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtfirstname'), "First mustn't be empty.", document.getElementById('txtfirstnameerr')))
    {if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtaddress1'), "Address mustn't be empty.", document.getElementById('txtaddress1err')))
    {if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtcity'), "City mustn't be empty.", document.getElementById('txtcityerr')))
    {if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtpincode'), "Pincode mustn't be empty.", document.getElementById('txtpincodeerr')))         
    {if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtISDCode'), "ISD Code mustn't be empty.", document.getElementById('txtphonenoerr'))) 
    {if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtSTDCode'), "STD Code mustn't be empty.", document.getElementById('txtphonenoerr')))
    {if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtphoneno'), "Contact No. mustn't be empty.", document.getElementById('txtphonenoerr')))                      
    {if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtISDMobCode'), "Mobile ISD Code mustn't be empty.", document.getElementById('txtmobilenoerr')))                
    {if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtmobileno'), "Mobile No. mustn't be empty.", document.getElementById('txtmobilenoerr')))
    {return true;
	}}}}}}}}}}}}}}
        return false;
}
function checkempty_AgentSignup()
{
     if  (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtUsername'), "Username name mustn't be empty.", document.getElementById('spnusernameerr'))) 
     {if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtpassword'), "Password mustn't be empty.", document.getElementById('spnpassworderr')))
     {if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtmtname'), "Agency Name mustn't be empty.", document.getElementById('spnagencynameerr')))
     {if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtpanno'), "PAN No. mustn't be empty.", document.getElementById('spnpannoerr'))) 
     //{if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtiatacode'), "IATA code mustn't be empty.", document.getElementById('spnIATAerr'))) 
     {if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtaddress1'), "Address1 mustn't be empty.", document.getElementById('spnaddress1err'))) 
     {if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtcity'), "City mustn't be empty.", document.getElementById('spncityerr1'))) 
  // {if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtstate'), "State mustn't be empty.", document.getElementById('spnstateerr'))) 
     {if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txttelephone'), "Telephone No. mustn't be empty.", document.getElementById('spnteleerr'))) 
//     {if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtmobile'), "Mobile No. mustn't be empty.", document.getElementById('spncontactno1err2'))) 
//     {if (validatemobile(document.getElementById('ctl00_CPHDrukAir_txtmobile').value, "Mobile No. must be 10 digits", document.getElementById('spncontactno1err2')))
     {if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtemailid'), "Email-ID mustn't be empty.", document.getElementById('spnemailiderr')))
     {if (isValidEmail(document.getElementById('ctl00_CPHDrukAir_txtemailid'), "Invalid Email", document.getElementById('spnemailiderr')))
     {
     return true;
     }}}}}}}}}//}}}
     return false;
}
function getfocus(id)
{
if (id.focus!=true)
{
    id.focus();
    return false;
}
return true;

}
function checkPassword(id)									
{
    var passwd=	document.getElementById(id).value;
		var intScore   = 0							
		var strVerdict = "weak"							

	    if (passwd.length==0) 		
		{							
			intScore = 0		
		}	
		else if (passwd.length<5)				
		{							
			intScore = (intScore+3)
		}							
		else if (passwd.length>4 && passwd.length<8) 
		{							
			intScore = (intScore+6)
		}							
		else if (passwd.length>7 && passwd.length<16)
		{							
			intScore = (intScore+12)
		}							
		else if (passwd.length>15) 		
		{							
			intScore = (intScore+18)			
		}
					
		if (passwd.match(/[a-z]/))				
		{							
			intScore = (intScore+1)	
		}							
									
		if (passwd.match(/[A-Z]/))
		{							
			intScore = (intScore+5)
		}
		if (passwd.match(/\d+/))
		{							
			intScore = (intScore+5)
		}							
									
		if (passwd.match(/(.*[0-9].*[0-9].*[0-9])/))
		{							
			intScore = (intScore+5)
		}
		if (passwd.match(/.[!,@,#,$,%,^,&,*,?,_,~]/))
		{							
			intScore = (intScore+5)
		}
		if (passwd.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/))							
		{							
			intScore = (intScore+5)
		}
		if (passwd.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/))
		{							
			intScore = (intScore+2)
		}
		if (passwd.match(/([a-zA-Z])/) && passwd.match(/([0-9])/))
		{							
			intScore = (intScore+2)
		}
		if (passwd.match(/([a-zA-Z0-9].*[!,@,#,$,%,^,&,*,?,_,~])|([!,@,#,$,%,^,&,*,?,_,~].*[a-zA-Z0-9])/))							
		{							
			intScore = (intScore+2)
		}
		var progressBar = document.getElementById("progressBar");
		if(intScore ==0)							
		{			
		   progressBar.style.backgroundColor = "white";				
		   progressBar.innerText = ''							
		}		
		else if(intScore < 16)							
		{			
		   progressBar.style.backgroundColor = "#ffd801";				
		   progressBar.innerText = "weak"							
		}							
		else if (intScore > 15 && intScore < 25)							
		{			
		progressBar.style.backgroundColor = "#ffd801";				
		   progressBar.innerText = "weak"							
		}							
		else if (intScore > 24 && intScore < 35)							
		{					
		progressBar.style.backgroundColor = "orange";		
		   progressBar.innerText = "medium"							
		}							
		else if (intScore > 34 && intScore < 45)							
		{							
		 progressBar.style.backgroundColor = "red";
		   progressBar.innerText = "strong"							
		}									
		else							
		{				
		   progressBar.style.backgroundColor = "#3bce08";			
		   progressBar.innerText = "strong"							
		}
	}
	
	
	function RadioBtnChng()
    {    
		rbtn=document.getElementsByName('ctl00$CPHDrukAir$ralistbkng');
		for(i=0;i< rbtn.length;i++)
		{		
		    if (rbtn[i].checked==true)
		    {
		      val = rbtn[i].value;
		    }	
		 }	
         if(val=='1')
        {
             document.getElementById("ctl00_CPHDrukAir_txtterminalid").focus();
            if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtterminalid'), "Terminal Id can't be empty", document.getElementById('ctl00_CPHDrukAir_lblerrmsg')))
		            {
				            if(isEmpty(document.getElementById('ctl00_CPHDrukAir_txtusername'), "Username can't be empty", document.getElementById('ctl00_CPHDrukAir_lblerrmsg')))
					            {
						            if(isEmpty(document.getElementById('ctl00_CPHDrukAir_txtpassword'), "Password can't be empty", document.getElementById('ctl00_CPHDrukAir_lblerrmsg')))
							            {
								            return true;
							            }
					            }
		           }
		           return false;
        	
         }
         else
         {
               document.getElementById("ctl00_CPHDrukAir_txtusername").focus();
               if (isEmpty(document.getElementById('ctl00_CPHDrukAir_txtusername'), "Username can't be empty", document.getElementById('ctl00_CPHDrukAir_lblerrmsg')))
			                    {
				                    if(isEmpty(document.getElementById('ctl00_CPHDrukAir_txtpassword'), "Password can't be empty", document.getElementById('ctl00_CPHDrukAir_lblerrmsg')))
					                    {
						                    if(isValidEmail(document.getElementById('ctl00_CPHDrukAir_txtusername'), "Invalid E Mail", document.getElementById('ctl00_CPHDrukAir_lblerrmsg')))
							                    {
								                    return true;
								                }
							            }
					            }
			   return false;

         }
          return false; 
 }
	