﻿// JScript File
function CheckMail()
{

    var email=document.getElementById("txtEMail");
    var pass=document.getElementById("txtPass");
    if(email.value=="")
       {
       alert("Please enter Login Id and Password.");
       document.getElementById("txtEMail").focus();
        return false;
       }
        else if(EmailSignIn_validate()==false)
        {
            return false;
        }
     else if(pass.value=="")
       {
       alert("Please Enter Password");
       document.getElementById("txtPass").focus();
        return false;
       }
       else
       {
	
        return true;
       }
}

function ChangePwd()
{
var CurrPwd=document.getElementById("txtOldPassword");
var NewPwd=document.getElementById("txtNewPassword");
var ConfPwd=document.getElementById("txtNewPassword2");
if(CurrPwd.value == "")
{
alert("Please enter current password");
document.getElementById("txtOldPassword").focus();
return false;
}
if(NewPwd.value == "")
{
alert("Please enter new password");
document.getElementById("txtNewPassword").focus();
return false;
}
if(NewPwd.value == " ")
{
alert("Please enter New Password, without any space");
document.getElementById("txtNewPassword").focus();
return false;
}
if (NewPwd.value!="")
	 {
	    
        var userName = NewPwd.value;//document.getElementById(txtNewPassword).value
        //alert(document.getElementById(txtId).value);
        var w_space = userName.indexOf(' ');
        var v_length = userName.length;
        if(v_length < 1)
        {
            return"";
        }
            var strTemp = "";

            var iTemp = 0;
        if( w_space >=0)
        {
           alert("Please enter New Password, without any space");
          document.getElementById("txtNewPassword").focus();
            return false;
        }

	 }
if(ConfPwd.value == "")
{
alert("Please enter confirm password");
document.getElementById("txtNewPassword2").focus();
return false;
}
if(NewPwd.value != ConfPwd.value)
{
alert("Confirm password must be same as new password");
return false;
}

}



