/* ****************************************************
 Web Application: YHA Australia Web Site
 Type: JavaScript library                      
 
 Date: 16/08/2004
         
 ***** Legal Notice *****
 The code contained within this page is the Intellectual property
 of Red Square Productions Pty Ltd and licensed to YHA Australia Inc for 
 use only within the specified Web Application.
 
 
 This notice cannot be removed or altered.  
 
****************************************************  */

/*
* @class Date
* @author Lindsay Evans
* @version 3.0
*/

/* Extensions to the built-in JavaScript Date object */

Date.DayNames = [
	'Sunday', 'Monday', 'Tuesday', 'Wednesday', 
	'Thursday', 'Friday', 'Saturday'
];

Date.MonthNames = [
	'January', 'February', 'March',
	'April', 'May', 'June',
	'July', 'August', 'September',
	'October', 'November', 'December'
];

Date.ShortMonthNames = [
	'Jan', 'Feb', 'Mar',
	'Apr', 'May', 'Jun',
	'Jul', 'Aug', 'Sep',
	'Oct', 'Nov', 'Dec'
];

Date.DaysInMonth = [
	31,28,31,
	30,31,30,
	31,31,30,
	31,30,31
];

/**
* @method getDaysInMonth
* @return Number
*/
Date.prototype.getDaysInMonth = function() {
	return (this.getMonth() == 1 && this.isLeapYear()) ? 29 : Date.DaysInMonth[this.getMonth()];
}

/**
* @method getMonthName
* @return String
*/
Date.prototype.getMonthName = function() {
	return Date.MonthNames[this.getMonth()];
}

/**
* @method getShortMonthName
* @return String
*/
Date.prototype.getShortMonthName = function() {
	return Date.ShortMonthNames[this.getMonth()];
}

/**
* @method getDayOfWeekAsString
* @return String
*/
Date.prototype.getDayOfWeekAsString = function() {
	return Date.DayNames[this.getDay()];
}

/**
* @method isLeapYear
* @return Boolean
*/
Date.prototype.isLeapYear = function(){
	if(this.getYear() % 400 == 0){
		return true;
	}else if(this.getYear() % 4 != 0 || this.getYear() % 100 == 0){
		return false;
	}else{
		return true;
	}
}
