﻿// JScript File


var Prefix;
 function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

         return true;
      }
      
      
 function Chk_Field()
   {
           var txtPhone1=document.getElementById (Prefix+"txtPhone1");
           var txtPhone2=document.getElementById (Prefix+"txtPhone2");
           var txtPhone3=document.getElementById (Prefix+"txtPhone3");
           var txtfax1=document.getElementById (Prefix+"txtfax1");
           var txtfax2=document.getElementById (Prefix+"txtfax2");
           var txtfax3=document.getElementById (Prefix+"txtfax3");
           var txtnphone1=document.getElementById (Prefix+"txtnphone1");
           var txtnphone2=document.getElementById (Prefix+"txtnphone2");
           var txtnphone3=document.getElementById (Prefix+"txtnphone3");
         
              var validated = Page_ClientValidate("VGBond");
              if(validated)
              {
                 if(txtPhone1.value !="" &&(txtPhone2.value ==""||txtPhone3.value ==""))
                     {
                       alert("Phone no is not valid!all three fields are complusory");
                       txtPhone1.focus ();
                       return false;                    
                     }
                  if(txtPhone2.value !="" &&(txtPhone1.value ==""||txtPhone3.value ==""))
                     {
                         alert("Phone no is not valid!all three fields are complusory");
                         txtPhone1.focus ();
                         return false;
                     }
                  if(txtPhone3.value !="" &&(txtPhone1.value ==""||txtPhone2.value ==""))
                     {
                       alert("Phone no is not valid!all three fields are complusory");
                       txtPhone1.focus ();
                       return false;
                     }
                 
                 //phone night
                 
                  if(txtnphone1.value !="" &&(txtnphone2.value ==""||txtnphone3.value ==""))
                     {
                          alert("Night Phone no is not valid!all three fields are complusory");
                          txtPhone1.focus ();
                          return false
                        
                     }
                  if(txtnphone2.value !="" &&(txtnphone1.value ==""||txtnphone3.value ==""))
                     {
                         alert("Night Phone no is not valid!all three fields are complusory");
                         txtPhone1.focus ();
                         return false
                     }
                  if(txtnphone3.value !="" &&(txtnphone1.value ==""||txtnphone2.value ==""))
                     {
                          alert("Night no is not valid!all three fields are complusory");
                          txtPhone1.focus ();
                          return false
                     }
                 //Fax
              if(txtfax1.value !="" &&(txtfax2.value ==""||txtfax3.value ==""))
                 {
                   alert("Fax no is not valid!all three fields are complusory");
                   txtfax1.focus ();
                   return false
                 }
               if(txtfax2.value !="" &&(txtfax1.value ==""||txtfax3.value ==""))
                 {
                   alert("Fax no is not valid!all three fields are complusory");
                   txtfax1.focus ();
                   return false
                 }
             if(txtfax3.value !="" &&(txtfax1.value ==""||txtfax2.value ==""))
                 {
                      alert("Fax no is not valid!all three fields are complusory");
                      txtfax1.focus ();
                      return false
                 }
        
        
                var hdnCity=document.getElementById (Prefix+"hdnCity");
               var hdnState=document.getElementById (Prefix+"hdnState");
             
               var ddlCity=document.getElementById (Prefix+"ddlCity");
               var ddlState=document.getElementById (Prefix+"ddlState");
                hdnCity.value=ddlCity.value;
               hdnState.value=ddlState.value;
          }
          return true;
  }
   