function forgotPwd()
{
var email=document.getElementById("txtForgotEMail");
if(email.value != "")
{
    if(ForgotPwd_validate()==false)
            {
                return false;
            }
}
else
{
       alert("Please enter email ID");
       document.getElementById("txtForgotEMail").focus();
        return false;
}

}
function CheckValidation()
    {
    
        var email=document.getElementById("txtUserEMail");
        var Title=document.getElementById("NameTitle");
        var name=document.getElementById("FirstName");
        var Lname=document.getElementById("LastName");
        var Category=document.getElementById("PersonCategory");
        var address=document.getElementById("BillingAddress1");
        var City=document.getElementById("BillingCity");
        var State=document.getElementById("BillingState");
        var Zip=document.getElementById("BillingZip");
        var Country=document.getElementById("BillingCountry");
        var Nationality=document.getElementById("ddlNationalOf");
        var Currency=document.getElementById("ddlCurrency");
         var Passport=document.getElementById("txtPassport");
         var MobileNo=document.getElementById("txtMobileNo");
         var pannumber="";
         if(document.getElementById("txtpannumber")!=null)
         {
          pannumber=document.getElementById("txtpannumber");
         }
         if(document.getElementById("txtpannumbersignin")!=null)
         {
          pannumber=document.getElementById("txtpannumbersignin");
         }

          
       if(email.value=="")
       {
       alert("Please Enter Email Id");
       document.getElementById("txtUserEMail").focus();
        return false;
       }
        else if(Email_validate()==false)
        {
            return false;
        }
      else if(Title.value=="Select")
        {
        alert("Please select an appropriate Title");
       document.getElementById("NameTitle").focus();
        return false;
        }
       else if(name.value=="" || name.value==" " )
       {
       alert("Please enter first name.");
       document.getElementById("FirstName").focus();
        return false;
       }
       else if(Lname.value=="" || Lname.value==" ")
       {
       alert("Please enter last name.");
       document.getElementById("LastName").focus();
        return false;
       }
       else if((Category.value=="Select Person Category")||(Category.value=="Select Appropriate Category"))
        {
        alert("Please choose the Person Category that is best applicable to you. This not only helps us present the site appropriately to you, but also lets us optimize Tax Benefits to you.");
        document.getElementById("PersonCategory").focus();
        return false;
        }
        else if(Category.options[Category.selectedIndex].value=="NRI" )
        {
            if(Passport.value=="")
            {
                alert("Please Enter Passport Number.");
                document.getElementById("txtPassport").focus();
                return false;                
            }
             if(Passport.value.length <6)
            {
                alert("Please Enter Atleast 6 Characters For Passport Number.");
                 document.getElementById("txtPassport").focus();
                return false; 
            }     
        }
           else if(pannumber.value != "")
        {
          if(checkPannumber() == false)
          {

            alert("Please enter a valid Pan Number.");
            document.getElementById("txtpannumber").focus();
            return false; 
          }
        }
        if(Category.options[Category.selectedIndex].value=="INR" && MobileNo.value.length)
        {
         if(isNaN(MobileNo.value))
        {
        alert("Please enter a ten digit mobile number");
         MobileNo.focus();
         MobileNo.select();
        return false;
        }
       if(MobileNo.value.length <10)
        {
         alert("Please enter a ten digit mobile number");
         MobileNo.focus();
         MobileNo.select();
         return false;
        }
        if(MobileNo.value.charAt(0)=="0")
        {
        alert("Please check the ten digit mobile number you have entered");
        MobileNo.focus();
         MobileNo.select();
         return false;
        }
        }
       if(address.value=="" || address.value==" ")
       {
       alert("Please enter Address.");
       document.getElementById("BillingAddress1").focus();
        return false;
       }
       if(address.value.length<3)
       {
       alert("Please enter atleast 3 characters for Address.");
       document.getElementById("BillingAddress1").focus();
        return false;
       }
       else if(City.value=="" || City.value==" ")
       {
       alert("Please enter city.");
       document.getElementById("BillingCity").focus();
        return false;
       }
       else if(State.value=="Select State")
        {
        alert("Please Select State");
        document.getElementById("BillingState").focus();
        return false;
        }
       else if(Zip.value=="" || Zip.value==" ")
       {
       alert("Please enter the Zip/Postal code.");
       document.getElementById("BillingZip").focus();
        return false;
       }
       else if(Country.value=="Select Country")
        {
        alert("Please Select Country");
        document.getElementById("BillingCountry").focus();
        return false;
        }
        
        else if(Nationality.value=="Select Nationality")
        {
        alert("Please Select Nationality");
       document.getElementById("ddlNationalOf").focus();
       
        return false;
        }
        else if(Category.options[Category.selectedIndex].value=="INR" )
        {
             if(Country.options[Country.selectedIndex].text!="India")
            {
                alert("Your Person Category is Indian. Please Select India as a Country, or select appropriate Person Category");
                document.getElementById("BillingCountry").focus();
                return false;
            }
            if(Nationality.options[Nationality.selectedIndex].text!="India")
            {
                alert("Your Person Category is Indian. Please Select Nationality as India.");
                document.getElementById("ddlNationalOf").focus();
                return false;
            }
           
                  
        }
        else if(Category.options[Category.selectedIndex].value=="GBP" )
        {
           if(Country.options[Country.selectedIndex].text!="United Kingdom")
            {
                alert("Your Person Category is UK Tax Payer. Please Select United Kingdom as a Country, or select appropriate Person Category");
                document.getElementById("BillingCountry").focus();
                return false;
            } 
//             if(State.options[State.selectedIndex].text!= "Other")
//            {
//                alert("Please Select State as Other.");
//                document.getElementById("BillingState").focus();
//                return false;
//            }                 
        }
        else if(Category.options[Category.selectedIndex].value=="USD" )
        {
           if(Country.options[Country.selectedIndex].text!="United States")
            {
                alert("Your Person Category is U.S. Tax Payer. Please Select United States as a Country, or select appropriate Person Category");
                document.getElementById("BillingCountry").focus();
                return false;
            }
//             if(State.options[State.selectedIndex].text!= "Other")
//            {
//                alert("Please Select State as Other.");
//                document.getElementById("BillingState").focus();
//                return false;
//            }                  
        }
        else if(Category.options[Category.selectedIndex].value=="OTH" )
        {
           if(Nationality.options[Nationality.selectedIndex].text== "India")
            {
                alert("Your Person Category is Other. Please Select Nationality Other Than India.");
                document.getElementById("ddlNationalOf").focus();
                return false;
            } 
//            if(State.options[State.selectedIndex].text!= "Other")
//            {
//                alert("Please Select State as Other.");
//                document.getElementById("BillingState").focus();
//                return false;
//            }              
        }    
        else if(Category.options[Category.selectedIndex].value=="NRI" )
        {
            if(Country.options[Country.selectedIndex].text=="India")
            {
                alert("Your Person Category is Non Resident Indian. Please Select Country Other Than India and Nationality as India.");
                document.getElementById("BillingCountry").focus();
                return false;
            }
             if(Nationality.options[Nationality.selectedIndex].text!="India")
            {
                alert("Your Person Category is Non Resident Indian. Please Select Country Other Than India and Nationality as India.");
                document.getElementById("ddlNationalOf").focus();
                return false;
            }
                     
              
        }
         if(Currency.value=="Select Currency")
        {
        alert("Please Select Currency");
        document.getElementById("ddlCurrency").focus();
        return false;
        }
      else if(Category.options[Category.selectedIndex].value=="INR")
      {
        if(Currency.options[Currency.selectedIndex].text!="Rupees")
        {
        alert("Please Select Rupee as you are Resident Indian");
        document.getElementById("ddlCurrency").focus();
        return false;
        }
      }
      else if(Category.options[Category.selectedIndex].value=="GBP")
      {
        if(Currency.options[Currency.selectedIndex].text!="British Pound")
        {
        alert("Please Select British Pound as you are UK Tax Payer");
        document.getElementById("ddlCurrency").focus();
        return false;
        }
      }
      else if(Category.options[Category.selectedIndex].value=="USD")
      {
        if(Currency.options[Currency.selectedIndex].text!="US Dollar")
        {
        alert("Please Select US Dollar as you are U.S. Tax Payer");
        document.getElementById("ddlCurrency").focus();
        return false;
        }
      }
       else
        {
         return true;
        } 
        
        
    }
     
   
