// Graphics Data Services, INC.
// http://www.graphicsdata.net
// Author: Blake Macleod <blake.macleod@gmail.com>

function isEmpty (strng, message) {
	var error = "";
	if (strng == "") {
		error = message;
	}
	return error;
}

function checkForm (formName) {
    var why = "";
	
	theForm = document.forms[formName];
	
	if (formName == "quote") {
		why += isEmpty(theForm.name.value, "Enter your name.\n");
		why += isEmpty(theForm.address1.value, "Enter your address.\n");
		why += isEmpty(theForm.city.value, "Enter your city.\n");
		why += isEmpty(theForm.state.value, "Enter your state.\n");
		why += isEmpty(theForm.zip.value, "Enter your zip code.\n");
		why += isEmpty(theForm.phone.value, "Enter your phone number.\n");
		why += isEmpty(theForm.quantity.value, "Enter the quantity.\n");
		why += isEmpty(theForm.comments.value, "Enter your description.\n");
	}
	else if (formName == "warehouse") {
		why += isEmpty(theForm.ship_to.value, "Enter your ship to #.\n");
		why += isEmpty(theForm.address1.value, "Enter your address.\n");
		why += isEmpty(theForm.city.value, "Enter your city.\n");
		why += isEmpty(theForm.state.value, "Enter your state.\n");
		why += isEmpty(theForm.zip.value, "Enter your zip code.\n");
		why += isEmpty(theForm.cost_center.value, "Enter your cost center.\n");
		why += isEmpty(theForm.form1.value, "Enter your catalog/form number.\n");
		why += isEmpty(theForm.description1.value, "Enter your description.\n");
		why += isEmpty(theForm.quantity1.value, "Enter quantity requested.\n");
	}
	else if (formName == "businesscard") {
		why += isEmpty(theForm.po_number.value, "Enter your P.O. Number.\n");
		why += isEmpty(theForm.quantity.value, "Enter quantity requested.\n");
		why += isEmpty(theForm.ink1.value, "Enter at least one ink color.\n");
		why += isEmpty(theForm.name.value, "Enter name on business card.\n");
		why += isEmpty(theForm.title.value, "Enter title on business card.\n");
		why += isEmpty(theForm.address1.value, "Enter address on business card.\n");
		why += isEmpty(theForm.phone.value, "Enter phone number on business card.\n");
		why += isEmpty(theForm.ship_address1.value, "Enter shipping address.\n");
		why += isEmpty(theForm.name.value, "Enter who this is requested by.\n");
	}
	else if (formName == "contact") {
		why += isEmpty(theForm.name.value, "Enter your name.\n");
		why += isEmpty(theForm.email.value, "Enter your email address.\n");
		why += isEmpty(theForm.comments.value, "Enter some comments.\n");
	}
	
	if (why != "") {
       alert(why);
       return false;
    }
	return true;
}