function date_reset()
{

  var txtCompanyname=document.getElementById (Prefix+"txtCompanyname");
  var txtfname=document.getElementById (Prefix+"txtfname");
  var txtlname=document.getElementById (Prefix+"txtlname");
  var txtEmail=document.getElementById (Prefix+"txtEmail");
  var txtStreet=document.getElementById (Prefix+"txtStreet");
  var txtCity=document.getElementById (Prefix+"txtCity");
  var txtCounty=document.getElementById (Prefix+"txtCounty");
  var ddlState=document.getElementById (Prefix+"ddlState");
  var txtZip=document.getElementById (Prefix+"txtZip");
  var txtPhone1=document.getElementById (Prefix+"txtPhone1");
  var txtPhone2=document.getElementById (Prefix+"txtPhone2");
  var txtPhone3=document.getElementById (Prefix+"txtPhone3");
  var txtnphone1=document.getElementById (Prefix+"txtnphone1");
  var txtnphone2=document.getElementById (Prefix+"txtnphone2");
  var txtnphone3=document.getElementById (Prefix+"txtnphone3");
  var txtfax1=document.getElementById (Prefix+"txtfax1");
  var txtfax2=document.getElementById (Prefix+"txtfax2");
  var txtfax3=document.getElementById (Prefix+"txtfax3");
  var  ddlBussinessType=document.getElementById (Prefix+"ddlBussinessType");
  var txtBType=document.getElementById (Prefix+"txtBType");
  var  txtJobDesc=document.getElementById (Prefix+"txtJobDesc");
  var txtEstablishedYr=document.getElementById (Prefix+"txtEstablishedYr");
  var  txtBondType=document.getElementById (Prefix+"txtBondType");
  var txtBondValue=document.getElementById (Prefix+"txtBondValue");
  
 txtCompanyname.value ="";
 txtfname.value =""
 txtlname.value ="";
 txtEmail.value ="";
  txtStreet.value ="";
  txtCity.value ="";
   txtCounty.value ="";
  ddlState.value ="";
 txtZip.value ="";
  txtPhone1.value="";
   txtPhone2.value="";
   txtPhone3.value="";
   txtnphone1.value="";
   txtnphone2.value="";
   txtnphone3.value="";
  txtfax1.value="";
  txtfax2.value="";
  txtfax3.value="";
  ddlBussinessType.value="";
  txtBType.value="";
   txtJobDesc.value="";
  txtEstablishedYr.value="";
  txtBondType.value="";
   txtBondValue.value="";
}

    


  function Chk_HealthField1()
    {
              
        var txtPhone1=document.getElementById (Prefix+"txtPhone1");
        var txtPhone2=document.getElementById (Prefix+"txtPhone2");
        var txtPhone3=document.getElementById (Prefix+"txtPhone3");
       var txtfax1=document.getElementById (Prefix+"txtfax1");
       var txtfax2=document.getElementById (Prefix+"txtfax2");
       var txtfax3=document.getElementById (Prefix+"txtfax3");
       var txtnphone1=document.getElementById (Prefix+"txtnphone1");
        var txtnphone2=document.getElementById (Prefix+"txtnphone2");
       var txtnphone3=document.getElementById (Prefix+"txtnphone3");
       
            
         var validated = Page_ClientValidate("VGHealth");
                    
            if (validated)
            {
                
                  if(txtPhone1.value !="" &&(txtPhone2.value ==""||txtPhone3.value ==""))
                     {
                       alert("Phone no is not valid!all three fields are complusory");
                      txtPhone1.focus ();
                       return false;
                     }
                  if(txtPhone2.value !="" &&(txtPhone1.value ==""||txtPhone3.value ==""))
                     {
                         alert("Phone no is not valid!all three fields are complusory");
                     txtPhone1.focus ();
                       return false;
                     }
                   if(txtPhone3.value !="" &&(txtPhone1.value ==""||txtPhone2.value ==""))
                     {
                        alert("Phone no is not valid!all three fields are complusory");
                       txtPhone1.focus ();
                       return false;
                     }
                     
                       //phone night
                     
                  if(txtnphone1.value !="" &&(txtnphone2.value ==""||txtnphone3.value ==""))
                     {
                       alert("Night Phone no is not valid!all three fields are complusory");
                      txtPhone1.focus ();
                      return false
                     }
                   if(txtnphone2.value !="" &&(txtnphone1.value ==""||txtnphone3.value ==""))
                     {
                         alert("Night Phone no is not valid!all three fields are complusory");
                     txtPhone1.focus ();
                      return false
                     }
                    if(txtnphone3.value !="" &&(txtnphone1.value ==""||txtnphone2.value ==""))
                     {
                        alert("Night no is not valid!all three fields are complusory");
                       txtPhone1.focus ();
                      return false
                     }
                       //Fax
              if(txtfax1.value !="" &&(txtfax2.value ==""||txtfax3.value ==""))
                 {
                   alert("Fax no is not valid!all three fields are complusory");
                   txtfax1.focus ();
                   return false;
                 }
              if(txtfax2.value !="" &&(txtfax1.value ==""||txtfax3.value ==""))
                 {
                   alert("Fax no is not valid!all three fields are complusory");
                     txtfax1.focus ();
                   return false;
                 }
                 if(txtfax3.value !="" &&(txtfax1.value ==""||txtfax2.value ==""))
                 {
                    alert("Fax no is not valid!all three fields are complusory");
                     txtfax1.focus ();
                   return false;
                 }
                    
                   
               var hdnCity=document.getElementById (Prefix+"hdnCity");
               var hdnState=document.getElementById (Prefix+"hdnState");
             
               var ddlCity=document.getElementById (Prefix+"ddlCity");
               var ddlState=document.getElementById (Prefix+"ddlState");
                hdnCity.value=ddlCity.value;
               hdnState.value=ddlState.value;
                     
            }
                   return true;
        }
   
  function Chk_HealthField2()
    {
        var chkLife=document.getElementById (Prefix+"chkLife");
        var chkHealth=document.getElementById (Prefix+"chkHealth");
        var ddlLifeOpt=document.getElementById (Prefix+"ddlLifeOpt");
        var ddlHealthOpt=document.getElementById (Prefix+"ddlHealthOpt");
        var ddlAmount=document.getElementById (Prefix+"ddlAmount");
        var Chk_HealthField=document.getElementById("dcFromComplete");
        
         var validated = Page_ClientValidate("VGHealth1");
                    
            if (validated)
            {
                 if(Chk_HealthField.value=="")
                     {
                        alert("Must Select Date of Birth");
                        Chk_HealthField.focus();
                       return false;
                     }
                     
                 if(chkLife.checked == false && chkHealth.checked == false)
                    {
                   
                        alert("Select atleast one Coverage to Quote");
                        return false
                    }
                if(chkLife.checked==true)
                    {
                        if(ddlLifeOpt.value=="-1")
                            {
                                alert("Must Select option  for Quick Life Quote");
                                 ddlLifeOpt.focus ();
                                return false
                            }
                    
                    }  
             if(chkHealth.checked==true)
                {
                    if(ddlHealthOpt.value=="-1")
                        {
                            alert("Must Select option  for Quick Life Health");
                             ddlHealthOpt.focus ();
                            return false
                        }
                
                }  
             if(ddlAmount.value=="-1")
                    {
                        alert("Must Select Amount of Insurance");
                         ddlAmount.focus ();
                        return false
                    }
                    
            
            }
    
    }
    
  function GetChk(val)
  {
       var chkLife=document.getElementById (Prefix+"chkLife");
        var chkHealth=document.getElementById (Prefix+"chkHealth");
          var ddlHealthOpt=document.getElementById (Prefix+"ddlHealthOpt");
          var ddlLifeOpt=document.getElementById (Prefix+"ddlLifeOpt");
                    if(val=="1")
                        {
                            if(chkLife.checked==false)
                                {
                                    alert("Must Select Life Coverage Quote");
                                    chkLife.focus();
                                    ddlLifeOpt.selectedIndex=0;
                                     return false
                                }
                        }
                        else
                        {
                             if(val=="2")
                                 {
                                    if(chkHealth.checked==false)
                                        {
                                            alert("Must Select Health Coverage Quote");
                                            chkHealth.focus();
                                             ddlHealthOpt.selectedIndex=0;
                                             return false
                                        }
                                 }
                        }
               
  }
  
  