//Fuction for Free Sign Up
function ValidateApplicationForm() 
{
   var retValue = true;
   
   var txtEmailAddress = document.getElementById("ctl00_ContentPlaceHolder1_txtEmailAddress").value;
   var txtFirstName = document.getElementById("ctl00_ContentPlaceHolder1_txtFirstName").value;
   var txtLastName = document.getElementById("ctl00_ContentPlaceHolder1_txtLastName").value;
   var txtAddress = document.getElementById("ctl00_ContentPlaceHolder1_txtAddress").value;
   var txtCity = document.getElementById("ctl00_ContentPlaceHolder1_txtCity").value;
   var txtPostalCode = document.getElementById("ctl00_ContentPlaceHolder1_txtPostalCode").value;
   
  // var txtPhoneNumber = document.getElementById("ctl00_ContentPlaceHolder1_txtPhoneNumber").value;
   //var txtSIN = document.getElementById("ctl00_ContentPlaceHolder1_txtSIN").value;
   //var txtBirthday = document.getElementById("ctl00_ContentPlaceHolder1_txtBirthday").value;
  // var txtNoOfDependents = document.getElementById("ctl00_ContentPlaceHolder1_txtNoOfDependents").value;
   //var txtBusinessPhone = document.getElementById("ctl00_ContentPlaceHolder1_txtBusinessPhone").value;
  // var txtJointApplicantsName = document.getElementById("ctl00_ContentPlaceHolder1_txtJointApplicantsName").value;
   var txtCaptcha = document.getElementById("ctl00_ContentPlaceHolder1_txtCaptcha").value;
  // var txtNoOfDependents = document.getElementById("ctl00_ContentPlaceHolder1_txtNoOfDependents").value;
 // var txtGrossAnnualIncome = document.getElementById("ctl00_ContentPlaceHolder1_txtGrossAnnualIncome").value;
 // var txtIncome = document.getElementById("ctl00_ContentPlaceHolder1_txtIncome").value;



 var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
 var txtSINum =/[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]/;;

 //var phoneRegex = /^([0-9]{10})/;
 
 var phoneRegex = /^(\()?(\d{3})([\)-\. ])?(\d{3})([-\. ])?(\d{4})$/;
 
 var zipRegex = /^[A-Z]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$/;

 var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
 //var dateOfBirth = /(?:0[1-9]|[12][0-9]|3[01])\/(?:0[1-9]|1[0-2])\/(?:19|20\d{2})/;
 var dateOfBirth = /(?:0[1-9]|1[0-2])\/(?:0[1-9]|[12][0-9]|3[01])\/(?:19|20\d{2})/;
 
 var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
 var numberRegex =  /^[0-9]+$/;
 var Amount = /^[+]?\d*.?\d*$/;

  if (txtEmailAddress != null) {
        if (txtEmailAddress == "") {

            inlineMsg('ctl00_ContentPlaceHolder1_txtEmailAddress', 'Please enter e-mail address.', 10);
            return false;
        }
        else if (!txtEmailAddress.match(emailRegex)) {
            inlineMsg('ctl00_ContentPlaceHolder1_txtEmailAddress', 'You have entered an invalid e-mail address.', 10);
            return false;
        }

    }
    else {

        return false;
    }



if (txtFirstName != null) {
     if (txtFirstName == "") {
         inlineMsg('ctl00_ContentPlaceHolder1_txtFirstName', 'Please enter first name.', 10);
        return false;
     }
    
 }
 
 
 if (txtLastName != null) {
     if (txtLastName == "") {
         inlineMsg('ctl00_ContentPlaceHolder1_txtLastName', 'Please enter last name.', 10);
        return false;
     }
     
 }
 
 if (txtAddress != null) 
 {
    if (txtAddress == "") 
    {
        inlineMsg('ctl00_ContentPlaceHolder1_txtAddress', 'Please enter address.', 10);
        return false;
    }
 }
 
 if (txtCity != null) 
 {
    if (txtCity == "") 
    {
        inlineMsg('ctl00_ContentPlaceHolder1_txtCity', 'Please enter city.', 10);
        return false;
    }
 }
 
 if (txtPostalCode != null) {
        if (txtPostalCode == "") {

            inlineMsg('ctl00_ContentPlaceHolder1_txtPostalCode', 'Please enter postal code.', 10);
            return false;
        }
        
    }
 
     
  
  if (txtCaptcha != null) 
 {
    if (txtCaptcha == "") 
    {
        inlineMsg('ctl00_ContentPlaceHolder1_txtCaptcha', 'Please enter security code .', 10);
        return false;
    }
 }
  
}

//Fuction for Free Sign Up
function validateFreeSignUp() {
    var retValue = true;

    //Rates.aspx validation
    var txtSignUpFname = document.getElementById("ctl00_ContentPlaceHolder1_txtSingnUpFirstName").value;
    var txtSignUpLastName = document.getElementById("ctl00_ContentPlaceHolder1_txtSingnUpLastName").value;
    var txtSignUpEmail = document.getElementById("ctl00_ContentPlaceHolder1_txtSingnUpEmail").value;
    var txtSignUpPhone = document.getElementById("ctl00_ContentPlaceHolder1_txtSingnUpPhone").value;
    var txtSingUpAddress = document.getElementById("ctl00_ContentPlaceHolder1_txtSingnUpAddress").value;

    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
 
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    
var phoneRegex = /^(\()?(\d{3})([\)-\. ])?(\d{3})([-\. ])?(\d{4})$/;


    if (txtSignUpFname != null) {
        if (txtSignUpFname == "") {
            inlineMsg('ctl00_ContentPlaceHolder1_txtSingnUpFirstName', 'Please enter first name.', 2);
            return false;
        }
       
    }

    if (txtSignUpLastName != null) {
        if (txtSignUpLastName == "") {
            inlineMsg('ctl00_ContentPlaceHolder1_txtSingnUpLastName', 'Please enter last name.', 2);
            return false;
        }
      
    }



    if (txtSignUpEmail != null) {
        if (txtSignUpEmail == "") {

            inlineMsg('ctl00_ContentPlaceHolder1_txtSingnUpEmail', 'Please enter email.', 2);
            return false;
        }
        else if (!txtSignUpEmail.match(emailRegex)) {
            inlineMsg('ctl00_ContentPlaceHolder1_txtSingnUpEmail', 'You have entered an invalid email.', 2);
            return false;
        }

    }
    else {

        return false;
    }


    if (txtSignUpPhone != null) {
        if (txtSignUpPhone == "") {

            inlineMsg('ctl00_ContentPlaceHolder1_txtSingnUpPhone', 'Please enter phone.', 2);
            return false;
        }
       
    }


    if (txtSingUpAddress != null) {
        if (txtSingUpAddress == "") {
            inlineMsg('ctl00_ContentPlaceHolder1_txtSingnUpAddress', 'Please enter address.', 2);
            return false;
        }

    }

}






//Fuction for rates
function validateRates() {
    var retValue = true;

    //Rates.aspx validation
    var txtRatesPageName = document.getElementById("ctl00_ContentPlaceHolder1_txtRateName").value;
    var txtRatesPagePhone = document.getElementById("ctl00_ContentPlaceHolder1_txtRatesPhone").value;
    var txtRatesPageEmail = document.getElementById("ctl00_ContentPlaceHolder1_txtRatesEmail").value;

    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
   var phoneRegex = /^(\()?(\d{3})([\)-\. ])?(\d{3})([-\. ])?(\d{4})$/;
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;



    // Validation for Rates page name
    if (txtRatesPageName != null) {
        if (txtRatesPageName == "") {
            inlineMsg('ctl00_ContentPlaceHolder1_txtRateName', 'Please enter name.', 2);
            return false;
        }
     
    }

    // Validation for Rates page Phone

   

    // Validation for Rates page email
    if (txtRatesPageEmail != null) {
        if (txtRatesPageEmail == "") {

            inlineMsg('ctl00_ContentPlaceHolder1_txtRatesEmail', 'Please enter email.', 2);
            return false;
        }
        else if (!txtRatesPageEmail.match(emailRegex)) {
            inlineMsg('ctl00_ContentPlaceHolder1_txtRatesEmail', 'You have entered an invalid email.', 2);
            return false;
        }

    }
    else {

        return false;
    }


}


function quickmortgagevalidation() {
    var retValue = true;


    var drpmortgagehome1 = document.getElementById("ctl00_drpmortgagehome").value;
    var Amount1 = document.getElementById("ctl00_drpAmounthome").value;
    var txtNamehome1 = document.getElementById("ctl00_txtNamehome").value;
    var txtphonehome1 = document.getElementById("ctl00_txtphonehome").value;
    var txtemailhome1 = document.getElementById("ctl00_txtemailhome").value;


    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    //var dateofbirth= /^((0?[13578]|10|12)(/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[01]?))(/)((19)([2-9])(\d{1})|(20)([01])(\d{1})|([8901])(\d{1}))|(0?[2469]|11)(/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[0]?))(/)((19)([2-9])(\d{1})|(20)([01])(\d{1})|([8901])(\d{1})))$;
    var txtSINum = /[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]/; ;
   var phoneRegex = /^(\()?(\d{3})([\)-\. ])?(\d{3})([-\. ])?(\d{4})$/;
    //var zipRegex = /(\d{5}(-\d{4}))?/;
    var zipRegex = /^([0-9]{5})(-[0-9]{4})?$/;
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

    var numberRegex = /^[0-9]+$/;



    if (txtNamehome1 != null) {
        if (txtNamehome1 == "") {
            inlineMsg('ctl00_txtNamehome', 'Please enter Name.', 2);
            return false;
        }
        
    }







    if (txtemailhome1 != null) {
        if (txtemailhome1 == "") {
            inlineMsg('ctl00_txtemailhome', 'Please enter email.', 2);
            return false;
        }
        else if (!txtemailhome1.match(emailRegex)) {
            inlineMsg('ctl00_txtemailhome', 'You have entered an invalid value for email.', 2);
            return false;
        }

    }
    else {

        return false;
    }


    return retValue;
}








