//<!--
function checkStep01() {
	var errormsg = "";
	if (document.quoteform.name.value == "") {
		errormsg += "The field 'Name' cannot be blank\n";
	}
	if (document.quoteform.title.value == "") {
		errormsg += "The field 'Job Title' cannot be blank\n";
	}
	if (document.quoteform.email.value == "") {
		errormsg += "The field 'E-mail' cannot be blank\n";
	} else {
		if (!isValidEmail(document.quoteform.email.value)) {
			errormsg += "Your e-mail address is not properly formatted\n";
		}
	}
	if (document.quoteform.company.value == "") {
		errormsg += "The field 'Company' cannot be blank\n";
	}
	if (document.quoteform.address_1.value + document.quoteform.address_2.value == "") {
		errormsg += "The field 'Address' cannot be blank\n";
	}
	if (document.quoteform.city.value == "") {
		errormsg += "The field 'City' cannot be blank\n";
	}
	if (document.quoteform.state.selectedIndex == "") {
		errormsg += "The field 'State' cannot be blank\n";
	}
	if (document.quoteform.zip.value == "") {
		errormsg += "The field 'ZIP' cannot be blank\n";
	}
	if (document.quoteform.telephone.value == "") {
		errormsg += "The field 'Telephone' cannot be blank\n";
	}

	if (errormsg) {
		var message = "The following errors have occurred:\n\n";
		message += errormsg;
		message += "\nPlease correct your entries and continue.";
		alert(message);
		return false;
	} else {
		return true;
	}
}

function checkStep02() {
	var errormsg = "";
	var ready = false;
	for (i = 0; i < document.quoteform.type.length; i++) {
		field = "document.quoteform.type[" + i + "].checked"
		if (eval(field) == true) {
			ready = true;
		}
	}
	if (!ready) {
		errormsg += "Please select the type of mail to send\n";
	}
	if (document.quoteform.type[5].checked == true && document.quoteform.type_if_other.value == "") {
		document.quoteform.type_if_other.focus();
		errormsg += "Please specify a type\n";
	}
	if (document.quoteform.weight.value == "") {
		errormsg += "Please enter a value for weight\n";
	}
	var ready = false;
	for (i = 0; i < document.quoteform.oz_lbs.length; i++) {
		field = "document.quoteform.oz_lbs[" + i + "].checked"
		if (eval(field) == true) {
			ready = true;
		}
	}
	if (!ready) {
		errormsg += "Please select Ounces or Pounds\n";
	}
	if (document.quoteform.size_length.value == "") {
		errormsg += "Please enter a value for length\n";
	}
	if (document.quoteform.size_width.value == "") {
		errormsg += "Please enter a value for width\n";
	}
	if (document.quoteform.size_thickness.value == "") {
		errormsg += "Please enter a value for thickness\n";
	}
	if (errormsg) {
		alert(errormsg);
		return false;
	} else {
		return true;
	}
}


function checkStep03() {
	var errormsg = "";
	var ready = false;
	if (document.quoteform.country_file.value != "") {
		ready = true;
	}
	if (document.quoteform.country_list.value != "") {
		ready = true;
	}
	if (!ready) {
		errormsg = "Please either upload a file or enter a list.\n";
		alert(errormsg);
		return false;
	} else {
		return true;
	}
}


function checkStep04() {
	var errormsg = "";
	var ready = false;
	for (i = 0; i < document.quoteform.timeframe.length; i++) {
		field = "document.quoteform.timeframe[" + i + "].checked"
		if (eval(field) == true) {
			ready = true;
		}
	}
	if (!ready) {
		errormsg += "Please select a desired delivery speed\n";
	}
	var ready = false;
	for (i = 0; i < document.quoteform.pickup.length; i++) {
		field = "document.quoteform.pickup[" + i + "].checked"
		if (eval(field) == true) {
			ready = true;
		}
	}
	if (!ready) {
		errormsg += "Please choose whether or not you require pick-up\n";
	}
	if (document.quoteform.pickup[1].checked == true && document.quoteform.pickup_from.value == "") {
		document.quoteform.pickup_from.focus();
		errormsg += "Please let us know the ZIP code for the pick-up location\n";
	}
	var ready = false;
	for (i = 0; i < document.quoteform.wrap.length; i++) {
		field = "document.quoteform.wrap[" + i + "].checked"
		if (eval(field) == true) {
			ready = true;
		}
	}
	if (!ready) {
		errormsg += "Please select a wrapping/addressing option\n";
	}
	if (errormsg) {
		alert(errormsg);
		return false;
	} else {
		return true;
	}
}


function isValidEmail(address, emailField) {
	if (address != '' && address.search) {
		if (address.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) {
			return true;
		} else {
			return false;
	  }
	}
	else return true;
}
//-->
