
	function checkShortForm(theForm) {
		var why = "";
		why += checkBlank("First Name", theForm.shippingFirstName.value);
		why += checkBlank("Last Name", theForm.shippingLastName.value);
		why += checkEmail(theForm.email.value);
		why += checkPhone("Phone Number", theForm.ShippingDayPhone.value);
		why += checkBlank("Address", theForm.shippingAddress1.value);
		why += checkBlank("City", theForm.shippingCity.value);
		why += checkState(theForm.shippingState.value);		
		why += checkZip(theForm.ShippingPostalCode.value);
		
		
		if (why != "") {
			alert(why);
			return false;
		} else {
			return true;
		}
	} 
	
	// Empty Field Checker
    function checkBlank (field, strng) {
		var error = "";
		if (strng == "") {
			error = "Required field is empty: " + field + "\n";
		}
		return error;
	}

	//phone
	function checkPhone (field, strng) {
		var error="";
		if (strng == "") {
			error = "Required field is empty: " + field + "\n";
			return error;
		} else {

		//strip out acceptable non-numeric characters
		var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
			
			if (isNaN(parseInt(stripped))) {
				error = "The phone number contains illegal characters.\n";
				return error;
			}
			
			if (!(stripped.length == 10)) {
				error = "The phone number is the wrong length. Format number as XXX-XXX-XXXX\n";
				return error;
			}
		}
		return error;
	} 
	
	// email
    function checkEmail (strng) {
		var error="";
		if (strng == "") {
			error = "You didn't enter an email address.\n";
		}

		var emailFilter=/^.+@.+\..{2,3}$/;
		if (!(emailFilter.test(strng))) { 
			error = "Please enter a valid email address.\n";
		} else {

		//test email for illegal characters
			var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
			if (strng.match(illegalChars)) {
				error = "The email address contains illegal characters.\n";
			}
		}
		return error;    
    }

    function checkZip (strng) {
		var error = "";
		if (strng == "") {
			error = "You didn't enter a zip code.\n";
		}

		/*
		var stripped = strng.replace(/^\d$/, ''); //strip out acceptable non-numeric characters
		if (isNaN(parseInt(stripped))) {
			error = "The Zip Code contains illegal characters.\n";
		}

		if (!(stripped.length == 5)) {
			error = "Please use a 5 digit zip code.\n";
		} 
		*/
		return error;
    }

    // valid state choice from dropdown list
    function checkState(choice) {
		var error = "";
		if (choice == 0) {
			error = "Please Select Your State.\n";
		}    
		return error;
    }    

	function checkRadio(checkvalue) {
	var error = "";
	if (!(checkvalue)) {
       error = "Please Select A Status Button.\n";
    }
	return error;    
}
function CopyShipTo(form) {
	if (form.copy.checked) {
		form.baddress.value = form.address.value;
		form.bcity.value = form.city.value;
		form.bstate.value = form.state.value;
		form.bzip.value = form.zip.value;
	}
}