// JavaScript Document
function hdqm1_g_chk(){
	if (document.form1.hdqm1_g.value != ""){
		document.form1.hdqm1_qte.checked = true
	}
}
function hdqm1_h_chk(){
if (document.form1.hdqm1_h.value != ""){
		document.form1.hdqm1_qte.checked = true
	}
}
function hdqm1_fr_chk(){
if (document.form1.hdqm1_fr.value != ""){
		document.form1.hdqm1_qte.checked = true
	}
}
function hdqm1_hnd_chk(){
if (document.form1.hdqm1_hnd.value != ""){
		document.form1.hdqm1_qte.checked = true
	}
}
function hdqm2_g_chk(){
	if (document.form1.hdqm2_g.value != ""){
		document.form1.hdqm2_qte.checked = true
	}
}
function hdqm2_h_chk(){
if (document.form1.hdqm2_h.value != ""){
		document.form1.hdqm2_qte.checked = true
	}
}
function hdqm2_fr_chk(){
if (document.form1.hdqm2_fr.value != ""){
		document.form1.hdqm2_qte.checked = true
	}
}
function hdqm2_hnd_chk(){
if (document.form1.hdqm2_hnd.value != ""){
		document.form1.hdqm2_qte.checked = true
	}
}
function hdqm3_g_chk(){
	if (document.form1.hdqm3_g.value != ""){
		document.form1.hdqm3_qte.checked = true
	}
}
function hdqm3_h_chk(){
if (document.form1.hdqm3_h.value != ""){
		document.form1.hdqm3_qte.checked = true
	}
}
function hdqm3_fr_chk(){
if (document.form1.hdqm3_fr.value != ""){
		document.form1.hdqm3_qte.checked = true
	}
}
function hdqm3_hnd_chk(){
if (document.form1.hdqm3_hnd.value != ""){
		document.form1.hdqm3_qte.checked = true
	}
}

