<!-- 
function isEmpty(s)
{ if ((s == null) || (s.length == 0)) {
		return true;
	}
	if (typeof(s) == "string") {
		for(var i=0;i<s.length;i++) {
			if (s.substring(i,i+1) != ' ') {
				return false;
			}
		}
		return true;
	}
	return false;
}

// File: DateTime.js
// Global Variables used for event handling of short dates
strDateShortSelect = "";
strDateShortChar=""
iDateShortLoc = 0;
bProcessingKey = false; // Set to true when processing the input of the key press

// Validate TimeDate form data
function jsCheckDateTime(pDateTime,pYear,pMonth,pDay,pHour,pMinute,pAMPM)
{
  if (!isDate(pYear.value,pMonth.value,pDay.value))
  {
    if (pMonth.type != "hidden")
      pMonth.focus();
    else {
      if (pDate.type != "hidden")
        pDate.focus();
    }
    return false;
  }
	if (isEmpty(pYear.value) && isEmpty(pMonth.value) && isEmpty(pDay.value) &&
			isEmpty(pHour.value) && isEmpty(pMinute.value))
    pDateTime.value = "";
	else {
		if (isEmpty(pYear.value) && isEmpty(pMonth.value) && isEmpty(pDay.value))
			pDateTime.value = "";
		else 
			pDateTime.value = pMonth.value + "/" + pDay.value + "/" + pYear.value;
		if (!isEmpty(pHour.value) && !isEmpty(pMinute.value) && !isEmpty(pAMPM.value)) 
			pDateTime.value += " " + pHour.value + ":" + pMinute.value + " " + pAMPM.value;
	}
	return true;
}

// Validate TimeDate form data
function jsCheckDateTime2(pDateTime,pDate,pHour,pMinute,pAMPM)
{
  if (!jsCheckDate(pDate, false)) 
  {
    if (pDate.type != "hidden")
      pDate.focus();
    return false;
  }
	if (isEmpty(pDate.value) && isEmpty(pHour.value) && isEmpty(pMinute.value)) 
	  pDateTime.value = "12:00 AM";
	else {
		if (isEmpty(pDate.value))
			pDateTime.value = "12:00 AM";
		else 
			pDateTime.value = pDate.value;
		if (!isEmpty(pHour.value) && !isEmpty(pMinute.value) && !isEmpty(pAMPM.value)) 
			pDateTime.value += " " + pHour.value + ":" + pMinute.value + " " + pAMPM.value;
	}
	return true;
}

// Validate Date form data
function jsCheckDate(pDate, bDispMsg)
{
  var month, day, year;

	if (isEmpty(pDate.value)) return true;
  month = pDate.value.substr(0,2);
  day   = pDate.value.substr(3,2);
	cent	= pDate.value.substr(6,2);
  year  = pDate.value.substr(8,2);
	if (year == '00' && cent != '20') {  // Allow 2000 as a valid year
		if (cent < 20) {
			year = '20' + cent;
		} else {
			year = '19' + cent;
		}
		if (pDate.value.substr(6,4) == '1900')
	pDate.value = month + '/' + day + '/1900';
	else
	pDate.value = month + '/' + day + '/' + year;
		
	} else {
		year = cent + year;
	}

  if (!isDate(year, month, day))
  {
    if (pDate.type != "hidden") {
      if (bDispMsg) alert(pDate.value + " is an Invalid Date! Please Correct.");
      pDate.focus();
			pDate.value = '';
    }
    return false;
  }
	return true;
}

