function sunVal()
{

 if (document.cleanclr.firstName.value == "")
  {
    alert("Please enter your First Name.");
    document.cleanclr.firstName.focus();
    return (false);
  }

  if (document.cleanclr.firstName.value.length < 1)
  {
    alert("Please enter your First Name.");
    document.cleanclr.firstName.focus();
    return (false);
  }

  if (document.cleanclr.firstName.value.length > 24)
  {
    alert("Please enter at most 24 characters in the \"First Name\" field.");
    document.cleanclr.firstName.focus();
    return (false);
  }

  if (document.cleanclr.firstName.value.indexOf(".", 0) >= 0)
 {
    alert("Please do not enter a period in the first name field.");
    document.cleanclr.firstName.focus();
    return (false);
 }

  if (document.cleanclr.firstName.value.indexOf(",", 0) >= 0)
 {
    alert("Please do not enter a comma in the first name field.");
    document.cleanclr.firstName.focus();
    return (false);
 }

  if (document.cleanclr.lastName.value == "")
  {
    alert("Please enter your Last Name.");
    document.cleanclr.lastName.focus();
    return (false);
  }

  if (document.cleanclr.lastName.value.length < 2)
  {
    alert("Please enter your Last Name.");
    document.cleanclr.lastName.focus();
    return (false);
  }

  if (document.cleanclr.lastName.value.length > 24)
  {
    alert("Please enter at most 24 characters in the \"Last Name\" field.");
    document.cleanclr.lastName.focus();
    return (false);
  }

 if (document.cleanclr.lastName.value.indexOf(".", 0) >= 0)
 {
    alert("Please do not enter a period in the last name field.");
    document.cleanclr.lastName.focus();
    return (false);
 }

 if (document.cleanclr.lastName.value.indexOf(",", 0) >= 0)
 {
    alert("Please do not enter a comma in the last name field.");
    document.cleanclr.lastName.focus();
    return (false);
 }

  if (document.cleanclr.address1.value == "")
  {
    alert("Please enter your Address.");
    document.cleanclr.address1.focus();
    return (false);
  }

  if (document.cleanclr.address1.value.length < 1)
  {
    alert("Please enter your Address.");
    document.cleanclr.address1.focus();
    return (false);
  }

  if (document.cleanclr.address1.value.length > 24)
  {
    alert("Please enter at most 24 characters in the Address field.");
    document.cleanclr.address1.focus();
    return (false);
  }

 if (document.cleanclr.address1.value.indexOf(",", 0) >= 0)
 {
    alert("Please do not enter a comma in the Address field.");
    document.cleanclr.address1.focus();
    return (false);
 }

 if (document.cleanclr.address2.value.indexOf(",", 0) >= 0)
 {
    alert("Please do not enter a comma in the Address field.");
    document.cleanclr.address2.focus();
    return (false);
 }

  if (document.cleanclr.address2.value.length > 24)
  {
    alert("Please enter at most 24 characters in the second Address field.");
    document.cleanclr.address2.focus();
    return (false);
  }

if (document.cleanclr.city.value.indexOf(",", 0) >= 0)
 {
    alert("Please only enter your city in the City field. No commas please!");
    document.cleanclr.city.focus();
    return (false);
 }

  if (document.cleanclr.city.value == "")
  {
    alert("Please enter your City.");
    document.cleanclr.city.focus();
    return (false);
  }

  if (document.cleanclr.city.value.length < 1)
  {
    alert("Please enter your City.");
    document.cleanclr.city.focus();
    return (false);
  }

  if (document.cleanclr.city.value.length > 24)
  {
    alert("Please enter at most 24 characters in the City field.");
    document.cleanclr.city.focus();
    return (false);
  }

  if (document.cleanclr.state.selectedIndex < 0)
  {
    alert("Please select your State.");
    document.cleanclr.state.focus();
    return (false);
  }

  if (document.cleanclr.state.selectedIndex == 0)
  {
    alert("Please select your State.");
    document.cleanclr.state.focus();
    return (false);
  }

  if (document.cleanclr.zip.value == "")
  {
    alert("Please enter your Zip Code.");
    document.cleanclr.zip.focus();
    return (false);
  }

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

  if (document.cleanclr.zip.value.length > 5)
  {
    alert("Please enter at least 5 numbers in the \"zip code\" field. Sorry, U.S. residents only..");
    document.cleanclr.zip.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = document.cleanclr.zip.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.cleanclr.zip.focus();
    return (false);
  }

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

  if (document.cleanclr.email.value.length < 7)
  {
    alert("Please enter at least 7 characters in the \"email\" field.");
    document.cleanclr.email.focus();
    return (false);
  }

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

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

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

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

  if (document.cleanclr.email.value.indexOf(",", 0) >= 0)
 {
	alert ("Please enter a valid e-mail address. Valid email addresses do not contain commas.");
	document.cleanclr.email.focus();
	return(false);
}
/*
 var radioSelected = false;
  for (i = 0;  i < document.cleanclr.gender.length;  i++)
  {
    if (document.cleanclr.gender[i].checked)
        radioSelected = true;
  }
  if (!radioSelected)
  {
    alert("What is your gender?  Please click on the appropriate circle.");
    return (false);
  }
  */
  
   if (document.cleanclr.month_of_birth.selectedIndex < 0)
  {
    alert("What is your month of birth?");
    document.cleanclr.month_of_birth.focus();
    return (false);
  }

  if (document.cleanclr.month_of_birth.selectedIndex == 0)
  {
    alert("What is your month of birth?");
    document.cleanclr.month_of_birth.focus();
    return (false);
  }
 if (document.cleanclr.day_of_birth.selectedIndex < 0)
  {
    alert("What is your day of birth?");
    document.cleanclr.day_of_birth.focus();
    return (false);
  }

  if (document.cleanclr.day_of_birth.selectedIndex == 0)
  {
    alert("What is your day of birth?");
    document.cleanclr.day_of_birth.focus();
    return (false);
  }


  if (document.cleanclr.birthyear.value == "")
  {
    alert("What is your year of birth?");
    document.cleanclr.birthyear.focus();
    return (false);
  }

  if (document.cleanclr.birthyear.value.length < 4)
  {
    alert("Please enter at least 4 characters in the \"birth year\" field.");
    document.cleanclr.birthyear.focus();
    return (false);
  }

  if (document.cleanclr.birthyear.value.length > 4)
  {
    alert("Please enter at most 4 characters in the \"birth year\" field.");
    document.cleanclr.birthyear.focus();
    return (false);
  }
  
   if (document.cleanclr.birthyear.value < 1907)
  {
    alert("Please enter your year of birth.");
    document.cleanclr.birthyear.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = document.cleanclr.birthyear.value;
  var allValid = true;
  var validGroups = true;
  var decPoints = 0;
  var allNum = "";
  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 (ch == ".")
    {
      allNum += ".";
      decPoints++;
    }
    else if (ch == "," && decPoints != 0)
    {
      validGroups = false;
      break;
    }
    else if (ch != ",")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("Please enter only digit characters in the \"birthyear\" field.");
    document.cleanclr.birthyear.focus();
    return (false);
  }

  if (decPoints > 1 || !validGroups)
  {
    alert("Please enter a valid number in the \"birthyear\" field.");
    document.cleanclr.birthyear.focus();
    return (false);
  }
  
var today = new Date();
//alert("Today's date is: " + today);

var milli = today.valueOf();
//alert("Today's date in milliseconds is: " + milli);

//var thirteen = (1000*60*60*24*365.242199*13);
//alert("The number of milliseconds in 13 years is: " + thirteen);

var oneyr = (1000*60*60*24*365.242199);
//alert("The number of milliseconds in 1 years is: " + oneyear);

var by, bm, bd, birthmilli, OK;
by = document.cleanclr.birthyear.value
bm = document.cleanclr.month_of_birth.value
bm = (bm-1);
bd = document.cleanclr.day_of_birth.value

//alert("The birth year is: " + by);
//alert("The birth month is: " + bm);
//alert("The birth day is: " + bd);

birthmilli = new Date(by,bm,bd);
//alert("birthmilli is: " + birthmilli);

var birthmilliconv = birthmilli.valueOf();
//alert("birthmilliconv is: " + birthmilliconv);

var agetest = ((milli - birthmilliconv) / oneyr);
//alert("agetest is: " + agetest);
  
if (agetest < 13){
 window.location = "http://www.teenfreeway.com/hcunderaged.htm";

return (false);
}


//birth date concatenation
var newbm, newbd;
bm = (bm+1);

/*
if (bd <10){
newbd = "0" + bd;
}
else
{
newbd = bd;
}
*/

if (bm <10){
newbm = "0" + bm;
}
else
{
newbm = bm;
}

document.cleanclr.birth_date.value = bd + "-" + newbm + "-" + by;

//dropdown validation


if (document.cleanclr.doYouUse.selectedIndex == 0)

  {
    alert("Have you used Clean & Clear in the past four weeks? Please select.");
    document.cleanclr.doYouUse.focus();
    return (false);
  }


 /*
if (document.cleanclr.howEffort.selectedIndex == 0)

  {
    alert("How much effort do you put into your appearance? Please select.");
    document.cleanclr.howEffort.focus();
    return (false);
  }

if (document.cleanclr.howFeel.selectedIndex == 0)

  {
    alert("How do you feel about your looks? Please select.");
    document.cleanclr.howFeel.focus();
    return (false);
  }

if (document.cleanclr.howDescribe.selectedIndex == 0)

  {
    alert("How would you describe your skin issues? Please select.");
    document.cleanclr.howDescribe.focus();
    return (false);
  }
  
  */
  
/*
if (document.cleanclr.futurePromoBrand.checked == false) 

  document.cleanclr.opt_in.value = "N";
  
  else
  
  document.cleanclr.opt_in.value = "Y";
*/

//converts order date to dd-mm-yyyy HH24:MI format
var subdate, day, month, newmonth, newday, year, hours, newhours, minutes, newminutes, seconds, newseconds;

var today = new Date();
day = today.getDate();
month = today.getMonth() + 1;
year = today.getFullYear();
hours = today.getHours();
minutes = today.getMinutes();
seconds = today.getSeconds();

if (day < 10)
{
newday = "0" + day;
}
else
{
newday = day;
}

if (month < 10)
{
newmonth = "0" + month;
}
else
{
newmonth = month;
}

if (hours < 10)
{
newhours = "0" + hours;
}
else
{
newhours = hours;
}

if (minutes < 10)
{
newminutes = "0" + minutes;
}
else
{
newminutes = minutes;
}

if (seconds < 10)
{
newseconds = "0" + seconds;
}
else
{
newseconds = seconds
}

subdate = newday + "-" + newmonth + "-" + year + " " + newhours + ":" + newminutes + ":" + newseconds;

document.cleanclr.created_when.value = subdate;


var em = document.cleanclr.email.value;
//alert("em = " + em);
document.cleanclr.email.value = em
document.cookie = "emcookie" + "=" + escape(document.cleanclr.email.value) + "; path=/"




return (true);
}
    
  

  