<!--

/*
dateFunctions.js
 
 in holding page
 
date format yyyy,m,dd
 
Set Dates
var myDate=new Date();
myDate.setFullYear(2010,0,14);
 
to utc string
var d=new Date();
document.write("Original form: ");
document.write(d + "<br />");
document.write("To string (universal time): ");
document.write(d.toUTCString());
 
    *  getTime() - Number of milliseconds since 1/1/1970 @ 12:00 AM
    * getSeconds() - Number of seconds (0-59)
    * getMinutes() - Number of minutes (0-59)
    * getHours() - Number of hours (0-23)
    * getDay() - Day of the week(0-6). 0 = Sunday, ... , 6 = Saturday
    * getDate() - Day of the month (0-31)
    * getMonth() - Number of month (0-11)
    * getFullYear() - The four digit year (1970-9999)
 
*/
// converts for javascript starting at zero
var monthName = new Array();
monthName[0] = "January ";
monthName[1] = "Febuary ";
monthName[2] = "March ";
monthName[3] = "April ";
monthName[4] = "May ";
monthName[5] = "June ";
monthName[6] = "July ";
monthName[7] = "August ";
monthName[8] = "September ";
monthName[9] = "October ";
monthName[10] = "November ";
monthName[11] = "December ";





function todaysDate()
{
	var todaysDate = new Date();
	passData = todaysDate;
	return passData;
}

function dayIncrement(whichDate)
{
	x = whichDate.getDate();
	//alert(x);
	passData = new Date();
	passData.setFullYear(2010,3,32);
	return passData;
}

function dayDecrement(whichDate)
{}


function monthIncrement(whichDate)
{
	x = whichDate.getMonth();
	//alert(x);
	x ++;
	whichDate.setMonth(x);
	passData = whichDate;

	//alert(passData);
	return passData;
}

function monthDecrement(whichDate)
{
	x = whichDate.getMonth();
	//alert(x);
	x --;
	whichDate.setMonth(x);
	passData = whichDate;

	//alert(passData);
	return passData;
}
/*
function compareDates()
{
	var myDate=new Date();
	myDate.setFullYear(2010,0,14);
	var today = new Date();

	if (myDate>today)
	{
		alert("Today is before 14th January 2010");
	}
	else
	{
		alert("Today is after 14th January 2010");
	}
}
*/
function splitDates()
{

}

function monthName()
{

}

function daysMonthsYears(whichDate)
{
	//this is to find how many days in this month and the month name and what day it starts with

	//set date to be ist of the month
	whichDate.setDate(1);

	// get month number
	monthNumber = whichDate.getMonth();
passDataMonthNumber = monthNumber;

	// now get month name
	passDataMonthName = monthName[monthNumber]; // declared in pickerVariable.js

	// how mant days
	thisYear = whichDate.getFullYear();
	thisMonth = whichDate.getMonth();
	passDataHowManyDays = 32 - new Date(thisYear,thisMonth, 32).getDate(); // 0 = jan; 1 = feb; 2 = march

	// day number for start day
	passDataDayNumber = whichDate.getDay(); // 0 = sun; 1 = mon; 2 =tue .... 6 = sat

	// year number
	passDataYearNumber = thisYear; // from how many days setup

	// return data
	return passDataMonthName, passDataMonthNumber, passDataHowManyDays, passDataDayNumber, passDataYearNumber;
	
	/*
	N.B.: iMonth is zero based, so 0 represents January, 1 represents February, 2 represents March and 11 represents December. iYear is not zero based, this is the actual calendar year number. (2006 is actually 2006)
	 
	To test this function, February in the years 2100, 2005, 2004, 2003, 2001, 2000 and 1999 should be checked. All of these should return 28, except for 2004 and 2000.
	 
	How does this function work? It is quite simple. When the Date() function is given a day number that is greater than the number of days in the given month of the given year, it wraps the date into the next month. The getDate() function returns the day of the month, starting from the beginning of the month that the date is in. So, day 32 of March is considered to be day 1 of April. Subtracting 1 from 32 gives the correct number of days in March!	
	*/
}

