///////////////////////////////////////////////////////////
// "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 = "Verdana";
var myfont_size = "9";
var myfont_color = "#ffffcc";
var myback_color = "#000066";
var mywidth = 80;
var my12_hour = 1;

var dn = ""; var old = "";

if (document.all||document.getElementById) { document.write('<span id="LiveClockIE" style="width:'+mywidth+'px;"></span>'); }
else if (document.layers) { document.write('<ilayer id="ClockPosNS"><layer width="'+mywidth+'" id="LiveClockNS"></layer></ilayer>'); }
else { old = "true"; show_clock(); }

//var hours = document.getElementById('pageLoadHour').value;
//var minutes = document.getElementById('pageLoadMinute').value;
//var seconds = 0;

show_clock();

function show_clock() 
{
	//var dhours = hours;
	//var dminutes = minutes;

	//show clock in NS 4
	if (document.layers)
			document.ClockPosNS.visibility="show"
	if (old == "die") { return; }

	var Digital = new Date();
	var dhours = Digital.getUTCHours();
	var dminutes = Digital.getUTCMinutes();
	var seconds = Digital.getUTCSeconds();

    dhours = dhours -6;

    if( dhours > 23 ) {
		dhours = dhours-24;
	}
    if( dhours < 0 ) {
        dhours = dhours+24;   
    } 

    dn = "AM";
    if (dhours >= 12) { dn = "PM"; dhours = dhours - 12; }
    if (dhours == 0) { dhours = 12; }

	if (dminutes <= 9) { dminutes = "0"+dminutes; }
	if (seconds <= 9) { seconds = "0"+seconds; }

	myclock = '';
	myclock += '';
	myclock += dhours+':'+dminutes+dn;
	myclock += '';

	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()",60000);
}

function inc_clock()
{
	minutes++;
	if( minutes > 59 ) {
		minutes = 0;
		hours++;
	}

	if( hours > 23 ) {
		hours = 0;
	}

	show_clock();
}