function quickmortgagevalidation1() {
    var retValue = true;


  
   
    var txtNamehome1 = document.getElementById("txtNamehome").value;
    var txtphonehome1 = document.getElementById("txtphonehome").value;
    var txtemailhome1 = document.getElementById("txtemailhome").value;


    var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
    //var dateofbirth= /^((0?[13578]|10|12)(/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[01]?))(/)((19)([2-9])(\d{1})|(20)([01])(\d{1})|([8901])(\d{1}))|(0?[2469]|11)(/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[0]?))(/)((19)([2-9])(\d{1})|(20)([01])(\d{1})|([8901])(\d{1})))$;
    var txtSINum = /[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]/; ;
   
   var phoneRegex = /^(\()?(\d{3})([\)-\. ])?(\d{3})([-\. ])?(\d{4})$/;
   
    //var zipRegex = /(\d{5}(-\d{4}))?/;
   
    var zipRegex = /^([0-9]{5})(-[0-9]{4})?$/;
   
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

    var numberRegex = /^[0-9]+$/;



    if (txtNamehome1 != null) {
        if (txtNamehome1 == "") {
            inlineMsg('txtNamehome', 'Please enter Name.', 2);
            return false;
        }
        
    }




    if (txtemailhome1 != null) {
        if (txtemailhome1 == "") {
            inlineMsg('txtemailhome', 'Please enter email.', 2);
            return false;
        }
        else if (!txtemailhome1.match(emailRegex)) {
            inlineMsg('txtemailhome', 'You have entered an invalid value for email.', 2);
            return false;
        }

    }
    else {

        return false;
    }


    return retValue;
}
   
   
function validateRegistration()
{

var retValue=true;


var txtFirstName = document.getElementById("ctl00_ContentPlaceHolder1_txtFirstName").value;
var txtLastName = document.getElementById("ctl00_ContentPlaceHolder1_txtLastName").value;
var testinput = document.getElementById("ctl00_ContentPlaceHolder1_date2").value;
var drpAppInfoMeritualStatus = document.getElementById("ctl00_ContentPlaceHolder1_drpAppInfoMeritualStatus").value;
var txtSinApp = document.getElementById("ctl00_ContentPlaceHolder1_txtSinApp").value;
var txtAppInfoPhone = document.getElementById("ctl00_ContentPlaceHolder1_txtAppInfoPhone").value;
var txtAppInfoDependencies = document.getElementById("ctl00_ContentPlaceHolder1_txtAppInfoDependencies").value;
var txtAppInfoCity = document.getElementById("ctl00_ContentPlaceHolder1_txtAppInfoCity").value;
var drpCurrentMailingProviance = document.getElementById("ctl00_ContentPlaceHolder1_drpCurrentMailingProviance").value;

var txtAppInfoPostalCode = document.getElementById("ctl00_ContentPlaceHolder1_txtAppInfoPostalCode").value;

var radAppInfoCurrentAddRent = document.getElementById("ctl00_ContentPlaceHolder1_radAppInfoCurrentAddRent").value;
var radAppInfoCurrentAddOwn = document.getElementById("ctl00_ContentPlaceHolder1_radAppInfoCurrentAddOwn").value;
var txtAppInfoRental = document.getElementById("ctl00_ContentPlaceHolder1_txtAppInfoRental").value;
var txtAppInfoYears = document.getElementById("ctl00_ContentPlaceHolder1_txtAppInfoYears").value;
var txtAppInfoMonths = document.getElementById("ctl00_ContentPlaceHolder1_txtAppInfoMonths").value;
var txtAppInfoCityPrev = document.getElementById("ctl00_ContentPlaceHolder1_txtAppInfoCityPrev").value;
var drpProviancePrevAddress = document.getElementById("ctl00_ContentPlaceHolder1_drpProviancePrevAddress").value;
var txtAppInfoPostalCodePrev = document.getElementById("ctl00_ContentPlaceHolder1_txtAppInfoPostalCodePrev").value;
var radAppInfoPrevAddRent = document.getElementById("ctl00_ContentPlaceHolder1_radAppInfoPrevAddRent").value;
var radAppInfoPrevAddOwn = document.getElementById("ctl00_ContentPlaceHolder1_radAppInfoPrevAddOwn").value;
var txtAppInfoRentInfo = document.getElementById("ctl00_ContentPlaceHolder1_txtAppInfoRentInfo").value;
var txtAppInfoYearsPrev = document.getElementById("ctl00_ContentPlaceHolder1_txtAppInfoYearsPrev").value;
var txtAppInfoPrevMonths = document.getElementById("ctl00_ContentPlaceHolder1_txtAppInfoPrevMonths").value;
var txtEmpInfoCurrentEmp = document.getElementById("ctl00_ContentPlaceHolder1_txtEmpInfoCurrentEmp").value;
var txtEmplomentInfoEmpAddress = document.getElementById("ctl00_ContentPlaceHolder1_txtEmplomentInfoEmpAddress").value;
var txtEmploymentInfoCity = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoCity").value;
var txtEmploymentInfoPostalCode = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoPostalCode").value;
var txtEmploymentInfoTelNo = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoTelNo").value;
var txtEmploymentInfoFax = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoFax").value;
var txtEmploymentInfoEmpAddress = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoEmpAddress").value;
var txtEmploymentInfoPrevCity = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoPrevCity").value;
var txtEmploymentInfoPostalCodePrev = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoPostalCodePrev").value;
var txtEmploymentInfoTelNoPrev = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoTelNoPrev").value;
var txtEmploymentInfoFaxPrev = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoFaxPrev").value;
var txtEmploymentInfoAnnualincome = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoAnnualincome").value;
var txtEmploymentInfoYears = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoYears").value;
var txtEmploymentInfoMonths = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoMonths").value;
var txtEmploymentInfoPosition = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoPosition").value;
var txtEmploymentInfoEmail = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoEmail").value;
var txtEmploymentInfoAnnualIncomePrev = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoAnnualIncomePrev").value;
var txtEmploymentInfoPrevYears = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoPrevYears").value;
var txtEmploymentInfoPrevMonths = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoPrevMonths").value;
var txtEmploymentInfoPositionPrev = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoPositionPrev").value;
var txtEmploymentInfoEmailPrev = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoEmailPrev").value;
var txtCoAppFirstName = document.getElementById("ctl00_ContentPlaceHolder1_txtCoAppFirstName").value;
var drpCoAppMeritualStatus = document.getElementById("ctl00_ContentPlaceHolder1_drpCoAppMeritualStatus").value;
var txtCoAppDependency = document.getElementById("ctl00_ContentPlaceHolder1_txtCoAppDependency").value;
var txtCoAppLastName = document.getElementById("ctl00_ContentPlaceHolder1_txtCoAppLastName").value;
var txtCoAppSin = document.getElementById("ctl00_ContentPlaceHolder1_txtCoAppSin").value;
var txtCoAppDate = document.getElementById("ctl00_ContentPlaceHolder1_txtCoAppDate").value;
var txtCoAppPhone = document.getElementById("ctl00_ContentPlaceHolder1_txtCoAppPhone").value;
var txtCoAppCurrentCity = document.getElementById("ctl00_ContentPlaceHolder1_txtCoAppCurrentCity").value;
var drpCoappProviance = document.getElementById("ctl00_ContentPlaceHolder1_drpCoappProviance").value;
var txtCoAppCurrentPostalCode = document.getElementById("ctl00_ContentPlaceHolder1_txtCoAppCurrentPostalCode").value;
var radCoappCurrentRent = document.getElementById("ctl00_ContentPlaceHolder1_radCoappCurrentRent").value;
var radCoappCurrentOwn = document.getElementById("ctl00_ContentPlaceHolder1_radCoappCurrentOwn").value;
var txtCoAppRentalAmount = document.getElementById("ctl00_ContentPlaceHolder1_txtCoAppRentalAmount").value;
var txtCoAppCurrentYears = document.getElementById("ctl00_ContentPlaceHolder1_txtCoAppCurrentYears").value;
var txtCoAppCurrentMonths = document.getElementById("ctl00_ContentPlaceHolder1_txtCoAppCurrentMonths").value;
var txtCoAppCurrentCityPrev = document.getElementById("ctl00_ContentPlaceHolder1_txtCoAppCurrentCityPrev").value;
var drpCoAppInfoProviance = document.getElementById("ctl00_ContentPlaceHolder1_drpCoAppInfoProviance").value;
var txtCoAppCurrentPostalCodePrev = document.getElementById("ctl00_ContentPlaceHolder1_txtCoAppCurrentPostalCodePrev").value;
var radCurrentMailAddRent = document.getElementById("ctl00_ContentPlaceHolder1_radCurrentMailAddRent").value;
var radCurrentMailAddOwn = document.getElementById("ctl00_ContentPlaceHolder1_radCurrentMailAddOwn").value;
var txtCoAppCurrentRentalAmount = document.getElementById("ctl00_ContentPlaceHolder1_txtCoAppCurrentRentalAmount").value;
var txtCoAppCurrentYearsPrev = document.getElementById("ctl00_ContentPlaceHolder1_txtCoAppCurrentYearsPrev").value;
var txtCoAppCurrentMonthsPrev = document.getElementById("ctl00_ContentPlaceHolder1_txtCoAppCurrentMonthsPrev").value;
var txtCurrentEmployerThird = document.getElementById("ctl00_ContentPlaceHolder1_txtCurrentEmployerThird").value;
var txtEmployerAddressThird = document.getElementById("ctl00_ContentPlaceHolder1_txtEmployerAddressThird").value;
var txtEmploymentThirdCity = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentThirdCity").value;
var txtEmploymentthirdPostalCode = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentthirdPostalCode").value;
var txtEmpInfoThirdTelNo = document.getElementById("ctl00_ContentPlaceHolder1_txtEmpInfoThirdTelNo").value;
var txtEmpInfoThirdFax = document.getElementById("ctl00_ContentPlaceHolder1_txtEmpInfoThirdFax").value;
var txtEmpInfoThirdEmploymentAddress = document.getElementById("ctl00_ContentPlaceHolder1_txtEmpInfoThirdEmploymentAddress").value;
var txtEmpInfoThirdCity = document.getElementById("ctl00_ContentPlaceHolder1_txtEmpInfoThirdCity").value;
var txtEmpInfoThirdTelNoPrev = document.getElementById("ctl00_ContentPlaceHolder1_txtEmpInfoThirdTelNoPrev").value;
var txtEmpInfoThirdPostalCode = document.getElementById("ctl00_ContentPlaceHolder1_txtEmpInfoThirdPostalCode").value;
var txtEmpInfoThirdPrevFax = document.getElementById("ctl00_ContentPlaceHolder1_txtEmpInfoThirdPrevFax").value;
var txtEmpInfoThirdPrevAnnualIncome = document.getElementById("ctl00_ContentPlaceHolder1_txtEmpInfoThirdPrevAnnualIncome").value;
var txtEmpInfoThirdPrevYears = document.getElementById("ctl00_ContentPlaceHolder1_txtEmpInfoThirdPrevYears").value;
var txtEmpInfoPrevThirdMonths = document.getElementById("ctl00_ContentPlaceHolder1_txtEmpInfoPrevThirdMonths").value;
var txtEmpInfoPositionThirdPrev = document.getElementById("ctl00_ContentPlaceHolder1_txtEmpInfoPositionThirdPrev").value;
var txtempInfoThirdPrevEmail = document.getElementById("ctl00_ContentPlaceHolder1_txtempInfoThirdPrevEmail").value;
var txtEmpInfoPrevThirdAnnualIncome = document.getElementById("ctl00_ContentPlaceHolder1_txtEmpInfoPrevThirdAnnualIncome").value;
var txtEmpInfoPrevThirdYears = document.getElementById("ctl00_ContentPlaceHolder1_txtEmpInfoPrevThirdYears").value;
var txtEmpInfoPrevThirdMonth = document.getElementById("ctl00_ContentPlaceHolder1_txtEmpInfoPrevThirdMonth").value;
var txtEmpInfoThirdPrevPosition = document.getElementById("ctl00_ContentPlaceHolder1_txtEmpInfoThirdPrevPosition").value;
var txtEmpInfoPrevThirdEmail = document.getElementById("ctl00_ContentPlaceHolder1_txtEmpInfoPrevThirdEmail").value;
var txtPriorityCity = document.getElementById("ctl00_ContentPlaceHolder1_txtPriorityCity").value;
var drpSubPriorityProviance = document.getElementById("ctl00_ContentPlaceHolder1_drpSubPriorityProviance").value;
var txtPriorityPostalCode = document.getElementById("ctl00_ContentPlaceHolder1_txtPriorityPostalCode").value;
var txtPropertyAddressPurchaseDate = document.getElementById("ctl00_ContentPlaceHolder1_txtPropertyAddressPurchaseDate").value;
var txtPropertyAddressPurchasePrice = document.getElementById("ctl00_ContentPlaceHolder1_txtPropertyAddressPurchasePrice").value;
var txtPropertyEstimatedCurrentValue = document.getElementById("ctl00_ContentPlaceHolder1_txtPropertyEstimatedCurrentValue").value;
var radFinancialAccPurchase = document.getElementById("ctl00_ContentPlaceHolder1_radFinancialAccPurchase").value;
var radFinancialAccRefinance = document.getElementById("ctl00_ContentPlaceHolder1_radFinancialAccRefinance").value;
var radFinancialAccEquitytakeOut = document.getElementById("ctl00_ContentPlaceHolder1_radFinancialAccEquitytakeOut").value;
var radFinancialAccsecMort = document.getElementById("ctl00_ContentPlaceHolder1_radFinancialAccsecMort").value;
var radFinancialAccOther = document.getElementById("ctl00_ContentPlaceHolder1_radFinancialAccOther").value;
var txtFinancingRequestNote = document.getElementById("ctl00_ContentPlaceHolder1_txtFinancingRequestNote").value;
 
 var txtsendingEmailAddress = document.getElementById("ctl00_ContentPlaceHolder1_txtEmailTo").value;
 
 
 var txtFaxEmpOne = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoFax").value;
 var txtFaxEmpOnePrev = document.getElementById("ctl00_ContentPlaceHolder1_txtEmploymentInfoFaxPrev").value;
 var txtFaxEmpSecond = document.getElementById("ctl00_ContentPlaceHolder1_txtEmpInfoThirdFax").value;
 var txtFaxEmpSecondPrev = document.getElementById("ctl00_ContentPlaceHolder1_txtEmpInfoThirdPrevFax").value;
 
 
 
 

  
    
 var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
 //var dateofbirth= /^((0?[13578]|10|12)(/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[01]?))(/)((19)([2-9])(\d{1})|(20)([01])(\d{1})|([8901])(\d{1}))|(0?[2469]|11)(/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[0]?))(/)((19)([2-9])(\d{1})|(20)([01])(\d{1})|([8901])(\d{1})))$;
 var txtSINum =/[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]/;;
 //var phoneRegex = /^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/;
 var phoneRegex = /^([0-9]{10})/;
 //var zipRegex = /(\d{5}(-\d{4}))?/;
 //var zipRegex = /^([0-9]{5})(-[0-9]{4})?$/;
// var zipRegex = /^[ABCEGHJ-NPRSTVXY]{1}[0-9]{1}[ABCEGHJ-NPRSTV-Z]{1}[ ]?[0-9]{1}[ABCEGHJ-NPRSTV-Z]{1}[0-9]{1}$/;
  var zipRegex = /^[A-Z]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$/;
 
 var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
 var dateOfBirth = /^\(?(\d{2})\)?[- ]?(\d{2})[- ]?(\d{4})$/;
 
 var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
 var numberRegex =  /^[0-9]+$/;


 if (txtFaxEmpOne != null) {
     if (txtFaxEmpOne != "") {
         if (!txtFaxEmpOne.match(phoneRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmploymentInfoFax', 'Invalid Fax Entered, please correct the format in the form of 1231231234', 2);
        return false;
     }
    }
 }
 else {

    return false;
 }



 if (txtFaxEmpOnePrev != null) {
     if (txtFaxEmpOnePrev != "") {
         if (!txtFaxEmpOnePrev.match(phoneRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmploymentInfoFaxPrev', 'Invalid Fax Entered, please correct the format in the form of 1231231234', 2);
        return false;
     }
    }
 }
 else {

    return false;
 }
 
 
  if (txtFaxEmpSecond != null) {
     if (txtFaxEmpSecond != "") {
         if (!txtFaxEmpSecond.match(phoneRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmpInfoThirdFax', 'Invalid Fax Entered, please correct the format in the form of 1231231234', 2);
        return false;
     }
    }
 }
 else {

    return false;
 }
 
 
 if (txtFaxEmpSecondPrev != null) {
     if (txtFaxEmpSecondPrev != "") {
         if (!txtFaxEmpSecondPrev.match(phoneRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmpInfoThirdPrevFax', 'Invalid Fax Entered, please correct the format in the form of 1231231234', 2);
        return false;
     }
    }
 }
 else {

    return false;
 }

 if (txtFirstName != null) {
     if (txtFirstName == "") {
         inlineMsg('ctl00_ContentPlaceHolder1_txtFirstName', 'Please enter First Name.', 5);
        return false;
     }
     else if (!txtFirstName.match(nameRegex)) {
     inlineMsg('ctl00_ContentPlaceHolder1_txtFirstName', 'You have entered an invalid value for first name.', 5);
        return false;
     }
 }
 else {

    return false;
 }

 if (txtLastName != null) {
     if (txtLastName == "") {
         inlineMsg('ctl00_ContentPlaceHolder1_txtLastName', 'Please enter first Name.', 2);
        return false;
     }
     else if (!txtLastName.match(nameRegex)) {
     inlineMsg('ctl00_ContentPlaceHolder1_txtLastName', 'You have entered an invalid value for last name.', 2);
        return false;
     }
 }
 else {

    return false;
 }





 
 if (testinput != null) {
     if (testinput == "") {
        
         inlineMsg('ctl00_ContentPlaceHolder1_date2', 'Please enter date of birth.', 2);
        return false;
     }
     else if (!testinput.match(dateOfBirth)) {
     inlineMsg('ctl00_ContentPlaceHolder1_date2', 'Invalid Date Entered, please correct the format in the form of "MM-DD-YYYY"', 2);
        return false;
     }

 }
 else {

    return false;
 }
 
 
 

 if (txtAppInfoPhone != null) {
     if (txtAppInfoPhone == "") {
        
         inlineMsg('ctl00_ContentPlaceHolder1_txtAppInfoPhone', 'Please enter phone.', 2);
        return false;
     }
     else if (!txtAppInfoPhone.match(phoneRegex)) {
     inlineMsg('ctl00_ContentPlaceHolder1_txtAppInfoPhone', 'Invalid Phone Entered, please correct the format in the form of 1231231234', 2);
        return false;
     }

 }
 else {

    return false;
 }
 
 
 
 if (txtsendingEmailAddress != null) {
     if (txtsendingEmailAddress == "") {
        
         inlineMsg('ctl00_ContentPlaceHolder1_txtEmailTo', 'Please enter email.', 2);
        return false;
     }
     else if (!txtsendingEmailAddress.match(emailRegex)) {
     inlineMsg('ctl00_ContentPlaceHolder1_txtEmailTo', 'You have entered an invalid value for email.', 2);
        return false;
     }

 }
 else {

    return false;
 }
 
 
 


 if (txtAppInfoDependencies != null) {
     if (txtAppInfoDependencies != "") {
         if (!txtAppInfoDependencies.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtAppInfoDependencies', 'You have entered an invalid value for # Dependants.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }



 if (txtSinApp != null) {
     if (txtSinApp != "") {
         if (!txtSinApp.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtSinApp', 'You have entered an invalid value for SIN.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }

 if (txtAppInfoCity != null) {
     if (txtAppInfoCity != "") {
         if (!txtAppInfoCity.match(nameRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtAppInfoCity', 'You have entered an invalid value for city.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }



 if (txtAppInfoPostalCode != null) {
     if (txtAppInfoPostalCode != "") {
         if (!txtAppInfoPostalCode.match(zipRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtAppInfoPostalCode', 'You have entered an invalid value for postal code.(Format: "L4B 3H7" or "L4B3H7" )', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }





 if (txtAppInfoRental != null) {
     if (txtAppInfoRental != "") {
         if (!txtAppInfoRental.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtAppInfoRental', 'You have entered an invalid rental amount.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }

 if (txtAppInfoYears != null) {
     if (txtAppInfoYears != "") {
         if (!txtAppInfoYears.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtAppInfoYears', 'You have entered an invalid value for years.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }


 if (txtAppInfoMonths != null) {
     if (txtAppInfoMonths != "") {
         if (!txtAppInfoMonths.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtAppInfoMonths', 'You have entered an invalid value for months.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }



 if (txtAppInfoCityPrev != null) {
     if (txtAppInfoCityPrev != "") {
         if (!txtAppInfoCityPrev.match(nameRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtAppInfoCityPrev', 'You have entered an invalid value for city.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }








 if (txtAppInfoPostalCodePrev != null) {
     if (txtAppInfoPostalCodePrev != "") {
         if (!txtAppInfoPostalCodePrev.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtAppInfoPostalCodePrev', 'You have entered an invalid value for postal code.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }




 if (txtAppInfoRentInfo != null) {
     if (txtAppInfoRentInfo != "") {
         if (!txtAppInfoRentInfo.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtAppInfoRentInfo', 'You have entered an invalid rental amount.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }




 if (txtAppInfoYearsPrev != null) {
     if (txtAppInfoYearsPrev != "") {
         if (!txtAppInfoYearsPrev.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtAppInfoYearsPrev', 'You have entered an invalid value for years.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }


 if (txtAppInfoPrevMonths != null) {
     if (txtAppInfoPrevMonths != "") {
         if (!txtAppInfoPrevMonths.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtAppInfoPrevMonths', 'You have entered an invalid value for months.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }



 if (txtEmploymentInfoAnnualincome != null) {
     if (txtEmploymentInfoAnnualincome != "") {
         if (!txtEmploymentInfoAnnualincome.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmploymentInfoAnnualincome', 'You have entered an invalid value for annual income.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }



 
 

 if (txtEmploymentInfoYears != null) {
     if (txtEmploymentInfoYears != "") {
         if (!txtEmploymentInfoYears.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmploymentInfoYears', 'You have entered an invalid value for years.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }


 if (txtEmploymentInfoMonths != null) {
     if (txtEmploymentInfoMonths != "") {
         if (!txtEmploymentInfoMonths.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmploymentInfoMonths', 'You have entered an invalid value for months.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }




 if (txtEmploymentInfoCity != null) {
     if (txtEmploymentInfoCity != "") {
         if (!txtEmploymentInfoCity.match(nameRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmploymentInfoCity', 'You have entered an invalid value for city.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }


 if (txtEmploymentInfoPostalCode != null) {
     if (txtEmploymentInfoPostalCode != "") {
         if (!txtEmploymentInfoPostalCode.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmploymentInfoPostalCode', 'You have entered an invalid value for postal code.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }



 if (txtEmploymentInfoTelNo != null) {
     if (txtEmploymentInfoTelNo != "") {
         if (!txtEmploymentInfoTelNo.match(phoneRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmploymentInfoTelNo', 'Invalid Phone Entered, please correct the format in the form of 1231231234', 2);
        return false;
     }
    }
 }
 else {

    return false;
 }



 if (txtEmploymentInfoPrevCity != null) {
     if (txtEmploymentInfoPrevCity != "") {
         if (!txtEmploymentInfoPrevCity.match(nameRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmploymentInfoPrevCity', 'You have entered an invalid value for city.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }



 if (txtEmploymentInfoPostalCodePrev != null) {
     if (txtEmploymentInfoPostalCodePrev != "") {
         if (!txtEmploymentInfoPostalCodePrev.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmploymentInfoPostalCodePrev', 'You have entered an invalid value for postal code.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }



 if (txtEmploymentInfoTelNoPrev != null) {
     if (txtEmploymentInfoTelNoPrev != "") {
         if (!txtEmploymentInfoTelNoPrev.match(phoneRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmploymentInfoTelNoPrev', 'Invalid Phone Entered, please correct the format in the form of 1231231234', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }




 if (txtEmploymentInfoEmail != null) {
     if (txtEmploymentInfoEmail != "") {
         if (!txtEmploymentInfoEmail.match(emailRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmploymentInfoEmail', 'You have entered an invalid value for email.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }




 if (txtEmploymentInfoAnnualIncomePrev != null) {
     if (txtEmploymentInfoAnnualIncomePrev != "") {
         if (!txtEmploymentInfoAnnualIncomePrev.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmploymentInfoAnnualIncomePrev', 'You have entered an invalid value for annual income.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }

 
 




 if (txtEmploymentInfoPrevYears != null) {
     if (txtEmploymentInfoPrevYears != "") {
         if (!txtEmploymentInfoPrevYears.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmploymentInfoPrevYears', 'You have entered an invalid value for years.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }


 if (txtEmploymentInfoPrevMonths != null) {
     if (txtEmploymentInfoPrevMonths != "") {
         if (!txtEmploymentInfoPrevMonths.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmploymentInfoPrevMonths', 'You have entered an invalid value for months.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }



 if (txtEmploymentInfoEmailPrev != null) {
     if (txtEmploymentInfoEmailPrev != "") {
         if (!txtEmploymentInfoEmailPrev.match(emailRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmploymentInfoEmailPrev', 'You have entered an invalid value for email.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }

 
 

 if (txtCoAppFirstName != null) {
     if (txtCoAppFirstName != "") {
         if (!txtCoAppFirstName.match(nameRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtCoAppFirstName', 'You have entered an invalid value for first name.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }


 if (txtCoAppLastName != null) {
     if (txtCoAppLastName != "") {
         if (!txtCoAppLastName.match(nameRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtCoAppLastName', 'You have entered an invalid value for last name.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }






 if (txtCoAppSin != null) {
     if (txtCoAppSin != "") {
         if (!txtCoAppSin.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtCoAppSin', 'You have entered an invalid value for SIN.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }





 if (txtCoAppPhone != null) {
     if (txtCoAppPhone != "") {
         if (!txtCoAppPhone.match(phoneRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtCoAppPhone', 'Invalid Phone Entered, please correct the format in the form of 1231231234', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }



 if (txtCoAppDependency != null) {
     if (txtCoAppDependency != "") {
         if (!txtCoAppDependency.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtCoAppDependency', 'You have entered an invalid value for # Dependants.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }



 if (txtCoAppCurrentCity != null) {
     if (txtCoAppCurrentCity != "") {
         if (!txtCoAppCurrentCity.match(nameRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtCoAppCurrentCity', 'You have entered an invalid value for city.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }






 if (txtCoAppRentalAmount != null) {
     if (txtCoAppRentalAmount != "") {
         if (!txtCoAppRentalAmount.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtCoAppRentalAmount', 'You have entered an invalid value for rental amount.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }

 
 

 if (txtCoAppCurrentYears != null) {
     if (txtCoAppCurrentYears != "") {
         if (!txtCoAppCurrentYears.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtCoAppCurrentYears', 'You have entered an invalid value for years.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }


 if (txtCoAppCurrentMonths != null) {
     if (txtCoAppCurrentMonths != "") {
         if (!txtCoAppCurrentMonths.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtCoAppCurrentMonths', 'You have entered an invalid value for months.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }






 if (txtCoAppCurrentCityPrev != null) {
     if (txtCoAppCurrentCityPrev != "") {
         if (!txtCoAppCurrentCityPrev.match(nameRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtCoAppCurrentCityPrev', 'You have entered an invalid value for city.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }




 
 
 


 if (txtCoAppCurrentRentalAmount != null) {
     if (txtCoAppCurrentRentalAmount != "") {
         if (!txtCoAppCurrentRentalAmount.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtCoAppCurrentRentalAmount', 'You have entered an invalid value for rental amount.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }




 if (txtCoAppCurrentYearsPrev != null) {
     if (txtCoAppCurrentYearsPrev != "") {
         if (!txtCoAppCurrentYearsPrev.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtCoAppCurrentYearsPrev', 'You have entered an invalid value for years.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }


 if (txtCoAppCurrentMonthsPrev != null) {
     if (txtCoAppCurrentMonthsPrev != "") {
         if (!txtCoAppCurrentMonthsPrev.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtCoAppCurrentMonthsPrev', 'You have entered an invalid value for months.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }





 if (txtEmploymentThirdCity != null) {
     if (txtEmploymentThirdCity != "") {
         if (!txtEmploymentThirdCity.match(nameRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmploymentThirdCity', 'You have entered an invalid value for city.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }




 if (txtEmpInfoThirdTelNo != null) {
     if (txtEmpInfoThirdTelNo != "") {
         if (!txtEmpInfoThirdTelNo.match(phoneRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmpInfoThirdTelNo', 'Invalid Phone Entered, please correct the format in the form of 1231231234', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }


 
 

 if (txtEmpInfoThirdCity != null) {
     if (txtEmpInfoThirdCity != "") {
         if (!txtEmpInfoThirdCity.match(nameRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmpInfoThirdCity', 'You have entered an invalid value for city.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }




 if (txtEmpInfoThirdTelNoPrev != null) {
     if (txtEmpInfoThirdTelNoPrev != "") {
         if (!txtEmpInfoThirdTelNoPrev.match(phoneRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmpInfoThirdTelNoPrev', 'Invalid Phone Entered, please correct the format in the form of 1231231234', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }




 if (txtEmpInfoThirdPrevAnnualIncome != null) {
     if (txtEmpInfoThirdPrevAnnualIncome != "") {
         if (!txtEmpInfoThirdPrevAnnualIncome.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmpInfoThirdPrevAnnualIncome', 'You have entered an invalid value for annual income.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }

 
 

 if (txtEmpInfoThirdPrevYears != null) {
     if (txtEmpInfoThirdPrevYears != "") {
         if (!txtEmpInfoThirdPrevYears.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmpInfoThirdPrevYears', 'You have entered an invalid value for years.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }


 if (txtEmpInfoPrevThirdMonths != null) {
     if (txtEmpInfoPrevThirdMonths != "") {
         if (!txtEmpInfoPrevThirdMonths.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmpInfoPrevThirdMonths', 'You have entered an invalid value for months.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }



 if (txtempInfoThirdPrevEmail != null) {
     if (txtempInfoThirdPrevEmail != "") {
         if (!txtempInfoThirdPrevEmail.match(emailRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtempInfoThirdPrevEmail', 'You have entered an invalid value for email.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }

 
 
 

 if (txtEmpInfoPrevThirdAnnualIncome != null) {
     if (txtEmpInfoPrevThirdAnnualIncome != "") {
         if (!txtEmpInfoPrevThirdAnnualIncome.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmpInfoPrevThirdAnnualIncome', 'You have entered an invalid value for annual income.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }




 if (txtEmpInfoPrevThirdYears != null) {
     if (txtEmpInfoPrevThirdYears != "") {
         if (!txtEmpInfoPrevThirdYears.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmpInfoPrevThirdYears', 'You have entered an invalid value for years.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }


 if (txtEmpInfoPrevThirdMonth != null) {
     if (txtEmpInfoPrevThirdMonth != "") {
         if (!txtEmpInfoPrevThirdMonth.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmpInfoPrevThirdMonth', 'You have entered an invalid value for months.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }



 if (txtEmpInfoPrevThirdEmail != null) {
     if (txtEmpInfoPrevThirdEmail != "") {
         if (!txtEmpInfoPrevThirdEmail.match(emailRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtEmpInfoPrevThirdEmail', 'You have entered an invalid value for email.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }




 
 

 if (txtPriorityCity != null) {
     if (txtPriorityCity != "") {
         if (!txtPriorityCity.match(nameRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtPriorityCity', 'You have entered an invalid value for city.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }

 if (txtPropertyAddressPurchasePrice != null) {
     if (txtPropertyAddressPurchasePrice != "") {
         if (!txtPropertyAddressPurchasePrice.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtPropertyAddressPurchasePrice', 'You have entered an invalid value for purchase price.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }




 if (txtPropertyEstimatedCurrentValue != null) {
     if (txtPropertyEstimatedCurrentValue != "") {
         if (!txtPropertyEstimatedCurrentValue.match(numberRegex)) {
             inlineMsg('ctl00_ContentPlaceHolder1_txtPropertyEstimatedCurrentValue', 'You have entered an invalid value for estimated current value.', 2);
            return false;
         }
     }
 }
 else {

    return false;
 }




return  retValue;

}


  






var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	 var txtLastWorkDate = document.getElementById("ctl00_MainContent_txtLastWorkDate").value

	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
	
	    inlineMsg('ctl00_MainContent_txtLastWorkDate','The date format should be : mm/dd/yyyy.',2)

		
		return false;
	}
	if (strMonth.length<1 || month<1 || month>12){
	inlineMsg('ctl00_MainContent_txtLastWorkDate','Please enter a valid month',2)
		
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		
			inlineMsg('ctl00_MainContent_txtLastWorkDate','Please enter a valid day',2)

		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		inlineMsg('ctl00_MainContent_txtLastWorkDate','Please enter a valid 4 digit year between '+minYear+' and '+maxYear,2)

		
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
			inlineMsg('ctl00_MainContent_txtLastWorkDate','Please enter a valid date',2)

		return false
	}
return true
}

















   





function checkdate(input){
var validformat=/^\d{4}\/\d{2}\/\d{2}$/ //Basic check for format validity
var returnval=false
if (validformat.test(input.value))
{
alert("Invalid Date Format. Please correct and submit again.")
return false;
}
else
{
//Detailed check for valid date ranges
var yearfield=input.value.split("/")[0]
var monthfield=input.value.split("/")[1]
var dayfield=input.value.split("/")[2]
var dayobj = new Date(yearfield, monthfield-1, dayfield)
if ((dayobj.getMonth()+1!=monthfield)||(dayobj.getDate()!=dayfield)||(dayobj.getFullYear()!=yearfield))
alert("Invalid Day, Month, or Year range detected. Please correct and submit again.")
else
returnval=true
}
if (returnval==false) input.select()
return returnval
}


















function validate_step1()
{
var contact_name = document.getElementById("ctl00_MainContent_contact_name").value;
  
  var contact_lastname = document.getElementById("ctl00_MainContent_contact_lastname").value;
 var contact_email = document.getElementById("ctl00_MainContent_contact_email").value;
  var contact_address = document.getElementById("ctl00_MainContent_contact_address").value;
   var contact_city = document.getElementById("ctl00_MainContent_contact_city").value;
  var contact_state = document.getElementById("ctl00_MainContent_contact_state").value;
  var contact_zip = document.getElementById("ctl00_MainContent_contact_zip").value;
   var contact_country = document.getElementById("ctl00_MainContent_contact_country").value;
   var contact_phone = document.getElementById("ctl00_MainContent_contact_phone").value;
  
   var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
  var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
  var zipRegex = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
  var phoneRegex = /^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/;
  var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
  var numberRegex =  /([0-9]+)/;
  
  
   if(contact_name == "") {
    inlineMsg('ctl00_MainContent_contact_name','You must enter your name.',2);
    return false;
  }
  if(!contact_name.match(nameRegex)) {
    inlineMsg('ctl00_MainContent_contact_name','You have entered an invalid name.',2);
    return false;
  }
  // CONTACT LAST NAME
  if(contact_lastname == "") {
    inlineMsg('ctl00_MainContent_contact_lastname','You must enter your last name.',2);
    return false;
  }
  if(!contact_lastname.match(nameRegex)) {
    inlineMsg('ctl00_MainContent_contact_lastname','You have entered an invalid last name.',2);
    return false;
  }
  // CONTACT EMAIL
  if(contact_email == "") {
    inlineMsg('ctl00_MainContent_contact_email','You must enter your email.',2);
    return false;
  }
  if(!contact_email.match(emailRegex)) {
    inlineMsg('ctl00_MainContent_contact_email','You have entered an invalid email.',2);
    return false;
  }
  // CONTACT ADDRESS
  if(contact_address == "") {
    inlineMsg('ctl00_MainContent_contact_address','You must enter your address.',2);
    return false;
  }
  // CONTACT CITY
  if(contact_city == "") {
    inlineMsg('ctl00_MainContent_contact_city','You must enter your city.',2);
    return false;
  }
  if(!contact_city.match(nameRegex)) {
    inlineMsg('ctl00_MainContent_contact_city','You have entered an invalid city name.',2);
    return false;
  }
  // CONTACT STATE
  if(contact_state == "") {
    inlineMsg('ctl00_MainContent_contact_state','You must select your state.',2);
    return false;
  }
  // CONTACT ZIP
  if(contact_zip == "") {
    inlineMsg('ctl00_MainContent_contact_zip','You must enter your zip code.',2);
    return false;
  }
  if(!contact_zip.match(zipRegex)) {
    inlineMsg('ctl00_MainContent_contact_zip','You have entered an invalid zip code.',2);
    return false;
  }
  // CONTACT COUNTRY

  
  if(contact_country == 'Please select') {
    inlineMsg('ctl00_MainContent_contact_country','You must select your country.',2);
    return false;
  }
  
  //United States
  //Km.soomro
  if(contact_country == 'United States') {
      if(contact_state == 'Please Select State') {
        inlineMsg('ctl00_MainContent_contact_state','You must select your state.',2);
        return false;
      }
       
  }
  else
    phoneRegex = numberRegex // replace phone regular expression
  
  
  
  
  // CONTACT PHONE NUMBER
  if(contact_phone == "") {
    inlineMsg('ctl00_MainContent_contact_phone','You must enter your phone number.',2);
    return false;
  }
  if(!contact_phone.match(phoneRegex)) {
    inlineMsg('ctl00_MainContent_contact_phone','You have entered an invalid phone number.',2);
    return false;
  }
  
}
function validate() 
{
   
  //var product = form.product.value;
  var cardtype = document.getElementById("cardtype").value;
  
 
 

 
 
 
  var credit_card = document.getElementById("ctl00_MainContent_credit_card").value;
  var csc = document.getElementById("ctl00_MainContent_csc").value;
  var address = document.getElementById("ctl00_MainContent_address").value;
  var name = document.getElementById("ctl00_MainContent_name").value;
  var expmonth = document.getElementById("ctl00_MainContent_expmonth").value;
  var expyear = document.getElementById("ctl00_MainContent_expyear").value;
  var lastname = document.getElementById("ctl00_MainContent_lastname").value;
  var city = document.getElementById("ctl00_MainContent_city").value;
  var state = document.getElementById("ctl00_MainContent_state").value;
  var zip = document.getElementById("ctl00_MainContent_zip").value;
  var country = document.getElementById("ctl00_MainContent_country").value;
  var phone = document.getElementById("ctl00_MainContent_phone").value;
  var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
  var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
  var zipRegex = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
  var phoneRegex = /^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/;
  var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
  var numberRegex =  /([0-9]+)/;
  // PRODUCT
 
  
  


  //if(product == "") {
  //  inlineMsg('product','You must choose a product.',2);
    // VISIBILITY: hidden; WIDTH: 1px
  //  return false;
 // }

//alert(contact_name);
  // CONTACT NAME
 
  // CREDIT CARD TYPE
  //if(cardtype == "") {
  //  inlineMsg('cardtype','You must select your card type.',2);
  //  return false;
  //}
  
  
  // CREDIT CARD NUMBER
  if(credit_card == "") {
    inlineMsg('ctl00_MainContent_credit_card','You must enter your credit card number.',2);
    return false;
  }
  if(!credit_card.match(numberRegex)) {
    inlineMsg('ctl00_MainContent_credit_card','You have entered an invalid credit card number.',2);
    return false;
  }
  // EXPIRATION DATE - MONTH
  if(expmonth == 'Please Select Month') {
    inlineMsg('ctl00_MainContent_expmonth','You must select your card expiration month.',2);
    return false;
  }
  // EXPIRATION DATE - YEAR
  if(expyear == 'Please Select Year') {
    inlineMsg('ctl00_MainContent_expyear','You must select your card expiration year.',2);
    return false;
  }
  // CSC
  if(csc == "") {
    inlineMsg('ctl00_MainContent_csc','You must enter your CSC number.',2);
    return false;
  }
  // PAYMENT ADDRESS
  if(address == "") {
    inlineMsg('ctl00_MainContent_address','You must enter your address.',2);
    return false;
  }
  // PAYMENT NAME
  if(name == "") {
    inlineMsg('ctl00_MainContent_name','You must enter your name.',2);
    return false;
  }
  if(!name.match(nameRegex)) {
    inlineMsg('ctl00_MainContent_name','You have entered an invalid name.',2);
    return false;
  }
  // PAYMENT LAST NAME
  if(lastname == "") {
    inlineMsg('ctl00_MainContent_lastname','You must enter your last name.',2);
    return false;
  }
  if(!lastname.match(nameRegex)) {
    inlineMsg('ctl00_MainContent_lastname','You have entered an invalid last name.',2);
    return false;
  }
  // PAYMENT CITY
  if(city == "") {
    inlineMsg('ctl00_MainContent_city','You must select your city.',2);
    return false;
  }
  if(!city.match(nameRegex)) {
    inlineMsg('ctl00_MainContent_city','You have entered an invalid city name.',2);
    return false;
  }
  // PAYMENT STATE
  if(state == "") {
    inlineMsg('ctl00_MainContent_state','You must select your state.',2);
    return false;
  }
  // PAYMENT ZIP
  if(zip == "") {
    inlineMsg('ctl00_MainContent_zip','You must enter your zip code.',2);
    return false;
  }
  if(!zip.match(zipRegex)) {
    inlineMsg('ctl00_MainContent_zip','You have entered an invalid zip code.',2);
    return false;
  }
  // PAYMENT COUNTRY
  if(country == 'Please select') {
    inlineMsg('ctl00_MainContent_country','You must select your country.',2);
    return false;
  }
  
  if(country == 'United States') {
      if(state == 'Please Select State') {
        inlineMsg('ctl00_MainContent_state','You must select your state.',2);
        return false;
      }
  }
  else
    phoneRegex = numberRegex // replace phone regular expression

  
  
  // PAYMENT PHONE NUMBER
  if(phone == "") {
    inlineMsg('ctl00_MainContent_phone','You must enter your phone number.',2);
    return false;
  }
  if(!phone.match(phoneRegex)) {
    inlineMsg('ctl00_MainContent_phone','You have entered an invalid phone number.',2);
    return false;
  }


  // END
  return true;
}





// form validation function //
function validate_logedin() 
{
  var cardtype = document.getElementById("cardtype").value;
  var contact_name = document.getElementById("ctl00_MainContent_contact_name").value;
  var contact_lastname = document.getElementById("ctl00_MainContent_contact_lastname").value;
  var contact_email = document.getElementById("ctl00_MainContent_contact_email").value;
  var contact_address = document.getElementById("ctl00_MainContent_contact_address").value;
  var contact_city = document.getElementById("ctl00_MainContent_contact_city").value;
  var contact_state = document.getElementById("ctl00_MainContent_contact_state").value;
  var contact_zip = document.getElementById("ctl00_MainContent_contact_zip").value;
  var contact_country = document.getElementById("ctl00_MainContent_contact_country").value;
  var contact_phone = document.getElementById("ctl00_MainContent_contact_phone").value;
  var credit_card = document.getElementById("ctl00_MainContent_credit_card").value;
  var csc = document.getElementById("ctl00_MainContent_csc").value;
  var address = document.getElementById("ctl00_MainContent_address").value;
  var name = document.getElementById("ctl00_MainContent_name").value;
  var expmonth = document.getElementById("ctl00_MainContent_expmonth").value;
  var expyear = document.getElementById("ctl00_MainContent_expyear").value;
  var lastname = document.getElementById("ctl00_MainContent_lastname").value;
  var city = document.getElementById("ctl00_MainContent_city").value;
  var state = document.getElementById("ctl00_MainContent_state").value;
  var zip = document.getElementById("ctl00_MainContent_zip").value;
  var country = document.getElementById("ctl00_MainContent_country").value;
  var phone = document.getElementById("ctl00_MainContent_phone").value;
  
  var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
  var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
  var zipRegex = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
  var phoneRegex = /^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/;
  var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
  var numberRegex =  /([0-9]+)/;


  // CONTACT NAME
  if(contact_name == "") {
    inlineMsg('ctl00_MainContent_contact_name','You must enter your name.',2);
    return false;
  }
  if(!contact_name.match(nameRegex)) {
    inlineMsg('ctl00_MainContent_contact_name','You have entered an invalid name.',2);
    return false;
  }
  // CONTACT LAST NAME
  if(contact_lastname == "") {
    inlineMsg('ctl00_MainContent_contact_lastname','You must enter your last name.',2);
    return false;
  }
  if(!contact_lastname.match(nameRegex)) {
    inlineMsg('ctl00_MainContent_contact_lastname','You have entered an invalid last name.',2);
    return false;
  }
  // CONTACT EMAIL
  if(contact_email == "") {
    inlineMsg('ctl00_MainContent_contact_email','You must enter your email.',2);
    return false;
  }
  if(!contact_email.match(emailRegex)) {
    inlineMsg('ctl00_MainContent_contact_email','You have entered an invalid email.',2);
    return false;
  }
  // CONTACT ADDRESS
  if(contact_address == "") {
    inlineMsg('ctl00_MainContent_contact_address','You must enter your address.',2);
    return false;
  }
  // CONTACT CITY
  if(contact_city == "") {
    inlineMsg('ctl00_MainContent_contact_city','You must enter your city.',2);
    return false;
  }
  if(!contact_city.match(nameRegex)) {
    inlineMsg('ctl00_MainContent_contact_city','You have entered an invalid city name.',2);
    return false;
  }
  // CONTACT STATE
  if(contact_state == "") {
    inlineMsg('ctl00_MainContent_contact_state','You must select your state.',2);
    return false;
  }
  // CONTACT ZIP
  if(contact_zip == "") {
    inlineMsg('ctl00_MainContent_contact_zip','You must enter your zip code.',2);
    return false;
  }
  if(!contact_zip.match(zipRegex)) {
    inlineMsg('ctl00_MainContent_contact_zip','You have entered an invalid zip code.',2);
    return false;
  }
  // CONTACT COUNTRY
  if(contact_country == 'Please select') {
    inlineMsg('ctl00_MainContent_contact_country','You must select your country.',2);
    return false;
  }
  
  if(contact_country == 'United States') {
      if(contact_state == 'Please Select State') {
        inlineMsg('ctl00_MainContent_contact_state','You must select your state.',2);
        return false;
      }
       
  }
  else
    phoneRegex = numberRegex // replace phone regular expression

  
  
  
  // CONTACT PHONE NUMBER
  if(contact_phone == "") {
    inlineMsg('ctl00_MainContent_contact_phone','You must enter your phone number.',2);
    return false;
  }
  if(!contact_phone.match(phoneRegex)) {
    inlineMsg('ctl00_MainContent_contact_phone','You have entered an invalid phone number.',2);
    return false;
  }
  
  // CREDIT CARD TYPE
  //if(cardtype == "") {
  //  inlineMsg('cardtype','You must select your card type.',2);
  //  return false;
  //}
  
  
  // CREDIT CARD NUMBER
  if(credit_card == "") {
    inlineMsg('ctl00_MainContent_credit_card','You must enter your credit card number.',2);
    return false;
  }
  if(!credit_card.match(numberRegex)) {
    inlineMsg('ctl00_MainContent_credit_card','You have entered an invalid credit card number.',2);
    return false;
  }
  // EXPIRATION DATE - MONTH
  if(expmonth == 'Please Select Month') {
    inlineMsg('ctl00_MainContent_expmonth','You must select your card expiration month.',2);
    return false;
  }
  // EXPIRATION DATE - YEAR
  if(expyear == 'Please Select Year') {
    inlineMsg('ctl00_MainContent_expyear','You must select your card expiration year.',2);
    return false;
  }
  // CSC
  if(csc == "") {
    inlineMsg('ctl00_MainContent_csc','You must enter your CSC number.',2);
    return false;
  }
  // PAYMENT ADDRESS
  if(address == "") {
    inlineMsg('ctl00_MainContent_address','You must enter your address.',2);
    return false;
  }
  // PAYMENT NAME
  if(name == "") {
    inlineMsg('ctl00_MainContent_name','You must enter your name.',2);
    return false;
  }
  if(!name.match(nameRegex)) {
    inlineMsg('ctl00_MainContent_name','You have entered an invalid name.',2);
    return false;
  }
  // PAYMENT LAST NAME
  if(lastname == "") {
    inlineMsg('ctl00_MainContent_lastname','You must enter your last name.',2);
    return false;
  }
  if(!lastname.match(nameRegex)) {
    inlineMsg('ctl00_MainContent_lastname','You have entered an invalid last name.',2);
    return false;
  }
  // PAYMENT CITY
  if(city == "") {
    inlineMsg('ctl00_MainContent_city','You must select your city.',2);
    return false;
  }
  if(!city.match(nameRegex)) {
    inlineMsg('ctl00_MainContent_city','You have entered an invalid city name.',2);
    return false;
  }
  // PAYMENT STATE
  if(state == "") {
    inlineMsg('ctl00_MainContent_state','You must select your state.',2);
    return false;
  }
  // PAYMENT ZIP
  if(zip == "") {
    inlineMsg('ctl00_MainContent_zip','You must enter your zip code.',2);
    return false;
  }
  if(!zip.match(zipRegex)) {
    inlineMsg('ctl00_MainContent_zip','You have entered an invalid zip code.',2);
    return false;
  }
  // PAYMENT COUNTRY
  if(country == 'Please select') {
    inlineMsg('ctl00_MainContent_country','You must select your country.',2);
    return false;
  }
  
  if(country == 'United States') {
      if(state == 'Please Select State') {
        inlineMsg('ctl00_MainContent_state','You must select your state.',2);
        return false;
      }
  }
  else
    phoneRegex = numberRegex // replace phone regular expression
    
  
  // PAYMENT PHONE NUMBER
  if(phone == "") {
    inlineMsg('ctl00_MainContent_phone','You must enter your phone number.',2);
    return false;
  }
  if(!phone.match(phoneRegex)) {
    inlineMsg('ctl00_MainContent_phone','You have entered an invalid phone number.',2);
    return false;
  }


  // END
  return true;
}



/*AJ*/

// form validation function //
function validate_PasswordReset() {
 
  
  var txtEmailAddress = document.getElementById("ctl00_MainContent_txtEmailAddress").value;
  
  var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
  
  var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
  var numberRegex =  /([0-9]+)/;


  // CONTACT EMAIL
  if(txtEmailAddress == "") {
    inlineMsg('ctl00_MainContent_txtEmailAddress','You must enter your email.',2);
    return false;
  }
  if(!txtEmailAddress.match(emailRegex)) {
    inlineMsg('ctl00_MainContent_txtEmailAddress','You have entered an invalid email.',2);
    return false;
  }

  // END
  return true;
}

//validate_ForgetPassword


// form validation function //
function validate_ForgetPassword() {
   
  var email = document.getElementById("ctl00_MainContent_email").value;
  var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
  // CONTACT EMAIL
  if(email == "") {
    inlineMsg('ctl00_MainContent_email','You must enter your email.',2);
    return false;
  }
  if(!email.match(emailRegex)) {
    inlineMsg('ctl00_MainContent_email','You have entered an invalid email.',2);
    return false;
  }
  
  return true;
}





// form validation function //
function validate_ChangePassword() {
 
  
  var txtOldPassword = document.getElementById("ctl00_MainContent_txtOldPassword").value;
  var txtNewPassword = document.getElementById("ctl00_MainContent_txtNewPassword").value;
  var txtConfirmPassword = document.getElementById("ctl00_MainContent_txtConfirmPassword").value;
  
  
  var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
  
  var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
  var numberRegex =  /([0-9]+)/;


  // Old Password
  if(txtOldPassword == "") {
    inlineMsg('ctl00_MainContent_txtOldPassword','You must enter your Old Password.',2);
    return false;
  }
  
  // New Password
  if(txtNewPassword == "") {
    inlineMsg('ctl00_MainContent_txtNewPassword','You must enter your New Password.',2);
    return false;
  }
  
  // Confirm Password
  if(txtConfirmPassword == "") {
    inlineMsg('ctl00_MainContent_txtConfirmPassword','You must enter your Confirm Password.',2);
    return false;
  }
  
  if(!txtNewPassword.match(txtConfirmPassword)) {
    inlineMsg('ctl00_MainContent_txtNewPassword','You must enter Confirm and new passwords same.',2);
    return false;
  }
  
//  if(!txtConfirmPassword.match(txtNewPassword)) {
//    inlineMsg('txtConfirmPassword','You must enter Confirm and new passwords same.',2);
//    return false;
//  }
  
  
  
//  if(!txtEmailAddress.match(emailRegex)) {
//    inlineMsg('txtEmailAddress','You have entered an invalid email.',2);
//    return false;
//  }

  // END
  return true;
}
/*AJ*/

// START OF MESSAGE SCRIPT //

var MSGTIMER = 20;
var MSGSPEED = 5;
var MSGOFFSET = 3;
var MSGHIDE = 3;

// build out the divs, set attributes and call the fade function //
function inlineMsg(target,string,autohide) {
  var msg;
  var msgcontent;
  if(!document.getElementById('msg')) 
  {

    msg = document.createElement('div');
    msg.id = 'msg';
    msg.nowrap="nowrap";
    msg.setAttribute("WIDTH","500PX");
    msgcontent = document.createElement('div');
    msgcontent.id = 'msgcontent';
    
    document.body.appendChild(msg);
    msg.appendChild(msgcontent);
    msg.style.filter = 'alpha(opacity=0)';
    msg.style.opacity = 0;
    
    msg.alpha = 0;
   
  } else {
 
    msg = document.getElementById('msg');
    msgcontent = document.getElementById('msgcontent');
  }
  msgcontent.innerHTML = string;
  msg.style.display = 'block';
  var msgheight = msg.offsetHeight;
 
  var targetdiv = document.getElementById(target);
  

  targetdiv.focus();
  var targetheight = targetdiv.offsetHeight;
  var targetwidth = targetdiv.offsetWidth;
  var topposition = topPosition(targetdiv) - ((msgheight - targetheight) / 2);
  var leftposition = leftPosition(targetdiv) + targetwidth + MSGOFFSET;
  msg.style.top = topposition + 'px';
  msg.style.left = leftposition + 'px';
  clearInterval(msg.timer);
  msg.timer = setInterval("fadeMsg(1)", MSGTIMER);
  if(!autohide) {
    autohide = MSGHIDE;  
  }
  window.setTimeout("hideMsg()", (autohide * 1000));
}

// hide the form alert //
function hideMsg(msg) {
  var msg = document.getElementById('msg');
  if(!msg.timer) {
    msg.timer = setInterval("fadeMsg(0)", MSGTIMER);
  }
}

// face the message box //
function fadeMsg(flag) {
  if(flag == null) {
    flag = 1;
  }
  var msg = document.getElementById('msg');
  var value;
  if(flag == 1) {
    value = msg.alpha + MSGSPEED;
  } else {
    value = msg.alpha - MSGSPEED;
  }
  msg.alpha = value;
  msg.style.opacity = (value / 100);
  msg.style.filter = 'alpha(opacity=' + value + ')';
  if(value >= 99) {
    clearInterval(msg.timer);
    msg.timer = null;
  } else if(value <= 1) {
    msg.style.display = "none";
    clearInterval(msg.timer);
  }
}

// calculate the position of the element in relation to the left of the browser //
function leftPosition(target) {
  var left = 0;
  if(target.offsetParent) {
    while(1) {
      left += target.offsetLeft;
      if(!target.offsetParent) {
        break;
      }
      target = target.offsetParent;
    }
  } else if(target.x) {
    left += target.x;
  }
  return left;
}

// calculate the position of the element in relation to the top of the browser window //
function topPosition(target) {
  var top = 0;
  if(target.offsetParent) {
    while(1) {
      top += target.offsetTop;
      if(!target.offsetParent) {
        break;
      }
      target = target.offsetParent;
    }
  } else if(target.y) {
    top += target.y;
  }
  return top;
}

// preload the arrow //
if(document.images) {
  arrow = new Image(7,80); 
  arrow.src = "msg_arrow.gif"; 
}

function validateCheckupForm() 
{
   
  //var product = form.product.value;
  var cardtype = document.getElementById("cardtype").value;
  var contact_name = document.getElementById("txtFName").value;
  
  var contact_lastname = document.getElementById("txtLName").value;
  var contact_email = document.getElementById("txtEmail").value;
  var contact_address = document.getElementById("txtBillingAddr1").value;
  var contact_city = document.getElementById("txtCity").value;
  var contact_state = document.getElementById("contactState").value;
  var contact_zip = document.getElementById("txtZipCode").value;
  var contact_country = document.getElementById("contactCountry").value;
  var contact_phone = document.getElementById("txtHomeTelePh").value;
  var credit_card = document.getElementById("txtCreditCard").value;
  var csc = document.getElementById("txtSecurityCd").value;  
  var expmonth = document.getElementById("expMonth").value;
  var expyear = document.getElementById("expYear").value;
  var Qty = document.getElementById("txtQty").value;
   
  var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
  var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
  var zipRegex = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
  var phoneRegex = /^[0-9]\d{2}-\d{3}-\d{4}$/;
  var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
  var numberRegex =  /([0-9]+)/;
  // PRODUCT
 
  
    chosen = ""
    
   
  if(contact_name == "") {
    inlineMsg('txtFName','You must enter your name.',2);
    return false;
  }
  if(!contact_name.match(nameRegex)) {
    inlineMsg('txtFName','You have entered an invalid name.',2);
    return false;
  }
  // CONTACT LAST NAME
  if(contact_lastname == "") {
    inlineMsg('txtLName','You must enter your last name.',2);
    return false;
  }
  if(!contact_lastname.match(nameRegex)) {
    inlineMsg('txtLName','You have entered an invalid last name.',2);
    return false;
  }
  
  // CONTACT PHONE NUMBER
  if(contact_phone == "") {
    inlineMsg('txtHomeTelePh','You must enter your phone number.',2);
    return false;
  }
  if(!contact_phone.match(phoneRegex)) {
    inlineMsg('txtHomeTelePh','You have entered an invalid phone number.',2);
    return false;
  }
  
  // CONTACT EMAIL
  if(contact_email == "") {
    inlineMsg('txtEmail','You must enter your email.',2);
    return false;
  }
  if(!contact_email.match(emailRegex)) {
    inlineMsg('txtEmail','You have entered an invalid email.',2);
    return false;
  }
  
  // CREDIT CARD TYPE
//  if(cardtype == "") {
//  alert(cardtype.value);
//    return false;
//  }
  
  // CREDIT CARD NUMBER
  if(credit_card == "") {
    inlineMsg('txtCreditCard','You must enter your credit card number.',2);
    return false;
  }
  if(!credit_card.match(numberRegex)) {
    inlineMsg('txtCreditCard','You have entered an invalid credit card number.',2);
    return false;
  }
  
  // EXPIRATION DATE - MONTH
  if(expmonth == 'Please Select Month') {
    inlineMsg('expmonth','You must select your card expiration month.',2);
    return false;
  }
  // EXPIRATION DATE - YEAR
  if(expyear == 'Please Select Year') {
    inlineMsg('expyear','You must select your card expiration year.',2);
    return false;
  }
  
  // CSC
  if(csc == "") {
    inlineMsg('txtSecurityCd','You must enter your CSC number.',2);
    return false;
  }
  
  // CONTACT ADDRESS
  if(contact_address == "") {
    inlineMsg('txtBillingAddr1','You must enter your address.',2);
    return false;
  }
  // CONTACT CITY
  if(contact_city == "") {
    inlineMsg('txtCity','You must enter your city.',2);
    return false;
  }
  if(!contact_city.match(nameRegex)) {
    inlineMsg('txtCity','You have entered an invalid city name.',2);
    return false;
  }
  // CONTACT STATE
  if(contact_state == "") {
    inlineMsg('contact_state','You must select your state.',2);
    return false;
  }
  // CONTACT ZIP
  if(contact_zip == "") {
    inlineMsg('txtZipCode','You must enter your zip code.',2);
    return false;
  }
  if(!contact_zip.match(zipRegex)) {
    inlineMsg('txtZipCode','You have entered an invalid zip code.',2);
    return false;
  }
  // CONTACT COUNTRY

  
  if(contact_country == 'Please select') {
    inlineMsg('contact_country','You must select your country.',2);
    return false;
  }
  
  //United States
  //Km.soomro
  if(contact_country == 'United States') {
      if(contact_state == 'Please Select State') {
        inlineMsg('contact_state','You must select your state.',2);
        return false;
      }
       
  }
  else
    phoneRegex = numberRegex // replace phone regular expression
  
  
  
  
  
  
  
  
  
  
  if(Qty=="0")
  {
   inlineMsg('txtQty','You must enter quantity .',2);
    return false;
  }
  if(!Qty.match(numberRegex)) {
    inlineMsg('txtQty','You have entered an invalid quantity.',2);
    return false;
  }

  // END
  return true;
}


function TransactionDateValidation()
{
 

var rdDate = document.getElementById("ctl00_ContentPlaceHolder1_rdodate").checked;
 var rdDateRange = document.getElementById("ctl00_ContentPlaceHolder1_rdoDateRangeTo").checked;
 var fromDate = document.getElementById("ctl00_ContentPlaceHolder1_txtDateRangeFrom").value; 
 var toDate = document.getElementById("ctl00_ContentPlaceHolder1_txtDateRangeTo").value; 
 if(rdDate== false && rdDateRange == false )
 {
  inlineMsg('ctl00_ContentPlaceHolder1_rdodate','Please select atleast one radio button',2);
    return false;
 }
 
if(rdDateRange ==true )
{
    if(fromDate == "")
    {
        inlineMsg('ctl00_ContentPlaceHolder1_txtDateRangeFrom','Please enter from date',2);
        return false;
    }
    else if(toDate == "")
    {
        inlineMsg('ctl00_ContentPlaceHolder1_txtDateRangeTo','Please enter to date',2);
        return false;
    }
}
   //return true ;
}


