﻿// 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 ddlState=document.getElementById (Prefix+"ddlState");
          var validated = Page_ClientValidate("VGBuilder");
          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;
             }
             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");
                hdnCity.value=ddlCity.value;
               hdnState.value=ddlState.value;
          
       }
                return true;
  }
 
   