/*

If you understand what's happening below, why not send me your resume?
I work for a great, young company in New Zealand that wants to take over
the world, but we need your help!  Email me your resume or CV at:

   andrew (dot) hedges (at) vianet (dot) travel

Oh, if you want to use the code below, feel free.  But if you do, please
let me know.  Thanks!

-Andrew

*/
String.prototype.trim = function () {
    return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}

String.prototype.toDate = function () {
	return  new Date(Date.parse(this));
}

var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];

Date.prototype.format = function () {
	var year = this.getFullYear();
	var month = months[this.getMonth()];
	var day = this.getDate();
	return day + ' ' + month + ' ' + year;
}

// Add functions to fire on page load
// Based on Simon Willison's function at http://simon.incutio.com/archive/2004/05/26/addLoadEvent
function addLoadEvent (func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload=function() {
			if (oldonload) {
				oldonload();
			}
			func ();
		}
	}
}

