/* ***************************************** *
 * Date object expansion script              *
 * Adds extra date methods to all your dates *
 * copyright Stephen Chapman 30 Dec 2007     *
 * http://javascript.about.com/              *
 *                                           *
 * You may copy this script provided that no *
 * changes to the script or content are made *
 *                                           *
 * Additional methods added:                 *
 *   addDays(number_of_days_to_add)          *
 *   week_num = getWeek()                    *
 *   day_of_year = getDOY()                  *
 *   julian_day = getJulian()                *
 *   month_name = getMonthName()             *
 *   day_of_week = getDayName()              *
 * ***************************************** */

Date.prototype.addDays = function(days) {this.setDate(this.getDate()+days);}
Date.prototype.getWeek = function() {var onejan = new Date(this.getFullYear(),0,1); return Math.ceil((((this - onejan) / 86400000) + onejan.getDay())/7);}
Date.prototype.getDOY = function() {var onejan = new Date(this.getFullYear(),0,1); return Math.ceil((this - onejan) / 86400000);}
Date.prototype.getJulian = function() {return Math.floor((this / 86400000) -
(this.getTimezoneOffset()/1440) + 2440587.5);}
Date.prototype.getMonthName = function() {var m = ['January','February','March','April','May','June','July','August','September','October','November','December']; return m[this.getMonth()];}
Date.prototype.getDayName = function() {var d = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; return d[this.getDay()];}


