function setOptions()
{ 
o=document.ask.sSubject.options[document.ask.sSubject.selectedIndex].value
if (o == "1") 
{ 
  document.getElementById('rowCopy').style.display='block';
  /*
  document.ask.lotNumber.value='';
  document.ask.lotNumberExists.checked=false;
  document.ask.lotNumberExists.value='false';
  document.ask.expMonth.value='';
  document.ask.expYear.value='';
  document.ask.upcCode.value='';
  document.ask.prodName.value='';
  document.ask.wherePurchased.value='';
  */
} 
else
{
  document.getElementById('rowCopy').style.display='none';
  /*
  document.ask.lotNumber.value='';
  document.ask.lotNumberExists.value='false';
  document.ask.lotNumberExists.checked=false;
  document.ask.expMonth.value='';
  document.ask.expYear.value='';
  document.ask.upcCode.value='';
  document.ask.prodName.value='';
  document.ask.wherePurchased.value='';
  */
}

}



//-------------------------------------------------------------------------------
// AskCheckAge()
//-------------------------------------------------------------------------------
// Purpose:
//   On Ask form, check if age is valid
//
// Parameters:
//	 submit bit
//
//-------------------------------------------------------------------------------
function AskCheckAge(submit){

	var sErrMessage;
	var iAge;
	var Err;
	sErrMessage = "We're sorry, but Neutrogena.com does not collect personally identifiable information from children under age 13. \n\n We encourage you to visit the areas of our site that do not require personally identifiable information. \n\n Clicking OK will take you to the Neutrogena.com home page.";
	validInput = /^[1-9]([0-9]*)$/
	
	iAge = document.forms[1].lAge.value;
	if (document.forms[1].VerifyAge.value == 1) {
		fMon = document.forms[1].iMonth.options[document.forms[1].iMonth.selectedIndex].value;
		fDay =  document.forms[1].iDay.options[document.forms[1].iDay.selectedIndex].text;
		fYr = document.forms[1].lYear.value;

		if (fMon != "" && fDay != "" && fYr != "") {
//alert("a0");
			mydate = new Date();
			mon = mydate.getMonth() + 1;
			day = mydate.getDate();
			yr = mydate.getFullYear();

			if ((yr - fYr < 13 || fYr > yr || !validInput.test(fYr)))  {
			    Err = 1
//alert("a1");
			} else if (yr - fYr == 13) {
				if (mon < fMon) {
//alert("b1");
					Err = 1
				} else if (mon == fMon && fDay > day) {
//alert("c1");
					Err = 1
				}
			}
		}
	}

	if (!validInput.test(iAge) && iAge != "") {
		document.forms[1].lAge.value = "";
		document.forms[1].lAge.text = "";
	} else {

		if (iAge <= 12 && iAge != ""){
			Err = 1
//alert("a");
		} else if (submit == "2") {
		document.forms[1].submit();
		} else if (submit == "1") {
//alert("b");

          mydate = new Date();
		  mon = mydate.getMonth() + 1;
		  day = mydate.getDate();
		  yr = mydate.getFullYear();
		  nAge = 0;

          
          if (fMon > mon) {
                nAge = -1;
          }
          if (fMon == mon) {
               if (fDay > day) {
                 nAge = -1;
               }
          } 
          userAge = yr - fYr;
          userAge = userAge + nAge;
          if (userAge != iAge) {
             alert("Your Age and Date of Birth do not match.  Please provide the correct information and re-submit the form.");
          } else if (document.forms[1].lotNumber.value == "" && !document.forms[1].lotNumberExists.checked && document.forms[1].sSubject.options[document.ask.sSubject.selectedIndex].value == "1"){
             alert("If lot number is not available, please check the box.");             
          } else if (document.forms[1].sEmail.value != document.forms[1].sVerifyEmail.value){
             alert("Your email does not match")
          } else {
             document.forms[1].submit();
          }
		
		}
	}

	if (Err == 1) {
		alert(sErrMessage);
		document.forms[1].lAge.value = "";
		document.forms[1].lAge.text = "";
			
		//Redirect them to an intermediate page where the under 13 cookie will be set
		window.location.href = "/AgeRedirect.asp";
		document.forms[1].VerifyAge.value = 0
	}	
}

