// JavaScript Document
function isDecimal(str) {
 	  return /^\d+(\.\d+)?$|^\.\d+$/.test(str);
}

function checkEstimateForm(){
    var emailReg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var email = document.estimate_form.email.value;
	var phone = document.estimate_form.phone.value;
	var name = document.estimate_form.name.value;
	var humantest = document.estimate_form.humantest.value;
	
	if (name == "" || name == null){
		alert("Please fill in the required feild: Contact Name");
		return false;
	}
	if (email == "" || email == null){
		alert("Please fill in the required feild: Email Address");
		return false;
	}
	if (phone == "" || phone == null){
		alert("Please fill in the required feild: Phone Number");
		return false;
	}
	if(emailReg.test(email) == false) {
    	alert('Invalid Email Address');
        return false;
   }
   if (humantest != "6"){
		alert("Incorrect Math: Human Test");
		return false;
	}
   
	
	return true;
}

function checkContactForm(){
    var emailReg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var email = document.contact_form.email.value;
	var name = document.contact_form.name.value;	
	
	if (name == "" || name == null){
		alert("Please fill in the required feild: Contact Name");
		return false;
	}
	if (email == "" || email == null){
		alert("Please fill in the required feild: Email Address");
		return false;
	}
	if(emailReg.test(email) == false) {
    	alert('Invalid Email Address');
        return false;
   }
	
	return true;
}
