<!--  


function howOld(day,month,year) {
    var c = new Date(); // a new instance
    fixDate(c);

    var thisDay = c.getDate();
    var thisMonth = c.getMonth() + 1;
    var thisYear = c.getFullYear();

    var yearsold = thisYear - year; 
    var monthsold = 0;
    var daysold = 0;
    var age = '';

    if (thisMonth >= month) {
      monthsold = thisMonth - month;
    }
    else {
      yearsold--;
      monthsold = thisMonth + 12 - month;
    }

    if (thisDay >= day) {
     daysold = thisDay - day;
    }
    else {
        if (monthsold > 0) {
          monthsold--;
        }
        else {
          yearsold--;
          monthsold += 11;
        }
        daysold = thisDay + 31 - day;
    }

    if (yearsold < 0) return '';

    if ((yearsold == 0) && (monthsold == 0) && (daysold == 0)) return '';

    if (yearsold > 0) {
        age = yearsold;
        if (yearsold > 1) age;
        age += ' ';
    }

    return age;
}

function fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0) { date.setTime(date.getTime() - skew); }
}

function doSubmit() {
 var f = document.form1;
 var dob,theMonth,theDay;

 /* Validate month: check for digits, then check:  1 <= month <= 12 */
 if(f.dob_month.value.match(/\d{1,2}/)) {
   theMonth = eval(f.dob_month.value);		
   if(!(theMonth <= 12 && theMonth >= 1)){
     alert('Please enter a valid month of birth.');
     f.dob_month.focus();
     f.dob_month.select(); 
     return(false); 
  }
 } 
 else {
  alert('Please enter a valid month of birth.');
  f.dob_month.focus();
  f.dob_month.select(); 
  return(false); 
 }
  
 /* Validate day: check for digits, then check:  1 <= day <= 31 */
 if(f.dob_day.value.match(/\d{1,2}/)) {
   theDay = eval(f.dob_day.value);
   if(!(theDay >= 1 && theDay <= 31)) {
      alert('Please enter a valid day of birth.'); 
      f.dob_day.focus(); 
      f.dob_day.select(); 
      return(false); 
   }
 }
 else {
   alert('Please enter a valid day of birth.'); 
   f.dob_day.focus(); 
   f.dob_day.select(); 
   return(false); 
 }

 if(!f.dob_year.value.match(/\d{4}/) || f.dob_year.value=="0000") { 
    alert('Please enter a valid year of birth (xxxx).'); 
    f.dob_year.focus(); 
    f.dob_year.select(); 
    return(false); 
 }
 
 var age = howOld(f.dob_day.value, f.dob_month.value, f.dob_year.value);

 if((age >= 21) && (age <= 150)) {
    dob = f.dob_year.value + "-" + f.dob_month.value + "-" + f.dob_day.value;
		return true;
 }else{
 	/*alert("You must be 21 years of age or older to enter this site.");*/
	self.location.href = "not21.htm";
 	return false;
 }
}

function checkform(thisform)
        {
        returnval=true;
        for (var j=0; j<(thisform.elements.length); j++)
                {
                indx = thisform.elements[j].name.indexOf('_required');
                if (indx != -1)
                        {
                        fieldname=thisform.elements[j].name.substring(0,indx);
                        if (thisform.elements[fieldname].value.length == 0)
                                {
                                alert(thisform.elements[j].value);
                                j = (thisform.elements.length);
                                returnval = false;
                                }
                        }
                }
        return returnval;
        }