function OnCheckDate(sDate)
{
var retval = true;

    //if (!bProcessingKey)
    retval = jsCheckDate(sDate, true);
    
  return retval;

}
function OnKeyPressDateShort(s)
{
	if (s.readOnly || s.disabled ) {
		return false;
	} 
	//Add code here if you want to process a key press
	return true;
}
function OnKeyDownDateShort(s,e)
{ 
  var sMonth, sDay, sYear, kcode, kchar
	if (s.readOnly || s.disabled ) {
		return false;
	} 
  kcode = (window.Event) ? e.which : e.keyCode;
  bProcessingKey = true;
  //s.form.testing.value = kcode;

	kcode = validkeyDateShort(kcode)
	kchar = String.fromCharCode(kcode);
	if (kcode > 0) {
    // Restore Saved Character
    if (strDateShortChar != "") {
      strDateShortSelect = strDateShortSelect.substr(0,iDateShortLoc) + strDateShortChar + strDateShortSelect.substr(iDateShortLoc+1,9-iDateShortLoc);
      strDateShortChar = "";
    }
    switch (kcode) {
      case 13:  // Return Key
      case 9:   // Tab Key
				dtSaveDate(s);
        if (jsCheckDate(s, true)) {
          bProcessingKey = false;
          return true;
        }
        else {
          bProcessingKey = false;
          return false;
        }
        break;
      case 8:   // Backspace Key
      case 37:  // Left Arrow Key
        switch (iDateShortLoc) {
          case 0:
            s.value = strDateShortSelect;
            return false;
            break;
          case 1:
            iDateShortLoc = 0;
            break;
          case 2:
          case 3:
            iDateShortLoc = 1;
            break;
          case 4:
            iDateShortLoc = 3;
            break;
          case 5:
          case 6:
            iDateShortLoc = 4;
            break;
          default:
            iDateShortLoc = iDateShortLoc-1;
            break;
        }
        break;
      case 191:   //  "/" Key
        switch (iDateShortLoc) {
          case 0:
            break;
          case 1:
            strDateShortSelect = "0" + strDateShortSelect.charAt(0) + strDateShortSelect.substr(2,8);
          case 2:
            iDateShortLoc = 3;
            break;
          case 3:
            break;
          case 4:
            strDateShortSelect = strDateShortSelect.substr(0,3) + "0" + strDateShortSelect.charAt(3) + strDateShortSelect.substr(5,5);
          case 5:
            iDateShortLoc = 6;
            break;
          default:
            break;
        }
        break;
			case 84: // 't' Key
				t = new Date();
				t2 = (t.getMonth()+1) + "/" + t.getDate() + "/" + t.getFullYear();
				if (t2.charAt(1) == "/")
					t2 = "0" + t2;
				if (t2.charAt(4) == "/")
				  t2 = t2.substr(0,3) + "0" + t2.substr(3,6);
				strDateShortSelect=t2;
				iDateShortLoc = 0;
				s.value = strDateShortSelect;
				bProcessingKey = false;
				s.select();
				return false;
			  break;
			case 46: // Delete Key
				strDateShortChar=""
				s.value = "";
				OnFocusDateShort(s);
			  break;
      default:
        if (iDateShortLoc < 10) {
          if (kcode != 39) { // Right arrow Key
            if (iDateShortLoc == 0) 
              strDateShortSelect = kchar + strDateShortSelect.substr(1,strDateShortSelect.length-1);
            else 
              strDateShortSelect = strDateShortSelect.substr(0,iDateShortLoc) + kchar + strDateShortSelect.substr(iDateShortLoc+1,9-iDateShortLoc);
          }
          if (iDateShortLoc < 10) 
            iDateShortLoc++;
          if (iDateShortLoc == 2) iDateShortLoc = 3;
          if (iDateShortLoc == 5) iDateShortLoc = 6;
        }
        break;
    }
    if (iDateShortLoc < 10)
      strDateShortChar = strDateShortSelect.charAt(iDateShortLoc);
    else
      strDateShortChar = " ";
    strDateShortSelect = strDateShortSelect.substr(0,iDateShortLoc) + "_" + strDateShortSelect.substr(iDateShortLoc+1,9-iDateShortLoc);
    s.value = strDateShortSelect;
  }
  bProcessingKey = false;
	return false;
}
function OnClickDateShort(s)
{
	if (s.readOnly || s.disabled ) {
		return false;
	} 
   // Restore Saved value
  if (strDateShortChar != "") {
    strDateShortSelect = strDateShortSelect.substr(0,iDateShortLoc) + strDateShortChar + strDateShortSelect.substr(iDateShortLoc+1,9-iDateShortLoc);
    strDateShortChar = "";
    s.value = strDateShortSelect;
  }
  OnFocusDateShort(s);
}
function OnFocusDateShort(s)
{
	if (s.readOnly || s.disabled ) {
		return false;
	} 
  if (s.value.length != 10 && (s.value.length != 11 || strDateShortChar != " ")) 
    s.value = "00/00/0000";
  strDateShortSelect = s.value;
  strDateShortChar="";
  iDateShortLoc = 0;
  s.select();
}
function dtSaveDate(s) {
   // Restore Saved value
  if (strDateShortChar != "") {
    strDateShortSelect = strDateShortSelect.substr(0,iDateShortLoc) + strDateShortChar + strDateShortSelect.substr(iDateShortLoc+1,9-iDateShortLoc);
    strDateShortChar = "";
  }

  // Shorten to 10 characters
  strDateShortSelect = strDateShortSelect.substr(0,10);

  s.value = strDateShortSelect;
  if (s.value == "00/00/0000") s.value = "";
}
function OnBlurDateShort(s)
{
  var retval = true;

	if (s.readOnly || s.disabled ) {
		return false;
	} 
  dtSaveDate(s);
  if (!bProcessingKey)
    retval = jsCheckDate(s, true);
  return retval;
}
function validkeyDateShort(k)
{ 
  // Allow 0-9(48-57,96-105), /(191,111), Backspace(8), Tab(9), Return(13), Left Arrow(37), Right Arrow(39), Delete(46), t(84)
  if ((k >= 48 && k <= 57) || (k >= 96 && k <= 105) || k == 37 || k == 8 || k == 9 || k == 13 || k == 191 || k==111 || k == 39 || k == 46 || k == 84) {
	  if (k >= 96 && k <= 105) k = k - 48;
		if (k==111) k=191;
		return k;
	}
	return 0;
}

