
<!--
function checkForm(theForm, s_month, s_day, s_year, e_month, e_day, e_year)
{

	

 if (theForm.user_fname.value == "")
  {
    alert("You have not entered your first name.");
    theForm.user_fname.focus();
    return (false);
  }
  
  if (theForm.user_lname.value == "")
  {
    alert("You have not entered your last name.");
    theForm.user_lname.focus();
    return (false);
  }
  


if (theForm.user_email.value == "")
  {
    alert("You have not entered your email address.");
    theForm.user_email.focus();
    return (false);
  }

invalidChars = " /:,;"
  for (i=0; i<invalidChars.length; i++)
  	badChar = invalidChars.charAt(i)
  	if (theForm.user_email.value.indexOf(badChar,0) > -1) {
  		alert ('Your email address contains invalid chars.');
		theForm.user_email.focus();
  		return (false);
  		}
  		
  atPos = theForm.user_email.value.indexOf("@",1)
  if (atPos == -1) {
  	alert ('Your email address doesn\'t contain \"@\" ');
	theForm.user_email.focus();
  	return (false);
  	}
  	
  if (theForm.user_email.value.indexOf("@",atPos+1) >	 -1) {
 	alert ('Your email address contains 2 \"@s\" ');
	theForm.user_email.focus();
  	return (false);
  	}
  	
  	periodPos = theForm.user_email.value.indexOf(".",atPos)
  	if (periodPos == -1) {
  		alert ('Your email address doesn\'t contain \".\" ');
		theForm.user_email.focus();
		return (false);
  	}
  
  if (periodPos +2 > theForm.user_email.value.length) {
		alert ('Your email address is incorrect. ');
		theForm.user_email.focus();
		return (false);
	}
	
if (theForm.user_address.value == "")
  {
    alert("You have not entered your home address. We need your address to mail you your rewards.");
    theForm.user_address.focus();
    return (false);
  }
  
  if (theForm.user_city.value == "")
  {
    alert("You have not entered your city.");
    theForm.user_city.focus();
    return (false);
  }
  
    if (theForm.user_state.value == "")
  {
    alert("You have not entered your state.");
    theForm.user_state.focus();
    return (false);
  }


if (theForm.user_homezip.value == "")
  {
    alert("You have not entered your home zip code.");
    theForm.user_homezip.focus();
    return (false);
  }


   if (theForm.user_hphone.value == "")
  {
    alert("You have not entered your home phone.");
    theForm.user_hphone.focus();
    return (false);
  }
  
     if (theForm.user_license.value == "")
  {
    alert("You have not entered your driver license number.");
    theForm.user_license.focus();
    return (false);
  }


	   if (theForm.user_otheremp.value == "")
  {
    alert("You have not entered your employer.");
	 theForm.user_otheremp.focus();
    return (false);
  }
 
 
	   if (theForm.user_emp_address.value == "")
  {
    alert("You have not entered your work address.");
	 theForm.user_emp_address.focus();
    return (false);
  }
 
 	   if (theForm.user_emp_city.value == "")
  {
    alert("You have not entered your work city.");
	 theForm.user_emp_city.focus();
    return (false);
  }
  
  	   if (theForm.user_emp_state.value == "")
  {
    alert("You have not entered your work state.");
	 theForm.user_emp_state.focus();
    return (false);
  }
 
 
if (theForm.user_workzip.value == "")
  {
    alert("You have not entered your work zip code.");
    theForm.user_workzip.focus();
    return (false);
  }
  
  if (theForm.user_wphone.value == "")
  {
    alert("You have not entered your work phone.");
	 theForm.user_wphone.focus();
    return (false);
  }
 
   
  
    if (theForm.user_supervisor.value == "")
  {
    alert("You have not entered your supervisor's name.");
	 theForm.user_supervisor.focus();
    return (false);
  }
  
    if (theForm.user_supervisor_phone.value == "")
  {
    alert("You have not entered your supervisor's phone.");
	 theForm.user_supervisor_phone.focus();
    return (false);
  }
	
   if (theForm.user_miles.value == "")
  {
    alert("You have not entered your one-way commute miles.");
	 theForm.user_miles.focus();
    return (false);
  }
   var checkOK = "0123456789";
  var checkStr = theForm.user_miles.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 digits in the commute miles field.");
	theForm.user_miles.value = '';
	theForm.user_miles.focus();
    return (false);
  }
  
  
  buddy_count = parseInt(theForm.buddies.value)-1
  

