	//function for returning how many days there are in a month including leap years
	//set todays date
	Now = new Date();
	NowDay = Now.getDate();
	NowMonth = Now.getMonth();
	NowYear = Now.getYear();
	if (NowYear < 2000) NowYear += 1900; //for Netscape
	
	function DaysInMonth(WhichMonth, WhichYear)
	{
	  var DaysInMonth = 31;
	  if (WhichMonth == "Apr" || WhichMonth == "Jun" || WhichMonth == "Sep" || WhichMonth == "Nov") DaysInMonth = 30;
	  if (WhichMonth == "Feb" && (WhichYear/4) != Math.floor(WhichYear/4))	DaysInMonth = 28;
	  if (WhichMonth == "Feb" && (WhichYear/4) == Math.floor(WhichYear/4))	DaysInMonth = 29;
	  return DaysInMonth;
	}
	
	//function to change the available days in a months
	function ChangeOptionDays(WhichMonth,WhichDay,WhichYear)
	{
	  DaysObject = eval("document.Form1." + WhichDay);
	  MonthObject = eval("document.Form1." + WhichMonth);
	  YearObject = eval("document.Form1." + WhichYear);
	
	  Month = MonthObject[MonthObject.selectedIndex].text;
	  Year = YearObject[YearObject.selectedIndex].text;
	
	  DaysForThisSelection = DaysInMonth(Month, Year);
	  CurrentDaysInSelection = DaysObject.length;
	  if (CurrentDaysInSelection > DaysForThisSelection)
	  {
		for (i=0; i<(CurrentDaysInSelection-DaysForThisSelection); i++)
		{
		  DaysObject.options[DaysObject.options.length - 1] = null
		}
	  }
	  if (DaysForThisSelection > CurrentDaysInSelection)
	  {
		for (i=0; i<(DaysForThisSelection-CurrentDaysInSelection); i++)
		{
		  NewOption = new Option(DaysObject.options.length + 1);
		  DaysObject.add(NewOption);
		}
	  }
		if (DaysObject.selectedIndex < 0) DaysObject.selectedIndex == 0;
	}
	
	
	//function to write option years plus x
	function WriteYearOptions(YearsAhead)
	{
	  var addYear=(NowYear - 20)
	  line = "";
	  for (i=0; i<YearsAhead; i++)
	  {
		line += "<OPTION";
		line += " VALUE="+(addYear - i)+">";
		line += addYear - i;
	  }
	  return line;
	}		
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail Address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail Address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.Form1.Email
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter Your Email Address")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	if (document.Form1.chkEmail.checked == true){
		if ((document.Form1.birthMonth.value==null)||(document.Form1.birthMonth.value=="")){
			alert("You must provide a valid birthdate in order to receive email offers.")
			document.Form1.birthMonth.focus()
			return false
		}
		if ((document.Form1.birthDay.value==null)||(document.Form1.birthDay.value=="")){
			alert("You must provide a valid birthdate in order to receive email offers.")
			document.Form1.birthDay.focus()
			return false
		}
		if ((document.Form1.birthYear.value==null)||(document.Form1.birthYear.value=="")){
			alert("You must provide a valid birthdate in order to receive email offers.")
			document.Form1.birthYear.focus()
			return false
		}
	}
	return true
 }		