function chk(){
if (document.form1.hdqm1_qte.checked == true){
	
	if(document.form1.hdqm1_g.value == ""){
		alert("please select door guage")
document.form1.hdqm1_g.focus();
return false;
}

	
if(document.form1.hdqm1_h.value == ""){
		alert("please select door height")
document.form1.hdqm1_h.focus();
return false;
}
	
	
if(document.form1.hdqm1_fr.value == ""){
		alert("please select door fire rating")
document.form1.hdqm1_fr.focus();
return false;
}
	
	
if(document.form1.hdqm1_hnd.value == ""){
		alert("please select door handing")
document.form1.hdqm1_hnd.focus();
return false;
}
if(document.form1.hdqm1_qt.value == ""){
		alert("please enter quantity")
document.form1.hdqm1_qt.focus();
return false;
}
g1 = document.form1.hdqm1_g.value
h1 = document.form1.hdqm1_h.value
fr1 = document.form1.hdqm1_fr.value
hnd1 = document.form1.hdqm1_hnd.value
str1 = "HDQM" + g1 + "-36x" + h1 + "-" + fr1 + "-P(" + hnd1 + ")"
document.form1.hdqm1.value = str1
//alert(document.form1.hdqm1.value);
	}
	
	
	if (document.form1.hdqm2_qte.checked == true){
	
	if(document.form1.hdqm2_g.value == ""){
		alert("please select door guage")
document.form1.hdqm2_g.focus();
return false;
}

	
if(document.form1.hdqm2_h.value == ""){
		alert("please select door height")
document.form1.hdqm2_h.focus();
return false;
}
	
	
if(document.form1.hdqm2_fr.value == ""){
		alert("please select door fire rating")
document.form1.hdqm2_fr.focus();
return false;
}
	
	
if(document.form1.hdqm2_hnd.value == ""){
		alert("please select door handing")
document.form1.hdqm2_hnd.focus();
return false;
}
if(document.form1.hdqm2_qt.value == ""){
		alert("please enter quantity")
document.form1.hdqm2_qt.focus();
return false;
}
g1 = document.form1.hdqm2_g.value
h1 = document.form1.hdqm2_h.value
fr1 = document.form1.hdqm2_fr.value
hnd1 = document.form1.hdqm2_hnd.value
str1 = "HDQM" + g1 + "-36x" + h1 + "-" + fr1 + "-R(" + hnd1 + ")"
document.form1.hdqm2.value = str1
//alert(document.form1.hdqm2.value);
	}
	
	
	if (document.form1.hdqm3_qte.checked == true){
	
	if(document.form1.hdqm3_g.value == ""){
		alert("please select door guage")
document.form1.hdqm3_g.focus();
return false;
}

	
if(document.form1.hdqm3_h.value == ""){
		alert("please select door height")
document.form1.hdqm3_h.focus();
return false;
}
	
	
if(document.form1.hdqm3_fr.value == ""){
		alert("please select door fire rating")
document.form1.hdqm3_fr.focus();
return false;
}
	
	
if(document.form1.hdqm3_hnd.value == ""){
		alert("please select door handing")
document.form1.hdqm2_hnd.focus();
return false;
}
if(document.form1.hdqm3_qt.value == ""){
		alert("please enter quantity")
document.form1.hdqm3_qt.focus();
return false;
}
g1 = document.form1.hdqm3_g.value
h1 = document.form1.hdqm3_h.value
fr1 = document.form1.hdqm3_fr.value
hnd1 = document.form1.hdqm3_hnd.value
str1 = "HDQM" + g1 + "-36x" + h1 + "-" + fr1 + "-H(" + hnd1 + ")"
document.form1.hdqm3.value = str1
//alert(document.form1.hdqm3.value);
	}
	

if (document.form1.company.value ==""){
alert("Please Enter the Company Name")
document.form1.company.focus();
return false;
}
if (document.form1.first_name.value =="" || document.form1.first_name.value =="First Name"){
alert("Please Enter you Name")
document.form1.first_name.focus();
document.form1.first_name.select();
return false;
}

if (document.form1.last_name.value =="" || document.form1.last_name.value =="Last Name" ){
alert("Please Enter you Last Name")
document.form1.last_name.focus();
document.form1.last_name.select();
return false;
}

if (document.form1.address.value ==""){
alert("Please Enter your Mailing Address")
document.form1.address.focus();
return false;
}
if (document.form1.city.value ==""){
alert("Please Enter your City")
document.form1.city.focus();
return false;
}
if (document.form1.state.value ==""){
alert("Please Enter your State")
document.form1.state.focus();
return false;
}
var zipValue =document.form1.zip.value  
if (zipValue == ""){
  alert("Please Enter Zip code")
  document.form1.zip.focus()
  return false
  }
else
   {
   if (document.form1.bill_country.value == 'USA'){
   if (isNaN(zipValue)){
     alert("Please Enter a valid Zip Number")
     document.form1.zip.focus()
     document.form1.zip.select()
     return false
      }
	  }
   }
   
   var emailValue = document.form1.email.value

var phone =document.form1.phone.value  
if (phone == ""){
  alert("Please Enter your contact number")
  document.form1.phone.focus()
  return false
  }

if (emailValue == ""){
        alert("You Should Enter your Email-ID for future contact")
      document.form1.email.focus()
      return false
     }
 
else
    {
      var mailId =false
      for (i=0; i<emailValue.length; ++i){
             if (emailValue.substring(i,i+1) == "@"){
                                           mailId = true
                                           break
                                      } 
          }
       if (mailId==false){
          alert("Please enter a valid Email-Id ")
          document.form1.email.focus()
          document.form1.email.select()
          return false
        }
     }   



if (document.form1.comments.value ==""){
quess = confirm("You are about to send this information without any comments??","yes","no")
if (quess == false){
document.form1.comments.focus();
return false;
}

}
document.form1.submit();
}