function isDate (year, month, day)
{   // Allow all fields to be empty, but if one is filled then all have to be filled
		if (isEmpty(year) && isEmpty(month) && isEmpty(day)) return true;
		if (isEmpty(year) || isEmpty(month) || isEmpty(day)) return false;

    // Explicitly change type to integer to make code work in both
    // JavaScript 1.1 and JavaScript 1.2.
    var intYear = parseInt(year, 10);
		var intMonth = parseInt(month, 10);
    var intDay = parseInt(day, 10);

    if (intYear == 0 && intMonth == 0 && intDay == 0) return true;
    if (intYear == 0 || intMonth == 0 || intDay == 0) return false;

		if (intYear < 1800 || intYear > 2200) return false;
		if (intDay < 1 || intDay > 31) return false;
		switch(intMonth) 
		{
			case 2:
				// February has 29 days in any year evenly divisible by four,
				// EXCEPT for centurial years which are not also divisible by 400.
				var intDaysInFeb = ( ((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0) ) ) ? 29 : 28 );
				if (intDay > intDaysInFeb) return false;
				break;
			case 4:
				if (intDay > 30) return false;
				break;
			case 6:
				if (intDay > 30) return false;
				break;
			case 9:
				if (intDay > 30) return false;
				break;
			case 10:
				break;
			case 11:
				if (intDay > 30) return false;
				break;
			default:
				if (intMonth < 1 || intMonth > 12) return false;
				break;
		}
    return true;
}
/****************************** dateformat.js *********************************
 *
 * Object Extension for Date object
 *   description:
 *          -Stores day and month arrays in Date object 
 *          -Provides a format function to 'pretty' print
 *           the date in custom formats
 *   parameters:
 *          format - accpets any variation of the following list
 *                 yyyy  is a 4-digit year - i.e., 2002   
 *                 yy    is a 2-digit year - i.e., 02
 *                 month is the full month - i.e., September
 *                 mon   is the first three letters of the month - i.e., Sep
 *                 mmm   is the number of the month - i.e., 9
 *                 hh    is hours - i.e., 3
 *                 mm    is minutes (always 2-digit) - i.e., 05
 *                 ss    is seconds (always 2-digit) - i.e., 08
 *                 ddd   is the first three letters of the day - i.e., Wed
 *                 dd    is the numerical day of the month - i.e, 25
 *                 day   is the full day of the week - i.e., Wednesday
 *                 timezone is the the timezone in hours from GMT - i.e., GMT+5
 *                 time24   is the time based on a 24 hour clock - i.e., 18:24   
 *                 time     is the time based on am/pm - i.e., 6:24PM  
 *   example:
 *           myDate = newDate()
 *           myDate.format("day, month dd, yyyy hh:mm:ss timezone")
 *           would return "Wednesday, September 25, 2002 12:14:11 GMT-5"
 *   note: 
 *           If customizing the dateFormat function be aware that the ordering
 *           of the replace calls
 *   author:
 *           Scott Connelly scottsweep@yahoo.com 1/3/2002
 ******************************************************************************/ 