function CheckValidationUpdate()
    {
        var StrEmail =document.getElementById("txtEMail");
        var Title=document.getElementById("NameTitle");
        var name=document.getElementById("FirstName");
        var Lname=document.getElementById("LastName");
        var Category=document.getElementById("PersonCategory");
        var address=document.getElementById("BillingAddress1");
        var City=document.getElementById("BillingCity");
        var State=document.getElementById("BillingState");
        var Zip=document.getElementById("BillingZip");
        var Country=document.getElementById("BillingCountry");
        var Nationality=document.getElementById("ddlNationalOf");
        var Currency=document.getElementById("ddlCurrency");
        var Passport=document.getElementById("txtPassport");
         var MobileNo=document.getElementById("txtMobileNo");
        var pannumber="";
         if(document.getElementById("txtpannumber")!=null)
         {
          pannumber=document.getElementById("txtpannumber");
         }
         if(document.getElementById("txtpannumbersignin")!=null)
         {
          pannumber=document.getElementById("txtpannumbersignin");
         }
      	if(StrEmail.value=="" || StrEmail.value == " ")
        {
            alert("Email ID cannot be blank.");
            document.getElementById("txtEMail").focus();
            return false;
        }
        else if(Email_validateUpdate()==false)
        {
            return false;
        }
	else if(Title.value=="Select")
        {
        alert("Please select an appropriate Title");
       document.getElementById("NameTitle").focus();
        return false;
        }
      else if(name.value=="" || name.value==" " )
       {
       alert("Please enter first name.");
       document.getElementById("FirstName").focus();
        return false;
       }
       else if(Lname.value=="" || Lname.value==" ")
       {
       alert("Please enter last name.");
       document.getElementById("LastName").focus();
        return false;
       }
       else if((Category.value=="Select Person Category")||(Category.value=="Select Appropriate Category"))
        {
        alert("Please choose the Person Category that is best applicable to you. This not only helps us present the site appropriately to you, but also lets us optimize Tax Benefits to you.");
        document.getElementById("PersonCategory").focus();
        return false;
        }
         else if(Category.options[Category.selectedIndex].value=="NRI" )
        {
            if(Passport.value=="")
            {
                alert("Please Enter Passport Number.");
                document.getElementById("txtPassport").focus();
                return false;                
            }
             if(Passport.value.length <6)
            {
                alert("Please Enter Atleast 6 Characters For Passport Number.");
                 document.getElementById("txtPassport").focus();
                return false; 
            }     
        }
         else if(pannumber.value != "")
        {
          if(checkPannumber() == false)
          {
		
            alert("Please enter a valid Pan Number.");
            document.getElementById("txtpannumber").focus();
            return false; 
          }
        }
         if(Category.options[Category.selectedIndex].value=="INR" && MobileNo.value.length)
        {
         if(isNaN(MobileNo.value))
        {
        alert("Please enter a ten digit mobile number");
         MobileNo.focus();
         MobileNo.select();
        return false;
        }
       if(MobileNo.value.length <10)
        {
         alert("Please enter a ten digit mobile number");
         MobileNo.focus();
         MobileNo.select();
         return false;
        }
        if(MobileNo.value.charAt(0)=="0")
        {
        alert("Please check the ten digit mobile number you have entered");
        MobileNo.focus();
         MobileNo.select();
         return false;
        }
        }

      if(address.value=="" || address.value==" ")
       {
       alert("Please enter Address.");
       document.getElementById("BillingAddress1").focus();
        return false;
       }
       if(address.value.length<3)
       {
       alert("Please enter atleast 3 characters for Address.");
       document.getElementById("BillingAddress1").focus();
        return false;
       }
       else if(City.value=="" || City.value==" ")
       {
       alert("Please enter city.");
       document.getElementById("BillingCity").focus();
        return false;
       }
       else if(State.value=="Select State")
        {
        alert("Please Select State");
        document.getElementById("BillingState").focus();
        return false;
        }
       else if(Zip.value=="" || Zip.value==" ")
       {
       alert("Please enter the Zip/Postal code.");
       document.getElementById("BillingZip").focus();
        return false;
       }
       else if(Country.value=="Select Country")
        {
        alert("Please Select Country");
        document.getElementById("BillingCountry").focus();
        return false;
        }
        
        else if(Nationality.value=="Select Nationality")
        {
        alert("Please Select Nationality");
       document.getElementById("ddlNationalOf").focus();
       
        return false;
        }
        else if(Category.options[Category.selectedIndex].value=="INR" )
        {
             if(Country.options[Country.selectedIndex].text!="India")
            {
                alert("Your Person Category is Indian. Please Select India as a Country, or select appropriate Person Category");
                document.getElementById("BillingCountry").focus();
                return false;
            }
            if(Nationality.options[Nationality.selectedIndex].text!="India")
            {
                alert("Your Person Category is Indian. Please Select Nationality as India.");
                document.getElementById("ddlNationalOf").focus();
                return false;
            }
           
                  
        }
        else if(Category.options[Category.selectedIndex].value=="GBP" )
        {
           if(Country.options[Country.selectedIndex].text!="United Kingdom")
            {
                alert("Your Person Category is UK Tax Payer. Please Select United Kingdom as a Country, or select appropriate Person Category");
                document.getElementById("BillingCountry").focus();
                return false;
            } 
//             if(State.options[State.selectedIndex].text!= "Other")
//            {
//                //alert("Please Select State as Other.");
//                //document.getElementById("BillingState").focus();
//                //return false;
//                State.options[State.selectedIndex].text="Other";
//            }                 
        }
        else if(Category.options[Category.selectedIndex].value=="USD" )
        {
           if(Country.options[Country.selectedIndex].text!="United States")
            {
                alert("Your Person Category is U.S. Tax Payer. Please Select United States as a Country, or select appropriate Person Category");
                document.getElementById("BillingCountry").focus();
                return false;
            }
//             if(State.options[State.selectedIndex].text!= "Other")
//            {
//                //alert("Please Select State as Other.");
//                //document.getElementById("BillingState").focus();
//                //return false;
//                State.options[State.selectedIndex].text="Other";
//            }                  
        }
        else if(Category.options[Category.selectedIndex].value=="OTH" )
        {
           if(Nationality.options[Nationality.selectedIndex].text== "India")
            {
                alert("Your Person Category is Other. Please Select Nationality Other Than India.");
                document.getElementById("ddlNationalOf").focus();
                return false;
            } 
//            if(State.options[State.selectedIndex].text!= "Other")
//            {
//                alert("Please Select State as Other.");
//                document.getElementById("BillingState").focus();
//                return false;
//            }              
        }    
        else if(Category.options[Category.selectedIndex].value=="NRI" )
        {
            if(Country.options[Country.selectedIndex].text=="India")
            {
                alert("Your Person Category is Non Resident Indian. Please Select Country Other Than India and Nationality as India.");
                document.getElementById("BillingCountry").focus();
                return false;
            }
             if(Nationality.options[Nationality.selectedIndex].text!="India")
            {
                alert("Your Person Category is Non Resident Indian. Please Select Country Other Than India and Nationality as India.");
                document.getElementById("ddlNationalOf").focus();
                return false;
            }
                     
              
        }
         if(Currency.value=="Select Currency")
        {
        alert("Please Select Currency");
        document.getElementById("ddlCurrency").focus();
        return false;
        }
      else if(Category.options[Category.selectedIndex].value=="INR")
      {
        if(Currency.options[Currency.selectedIndex].text!="Rupees")
        {
        alert("Please Select Rupees as you are Resident Indian");
        document.getElementById("ddlCurrency").focus();
        return false;
        }
      }
      else if(Category.options[Category.selectedIndex].value=="GBP")
      {
        if(Currency.options[Currency.selectedIndex].text!="British Pound")
        {
        alert("Please Select British Pound as you are UK Tax Payer");
        document.getElementById("ddlCurrency").focus();
        return false;
        }
      }
      else if(Category.options[Category.selectedIndex].value=="USD")
      {
        if(Currency.options[Currency.selectedIndex].text!="US Dollar")
        {
        alert("Please Select US Dollar as you are U.S. Tax Payer");
        document.getElementById("ddlCurrency").focus();
        return false;
        }
      }
       else
        {
         return true;
        } 
        
        
    }
