function loadxmldoc() {
	var currentTime = new Date()
	var hours = currentTime.getHours()
	var minutes = currentTime.getMinutes()
	var seconds = currentTime.getSeconds()
	if (hours < 10) {
		hours = "0" + hours;
	}
	if (minutes < 10) {
		minutes = "0" + minutes;
	}
	if (seconds < 10) {
		seconds = "0" + seconds;
	}
	var hhmm = hours +""+ minutes;

	if (window.XMLHttpRequest) {
		xmlhttp=new XMLHttpRequest();
	} else {
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	var url = "image.php?time=" + hhmm; 
	xmlhttp.open("GET",url,false);
	xmlhttp.send();
	document.getElementById("clockdiv").innerHTML=xmlhttp.responseText;
}

function timer() {
	var currentTime = new Date()
	var seconds = currentTime.getSeconds()
	var countDownInterval=60-seconds;
	setTimeout("countDown()", countDownInterval*1000);
}

function countDown(){
	loadxmldoc();
	timer();
}