for (i=1;i<=buddy_count;i++)
{
	myField = ('buddy_fname'+i)
	if (document.getElementById(myField).value== "" ) {
		alert('Please enter each of your carpool buddy\'s first names');
		document.getElementById(myField).focus();
		return (false);
	}
	if (document.getElementById(myField).value.indexOf(',') != -1 ) {
		alert('Please do not type commas in the buddy first name fields');
		return (false);
	}
	
	myField = ('buddy_lname'+i)
	if (document.getElementById(myField).value== "" ) {
		alert('Please enter each of your carpool buddy\'s last names');
		document.getElementById(myField).focus();
		return (false);
	}
	if (document.getElementById(myField).value.indexOf(',') != -1 ) {
		alert('Please do not type commas in the buddy last name fields');
		return (false);
	}
	
	myField = ('buddy_email'+i)
	if (document.getElementById(myField).value== "" ) {
		alert('Please enter each of your carpool buddy\'s email addresses');
		document.getElementById(myField).focus();
		return (false);
	}
	if (document.getElementById(myField).value.indexOf(',') != -1 ) {
		alert('Please do not type commas in the buddy email fields');
		return (false);
	}
	
	myField = ('buddy_employer'+i)
	if (document.getElementById(myField).value== "" ) {
		alert('Please enter each of your carpool buddy\'s employers');
		document.getElementById(myField).focus();
		return (false);
	}
	if (document.getElementById(myField).value.indexOf(',') != -1 ) {
		alert('Please do not type commas in the buddy employer fields');
		return (false);
	}
	
	myField = ('buddy_wphone'+i)
	if (document.getElementById(myField).value== "" ) {
		alert('Please enter each of your carpool buddy\'s phone numbers');
		document.getElementById(myField).focus();
		return (false);
	}
	if (document.getElementById(myField).value.indexOf(',') != -1 ) {
		alert('Please do not type commas in the buddy phone fields');
		return (false);
	}
}


var myDate = new Date;
thisYear = myDate.getFullYear();
myDate.setDate(parseInt(theForm.user_start_day.value))
myDate.setMonth(parseInt(theForm.user_start_month.value)-1)
myDate.setFullYear(parseInt(theForm.user_start_year.value))



var startdate = new Date;
startdate.setDate(parseInt(s_day))
startdate.setMonth(parseInt(s_month)-1)
startdate.setFullYear(parseInt(s_year))



var enddate = new Date;
enddate.setDate(parseInt(e_day))
enddate.setMonth(parseInt(e_month)-1)
enddate.setFullYear(parseInt(e_year))



var today = new Date;

if (myDate < startdate) {
	alert('You must select a start date no earlier than ' + s_month + '/' + s_day + '/' + s_year )
	return(false);
} else {
	if (myDate <= today) {
	alert('You must select a start date no earlier than tomorrow.')
	return(false);
}
}

if (myDate > enddate) {
	alert('You must select a start date no later than ' + e_month + '/' + e_day + '/' + e_year )
	return(false);
}

	
    theForm.submit.value="Processing...";
    theForm.submit.disabled = true;
    return (true);
 
}

function applyDisplay(){
row = parseFloat(document.form1.buddies.value);
row = row+1

for (i=1;i<row;i++)
{
	if (i < 6) {
myField = ('guests'+i)
document.getElementById(myField).style.display = '';
}
}

for (i=row-1;i<=5;i++)
{
myField = ('guests'+i)
document.getElementById(myField).style.display = 'none';
}

}

function hideGuests(){

for (i=2;i<=5;i++)
{
myField = ('guests'+i)
document.getElementById(myField).style.display = 'none';
}

}

function sameEmp(buddy){
myCheck = ('buddy_sameemp'+buddy)
myField = ('buddy_employer'+buddy)
if (document.getElementById(myCheck).checked == true) {
	document.getElementById(myField).value = document.form1.user_otheremp.value
}
}

function disableNew(onoff){
	if (onoff == 1) {
		document.form1.user_start_month.disabled= true
		document.form1.user_start_day.disabled= true
		document.form1.user_gift_pref.disabled= true
	} else {
		document.form1.user_start_month.disabled= false
		document.form1.user_start_day.disabled=false
		document.form1.user_gift_pref.disabled= false
	}
}

