// Format the output. This extend made by meizz.
Date.prototype.format = function(format) {
	var _this = this;
	var o = {
		"M+" : _this.getMonth()+1, //month
		"d+" : _this.getDate(),    //day
		"h+" : _this.getHours(),   //hour
		"m+" : _this.getMinutes(), //minute
		"s+" : _this.getSeconds(), //second
		"q+" : Math.floor((_this.getMonth() + 3) / 3),  //quarter
		"S" : _this.getMilliseconds() //millisecond
	}
	if (/(y+)/.test(format))
		format = format.replace(RegExp.$1, (_this.getFullYear() + "").substr(4 - RegExp.$1.length));
	for(var k in o)
		if (new RegExp("("+ k +")").test(format))
			format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
	return format;
}

// These are made by Crazy Loong.
function showtime(DOMID) {
	var obj = document.getElementById(DOMID);
	obj.innerHTML = new Date().format("yyyy-MM-dd hh:mm:ss");
}

function refreshtime(DOMID) {
	showtime(DOMID);
	var timerID = setInterval("showtime('" + DOMID + "')", 1000);
}