<!--
function checkfield(echoForm) {
var message = ""; 

if (echoForm.paypalProcessing) {
	alert(echoForm.notify_url.value);
//	echoForm.notify_url.value = "http://www.beer-wine.com/scripts/process_order_paypal.asp?sessionID=" + 
//	echoForm.sessionID.value + "&substitutions=" + echoForm.substitutions.value + "&email_list=" + echoForm.email_list.value;
//	alert(echoForm.notify_url.value);
}

if (echoForm.find) {
	if((echoForm.search) && (echoForm.search.value == "")) {message += "\n  - Search Term.";}
}

if (echoForm.billing) {

	if(echoForm.cc_type)	{
			var testcheck = false;
			for (var i=0; i<echoForm.cc_type.length; i++) {
				if (echoForm.cc_type[i].checked) {
					testcheck = true;
				}
			}
			if (!testcheck) {
				message += '\n - Credit Card Type';
		}
	}
	
	if((echoForm.cc_number) && ((echoForm.cc_number.value == "") || (!isInteger(echoForm.cc_number.value))) ) {message += "\n  - Credit Card Number: Numbers Only";}
	
	if((echoForm.security_number) && (echoForm.security_number.value == "")) {message += "\n  - Credit Card Security Code.";}
	if((echoForm.cc_name) && (echoForm.cc_name.value == "")) {message += "\n  - Name on Credit Card.";}
	if((echoForm.exp_month) && (echoForm.exp_month.value == "")) {message += "\n  - Expiration Month.";}
	if((echoForm.exp_year) && (echoForm.exp_year.value == "")) {message += "\n  - Expiration Year.";}
	



	if (message == "") {
	echoForm.submit_button.disabled=true;
	echoForm.submit_button.value='Please wait while we process your order.';
	}


}


if (echoForm.check_out) {

		if((echoForm.bill_first_name) && (echoForm.bill_first_name.value == "")) {message += "\n  - First Name (billing).";}
		if((echoForm.bill_last_name) && (echoForm.bill_last_name.value == "")) {message += "\n  - Last Name (billing).";}
		if((echoForm.bill_address1) && (echoForm.bill_address1.value == "")) {message += "\n  - Address (billing).";}
		if((echoForm.bill_city) && (echoForm.bill_city.value == "")) {message += "\n  - City (billing).";}
		
		if(((echoForm.bill_state) && (echoForm.bill_state.value == "N/A")) && ((echoForm.bill_country.value == "US") || (echoForm.bill_country.value == "CA"))) {message += "\n  - State (billing).";}
		if(((echoForm.bill_zip) && (echoForm.bill_zip.value == "")) && ((echoForm.bill_country.value == "US") || (echoForm.bill_country.value == "CA"))) {message += "\n  - Zip (billing).";}
		
		if((echoForm.bill_country) && (echoForm.bill_country.value == "")) {message += "\n  - Country (billing).";}
		if((echoForm.bill_contact_phone) && (echoForm.bill_contact_phone.value == "")) {message += "\n  - Phone (billing).";}
		if((echoForm.bill_email) && (!emailCheck(echoForm.bill_email.value))) {message += "\n  - Email Address (billing).";}
	
	
	if (!echoForm.ship_check.checked)
	{
		if((echoForm.ship_first_name) && (echoForm.ship_first_name.value == "")) {message += "\n  - First Name (shipping).";}
		if((echoForm.ship_last_name) && (echoForm.ship_last_name.value == "")) {message += "\n  - Last Name (shipping).";}
		if((echoForm.ship_address1) && (echoForm.ship_address1.value == "")) {message += "\n  - Address (shipping).";}
		if((echoForm.ship_city) && (echoForm.ship_city.value == "")) {message += "\n  - City (shipping).";}
		
		if(((echoForm.ship_state) && (echoForm.ship_state.value == "N/A")) && ((echoForm.ship_country.value == "US") || (echoForm.ship_country.value == "CA"))) {message += "\n  - State (shipping).";}
		if(((echoForm.ship_zip) && (echoForm.ship_zip.value == "")) && ((echoForm.ship_country.value == "US") || (echoForm.ship_country.value == "CA"))) {message += "\n  - Zip (shipping).";}
		
		if((echoForm.ship_country) && (echoForm.ship_country.value == "")) {message += "\n  - Country (shipping).";}
		if((echoForm.ship_contact_phone) && (echoForm.ship_contact_phone.value == "")) {message += "\n  - Phone (shipping).";}
		if((echoForm.ship_email) && (!emailCheck(echoForm.ship_email.value))) {message += "\n  - Email Address. (shipping)";}
	
	}

}


if (echoForm.catalog_request) {
	if((echoForm.First_Name) && (echoForm.First_Name.value == "")) {message += "\n  - First Name.";}
	if((echoForm.Last_Name) && (echoForm.Last_Name.value == "")) {message += "\n  - Last Name.";}
	if((echoForm.Address) && (echoForm.Address.value == "")) {message += "\n  - Address.";}
	if((echoForm.City) && (echoForm.City.value == "")) {message += "\n  - City.";}
	if((echoForm.State) && (echoForm.State.value == "")) {message += "\n  - State.";}
	if((echoForm.ZipCode) && (echoForm.ZipCode.value == "")) {message += "\n  - Zip Code.";}
	//if((echoForm.Phone) && (echoForm.Phone.value == "")) {message += "\n  - Telephone.";}
	if((echoForm.Email) && (!emailCheck(echoForm.Email.value))) {message += "\n  - Email Address";}
			
}

if (echoForm.add_cart) {
	if((echoForm.qty) && (echoForm.qty.value == "") || echoForm.qty.value == "0") {message += "\n  - Quantity Field.";}
			if((echoForm.qty) && (!isPrice(echoForm.qty.value)) && (echoForm.qty.value != "")) {
			message += "\n  - Quantity field must be numbers only";
			}
}

if (echoForm.email_form) {

if((echoForm.name) && (echoForm.name.value == "")) {message += "\n  - Name.";}
if((echoForm.email) && (!emailCheck(echoForm.email.value))) {message += "\n  - Email Address";}

}



if (echoForm.samedia) {

var testcheck = false;


		for (var i=0; i<echoForm.kit.length; i++) {
			if (echoForm.kit[i].checked) {
				testcheck = true;
			}
		}
					
		if (!testcheck) {
			message += '\n - Select Kit';
		}

	

		if((echoForm.ship_first_name) && (echoForm.ship_first_name.value == "")) {message += "\n  - First Name";}
		if((echoForm.ship_last_name) && (echoForm.ship_last_name.value == "")) {message += "\n  - Last Name";}
		if((echoForm.ship_address1) && (echoForm.ship_address1.value == "")) {message += "\n  - Address";}
		if((echoForm.ship_city) && (echoForm.ship_city.value == "")) {message += "\n  - City";}
		
		if(((echoForm.ship_state) && (echoForm.ship_state.value == "N/A")) && ((echoForm.ship_country.value == "US") || (echoForm.ship_country.value == "CA"))) {message += "\n  - State";}
		if(((echoForm.ship_zip) && (echoForm.ship_zip.value == "")) && ((echoForm.ship_country.value == "US") || (echoForm.ship_country.value == "CA"))) {message += "\n  - Zip";}
		
		if((echoForm.ship_country) && (echoForm.ship_country.value == "")) {message += "\n  - Country";}
		if((echoForm.ship_contact_phone) && (echoForm.ship_contact_phone.value == "")) {message += "\n  - Phone";}
		
		if((echoForm.ship_email) && (!emailCheck(echoForm.ship_email.value))) {message += "\n  - Email Address";}
		
		if((echoForm.ship_company) && (echoForm.ship_company.value == "")) {message += "\n  - Company";}	
		
}


if (message != "") {
		if (message != "") {message = "The following fields require valid entries:\n" + message;}
		alert(message);
		return false;
		}	
return true;
}