//Store the date info in the Date object
Date.prototype.Months = ["January", "February", "March", 
                         "April", "May", "June", "July", 
                         "August", "September", "October", 
                         "November", "December"];
Date.prototype.Days = ["Sunday", "Monday", "Tuesday", 
                       "Wednesday", "Thursday", 
                       "Friday", "Saturday"];
Date.prototype.format = dateFormat;

function dateFormat(format) {
   var dateString = format;

   //yyyy  is a 4-digit year - i.e., 2002  
   dateString = dateString.replace( new RegExp("yyyy", "gi"), this.getYear() );
   //yy    is a 2-digit year - i.e., 02
   dateString = dateString.replace( new RegExp("yy", "gi"), new String( this.getYear() ).substring(2,4) );
   //month is the full month - i.e., September
   dateString = dateString.replace( new RegExp("month", "gi"), this.Months[this.getMonth()] );
   //mon   is the first three letters of the month - i.e., Sep
   dateString = dateString.replace( new RegExp("mon", "gi"), new String( this.Months[this.getMonth()] ).substring(0,3) );
   //mmm   is the number of the month - i.e., 9
   dateString = dateString.replace( new RegExp("mmm", "gi"), (this.getMonth() + 1) );   
   //hh    is hours - i.e., 3
   dateString = dateString.replace( new RegExp("hh", "gi"), this.getHours() );
   //mm    is minutes (always 2-digit) - i.e., 05
   var mm = new String( this.getMinutes() );
   if (mm.length == 1) mm = "0" + mm; //pad if single digit
   dateString = dateString.replace( new RegExp("mm", "gi"), mm );
   //ss    is seconds (always 2-digit) - i.e., 08
   var ss = new String( this.getSeconds() );
   if (ss.length == 1) ss = "0" + mm; //pad if single digit
   dateString = dateString.replace( new RegExp("ss", "gi"), ss ); 
   //ddd   is the first three letters of the day - i.e., Wed
   dateString = dateString.replace( new RegExp("ddd", "gi"), new String( this.Days[this.getDay()] ).substring(0,3) );
   //dd    is the numerical day of the month - i.e, 25
   dateString = dateString.replace( new RegExp("dd", "gi"), this.getDate() );
   //day   is the full day of the week - i.e., Wednesday
   dateString = dateString.replace( new RegExp("day", "gi"), this.Days[this.getDay()] );

   //timezone is the the timezone in hours from GMT - i.e., GMT+5
   tz = new Date().getTimezoneOffset();
   timezone = "";
   if (tz < 0)
      timezone = "GMT-" +  tz / 60;
   else if (tz == 0)
      timezone = "GMT";
   else
      timezone = "GMT+" + tz / 60;
   dateString = dateString.replace( new RegExp("timezone", "gi"), timezone );
   
   //time24   is the time based on a 24 hour clock - i.e., 18:24   
   var minutes = new String( this.getMinutes() );
   if (minutes.length == 1) minutes = "0" + minutes; //pad if single digit
   var time24 = new String( this.getHours() + ":" + minutes );
   dateString = dateString.replace( new RegExp("time24", "gi"), time24 );
   
   //time     is the time based on am/pm - i.e., 6:24PM
   var time;
   var ampm;
   var hour = this.getHours();
   if ( hour < 12) {
      if (hour == 0) hour = 12;
         ampm = "AM"
   } else {
      if (hour !=12)
         hour = hour - 12;
      ampm = "PM";   
   }
   time = new String(hour + ":" + minutes + ampm);     
   dateString = dateString.replace( new RegExp("time", "gi"), time );

   return dateString;   
}
function dateFormatToday(format) {
	var dateString = format;
	var Today = new Date();
   //yyyy  is a 4-digit year - i.e., 2002  
   dateString = dateString.replace( new RegExp("yyyy", "gi"), Today.getYear() );
   //yy    is a 2-digit year - i.e., 02
   dateString = dateString.replace( new RegExp("yy", "gi"), new String( Today.getYear() ).substring(2,4) );
   //month is the full month - i.e., September
   dateString = dateString.replace( new RegExp("month", "gi"), Today.getMonth[Today.getMonth()] );
   //mon   is the first three letters of the month - i.e., Sep
   dateString = dateString.replace( new RegExp("mon", "gi"), new String( Today.getMonth[Today.getMonth()] ).substring(0,3) );
   //mmm   is the number of the month - i.e., 9
   var mmm = new String(Today.getMonth() + 1);
   if (mmm.length == 1) mmm = "0" + mmm;
   dateString = dateString.replace( new RegExp("mmm", "gi"), mmm );   
   //hh    is hours - i.e., 3
   dateString = dateString.replace( new RegExp("hh", "gi"), Today.getHours() );
   //mm    is minutes (always 2-digit) - i.e., 05
   var mm = new String( Today.getMinutes() );
   if (mm.length == 1) mm = "0" + mm; //pad if single digit
   dateString = dateString.replace( new RegExp("mm", "gi"), mm );
   //ss    is seconds (always 2-digit) - i.e., 08
   var ss = new String( Today.getSeconds() );
   if (ss.length == 1) ss = "0" + mm; //pad if single digit
   dateString = dateString.replace( new RegExp("ss", "gi"), ss ); 
   //ddd   is the first three letters of the day - i.e., Wed
   dateString = dateString.replace( new RegExp("ddd", "gi"), new String( Today.getDay[Today.getDay()] ).substring(0,3) );
   //dd    is the numerical day of the month - i.e, 25
   dateString = dateString.replace( new RegExp("dd", "gi"), Today.getDate() );
   //day   is the full day of the week - i.e., Wednesday
   dateString = dateString.replace( new RegExp("day", "gi"), Today.getDay[Today.getDay()] );

   //timezone is the the timezone in hours from GMT - i.e., GMT+5
   tz = new Date().getTimezoneOffset();
   timezone = "";
   if (tz < 0)
      timezone = "GMT-" +  tz / 60;
   else if (tz == 0)
      timezone = "GMT";
   else
      timezone = "GMT+" + tz / 60;
   dateString = dateString.replace( new RegExp("timezone", "gi"), timezone );
   
   //time24   is the time based on a 24 hour clock - i.e., 18:24   
   var minutes = new String( Today.getMinutes() );
   if (minutes.length == 1) minutes = "0" + minutes; //pad if single digit
   var time24 = new String( Today.getHours() + ":" + minutes );
   dateString = dateString.replace( new RegExp("time24", "gi"), time24 );
   
   //time     is the time based on am/pm - i.e., 6:24PM
   var time;
   var ampm;
   var hour = Today.getHours();
   if ( hour < 12) {
      if (hour == 0) hour = 12;
         ampm = "AM"
   } else {
      if (hour !=12)
         hour = hour - 12;
      ampm = "PM";   
   }
   time = new String(hour + ":" + minutes + ampm);     
   dateString = dateString.replace( new RegExp("time", "gi"), time );

   return dateString;   
}

-->