<!-- 



      function isWhitespace (s)
      {
           var i;

           // Is s empty?
           if (isEmpty(s)) return true;

           // Search through string's characters one by one
           // until we find a non-whitespace character.
           // When we do, return false; if we don't, return true.

           for (i = 0; i < s.length; i++)
           {
                // Check that current character isn't whitespace.
                var c = s.charAt(i);

                if (whitespace.indexOf(c) == -1) return false;
           }

           // All characters are whitespace.
           return true;
      }

      /****************************************************************/
      

      // Check whether string s is empty.
      function isEmpty(s)
      { return ((s == null) || (s.length == 0)) }

      /****************************************************************/
      
// whitespace characters
      var whitespace = " \t\n\r";

// isEmail (STRING s [, BOOLEAN emptyOK])
// 
// Email address must be of form a@b.c ... in other words:
// * there must be at least one character before the @
// * there must be at least one character before and after the .
// * the characters @ and . are both required
//
// For explanation of optional argument emptyOK,
// see comments of function isInteger.

function isEmail (str,strWarning)
{   
var strinput = new String(str.value)
/*    if (isEmpty(str)) 
       if (isEmail.arguments.length == 1) {
        alert("1");
        return false;
        }
       else 
        return (isEmail.arguments[1] == true);
*/

    // is s whitespace?
if (isWhitespace(strinput))    { 
        alert(strWarning);
        return false;
        }

        
    // there must be >= 1 character before @, so we
    // start looking at character position 1 
    // (i.e. second character)
    var i = 1;
    var sLength = strinput.length;

    // look for @
    while ((i < sLength) && (strinput.charAt(i) != "@"))
    { i++
    }

    if ((i >= sLength) || (strinput.charAt(i) != "@")) {
        alert(strWarning);
        return false;
        }
    else 
        i += 2;

    // look for .
    while ((i < sLength) && (strinput.charAt(i) != "."))
    { i++
    }

    // there must be at least one character after the .
    if ((i >= sLength - 1) || (strinput.charAt(i) != ".")) {
        alert(strWarning);
        return false;
        }
    else 
        return true;
}

/****************************************************************/
      function ForceEntry(val, str) {
           var strInput = new String(val.value);

           if (isWhitespace(strInput)) {
                alert(str);
                return false;
           } else
                return true;

      }

      /****************************************************************/

// This function ensures that a field is less than or equal to the
// Length passed in.  You must call this function with the element
// name in your form (for example: "ForceLength(document.forms[0].txtElement)"
// as opposed to "ForceLength(document.forms[0].txtElement.value)"
// If the field's value is too large, an error message is displayed
// and false is returned, else true is returned.

function ForceLength(objField, nLength, strWarning)
{
	var strField = new String(objField.value);

	if (strField.length > nLength) {
		alert(strWarning);
		return false;
	} else
		return true;
}
/****************************************************************/
function ValidateData() {           
	var CanSubmit = false;
	var a,b,c,d,e,f,g,h,i,j,k,l,m,n,p,q,m2,n2,x1, x2
	
	// Check to make sure that the full name field is not empty.
	a = ForceEntry(document.forms[0].shipping_name,"Please enter a ship-to Name");
	b = ForceEntry(document.forms[0].billing_name,"Please enter a bill-to Name");
	 
	c = ForceEntry(document.forms[0].shipping_address1,"Please enter a shipping address");
	d = ForceEntry(document.forms[0].billing_address1,"Please enter an billing address");
	
	e = ForceEntry(document.forms[0].shipping_city,"Please enter a ship-to City");
	f = ForceEntry(document.forms[0].billing_city,"Please enter a bill-to City");
	
	g = ForceEntry(document.forms[0].shipping_state,"Please choose a ship-to State");
	h = ForceEntry(document.forms[0].billing_state,"Please choose a bill-to State");
	
	i = ForceEntry(document.forms[0].shipping_zip,"Please enter a ship-to Zip code");
	j = ForceEntry(document.forms[0].billing_zip,"Please enter a bill-to Zip code");
	
	k = ForceEntry(document.forms[0].shipping_phone,"Please enter a ship-to Phone number");
	l = ForceEntry(document.forms[0].billing_phone,"Please enter a bill-to Phone number");
	
	m = isEmail(document.forms[0].shipping_email,"Please enter a valid ship-to E-mail address (e.g. 'you@yourdomain.com') (your receipt will be sent here)");
	m2 = isEmail(document.forms[0].shipping_email2,"Please enter your ship-to E-mail address a second time to ensure accuracy");
	n = isEmail(document.forms[0].billing_email,"Please enter a valid bill-to E-mail address (e.g. 'you@yourdomain.com') (your receipt will be sent here)");
	n2 = isEmail(document.forms[0].billing_email2,"Please enter your bill-to E-mail address a second time to ensure accuracy");
	if (document.forms[0].shipping_email.value!=document.forms[0].shipping_email2.value)	{
		x12=false;
		alert('The email addresses you entered for your shipping information do not match.\nPlease check them and try again.');
	}
	
	if (document.forms[0].billing_email.value!=document.forms[0].billing_email2.value)	{
		x1=false;
		alert('The email addresses you entered for your billing information do not match.\nPlease check them and try again.');
	}

	if ((a=false) || (b==false) || (c==false) || (d==false) || (e==false) || (f==false) || (g==false) || (h==false) || (i==false) || (j==false) || (k==false) || (l==false) || (m==false) || (n==false) || (m2==false) || (n2==false) || (x1==false) || (x2==false))

return false;
          else return true;
      }

/****************************************************************/
function ValidateEmail() {           
	var a;
	
	// Check to make sure that the full name field is not empty.
	a = isEmail(document.forms[0].email,"Please enter a valid E-mail address (e.g. 'you@yourdomain.com')");
	
	if ((a==false))
		return false;
	else 
		return true;
	}
// --> 