function Email_validateUpdate()
{
	//alert('Santosh');
 	
	var emailRegex = /^[a-zA-Z0-9][-\+\w\.]*@([a-zA-Z0-9][\w\-]*\.)+[a-zA-Z]{2,4}$/;
	//alert(emailRegex);
	var emailid = document.getElementById('txtEMail').value;
	//alert(emailid);
	if( !emailid.match( emailRegex ) )
	{
		alert( 'Please enter valid Email Id.' );
		document.getElementById('txtEMail').focus();
		return false;
	}
	return true;
}
function datevalidation()
{
    var txtDate=document.getElementById("txtOccassionDate").value;
    var txtvalue=txtDate.split("/");
    var currentTime = new Date();
    var month = currentTime.getMonth() + 1;
    var day = currentTime.getDate();
    var year = currentTime.getFullYear();
    if(parseInt(txtvalue[2]) < year){
        alert("Selected year can't be before than current Date.");
        return false;
    }else if(parseInt(txtvalue[2]) >= year){
        if(parseInt(txtvalue[0]) < month){
            //alert("Selected year can't be before current month.");
            alert("Selected year can't be before than current Date.");
            return false;
        }else if(parseInt(txtvalue[0]) >= month){
            if(parseInt(txtvalue[1]) < day){
                //alert("Selected year can't be before current day.");
                alert("Selected year can't be before than current Date.");
                return false;
            }
        }   
    }
}