//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

function isPrice(value) {

	var g=".0123456789";
	var s=value
	var good=true;
	var n="";

	for(var i=0;i< s.length;i++)
	{
	c = s.charAt(i);
		for(j=0;j< g.length;j++)
		if(c == g.charAt(j))
		break;
		if(j == g.length)
		{
		good=false;
		break;
		}
		n += c;
		}
	  
		if(!good)
		{
		return(false);
		} else {
		return(true);  
		}
}

//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

function isInteger(argvalue) {
	argvalue = argvalue.toString();
	
	if (argvalue.length == 0)
	return false;
	
	for (var n = 0; n < argvalue.length; n++) {
		var oneChar = argvalue.charAt(n);
		if ( n == 0 && (oneChar == "+" || oneChar ==
		"-")) continue;
		if (oneChar < "0" || oneChar >
		"9")
		return false;
	}
	return true;
}

//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

function emailCheck(emailStr) {
/* The following pattern is used to check if the entered e-mail address
   fits the user@domain format.  It also is used to separate the username
   from the domain. */
var emailPat=/^(.+)@(.+)$/
/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address. 
   These characters include ( ) < > @ , ; : \ " . [ ]    */
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
/* The following string represents the range of characters allowed in a 
   username or domainname.  It really states which chars aren't allowed. */
var validChars="\[^\\s" + specialChars + "\]"
/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */
var quotedUser="(\"[^\"]*\")"
/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
/* The following string represents an atom (basically a series of
   non-special characters.) */
var atom=validChars + '+'
/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */
var word="(" + atom + "|" + quotedUser + ")"
// The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
/* The following pattern describes the structure of a normal symbolic
   domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


/* Finally, let's start trying to figure out if the supplied address is
   valid. */

/* Begin with the coarse pattern to simply break up user@domain into
   different pieces that are easy to analyze. */
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
  /* Too many/few @'s or something; basically, this address doesn't
     even fit the general mould of a valid e-mail address. */
	/* alert("Email address seems incorrect (check @ and .'s)") */
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

// See if "user" is valid 
if (user.match(userPat)==null) {
    // user is not valid
    /* alert("The username doesn't seem to be valid.") */
    return false
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
   host name) make sure the IP address is valid. */
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        /* alert("Destination IP address is invalid!") */
		return false
	    }
    }
    return true
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	/* alert("The domain name doesn't seem to be valid.") */
    return false
}

/* domain name seems valid, but now make sure that it ends in a
   three-letter word (like com, edu, gov) or a two-letter word,
   representing country (uk, nl), and that there's a hostname preceding 
   the domain or country. */

/* Now we need to break up the domain to get a count of how many atoms
   it consists of. */
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   // the address must end in a two letter or three letter word.
   /* alert("The address must end in a three-letter domain, or two letter country.") */
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   var errStr="This address is missing a hostname!"
   /* alert(errStr) */
   return false
}

// If we've gotten this far, everything's valid!
return true;
}

//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

//-->
