function chkDate(dateValue){
 // Checks for valid Date
 var i, x, y, tmpChar, tmpValue, tmpLength, tmpMonthValue, tmpDayValue, tmpYearValue, tmpErrorCode = "";
 tmpValue = dateValue;

 // Checks for two  "/", "\", or "-"
 if(tmpValue.indexOf("\\") <= 0 && tmpValue.indexOf("/") <= 0 && tmpValue.indexOf("-") <= 0) {
  tmpErrorCode = "error01";
 } else {
  x = tmpValue.indexOf("\\");
  if(x <= 0) x = tmpValue.indexOf("/");
  if(x <= 0) x = tmpValue.indexOf("-");
  tmpChar = tmpValue.charAt(x);
  tmpValue = tmpValue.substring(x + 1,tmpValue.length);
  y = tmpValue.indexOf(tmpChar);
  if(y <= 0) tmpErrorCode = "error01";
  else {

   // Assigns variables
   tmpMonthValue = dateValue.substring(0,x);
   tmpDayValue   = tmpValue.substring(0,y);
   tmpYearValue  = tmpValue.substring(y + 1,tmpValue.length);

   // Checks for valid month number
   tmpLength = tmpMonthValue.length;
   if(tmpMonthValue == "") tmpErrorCode = "error02";
   for(i = 0; i < tmpLength; i++){
    if((tmpMonthValue.charAt(i) < '0' || tmpMonthValue.charAt(i) > '9') && tmpMonthValue.charAt(i) != ' ') tmpErrorCode = "error02";
   }
   if(parseInt(tmpMonthValue) < 1 || parseInt(tmpMonthValue) > 12) tmpErrorCode = "error02";

   // Checks for a valid day number
   if(tmpErrorCode == ""){
    tmpLength = tmpDayValue.length;
    if(tmpDayValue == "") tmpErrorCode = "error03";
    for(i = 0; i < tmpLength; i++){
     if((tmpDayValue.charAt(i) < '0' || tmpDayValue.charAt(i) > '9') && tmpDayValue.charAt(i) != ' ') tmpErrorCode = "error03";
    }
    if(parseInt(tmpDayValue) < 1 || parseInt(tmpDayValue) > 31) tmpErrorCode = "error03";
   }

   // Checks for a valid year number
   if(tmpErrorCode == ""){
    tmpLength = tmpYearValue.length;
    if(tmpLength < 4) tmpErrorCode = "error04";
    for(i = 0; i < tmpLength; i++){
     if(tmpYearValue.charAt(i) < '0' || tmpYearValue.charAt(i) > '9') tmpErrorCode = "error04";
    }
    if(parseInt(tmpYearValue) < 1900 || parseInt(tmpYearValue) > 2100) tmpErrorCode = "error04";
   }

   // Checks for valid days in April, June, September, and November
   if(tmpErrorCode == ""){
    if(parseInt(tmpMonthValue) == 4 || parseInt(tmpMonthValue) == 6 || parseInt(tmpMonthValue) == 9 || parseInt(tmpMonthValue) == 11){
     if(parseInt(tmpDayValue) > 30) tmpErrorCode = "error05";
    }
   }

   // Checks for valid days in February
   if(tmpErrorCode == ""){
    if(parseInt(tmpMonthValue) == 2){
     if((parseInt(tmpYearValue)%4) == 0){
      if(parseInt(tmpDayValue) > 29) tmpErrorCode = "error06";
     }
     else{
      if(parseInt(tmpDayValue) > 28) tmpErrorCode = "error07";
     }
    }
   }
  }
 }

 // Displays error messages
 if(tmpErrorCode != ""){
  switch (tmpErrorCode){
   case "error01": window.alert ("Please enter a valid date in the format of \"mm-dd-yyyy\"."); break;
   case "error02": window.alert ("Please enter a valid month between 1 and 12."); break;
   case "error03": window.alert ("Please enter a valid day between 1 and 31."); break;
   case "error04": window.alert ("Please enter a valid four (4) digit year between 1900 and 2100."); break;
   case "error05": window.alert ("The month you selected only has 30 days, please enter a valid day between 1 and 30."); break;
   case "error06": window.alert ("The month of February only has 29 days during a leap year, please enter a valid day between 1 and 29."); break;
   case "error07": window.alert ("The month of February only has 28 days outside a leap year, please enter a valid day between 1 and 28."); break;
  }
  return (true);
 }
 else{
  return (false);
 }
}

function chkEffDt(tmpValue){
 var y, tmpChar, tmpDateValue, tmpMonthValue, tmpDayValue, tmpYearValue, tmpDate, tmpToday, tmpEffDt;
 tmpDateValue = tmpValue;

 // Gets the current date
 tmpDate  = new Date();
 tmpToday = new Date(tmpDate.getFullYear(), tmpDate.getMonth(), tmpDate.getDate());

 // Parses value to get the month, day, and year
 x = tmpValue.indexOf("\\");
 if(x <= 0) x = tmpValue.indexOf("/");
 if(x <= 0) x = tmpValue.indexOf("-");
 tmpChar = tmpValue.charAt(x);
 tmpValue = tmpValue.substring(x + 1,tmpValue.length);
 y = tmpValue.indexOf(tmpChar);

 // Assigns values to the month, day and year variables
 tmpMonthValue = tmpDateValue.substring(0,x);
 tmpDayValue   = tmpValue.substring(0,y);
 tmpYearValue  = tmpValue.substring(y + 1,tmpValue.length);
 tmpEffDt = new Date(tmpYearValue, tmpMonthValue - 1, tmpDayValue)

 if(tmpEffDt <= tmpToday){
  window.alert ("The appointment date cannot be set on or before the current date");
  return (true);
  }
  else return (false);
}

function checkDateRange(tmpValue) {
 	var y, tmpChar, tmpDateValue, tmpMonthValue, tmpDayValue, tmpYearValue, tmpStartDate, tmpEndDate, tmpEffDt;
 	tmpDateValue = tmpValue;

 	// Gets the current date
 	tmpStartDate = new Date(2009, 4, 22);
 	tmpEndDate = new Date(2009, 5, 10);
 	tmpNADate = new Date(2009, 4, 25);

 	// Parses value to get the month, day, and year
 	x = tmpValue.indexOf("\\");
 	if(x <= 0) x = tmpValue.indexOf("/");
 	if(x <= 0) x = tmpValue.indexOf("-");
 	tmpChar = tmpValue.charAt(x);
 	tmpValue = tmpValue.substring(x + 1,tmpValue.length);
 	y = tmpValue.indexOf(tmpChar);

 	// Assigns values to the month, day and year variables
 	tmpMonthValue = tmpDateValue.substring(0,x);
 	tmpDayValue   = tmpValue.substring(0,y);
 	tmpYearValue  = tmpValue.substring(y + 1,tmpValue.length);
 	tmpEffDt = new Date(tmpYearValue, tmpMonthValue - 1, tmpDayValue)

	if(tmpEffDt < tmpStartDate || tmpEffDt > tmpEndDate)
	{
		alert('The Annual Spring Show Tour is not offered on this date. Please choose another date.');
		return(true);
	}
	else if (tmpEffDt == tmpNADate)
	{
		alert('The Annual Spring Show Tour is not offered on 05/25/2009. Please choose another date.');
		return(true);
	}

	return(false);
}