﻿timeID = null;
timeRunning = false;
timerONE = window.setTimeout;
//run(); 
function stop (){
	if(timeRunning) 
		clearTimeout(timeID);
	timeRunning = false;
}
function time () {
	tick = new Date();
	hours = tick.getHours();
	minutes = tick.getMinutes();
	seconds = tick.getSeconds();
	date = tick.getDate();
	day = tick.getDay();
	month = tick.getMonth() + 1;
	year = tick.getFullYear();
	current = year + "年" + month + "月" + date + "日 ";
	if(day==0){var weekday = " 星期日"};
	if(day==1){var weekday = " 星期一"};
	if(day==2){var weekday = " 星期二"};
	if(day==3){var weekday = " 星期三"};
	if(day==4){var weekday = " 星期四"};
	if(day==5){var weekday = " 星期五"};
	if(day==6){var weekday = " 星期六"};
	current +=(weekday) + " ";
	current += "" + ((hours >12) ? hours -12 :hours);
	current += ((minutes < 10) ? ":0" : ":") + minutes;
	current += ((seconds < 10) ? ":0" : ":") + seconds;
	current += (hours >= 12) ? " P.M." : " A.M.";
	window.status=current;
	timeID = setTimeout("time()",1000);
	timeRunning = true;
}
function run(){
	stop();
	time();
}

