
function doClock(){ // By Paul Davis - www.kaosweaver.com
  var t=new Date(),a=doClock.arguments,str="",i,a1,lang="1";
  var month=new Array('January','Jan', 'February','Feb', 'March','Mar', 'April','Apr', 'May','May', 'June','Jun', 'July','Jul', 'August','Aug', 'September','Sep', 'October','Oct', 'November','Nov', 'December','Dec');
  var tday= new Array('Sunday','Sun','Monday','Mon', 'Tuesday','Tue', 'Wednesday','Wed','Thursday','Thr','Friday','Fri','Saturday','Sat');
  for(i=0;i<a.length;i++) {a1=a[i].charAt(1);switch (a[i].charAt(0)) {
  case "M":if  ((Number(a1)==3) && ((t.getMonth()+1)<10)) str+="0";
  str+=(Number(a1)>1)?t.getMonth()+1:month[t.getMonth()*2+Number(a1)];break;
  case "D": if ((Number(a1)==1) && (t.getDate()<10)) str+="0";str+=t.getDate();break;
  case "Y": str+=(a1=='0')?t.getFullYear():t.getFullYear().toString().substring(2);break;
  case "W":str+=tday[t.getDay()*2+Number(a1)];break; default: str+=unescape(a[i]);}}return str;
}



function dodate() {
	// Store the date in a variable
	d = new Date()
	dateText = ""

	// Get the current day and convert it to the name of the day
	dayValue = d.getDay()
	if (dayValue == 0)
	    dateText += "Sunday"
	else if (dayValue == 1)
	    dateText += "Monday"
	else if (dayValue == 2)
	    dateText += "Tuesday"
	else if (dayValue == 3)
	    dateText += "Wednesday"
	else if (dayValue == 4)
	    dateText += "Thursday"
	else if (dayValue == 5)
	    dateText += "Friday"
	else if (dayValue == 6)
	    dateText += "Saturday"

	// Get the current month and convert it to the name of the month
	monthValue = d.getMonth()
	dateText += " "
	if (monthValue == 0)
	    dateText += "January"
	if (monthValue == 1)
	    dateText += "February"
	if (monthValue == 2)
	    dateText += "March"
	if (monthValue == 3)
	    dateText += "April"
	if (monthValue == 4)
	    dateText += "May"
	if (monthValue == 5)
	    dateText += "June"
	if (monthValue == 6)
	    dateText += "July"
	if (monthValue == 7)
	    dateText += "August"
	if (monthValue == 8)
	    dateText += "September"
	if (monthValue == 9)
	    dateText += "October"
	if (monthValue == 10)
	    dateText += "November"
	if (monthValue == 11)
	    dateText += "December"
	
	// Get the current year; if it's before 2000, add 1900
	if (d.getYear() < 2000) 
	    dateText += " " + d.getDate() + ", " + (1900 + d.getYear())
	else 
	    dateText += " " + d.getDate() + ", " + (d.getYear())
	
	// Get the current minutes
	minuteValue = d.getMinutes()
	if (minuteValue < 10)
	    minuteValue = "0" + minuteValue
	
	// Get the current hours
	hourValue = d.getHours()
	
	// Customize the greeting based on the current hours
	if (hourValue < 12)
	    {
	    greeting = "Good morning!"
	    timeText = " at " + hourValue + ":" + minuteValue + " AM"
	    }
	else if (hourValue == 12)
	    {
	    greeting = "Good afternoon!"
	    timeText = " at " + hourValue + ":" + minuteValue + " PM"
	    }
	else if (hourValue < 17)
	    {
	    greeting = "Good afternoon!"
	    timeText = " at " + (hourValue-12) + ":" + minuteValue + " PM"
	    }
	else
	    {
	    greeting = "Good evening!"
	    timeText = " at " + (hourValue-12) + ":" + minuteValue + " PM"
	    }
	// Write the greeting, the date, and the time to the page
	document.write(greeting + " It's " + dateText + timeText)
	}
