<!--
function MM_validateForm() 
{ //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } 
	
	var fm = document.FBForm;
	
	if(fm.Preferred_Day.value != 99 && fm.Preferred_Month.value != 99 && fm.Preferred_Year.value != 9999)
	{
		if(!currentDate(fm.Preferred_Day.value, fm.Preferred_Month.value, fm.Preferred_Year.value))
		{
			valid = false;
			errors += '- The Preferred Date has already passed!\n';
		}
		if(!validDate(fm.Preferred_Day.value, fm.Preferred_Month.value, fm.Preferred_Year.value))
		{
			valid = false;
			errors += '- The Preferred Date in is not a valid date!\n';
		}
	}
	
	if (errors) alert('The following error(s) occurred:\n'+errors);
	document.MM_returnValue = (errors == '');
}

//function to ensure that a date has not yet passed
function currentDate(d, m, y)
{
	//create two date variables
	var dueDate = new Date();
	var today = new Date();
	//set a variable to sdtore the return
	var theReturn = true;
	//set the end date
	dueDate.setDate(d);
	dueDate.setMonth(m-1);
	dueDate.setYear(y);
	//check that the dueDate is greater than the present date
	if(today.getTime() > dueDate.getTime())
	{
		theReturn = false;
	}
	return theReturn;
}

//check to ensure the date is valid
function validDate(d, m, y)
{
	//create date variable
	var dueDate = new Date();
	//set a variable to store the return
	var theReturn = true;
	//set the due date
	dueDate.setDate(d);
	dueDate.setMonth(m-1);
	dueDate.setYear(y);
	//check that the dueDate is greater than the present date
	if(dueDate.getDate() != d && d != 31)
	{
		theReturn = false;
	}
	if(d==31 && (m==2 || m==4 || m==6 || m==9 || m==11))
	{
		theReturn = false;
	}
	return theReturn;
}
//-->