﻿function OpenStatement(id)
{
	window.open("/Chinese/News/Statement.aspx?ID="+id,"_blank","height=596,width=668,status=no,toolbar=no,directories=no,menubar=no,location=no,resizable=no");
}

function OpenNewsList(id)
{
	window.open("/Chinese/News/List.aspx?ID="+id,"_blank","height=596,width=668,status=no,toolbar=no,directories=no,menubar=no,location=no,resizable=no");
}

function Window_OnLoad()
{
	window.setInterval("SetTime()",1000);
	FloatWindow_Init(LeftLinkLayer);
	RightLinkLayer.style.posLeft=window.document.body.clientWidth-184;
	FloatWindow_Init(RightLinkLayer);
}

var ChineseNumbers=new Array("日","一","二","三","四","五","六","七","八","九","十");

function SetTime()
{
	var now=new Date();
	Now.innerText=now.toLocaleDateString()+" "+now.toLocaleTimeString()+"　星期"+ChineseNumbers[now.getDay()];
}

function FloatWindow_Init(layer)
{
	//layer.parentElement.removeChild(layer);
	//window.document.body.insertBefore(layer,window.document.body.children[0]);
	layer.style.display="";
	layer.CurrentX=layer.style.posLeft;
	layer.CurrentY=layer.style.posTop;
	layer.DirectionX=1;
	layer.DirectionY=1;

	FloatWindow_Float(layer);
}

function FloatWindow_Close(layer)
{
	layer.parentElement.removeChild(layer);
}

function FloatWindow_Float(layer)
{
	//if(!layer)
		//return;
	if(!layer.Stop)
	{
		layer.CurrentX+=layer.DirectionX;
		layer.CurrentY+=layer.DirectionY;
		var left=window.document.body.scrollLeft+layer.CurrentX;
		var top=window.document.body.scrollTop+layer.CurrentY;
		layer.style.left=left;
		layer.style.top=top;
		if(left<=window.document.body.scrollLeft)
			layer.DirectionX=1;
		else if(left>=window.document.body.scrollLeft+window.document.body.clientWidth-layer.scrollWidth)
			layer.DirectionX=-1;
		if(top<=window.document.body.scrollTop)
			layer.DirectionY=1;
		else if(top>=window.document.body.scrollTop+window.document.body.clientHeight-layer.scrollHeight)
			layer.DirectionY=-1;
	}
	window.setTimeout("FloatWindow_Float("+layer.id+")",1);
}

window.attachEvent("onload",Window_OnLoad);