function _daysInMonth(){
	/********************************************************
	*	Date: May 29, 1999
	*	Created by: Chris Vickerson
	*
	*	Returns the last day of a month. Recognizes leap
	*	years.
	*
	*	Compatibility Tests:
	*	JavaScript 1.0
	*	IE 5 (Windows 98)
	*	NN 4.6 (Windows 98)
	*
	********************************************************/
	
	var m = new Number(this.getMonth());
	var y = new Number(this.getYear());
	
	var tmpDate = new Date(y, m, 28);
	var checkMonth = tmpDate.getMonth();
	var lastDay = 27;
	
	while(lastDay <= 31){
		temp = tmpDate.setDate(lastDay + 1);
		if(checkMonth != tmpDate.getMonth())
			break;
		lastDay++
	}
	return lastDay;
}

function _dayOfWeekAsString(){
	/********************************************************
	*	Date: May 30, 1999
	*	Created by: Chris Vickerson
	*
	*	Returns the day of the week as a string.
	*
	*	Compatibility Tests:
	*	JavaScript 1.0
	*	IE 5 (Windows 98)
	*	NN 4.6 (Windows 98)
	*
	********************************************************/
	var daysInWeek = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
	return daysInWeek[this.getDay()];
}

function _monthAsString(){
	/********************************************************
	*	Date: May 30, 1999
	*	Created by: Chris Vickerson
	*
	*	Returns the month as a string.
	*
	*	Compatibility Tests:
	*	JavaScript 1.0
	*	IE 5 (Windows 98)
	*	NN 4.6 (Windows 98)
	*
	********************************************************/
	var monthsInYear = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	return monthsInYear[this.getMonth()];
}

function _dateFormat(displayPat){
	/********************************************************
	*	Date: June 5, 1999
	*	Created by: Chris Vickerson
	*
	*	Displays date according to user specified mask.
	*	
	*	Valid Masks:
	*	!mmmm = Long month (eg. January)
	*	!mmm = Short month (eg. Jan)
	*	!mm = Numeric date (eg. 07)
	*	!m = Numeric date (eg. 7)
	*	!dddd = Long day (eg. Monday)
	*	!ddd = Short day (eg. Mon)
	*	!dd = Numeric day (eg. 07)
	*	!d = Numeric day (eg. 7)
	*	!yyyy = Year (eg. 1999)
	*	!yy = Year (eg. 99)
	*
	*	Compatibility Tests:
	*	JavaScript 1.2
	*	IE 5 (Windows 98)
	*	NN 4.6 (Windows 98)
	*
	********************************************************/

	intMonth = this.getMonth();
	intDate = this.getDate();
	intDay = this.getDay();
	intYear = this.getFullYear();

	var months_long = new Array('January','February','March','April','May','June','July','August','September','October','November','December')
	var months_short = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')
	var days_long = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday')
	var days_short = new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat')
	
	var mmmm = months_long[intMonth]
	var mmm = months_short[intMonth]
	var mm = intMonth < 9?'0'+ (1 + intMonth) + '':(1+intMonth)+'';
	var m = 1+intMonth+'';
	var dddd = days_long[intDay];
	var ddd = days_short[intDay];
	var dd = intDate<10?'0'+intDate+'':intDate+'';
	var d = intDate+'';
	var yyyy = intYear;

	century = 0;
	while((intYear-century)>=100)
		century = century + 100;

	var yy = intYear - century
	if(yy<10)
		yy = '0' + yy + '';

	displayDate = new String(displayPat);

	displayDate = displayDate.replace(/!mmmm/i,mmmm);
	displayDate = displayDate.replace(/!mmm/i,mmm);
	displayDate = displayDate.replace(/!mm/i,mm);
	displayDate = displayDate.replace(/!m/i,m);
	displayDate = displayDate.replace(/!dddd/i,dddd);
	displayDate = displayDate.replace(/!ddd/i,ddd);
	displayDate = displayDate.replace(/!dd/i,dd);
	displayDate = displayDate.replace(/!d/i,d);
	displayDate = displayDate.replace(/!yyyy/i,yyyy);
	displayDate = displayDate.replace(/!yy/i,yy);

	return displayDate;
}


// create a date object before adding method to prototype object for compatibility with NN 3
var cv___tmpDateObj___ = new Date();

Date.prototype.lastDayOfMonth = _daysInMonth;
Date.prototype.dateFormat = _dateFormat;
Date.prototype.dayOfWeekAsString = _dayOfWeekAsString;
Date.prototype.monthAsString = _monthAsString;

/* Put this in for the date
* <script language="JavaScript" type="text/javascript">var d = new Date();document.write(d.dateFormat('!mm.!dd.!yy'));</script>
*/
