// This time function was Written
// and created by R M Grocott 
// in May 2004 Copyright..! 
var worldtimes = new Array()
var Aday = new Array()
var theDay = new Array()
var ampm = new Array()
var outtimes = new Array()
var hours
var hourdiff
var minutes
var seconds
var normhours
var worldarea
worldtimes[0]="London,0"  // 0 or 1
worldtimes[1]="Bangkok,7"
worldtimes[2]="Beijing,8"

function cmtimes() {
	EnableClientScript="False"
		outtimes[0]=""
		outtimes[1]=""
		outtimes[2]=""
	for (i=0; i<=worldtimes.length-1;i++) {
		worldarea=worldtimes[i].split(",")
		thistime= new Date();
		Aday[i] = thistime.getUTCDay()
		hours=thistime.getUTCHours()
		hours=eval(hours)
		
		hourdiff=eval(worldarea[1])
		normhours=eval(hourdiff+hours)
	if (normhours >=24){
	normhours=normhours-24
	Aday[i]= Aday[i]+1
	
	}else if	(normhours <0){ 
		normhours=24+normhours
			Aday[i]= Aday[i]-1
		}
		if (Aday[i] == 7){
			Aday[i] = 0
		}
	  ampm[i] = (normhours >= 12)?"PM:" : "AM:";	
		if(Aday[i] == 0)
		theDay[i] = "Sunday"
		else if(Aday[i] == 1)
		theDay[i] = "Monday"
		else if(Aday[i] == 2)
		theDay[i] = "Tuesday"
		else if(Aday[i] == 3)
		theDay[i] = "Wednesday"
		else if(Aday[i] == 4)
		theDay[i] = "Thursday"
		else if(Aday[i] == 5)
		theDay[i] = "Friday"
		else if(Aday[i] == 6)
		theDay[i] = "Saturday"
		minutes=thistime.getUTCMinutes()
		seconds=thistime.getUTCSeconds()
	  
		if (eval(minutes) < 10) {minutes="0"+minutes}
		if (eval(seconds) < 10) {seconds="0"+seconds}
		if (eval(normhours) < 10) {normhours="0"+normhours}
		
		outtimes[i]+=" "+normhours+":"+minutes+":"+seconds+": "+ampm[i]+" "+theDay[i]+ ": " +worldarea[0]	
	}
	
	document.clock.face0.value = outtimes[0];
	document.clock.face1.value = outtimes[1];
	document.clock.face2.value = outtimes[2];
	
	var timer=setTimeout("cmtimes()",1000)
}

function set_clocks(){

document.clock.face0.width = 250;
document.clock.face0.height = 24;
document.clock.face0.style.color = "#000000";
document.clock.face0.style.backgroundColor = "#FFF7C0";

// Border *****************3600***********************************
document.clock.face0.style.border = "solid";
document.clock.face0.style.borderWidth = "2px";
document.clock.face0.style.borderTopColor = "#FFFFFF";
document.clock.face0.style.borderLeftColor = "#FFFFFF";
document.clock.face0.style.borderRightColor = "#C0C0C0";
document.clock.face0.style.borderBottomColor = "#C0C0C0";
// ***********************************************************

document.clock.face0.style.borderSize = "1px";
document.clock.face0.style.fontFamily = "Times New Roman";
document.clock.face0.style.fontSize = "12pt";
document.clock.face0.style.fontWeight = "bold";
document.clock.face0.style.textAlign = "left";
document.clock.face0.style.verticalAlign = "middle";

document.clock.face1.width = 250;
document.clock.face1.height = 24;
document.clock.face1.style.color = "#000000"
document.clock.face1.style.backgroundColor = "#FFF7C0";

// Border ****************************************************
document.clock.face1.style.border = "solid";
document.clock.face1.style.borderWidth = "2px";
document.clock.face1.style.borderTopColor = "#FFFFFF";
document.clock.face1.style.borderLeftColor = "#FFFFFF";
document.clock.face1.style.borderRightColor = "#C0C0C0";
document.clock.face1.style.borderBottomColor = "#C0C0C0";
// ***********************************************************
document.clock.face1.style.borderSize = "1px";
document.clock.face1.style.fontFamily = "Times New Roman";
document.clock.face1.style.fontSize = "12pt";
document.clock.face1.style.fontWeight = "bold";
document.clock.face1.style.textAlign = "left";
document.clock.face1.style.verticalAlign = "middle";

document.clock.face2.width = 250;
document.clock.face2.height = 24;
document.clock.face2.style.color = "#000000";
document.clock.face2.style.backgroundColor = "#FFF7C0";

// Border ****************************************************
document.clock.face2.style.border = "solid";
document.clock.face2.style.borderWidth = "2px";
document.clock.face2.style.borderTopColor = "#FFFFFF";
document.clock.face2.style.borderLeftColor = "#FFFFFF";
document.clock.face2.style.borderRightColor = "#C0C0C0";
document.clock.face2.style.borderBottomColor = "#C0C0C0";
// ***********************************************************
document.clock.face2.style.borderSize = "1px";
document.clock.face2.style.fontFamily = "Times New Roman";
document.clock.face2.style.fontSize = "12pt";
document.clock.face2.style.fontWeight = "bold";
document.clock.face2.style.textAlign = "left";
document.clock.face2.style.verticalAlign = "middle";

}
