function validate() {
	firstName = document.getElementById("firstName").value;
	lastName = document.getElementById("lastName").value;
	title = document.getElementById("title").value;
	company = document.getElementById("company").value;
	addressLine1 = document.getElementById("addressLine1").value;
	addressLine2 = document.getElementById("addressLine2").value;
	city = document.getElementById("city").value;
	state = document.getElementById("state").value;
	zip = document.getElementById("zip").value;
	phone = document.getElementById("phone").value;
	fax = document.getElementById("fax").value;
	website = document.getElementById("website").value;
	email = document.getElementById("email").value;
	
	pc = document.getElementById("plantCatalog");
	if (pc)
	{
	    plantCatalog = document.getElementById("plantCatalog").checked;
	    rearCatalog = document.getElementById("rearCatalog").checked;
	    frontCatalog = document.getElementById("frontCatalog").checked;
    	
	    if ((!plantCatalog) && (!rearCatalog) && (!frontCatalog))
	    {
	        alert("You must check a catalog.  Please enter and try again.");
		    return false;
	    }
    }
	if (firstName == "" || firstName == null) {
		alert("First Name is a required field.  Please enter and try again.");
		return false;
	}
	else if (lastName == "" || lastName == null) {
		alert("Last Name is a required field.  Please enter and try again.");
		return false;
	}
	else if (title == "" || title == null) {
		alert("Title is a required field.  Please enter and try again.");
		return false;
	}
	else if (company == "" || company == null) {
		alert("Company is a required field.  Please enter and try again.");
		return false;
	}
	else if (addressLine1 == "" || addressLine1 == null) {
		alert("Address Line 1 is a required field.  Please enter and try again.");
		return false;
	}
	else if (city == "" || city == null) {
		alert("City is a required field.  Please enter and try again.");
		return false;
	}
	else if (state == "" || state == null) {
		alert("State is a required field.  Please enter and try again.");
		return false;
	}
	else if (zip == "" || zip == null) {
		alert("Zip is a required field.  Please enter and try again.");
		return false;
	}
	else if (phone == "" || phone == null) {
		alert("Phone is a required field.  Please enter and try again.");
		return false;
	}
	else if (checkphone(phone) == false) {
		alert("The phone number you entered is invalid.  Please reenter and try again.");
		return false;
	}
	else if (email == "" || email == null) {
		alert("Email is a required field.  Please enter and try again.");
		return false;
	}
	else if (checkemail(email) == false) {
		alert("You have entered an invalid email address.  Please reenter and try again.");
		return false;
	}
	else if (!(fax == "" || fax == null) && !checkphone(fax))
	{
		alert("You have entered an invalid fax number.  Please reenter and try again.");
		return false;
	}
	return true;
}

function checkemail(str){
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(str)) {
		return true;
	}
	
	return false;
}

function checkphone(str) {
	var stripped = str.replace(/[\(\)\.\-\ ]/g, '');
	if (isNaN(parseInt(stripped))) {
	   return false;
	}
	if (!(stripped.length == 10)) {
		return false;
	}
	return true;
}
