// JavaScript Document


function otcClock(z){
	this.zone=z;
	this.name="clock"+z;
	
	document.write('<span id="'+this.name+'" class="clockTime"></span><br />');
	this.isitlocal=false;
	this.ampm='';
	this.finaltime='';
	this.updateTime();
	var self=this;
	this.timer=window.setInterval(function()
										   {
											   self.updateTime();
										   },1000);
	
}

otcClock.prototype.updateTime=function(){
		now=new Date();
		ofst=now.getTimezoneOffset()/60;
		secs=now.getSeconds();
		sec=-1.57+Math.PI*secs/30;
		mins=now.getMinutes();
		min=-1.57+Math.PI*mins/30;
		hr=(this.isitlocal)?now.getHours():(now.getHours() + parseInt(ofst)) + parseInt(this.zone);
		hrs=-1.575+Math.PI*hr/6+Math.PI*parseInt(now.getMinutes())/360;
		if (hr < 0) hr+=24;
		if (hr > 23) hr-=24;
		this.ampm = (hr > 11)?"PM":"AM";
		statusampm = this.ampm.toLowerCase();
		
		hr2 = hr;
		if (hr2 == 0) hr2=12;
		(hr2 < 13)?hr2:hr2 %= 12;
		if (hr2<10) hr2="0"+hr2
		
		this.finaltime=hr2+':'+((mins < 10)?"0"+mins:mins)+' '+statusampm;
			
		
	if (document.all)
			this.name.innerHTML=this.finaltime
		else if (document.getElementById){
			document.getElementById(this.name).innerHTML=this.finaltime;
	}

	
}

