function preSelectProd() {
	if (window.location.pathname.indexOf("magazine") >= 0) {
		document.subscript_form.Subscription1.checked = true;
	} else {
		document.subscript_form.Subscription2.checked = true;
	}
}

function validate(form) {
	var publCount = 0;
	if (form.Subscription1.checked) { publCount++; }
	if (form.Subscription2.checked) { publCount++; }
	if (publCount == 0) {
		alert("Please select one or more publications to subscribe to.")
		form.Subscription1.focus();
		return false;
	}

	if (isEmpty(form.Name.value)) {
		alert("Please enter your name.");
		form.Name.focus();
		return false;
	}
	if (isEmpty(form.AddressLine1.value)) {
		alert("Please enter a mailing address.");
		form.AddressLine1.focus();
		return false;
	}
	if (isEmpty(form.City.value)) {
		alert("Please enter the city of your mailing address.");
		form.City.focus();
		return false;
	}
	if (isEmpty(form.PostalCode.value)) {
		alert("Please enter the postal code for your mailing address.");
		form.PostalCode.focus();
		return false;
	}

	cIndex = form.Country.selectedIndex;
	if ( (cIndex == 0) || ((cIndex == 9) && (form.DeliveryMethod.selectedIndex == 0)) ) {
		popup = window.open("", "CountryWarning", "width=450,height=300,status,scrollbars,resizable");
		content = "<html><body><center>\n<p><strong>Readers outside of the United States and its territories can ";
		content += "access the electronic version of <em>Coastal Services</em>. To receive an e-mail notification ";
		content += "when each new issue is available on-line, choose the appropriate category under \"Method of ";
		content += "Delivery.\"</strong></p>\n";
		content += "<form><p><input type='button' value='Return to Form' onclick='self.close()'></p></form>\n";
		content += "</body></html>";
		popup.document.write(content);
		popup.document.close();

		form.Country.focus();
		popup.focus();
		return false;
	}
	if ((form.Country.options[cIndex].text == "Other") && (form.Country2.value == "")) {
		alert("Please specify a country.");
		form.Country2.focus();
		return false;
	}
	if (form.Country.options[cIndex].text != "Other") {
		form.Country2.value = "";
	}
	if (cIndex == 1) {
		if (form.State.value.length != 2) {
			alert("Please enter the two-letter US state code for your mailing address.");
			form.State.focus();
			return false;
		}
		if (isInvalidUSZip(form.PostalCode.value)) {
			alert("Please enter a valid US zip code for your mailing address.");
			form.PostalCode.focus();
			return false;
		}
		if (isInvalidUSPhone(form.Phone.value)) {
			alert("Please enter a valid telephone number with area code.");
			form.Phone.focus();
			return false;
		}
	}

	if (isEmpty(form.Phone.value)) {
		alert("Please enter your telephone number.");
		form.Phone.focus();
		return false;
	}
	if (isInvalidEmail(form.Email.value)) {
		alert("Please enter a valid e-mail address.");
		form.Email.focus();
		return false;
	}

	return true;
}
