/* date routines */
// to write in the day and date on the page.

var now = new Date();
var theDay   = now.getDay();
var theMonth = now.getMonth();
var theDate  = now.getDate();
var theYear  = now.getFullYear();
var theHour = now.getHours();
var theMin  = now.getMinutes();
var theSec  = now.getSeconds();

function calculateTime() {	
	theTime = theHour+":"+theMin+":"+theSec;
	return theTime;
}

function timeAsString() {	
	if (theMin < 10) theMin = "0" + theMin;
	theTime = theHour+":"+theMin;
	return theTime;
}

function writeYear() {
	document.write(theYear);
}

function dateAndTimeAsString() {
	var tmp = dateAsString() + "&nbsp;&nbsp;" + timeAsString();
	return tmp;
}

function dayAndDateAsString() {
	
	if (theMonth == 0) theDay = "Sunday, ";
	else if (theDay == 1) theDay = "Monday, ";
	else if (theDay == 2) theDay = "Tuesday, ";
	else if (theDay == 3) theDay = "Wednesday, ";
	else if (theDay == 4) theDay = "Thursday, ";
	else if (theDay == 5) theDay = "Friday, ";
	else if (theDay == 6) theDay = "Saturday, ";
	else theDay = "error!day:";
	
	if (theMonth == 0) theMonth = "January ";
	else if (theMonth == 1) theMonth = "February ";
	else if (theMonth == 2) theMonth = "March ";
	else if (theMonth == 3) theMonth = "April ";
	else if (theMonth == 4) theMonth = "May ";
	else if (theMonth == 5) theMonth = "June ";
	else if (theMonth == 6) theMonth = "July ";
	else if (theMonth == 7) theMonth = "August ";
	else if (theMonth == 8) theMonth = "September ";
	else if (theMonth == 9) theMonth = "October ";
	else if (theMonth == 10) theMonth = "November ";
	else if (theMonth == 11) theMonth = "December ";
	else theMonth = "error!month:";
		
	myString = theDay + theMonth + theDate + ", " + theYear;
	return myString;
}

function dateAsString() {
	
	if (theMonth == 0) theMonth = "January ";
	else if (theMonth == 1) theMonth = "February ";
	else if (theMonth == 2) theMonth = "March ";
	else if (theMonth == 3) theMonth = "April ";
	else if (theMonth == 4) theMonth = "May ";
	else if (theMonth == 5) theMonth = "June ";
	else if (theMonth == 6) theMonth = "July ";
	else if (theMonth == 7) theMonth = "August ";
	else if (theMonth == 8) theMonth = "September ";
	else if (theMonth == 9) theMonth = "October ";
	else if (theMonth == 10) theMonth = "November ";
	else if (theMonth == 11) theMonth = "December ";
	else theMonth = "error!month:";
		
	myString = theMonth + theDate + ", " + theYear;
	return myString;
}

/* end date routines */