
function VerifyUSA() {
	var objForm = DocumentObject( 'locate-usa', false );
	var objZip = objForm.zipcode.value;

	if ( objZip != "" ) {
		// Check for correct zip code
		regZip = new RegExp(/(^\d{5}$)|(^\d{5}-\d{4}$)/);
 		if ( !regZip.test( objZip ) ) {
			alert('Please enter a valid 5-digit Zip Code.');
			return false;
		}
		return true;
	}

	if ( objForm.state.selectedIndex == 0 ) {
		alert( 'Please select your state or enter a Zip Code.' );
		return false;
	}

	return true;
}

function VerifyCanada() {
	var objForm = DocumentObject( 'locate-canada', false );
	var objPost = objForm.postalcode.value;

	if ( objPost != "" ) {
		regPost = new RegExp(/(^s*([a-z](\s)?\d(\s)?){3}$)s*/i);
		if ( !regPost.test( objPost ) ) {
			alert('Please enter a valid 6-character postal code (no spaces).');
			return false;
		}
		return true;
	}

	if ( objForm.province.selectedIndex == 0 ) {
		alert( 'Please select your province or enter a postal code.' );
		return false;
	}

	return true;
}

function VerifyInternational() {
	var objForm = DocumentObject( 'locate-international', false );

	if ( objForm.country.selectedIndex == 0 ) {
		alert( 'Please select your country.' );
		return false;
	}
	
	objForm.countryname.value = objForm.country[ objForm.country.selectedIndex ].text;
	
	return true;
}