function validateNumbers()
     {
	if (event.keyCode >= 48 & event.keyCode <=57)
	 {

	 }
	else if (event.keyCode == 13)
	 {

	 }
	else
	 {
		alert("Enter Numeric Value only");
		event.keyCode=0;
     }
     }
 // Email Validation 
 
    function Email_validate()
    {
    //alert('email validate');
 var userName = document.getElementById("txtUserEMail").value
     
            if(userName != "")
            {
                   
                var iaPos=userName.indexOf('@');
                var iDotPos=userName.lastIndexOf('.');
                var istrLen=userName.length;
                var iSpace=userName.indexOf(' ');
                if(iSpace > -1)
                {
                alert("Please enter valid Email Id.");
                document.getElementById("txtUserEMail").focus();
                return false;
                }
                if(iaPos<1 || iDotPos<2)
                {
                alert("Please enter valid Email Id.");
                document.getElementById("txtUserEMail").focus();
                return false;
                }
                if(istrLen == iDotPos+1)
                {
                alert("Please enter valid Email Id.");
                document.getElementById("txtUserEMail").focus();
                return false;
                }
                if(istrLen ==iaPos+1)
                {
                alert("Please enter valid Email Id.");
                document.getElementById("txtUserEMail").focus();
                return false;
                }
                if(iDotPos < iaPos)
                {
                alert("Please enter valid Email Id.");
                document.getElementById("txtUserEMail").focus();
                return false;
                }
            }
            if(userName == "")
            {
                alert("Please enter valid Email Id.");
                document.getElementById("txtUserEMail").focus();
                return false;
            }
             else
            {
            }
   
//    if(document.getElementById("txtUserEMail").value=="")
//    {
//        alert("User ID can not be Blank");
//        document.getElementById("txtUserEMail").focus();
//        return false;
//    }
//    //var emailPat = /^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}\|[0-9]{1,3})(\\]?)\$/;
//   var emailPat = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
//   
//    var emailid=document.getElementById("txtUserEMail").value;
//    var matchArray = emailid.match(emailPat);
//    if (matchArray == null)
//    {
//               alert("Your User ID seems incorrect. Please try again.");
//               document.getElementById("txtUserEMail").focus();
//               return false;
//    }
        return true;

   }

