document.writeln("<style>");
document.writeln("#bjt .k{color:#c60a00;}");
document.writeln("#bjt .swfBox{width:64px;height:64px;overflow:hidden;;margin-right:10px;}");
document.writeln("#bjt_1 {margin:5px auto;}");
document.writeln("#bjt_o {font-size:13px;}");
document.writeln("#bjt_o span{font-size:13px;color:#008000;}");
document.writeln("#bjt_o a{color:#7777CC;text-decoration:none;font-size:13px;}");
document.writeln("#bjt_info {float:left;height:64px;}");
document.writeln("#swf_clock {float:left;width:0;height:0;overflow:hidden;}");
document.writeln("#time {font-size:22px;font-family:Arial;line-height:26px;}");
document.writeln("#date {font-size:13px;color:#666;line-height:22px;}");
document.writeln("#ald_icon {border:0}");
document.writeln("<\/style>");
document.writeln("<div id=\"bjt\">");
document.writeln("	<a href=\"http:\/\/open.baidu.com\/static\/time\/beijingtime.html\" onmousedown=\"return c({\'fm\':\'alop\',\'url\':this.href,\'title\':this.innerHTML,\'p1\':_aMC(this)});\" target=_blank>北京<em>时间<\/em> - 国家授时中心标准<em>时间<\/em><\/a>");
document.writeln("	<div id=\"bjt_1\">");
document.writeln("		<div id=\"swf_clock\"><\/div>");
document.writeln("		<div id=\"bjt_info\">");
document.writeln("			<div id=\"time\">加载中...<\/div>");
document.writeln("			<div id=\"date\">加载中...<\/div>");
document.writeln("			<div id=\"bjt_o\"><span>open.baidu.com\/<\/span> - <a onmousedown=\"return c({\'fm\':\'alop\',\'url\':this.href,\'title\':this.innerHTML,\'p1\':_aMC(this),\'p2\':1});\" target=\"_blank\" href=\"http:\/\/open.baidu.com\/\"  class=\"op_LAMP\" ><\/a><\/div>");
document.writeln("		<\/div>");
document.writeln("	<\/div>");
document.writeln("<\/div>")


	if (typeof console == "undefined"){
		var console = {
			log:function(){}
		};
	}
	
	var swfLoaded = false;
	var initTime = undefined;
	
	
	function setFDF(){
		swfLoaded = true;
		//console.log(initTime);
		if(initTime) setClockTime(initTime);
		return true;
	}
	
	function setClockTime(time){
		if (swfLoaded && swfCtrl) {
			//console.log("COLK:"+time);
			//try{
				swfCtrl.setTime(time);
			//}catch(e){}
		}
	}

document.write('<script src="http://www.baidu.com/js/aladdin/clock/clock.js"></script>');

		(function(){
		var week = '日一二三四五六';
		var innerHtml = '{0}:{1}:{2}';
		var dateHtml = "{0}月{1}日 &nbsp;周{2}";
		var timer = 0;
		var beijingTimeZone = 8;
		
		function format(str, json){
			return str.replace(/{(\d)}/g, function(a, key) {
				return json[key];
			});
		}
		
		function p(s) {
			return s < 10 ? '0' + s : s;
		}
		
		window.baidu_time = 	function(timeObj){	
			var time = timeObj.time;
			initTime = time;
			if(timer != 0){
				clearInterval(timer);
				timer = 0;
			}
			show(time);
			timer = setInterval(function(){
				time += 1000;
				show(time);
			}, 1000);
			
		}
		
		function show(time){
			var timeOffset = ((-1 * (new Date()).getTimezoneOffset()) - (beijingTimeZone * 60)) * 60000;
			var now = new Date(time - timeOffset);
			document.getElementById('time').innerHTML = format(innerHtml, [p(now.getHours()), p(now.getMinutes()), p(now.getSeconds())]);
			setClockTime(time);
			document.getElementById('date').innerHTML = format(dateHtml, [ p((now.getMonth()+1)), p(now.getDate()), week.charAt(now.getDay())]);
		}
		
		function init(){
			var elm = document.createElement('SCRIPT');
			elm.src = 'http://open.baidu.com/app?module=beijingtime&t=' + new Date().getTime();
			document.getElementsByTagName('HEAD')[0].appendChild(elm);
			setTimeout(function(){init()}, 60000);
		}
		
		init();
		
		})();