// DHTML Clock ©1999 RGSoft Interactive, February 25, 1999

function Clock(name,dateNestRef,dateX,dateY,timeNestRef,timeX,timeY) {
	this.name = name
	this.dateNestRef = dateNestRef
	this.timeNestRef = timeNestRef
	this.obj = this.name + "Object"
	eval(this.obj + "=this")
	this.dateX = dateX
	this.dateY = dateY
	this.timeX = timeX
	this.timeY = timeY
	this.showSeconds = true
	this.twelveHour = true
	this.showDate = true
	this.showTime = true
	this.activate = ClockActivate
	this.getDate = ClockGetDate
	this.getTime = ClockGetTime
	this.build = ClockBuild
	this.tick = ClockTick
}
function ClockBuild(write) {
	this.getTime()
	this.css = css("clockDate",this.dateX,this.dateY)+css("clockTime",this.timeX,this.timeY)
	this.dateDiv = '<div id="clockDate"><div class="dateStyle">'+this.getDate()+'</div></div>'
	this.timeDiv = '<div id="clockTime"><div class="timeStyle">'+this.time+'</div></div>'
	this.div = ''
	if (this.showDate) this.div += this.dateDiv
	if (this.showTime) this.div += this.timeDiv
	if (write!=false) {
		var str = css('START')+
		this.css+
		css('END')
		document.write(str)
	}
}
function ClockGetDate() {
	var monthList = new Array('January','February','March','April','May','June','July','August','September','October','November','December')
	var dayList = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday')
	now = new Date()
	return dayList[now.getDay()]+", "+monthList[now.getMonth()]+" "+now.getDate()+", "+(now.getYear())+"&nbsp;"
}
function ClockGetTime() {
	var now = new Date()
	this.newmin = now.getMinutes()
	if (this.newmin<10) this.newmin = "0"+this.newmin
	var hour = now.getHours()
	var ampm = " AM"
	if (this.twelveHour) {
		if (hour==12) {
			hour = 12
			ampm = " Noon"
		}
		else if (hour>12) {
			hour-=12
			ampm = " PM"
		}
		else if (hour==0) {
			hour = 12
			ampm = " Midnight"
		}
	}
	if (hour<10) hour = "&nbsp;"+hour
	this.time = hour+":"+this.newmin
	if (this.showSeconds) {
		var sec = now.getSeconds()
		if (sec<10) sec = "0"+sec
		this.time += ":"+sec
	}
	if (this.twelveHour) this.time += ampm
}
function ClockActivate() {
	if (this.showDate) {
		this.datelyr = new DynLayer(this.name+"Date",this.dateNestRef)
		this.datelyr.write = DynLayerWrite
	}
	if (this.showTime) {
		this.timelyr = new DynLayer(this.name+"Time",this.timeNestRef)
		this.timelyr.write = DynLayerWrite
	}
	this.tick()
}
function ClockTick() {
	this.getTime()
	if (this.oldmin!=this.newmin || this.showSeconds) {
		if (this.showTime) this.timelyr.write('<div class="timeStyle">'+this.time+'</div>')
		this.oldmin = this.newmin
	}
	setTimeout(this.obj+".tick()",1000)
}