function emzipageVal()
{

  if (document.theForm.email.value == "")
  {
    alert("Please enter a valid email address.");
    document.theForm.email.focus();
    return (false);
  }

  if (document.theForm.email.value.length < 7)
  {
    alert("Please enter a valid email address.");
    document.theForm.email.focus();
    return (false);
  }

  if (document.theForm.email.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"email\" field.");
    document.theForm.email.focus();
    return (false);
  }

if (document.theForm.email.value.indexOf("@", 0) < 0)
 {
    alert("Please enter a valid email address.");
    document.theForm.email.focus();
    return (false);
 }

if (document.theForm.email.value.indexOf(".", 0) < 0)
 {
    alert("Please enter a valid email address.");
    document.theForm.email.focus();
    return false;
 }

  if (document.theForm.email.value.indexOf(",", 0) >= 0)
 {
	alert ("Please enter a valid e-mail address. Valid email addresses do not contain commas.");
	document.theForm.email.focus();
	return(false);
}

 if (document.theForm.email.value.indexOf("www.", 0) >= 0)
 {
	alert ("Please enter a valid e-mail address. Valid email addresses do not start with \" www.\"");
	document.theForm.email.focus();
	return(false);
}
// Canadian Postal Code Validation
var postal, blank;
blank = " ";
postal = document.theForm.postalcode.value;
postal = postal.toString();
postal = postal.replace(blank,"");
postal = postal.toUpperCase();  // in case of lowercase
//alert("The Value of Postal = " + postal);

if (document.theForm.postalcode.value == "")
  {
    alert("Please enter your 6 digit Canadian Postal Code.");
    document.theForm.postalcode.focus();
    return (false);
  }
  
  if (document.theForm.postalcode.value.length < 6)
  {
    alert("Please enter 6 digits in your Canadian Postal Code.");
    document.theForm.postalcode.focus();
    return (false);
  }
// Check for legal characters in string - note index starts at zero
if('ABCEGHJKLMNPRSTVXY'.indexOf(postal.charAt(0))<0) 
{
	alert("Please enter a correct 6 digit Canadian Postal Code.");
	document.theForm.postalcode.focus();
	return false;
	}
	
if('0123456789'.indexOf(postal.charAt(1))<0) 
{
	alert("Please enter a correct 6 digit Canadian Postal Code.");
	document.theForm.postalcode.focus();
	return false;
	}
	
if('ABCDEFGHJKLMNPQRSTUVWXYZ'.indexOf(postal.charAt(2))<0) 
{
	alert("Please enter a correct 6 digit Canadian Postal Code.");
	document.theForm.postalcode.focus();
	return false;
	}
	
if('0123456789'.indexOf(postal.charAt(3))<0) 
{
	alert("Please enter a correct 6 digit Canadian Postal Code.");
	document.theForm.postalcode.focus();
	return false;
	}
	
if('ABCDEFGHJKLMNPQRSTUVWXYZ'.indexOf(postal.charAt(4))<0) 
{
	alert("Please enter a correct 6 digit Canadian Postal Code.");
	document.theForm.postalcode.focus();
	return false;
	}
if('0123456789'.indexOf(postal.charAt(5))<0) 
{
	alert("Please enter a correct 6 digit Canadian Postal Code.");
	document.theForm.postalcode.focus();
	return false;
	}
/*
if (document.theForm.zipcode.value == "")
  {
    alert("Please enter your Zip Code.");
    document.theForm.zipcode.focus();
    return (false);
  }

  if (document.theForm.zipcode.value.length < 5)
  {
    alert("Please enter your Zip Code.");
    document.theForm.zipcode.focus();
    return (false);
  }

  if (document.theForm.zipcode.value.length > 5)
  {
    alert("Please enter at most 5 numbers in the \"Zip Code\" field.");
    document.theForm.zipcode.focus();
    return (false);
  }



  var checkOK = "0123456789";
  var checkStr = document.theForm.zipcode.value;
  var allValid = true;
  var validGroups = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only numbers in the \"Zip Code\" field. Sorry, U.S. residents only.");
    document.theForm.zipcode.focus();
    return (false);
  }
*/

  if (document.theForm.Age.value == "")
  {
    alert("Please enter your age.");
    document.theForm.Age.focus();
    return (false);
  }

  if (document.theForm.Age.value.length < 1)
  {
    alert("Please enter your age.");
    document.theForm.Age.focus();
    return (false);
  }

  if (document.theForm.Age.value.length > 2)
  {
    alert("Please enter at most 2 characters in the \"Age\" field.");
    document.theForm.Age.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = document.theForm.Age.value;
  var allValid = true;
  var validGroups = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only numbers in the \"Age\" field.");
    document.theForm.Age.focus();
    return (false);
  }
  
 if (document.theForm.Age.value < 13)
  {
    window.location = "http://www.teenfreeway.com/hcunderaged.htm";
return (false);
  }

/*
if(document.theForm.tfnewsletter_subscribe1.checked == false)
{

window.location = "http://www.startsampling.com/sm/22725/captureAddress.iphtml?item=22725";
return (true);
}
*/

if (document.theForm.tfrwayoptin1.checked == true)

{
var bally = document.theForm.email.value;
//alert("celine = " + celine);
document.theForm.email.value = bally
document.cookie = "ballycookie" + "=" + escape(document.theForm.email.value) + "; path=/"
}

/*
//Maine compliance w. age
var mainezip, agecomp;
mainezip = document.theForm.zipcode.value;
mainezip = mainezip.toString();
agecomp = document.theForm.Age.value;
agecomp = agecomp.toString();
//alert(agetest);
if (mainezip >= "03901" & mainezip <= "04990" & agecomp < "18")
  {
   window.location.replace("http://www.teenfreeway.com/hcunderaged_maine.htm");
    return (false);
  }
*/
return (true);
}

