// (c) 2003 by "Dnestrovsk -online-"
// http://www.dnestrovsk.com
// mail to: webmaster@dnestrovsk.com

var clockid=new Array();
var clockidoutside=new Array();
var i_clock=-1;

var sommer_time = 3;	// Sommer-Zeit
//var sommer_time = 2;	// Winter-Zeit

var time_diff = 0;

function init(serv_time) {
	loctime = new Date();
	time_diff = serv_time - loctime/1000;
}
	
function writeclock() {
	i_clock++;
	if (document.all || document.getElementById || document.layers) {
		clockid[i_clock]="clock"+i_clock;
		document.write("Днестровское время - <span id='"+clockid[i_clock]+"' style='position:relative'>"+thistime+"</span>");
	}
}

function clockon() {
	thistime= new Date();
	var new_time = ((thistime/1000) + time_diff + sommer_time*3600) * 1000;
	thistime.setTime(new_time);
	hours=thistime.getUTCHours();
	minutes=thistime.getUTCMinutes();
	seconds=thistime.getUTCSeconds();
	if (eval(hours) <10) {hours="0"+hours}
	if (eval(minutes) < 10) {minutes="0"+minutes}
	if (seconds < 10) {seconds="0"+seconds}
	thistime = hours+":"+minutes+":"+seconds
		
	if (document.all) {
		for (i=0;i<=clockid.length-1;i++) {
			var thisclock=eval(clockid[i])
			thisclock.innerHTML=thistime
		}
	}
	
	if (document.getElementById) {
		for (i=0;i<=clockid.length-1;i++) {
			document.getElementById(clockid[i]).innerHTML=thistime
		}
	}
	var timer=setTimeout("clockon()",1000)
}
