<!--
function checkModified(form, savelist) {
	var valid = true;
	for (var i = 0; i < form.length; i++) {
		if (form.elements[i].type == "checkbox") {
			if (!savelist && form.elements[i].checked) {
				valid = false;
				break; }
		} else if (form.elements[i].type == "text") {
			if (form.elements[i].className != "qty") {
				valid = false;
				break; }
		}
	}
	if (!valid) {
		if (window.confirm("You've made changes to the items displayed. If you press OK, your changes will be lost. Press Cancel to keep your changes and stay on the current display. After cancelling, save your changes by pressing the Update button.")) {
			valid = true; } }
	return valid;
}

function checkSelected(form) {
	var valid = false;
	for (var i = 0; i < form.length; i++) {
		if (form.elements[i].type == "checkbox") {
			if (form.elements[i].checked) {
				valid = true;
				break; } } } 
	if (!valid) window.alert("You have not Selected any Item(s) to Move to your Save List. First, select the Item(s) you'd like to Move, then click the Move to List button.");
	return valid;
}

function saveList(form, val) {
	var fld = findField(form, 'action');
	if (fld) fld.value = val;
}

function verifyQty(fld, orgVal) {
	var valid = true;
	var qty = fld.value;
	// Check that value is truely a number
	if (isNaN(qty)) {
		window.alert("The value entered must be numeric! Please try again.");
		valid = false;
	} else if (qty < 0) {
		window.alert("Invalid value entered ... cannot be less than 0.");
		valid = false;
	} else if (qty == 0) {
		window.alert("Invalid value entered ... cannot be 0. Use checkbox to remove this item.");
		valid = false; }
	if (!valid) {
		fld.value = orgVal;
	} else if (qty != orgVal) {
		fld.className = "qty_updt";
	} else {
		fld.className = "qty"; }
	return valid;
}

function verifyZip(fld, mthdFld) {
	var valid = true;
	var zip = fld.value;
	var form = fld.form;
	var methodField = findField(form, mthdFld);
	// Check that zipcode is truely a number
	if (methodField.options[methodField.selectedIndex].value == 'STD') {
		// Check that it's a Canadian postal zip
		if (zip.length != 6) {
			window.alert("The Postal Code entered seems to be incorrect! Please try again.\nPlease note that our online ordering does not accept all international customers. If you're from outside the United States or Canada please call our Customer Service Team at 800-523-8197.");
			valid = false;
		} else if (!/^[A-Z]\d[A-Z]\d[A-Z]\d$/.test(zip)) {
			window.alert("The Postal Code entered seems to be incorrect! Please try again.\nPlease note that our online ordering does not accept all international customers. If you're from outside the United States or Canada please call our Customer Service Team at 800-523-8197.");
			valid = false;
		}
	} else {
		// Check that it's a U.S. zip
		if (isNaN(zip)) {
			window.alert("The Zip Code entered seems to be incorrect! Please try again.\nPlease note that our online ordering does not accept all international customers. If you're from outside the United States or Canada please call our Customer Service Team at 800-523-8197.");
			valid = false;
		} else if (zip < 0) {
			window.alert("Invalid Zip Code entered! Please try again.");
			valid = false;
		} else if (zip == 0) {
			window.alert("Invalid Zip Code entered! Please try again.");
			valid = false;
		} else if (zip.length != 5) {
			window.alert("Invalid Zip Code entered! Please try again.");
			valid = false;
		}
	}
	return valid;
}

function modifyZipField(fld, codeFld) {
	var method = fld.value;
	var form = fld.form;
	var doc = form.ownerDocument;
	var zipField = findField(form, codeFld);
	var txtField = doc.getElementById(codeFld);
	if (method == "STD") {
		if (zipField.maxLength != 6) {
			txtField.innerHTML = "Postal Code:";
			zipField.value = "";
			zipField.maxLength = 6;
			zipField.size = 6; }
	} else if (zipField.maxLength != 5) {
		txtField.innerHTML = "Zip Code:";
		zipField.value = "";
		zipField.maxLength = 5;
		zipField.size = 5;
	}
}

function validateShipping(form, mthdField) {
	var valid = true;
	for (var i = 0; i < form.length; i++) {
		if (form.elements[i].name == "shipZip") {
			var zipfld = form.elements[i];
			if (zipfld.value == "") {
				window.alert("Please enter your shipping destination zip/postal code before re-calculating the shipping charges.");
				valid = false;
				break; }
			if (!verifyZip(zipfld, mthdField)) {
				valid = false;
				break; }
		} else if (form.elements[i].name == "shipvia") {
			var viafld = form.elements[i];
			if (viafld.selectedIndex == 0) {
				var option = viafld.options[viafld.selectedIndex];
				if (option.text == "") {
					window.alert("Please select a shipping method before re-calculating the shipping charges.");
					valid = false;
					break; } } }
	}
	return valid;
}

function validateCoupon(form) {
	var valid = true;
	var field = findField(form, "couponCode");
	if (field.value == "") {
		window.alert("Please enter the Coupon Code in the field provided.");
		valid = false;
	}
	return valid;
}

function checkOne(fld) {
	var form = fld.form;
	var field = findField(form, fld);
	if (!fld.checked) {
		field.checked = false; }
}

function selectAll(form, fld) {
	var valid = true;
	var field = findField(form, fld);
	var checked = field.checked;
	for (var i = 0; i < form.length; i++) {
		if (form.elements[i].type == "checkbox") {
			if (form.elements[i].name != fld) {
				form.elements[i].checked = checked; } } }
}
//-->
