/*=========left&right================*/
var __close="关闭";
function _closead(lyName){
	var v = $(lyName);
	v.style.display = "none";
};
function MoveLayer(layerName,_y){
	var scrolltop = parseInt(document.body.scrollTop || document.documentElement.scrollTop);
	var v = $(layerName);
	var y = _y;
	var diff = (scrolltop + y - parseInt(v.style.top)) * 0.60;
	y = scrolltop  + y - diff;
	v.style.top = y + "px";
	setTimeout("MoveLayer('" + layerName + "'," + _y + ")",50);
};
function initEcAd(lyName,y,x,pos){
	var v = $(lyName);
	var textalign="left";
	v.style.top = y+"px";
	if(pos=="right"){v.style.right = x+"px";}
	else if(pos=="left"){v.style.left = x+"px";}
	else{return;}
	var closepanel=document.createElement("div");
	if(pos=="left")textalign="right";
	closepanel.style.paddingTop="1px";
	closepanel.innerHTML="<div style='text-align:"+textalign+";'><a href='javascript:;' onclick=\"_closead('"+lyName+"')\">"+__close+"</a></div>";
	v.appendChild(closepanel);
	v.style.position = "absolute";
	v.style.zIndex = "1000";
	v.style.display = "block";
	MoveLayer(lyName,y);
};
/*=========move================*/
function Moving(id){
	this.Init={};
	this.Init.Y=50;
	this.Init.X=50;
	this.Delay=100;
	this.Span={};
	this.Span.XStep=2;
	this.Span.YStep=5;
	this.Span.YStepCount=0;
	this.Main={};
	this.Main.Obj=$(id);
	var Tl=this;
	var pMain=null;
	this.Go=fGo;
	function fGo(){
		var EleDiv=Tl.Main.Obj;
		with(EleDiv){
			style.top=Tl.Init.Y+"px";
			style.left=Tl.Init.X+"px";
			style.display="block";
			if(fCkBrs()==1){style.position="absolute";}
			else{style.position="fixed";}
		}
		var pMain=EleDiv;
		var sqMoving=setInterval(
			function (){
				var iTemp=0;
				if(fCkBrs()==2){iTemp=18;}
				else if(fCkBrs()==1){iTemp=1;}
				else{iTemp=0;}
				var iTop=parseInt(pMain.style.top);
				var iLeft=parseInt(pMain.style.left);
				var Width=document.body.clientWidth-pMain.offsetWidth-iTemp;
				if(fCkBrs()==1){
					var ScrollTop=document.documentElement.scrollTop;
					iTop=ScrollTop;
					if((fGetViewPortSize()[1]-pMain.offsetHeight)<Tl.Span.YStepCount){Tl.Span.YStep=-Tl.Span.YStep;}
					if(Tl.Span.YStepCount<0){Tl.Span.YStep=Math.abs(Tl.Span.YStep);}
					Tl.Span.YStepCount+=Tl.Span.YStep;
					pMain.style.top=(iTop+Tl.Span.YStepCount)+"px";
				}else{
					var Height=fGetViewPortSize()[1]-pMain.offsetHeight;
					if(iTop>Height){Tl.Span.YStep=-Tl.Span.YStep;}
					if(iTop<0){Tl.Span.YStep=Math.abs(Tl.Span.YStep);}
					pMain.style.top=(iTop+Tl.Span.YStep)+"px";
				}
				if(iLeft>Width){Tl.Span.XStep=-Tl.Span.XStep;}
				if(iLeft<0){Tl.Span.XStep=Math.abs(Tl.Span.XStep);}
				pMain.style.left=(iLeft+Tl.Span.XStep)+"px";
		},Tl.Delay);
	};
	function fCkBrs(){
		switch(navigator.appName){
			case 'Opera':return 2;
			case 'Netscape':return 3;
			default:return 1;
		}
	};
	function fGetViewPortSize(){
		var myWidth=0,myHeight=0;
		if(typeof(window.innerWidth)=='number'){
			myWidth=window.innerWidth;
			myHeight=window.innerHeight;
		}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){
			myWidth=document.documentElement.clientWidth;
			myHeight=document.documentElement.clientHeight;
		}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){
			myWidth=document.body.clientWidth;
			myHeight=document.body.clientHeight;
		}
		return [myWidth,myHeight];
	};
};