// DHTML Clock Object
// a widget that writes the date and current time (with updating seconds) to 2 individual layers
// 19990330

// Copyright (C) 1999 Dan Steinman
// Distributed under the terms of the GNU Library General Public License
// Available at http://www.dansteinman.com/dynapi/

function Clock(dateX,dateY,timeX,timeY) {
	this.name = "Clock"+(Clock.count++)
	this.obj = this.name + "Object"
	eval(this.obj + "=this")
	this.dateX = dateX
	this.dateY = dateY
	this.timeX = timeX
	this.timeY = timeY
	this.dateStyle = 'font-size:8pt; font-family:Arial,Helvetica,sans-serif; color:White;'
	this.showSeconds = true
	this.twelveHour = true
	this.showDate = true
	this.shortDate = false
	this.activate = ClockActivate
	this.getDate = ClockGetDate
	this.build = ClockBuild
}
function ClockBuild() {
	this.css = css(this.name+'Date',this.dateX,this.dateY)+
	css(this.name+'Time',this.timeX,this.timeY)+
	'.'+this.name+'DateStyle {'+this.dateStyle+'}\n'+
	'.'+this.name+'TimeStyle {'+this.timeStyle+'}\n'
	this.dateDiv = '<div id="'+this.name+'Date"><div class="'+this.name+'DateStyle">'+this.getDate()+'</div></div>'
	this.timeDiv = '<div id="'+this.name+'Time"><div class="'+this.name+'TimeStyle">'+this.time+'</div></div>'
	this.div = ''
	if (this.showDate) this.div += this.dateDiv
	if (this.showTime) this.div += this.timeDiv
}
function ClockGetDate() {
	if (this.shortDate) {
		var monthList = new Array('Jan','Feb','Mar','Apr','May','Jun','July','Aug','Sept','Oct','Nov','Dec')
		var dayList = new Array('Sun','Mon','Tues','Wed','Th','Fri','Sat')
	}
	else {
		var monthList = new Array('Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember')
		var dayList = new Array('Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag')
	}
	now = new Date()
	return dayList[now.getDay()]+", "+now.getDate()+". "+monthList[now.getMonth()]+" 2002   "
}


function ClockActivate() {
	if (this.showDate) {
		this.datelyr = new DynLayer(this.name+"Date")
		this.datelyr.write = DynLayerWrite
	}
}

