
function validateform()
{

if(document.brochure.name.value=="") {
window.alert ("Please Enter a Name");
return false;
}
if(document.brochure.address1.value=="") {
window.alert ("Please Enter a Address");
return false;
}
if(document.brochure.city.value=="") {
window.alert ("Please Enter a City");
return false;
}
if(document.brochure.prov_state.value=="") {
window.alert ("Please Enter a Province / State");
return false;
}
if(document.brochure.postal_zip.value=="") {
window.alert ("Please Enter a Postal / Zip Code");
return false;
}
if(document.brochure.country.value=="") {
window.alert ("Please Enter a Country");
return false;
}
if(document.brochure.telephone.value=="") {
window.alert ("Please Enter a Telephone Number");
return false;
}
if(document.brochure.email.value=="") {
window.alert ("Please Enter a Email Address");
return false;
}

// check that there is at least one checkbox selected from the *** are you a *** section 
var  minCheckBoxMet = false;  

	if(document.brochure.cb_owner.checked) {
		minCheckBoxMet =  true;
	}
	if(document.brochure.cb_architect.checked) {
		minCheckBoxMet =  true;
	}
	if(document.brochure.cb_designer.checked) {
		minCheckBoxMet =  true;
	}
	if(document.brochure.cb_custom_builder.checked) {
		minCheckBoxMet =  true;
	}
	if(document.brochure.cb_builder.checked) {
		minCheckBoxMet =  true;
	}
	if(document.brochure.cb_contractor.checked) {
		minCheckBoxMet =  true;
	}
	if(document.brochure.cb_dealer.checked) {
		minCheckBoxMet =  true;
	}
	if(document.brochure.cb_other.checked) {
		minCheckBoxMet =  true;
	}
	if(minCheckBoxMet == false) {
			alert("check at least one checkbox from the 'Are you a' list");
			return false;
	}
	
// check that there is at least one checkbox selected from the *** I am in the process of *** section 
	
var  minCheckBoxMet = false;  

	if(document.brochure.cb_newHome.checked) {
		minCheckBoxMet =  true;
	}
		if(document.brochure.cb_renoHome.checked) {
		minCheckBoxMet =  true;
	}
		if(document.brochure.cb_renoKitchen.checked) {
		minCheckBoxMet =  true;
	}
		if(document.brochure.cb_renoWashroom.checked) {
		minCheckBoxMet =  true;
	}
		if(document.brochure.cb_other2.checked) {
		minCheckBoxMet =  true;
	}
	if(minCheckBoxMet == false) {
			alert("check at least one checkbox from the 'I am in the process of' list");
			return false;
	}
	
// check dropdown

if(document.brochure.cabinetry_budget.selectedIndex == 0) {
window.alert ("Please enter your cabinetry budget");
return false;
}

// make at least one selection from the radio buttons in the brochure/dvd section 
var isChecked = "no"

	for (i=0;i<document.brochure.send_brochure.length;i++){
	if (document.brochure.send_brochure[i].checked==true)
	isChecked = "yes"
	}
	for (i=0;i<document.brochure.send_dvd.length;i++){
	if (document.brochure.send_dvd[i].checked==true)
	isChecked = "yes"
	}
	for (i=0;i<document.brochure.send_combo.length;i++){
	if (document.brochure.send_combo[i].checked==true)
	isChecked = "yes"
	}
	if(isChecked=="no"){
		alert("choose at least one option from the brochure/dvd section");
		return false;
	}
// check that the credit card number has 16 digits	and begins with a 4
    if(document.brochure.cc_number.value.length < 15 ){
		alert("The credit card number requires 16 digits");
		return false;
	}
	var firstDigit = document.brochure.cc_number.value.substring(0,1)
	if(firstDigit != 4){
		alert("We only accept Visa and the number should start with a four.")
		return false;
	}
	
	if(document.brochure.cc_expires_year.value=="") {
		window.alert ("Please enter the credit card expiration year.");
		return false;
		}
	if(document.brochure.cc_expires_month.value=="") {
		window.alert ("Please enter the credit card expiration month.");
		return false;
	}
	
	return true;
}