function confirmSubmit()
    {
var flag=true;  
var r=confirm("Are you sure want to clear the form and  enter the information again.");
if (r==true)
  {
   return true;
  }
else
  {
   return false;
  }

    }
    
    
function LTrim(VALUE)
{

 var txtId=VALUE.id;
 var userName = document.getElementById(txtId).value
//alert(document.getElementById(txtId).value);
 var w_space = userName.indexOf(' ');
 
 var v_length = userName.length;
 if(v_length < 1)
{
 return"";
}
 var strTemp = "";

 var iTemp = 0;

while(iTemp < v_length){
if(userName.charAt(iTemp) == w_space)
{
}
else
{
strTemp = userName.substring(iTemp,v_length);
break;
}

iTemp = iTemp + 1;
} 

document.getElementById(txtId).value=strTemp;
return strTemp;
}    

//Email check for sign in
    function EmailSignIn_validate()
    {
    //alert('email validate');
 var userName = document.getElementById("txtEMail").value
     
            if(userName != "")
            {
                   
                var iaPos=userName.indexOf('@');
                var iDotPos=userName.lastIndexOf('.');
                var istrLen=userName.length;
                var iSpace=userName.indexOf(' ');
                if(iSpace > -1)
                {
                alert("Please enter valid Email Id.");
                document.getElementById("txtEMail").focus();
                return false;
                }
                if(iaPos<1 || iDotPos<2)
                {
                alert("Please enter valid Email Id.");
                document.getElementById("txtEMail").focus();
                return false;
                }
                if(istrLen == iDotPos+1)
                {
                alert("Please enter valid Email Id.");
                document.getElementById("txtEMail").focus();
                return false;
                }
                if(istrLen ==iaPos+1)
                {
                alert("Please enter valid Email Id.");
                document.getElementById("txtEMail").focus();
                return false;
                }
                if(iDotPos < iaPos)
                {
                alert("Please enter valid Email Id.");
                document.getElementById("txtEMail").focus();
                return false;
                }
            }
            if(userName == "")
            {
                alert("Please enter valid Email Id.");
                document.getElementById("txtEMail").focus();
                return false;
            }
             else
            {
            }
   
//    if(document.getElementById("txtUserEMail").value=="")
//    {
//        alert("User ID can not be Blank");
//        document.getElementById("txtUserEMail").focus();
//        return false;
//    }
//    //var emailPat = /^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}\|[0-9]{1,3})(\\]?)\$/;
//   var emailPat = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
//   
//    var emailid=document.getElementById("txtUserEMail").value;
//    var matchArray = emailid.match(emailPat);
//    if (matchArray == null)
//    {
//               alert("Your User ID seems incorrect. Please try again.");
//               document.getElementById("txtUserEMail").focus();
//               return false;
//    }
        return true;

   }
   
      function ForgotPwd_validate()
    {
    //alert('email validate');
 var userName = document.getElementById("txtForgotEMail").value
     
            if(userName != "")
            {
                   
                var iaPos=userName.indexOf('@');
                var iDotPos=userName.lastIndexOf('.');
                var istrLen=userName.length;
                var iSpace=userName.indexOf(' ');
                if(iSpace > -1)
                {
                alert("Please enter valid Email Id.");
                document.getElementById("txtForgotEMail").focus();
                return false;
                }
                if(iaPos<1 || iDotPos<2)
                {
                alert("Please enter valid Email Id.");
                document.getElementById("txtForgotEMail").focus();
                return false;
                }
                if(istrLen == iDotPos+1)
                {
                alert("Please enter valid Email Id.");
                document.getElementById("txtForgotEMail").focus();
                return false;
                }
                if(istrLen ==iaPos+1)
                {
                alert("Please enter valid Email Id.");
                document.getElementById("txtForgotEMail").focus();
                return false;
                }
                if(iDotPos < iaPos)
                {
                alert("Please enter valid Email Id.");
                document.getElementById("txtForgotEMail").focus();
                return false;
                }
            }
            if(userName == "")
            {
                alert("Please enter valid Email Id.");
                document.getElementById("txtForgotEMail").focus();
                return false;
            }
             else
            {
            }
   

        return true;

   }
 // Added by kunal to check the Pan Number
  function checkPannumber()
    {
        //alert("Inside checkPannumber");
           var _panumber          = document.getElementById('txtpannumber').value;   // Store the Pan Number
          // alert(_panumber.value);
        if(_panumber.length > 0)
        {
            
            var _Lastname          = document.getElementById('LastName').value;        // Store the Customer last name          
            var _FirstCharOfName   = _Lastname.substring(0,1);                        // alert("FirstCharOfName :- " +_FirstCharOfName)            // Store the First character of customer last name   
            var _str               = /^[a-zA-Z]+$/;  
            var _str1              = "CPHFATBLJG";
            var _str2              = /^[0-9]\d*$/;  
        
        if ( _panumber.length == 10)
        {                 
             // alert("Inside 1");
              
            var _firstThreeValidation = _panumber.substring(0,3);               // First three charachter           
            var _fourthValidation     = _panumber.substring(3,4);               // Fourth charcater               
            var _fifthValidation      = _panumber.substring(4,5);               // Fifth charcater              
            var _NumericValidation    = _panumber.substring(5,5+4);             // Numeric Digits            
            var _tenthValidation      = _panumber.substring(9,9+1);             // Tenth character
                  
          
            // Check the first three character
            if (_firstThreeValidation.search(_str) != -1)
                {                             
                         //  alert("Inside 2");
                         
                      // Check the forth character
                if (_str1.toUpperCase().indexOf(_fourthValidation.toUpperCase()) > -1)
                    {
                                 
                                // alert("Inside 3");               
                          // Check the fifth character
                        if (_fifthValidation.search(_str) != -1)
                            {
                                        
                                       // alert("Inside 4");                                 
                                 // Check the Numeric characters
                            if (_NumericValidation.search(_str2) != -1)
                                    {
                                            //   alert("Inside 5");                                             
                                        // Check the tenth character
                                        if (_tenthValidation.search(_str) != -1)
                                        {
                                           return true;
                                        }
                                        else
                                        {
                                          //  alert("Inside 6 as tenth validation is failed");
                                            //document.getElementById('txtpannumber').Focus();
                                             return false;
                                        }
                                     }
                                 else
                                     {
                                       // alert("Inside 7 as Numeric validation is failed");
                                       // document.getElementById('txtpannumber').Focus();
                                        return false;
                                     }
                            }
                        else
                            {
                              // alert("Inside 8 as fifth validation is failed");
                                //document.getElementById('txtpannumber').Focus();
                                return false;
                            }  
                    }
                else
                    {
                        // alert("Inside 9 as forth validation is failed");
                        // document.getElementById('txtpannumber').Focus();
                         return false;
                    }
      
                }
            else
                {
                     // alert("Inside 10 as first three validation is failed ");            
                    //document.getElementById('txtpannumber').Focus();
                    return false;               
                }
        }
        else
        {
             //  alert("Inside 11 as lenth is not 10");
               return false;
            
        }
        }
        else
        {
        return true;
        }
       
       
    } 
