///////////////////////////////////////////////////////////
// "Live Clock Lite" script - Version 1.0
// By Mark Plachetta (astroboy@zip.com.au)
//
// Get the latest version at:
// http://www.zip.com.au/~astroboy/liveclock/
//
// Based on the original script: "Upper Corner Live Clock"
// available at:
// - Dynamic Drive (http://www.dynamicdrive.com)
// - Website Abstraction (http://www.wsabstract.com)
// ========================================================
// CHANGES TO ORIGINAL SCRIPT:
// - Gave more flexibility in positioning of clock
// - Added date construct (Advanced version only)
// - User configurable
// ========================================================
// Both "Advanced" and "Lite" versions are available free
// of charge, see the website for more information on the
// two scripts.
///////////////////////////////////////////////////////////

	var myfont_face = "";
	var myfont_size = "";
	var myfont_color = "#cccccc";
	var myback_color = "";
	var mywidth = 380;
	var my12_hour = 0;

	var dn = ""; var old = "";

	if (document.all||document.getElementById) { document.write('<span id="LiveClockIE" style="width:'+mywidth+'px; background-color:'+myback_color+'"></span>'); }
	else if (document.layers) { document.write('<ilayer bgColor="'+myback_color+'" id="ClockPosNS"><layer width="'+mywidth+'" id="LiveClockNS"></layer></ilayer>'); }
	else { old = "true"; show_clock(); }

	function show_clock() {

		//show clock in NS 4
		if (document.layers)
                document.ClockPosNS.visibility="show"
		if (old == "die") { return; }


		var Digital = new Date();			
		var months=new Array();	
			months[1]="January";
			months[2]="February";
			months[3]="March";
			months[4]="April";
			months[5]="May";
			months[6]="June";
			months[7]="July";
			months[8]="August";
			months[9]="September";
			months[10]="October";
			months[11]="November";
			months[12]="December";
		var day=new Array();
			day[1]="Monday";
			day[2]="Tuesday";
			day[3]="Wednesday";
			day[4]="Thursday";
			day[5]="Friday";
			day[6]="Saturday";
			day[0]="Sunday";
		var ardate = new Array("0th","1st","2nd","3rd","4th","5th","6th","7th","8th","9th","10th","11th","12th","13th","14th","15th","16th","17th","18th","19th","20th","21st","22nd","23rd","24th","25th","26th","27th","28th","29th","30th","31st");


		var today = day[Digital.getDay()];
		var thismonth = months[Digital.getMonth() +1]; 
		var date = ardate[Digital.getDate()];
		var year = Digital.getYear();
if (year < 2000)    
year = year + 1900; 
/*		var month = Digital.getMonth();
		var day = Digital.getDay();*/
		var hours = Digital.getHours();
		var minutes = Digital.getMinutes();
		var seconds = Digital.getSeconds();

		if (my12_hour) {
			dn = "AM";
			if (hours > 12) { dn = "PM"; hours = hours - 12; }
			if (hours == 0) { hours = 12; }
		} else {
			dn = "";
		}
		if (minutes <= 9) { minutes = "0"+minutes; }
		if (seconds <= 9) { seconds = "0"+seconds; }

		myclock = '';
		myclock += '<font style="color:'+myfont_color+'; font-family:'+myfont_face+'; font-size:'+myfont_size+'pt;">';
		myclock += '<font color="#FFFFFF"><b>'+hours+':'+minutes+':'+seconds+' '+dn+'</font> <font color="#777777">on</font> <font color="#FFFFFF">'+today+'</font> <font color="#777777">the</font> <font color="#FFFFFF">'+date+'</font> <font color="#777777">of</font> <font color="#FFFFFF">'+thismonth+' '+year+'</b>';
		myclock += '</font>';

		if (old == "true") {
			document.write(myclock);
			old = "die"; return;
		}

		if (document.layers) {
			clockpos = document.ClockPosNS;
			liveclock = clockpos.document.LiveClockNS;
			liveclock.document.write(myclock);
			liveclock.document.close();
		} else if (document.all) {
			LiveClockIE.innerHTML = myclock;
		} else if (document.getElementById) {
			document.getElementById("LiveClockIE").innerHTML = myclock;
		}

		setTimeout("show_clock()",1000);
}

