function $(o){return document.getElementById(o)}

var step = 1;

var mnow=false;
var twidth=825;//每次滚动页面显示的总宽
var as=165;//此数为瞬间穿越针数
var spd=165;

function setmove(){
	if($('games').offsetWidth<=twidth)return;
	//var a=document.createElement("UL");//为了无缝连接
	//a.innerHTML=$('games').innerHTML;//为了无缝连接
	//$('gamesdiv').appendChild(a);//为了无缝连接
	$('mleft').onclick=function(){if(!mnow){movegame(twidth,"r")}};
	$('mright').onclick=function(){if(!mnow){movegame(twidth,"l")}}
	$('mleft2').onclick=function(){if(!mnow){movegame(twidth,"r")}};
	$('mright2').onclick=function(){if(!mnow){movegame(twidth,"l")}}
}
function movegame(n,f){
	mnow=true;
	//alert($('mcontent').scrollLeft);
	if(f=="l"&&$('mcontent').scrollLeft>=$('games').offsetWidth)$('mcontent').scrollLeft=0;
	if(f=="r"&&$('mcontent').scrollLeft==0)	mnow=false;clearTimeout(mto);spd=as;//$('mcontent').scrollLeft=$('games').offsetWidth;
	//alert($('mcontent').scrollLeft);
	//alert(n);
	if(f=="l")$('mcontent').scrollLeft+=spd;
	if(f=="r")$('mcontent').scrollLeft-=spd;
	n=n-spd;

	if(n<=as){
		if (step==1){
			spd=19;step=0;
		}
		else{
			spd=20;step=1;
		}
	}
	if(n==0 || n<0){
		mnow=false;clearTimeout(mto);
		spd=as;
	}
	else{
		var mto=window.setTimeout(function(){movegame(n,f)},10)
	}
}

/*
 *首页左侧游戏列表标签切换选项卡
 *TabID需要显示的标签 TotalUnit 标签总数
 */
function Select_Tab(TabID,TotalUnit){
   info_num=TotalUnit;
   for(i=1;i<=info_num;i++){
		document.getElementById("game_"+i).style.display="none";
	}
	document.getElementById("game_"+TabID).style.display="";
}
//-----------------------所有游戏菜单 START------------------------------------
//取消菜单显示
function telescopic_menu_c(ids,id)
{
	document.getElementById(id).style.display='none';
}
function getL(e)
{
	var l=e.offsetLeft;
	while(e=e.offsetParent)l+=e.offsetLeft;
	return l
}
function getT(e)
{
	var t=e.offsetTop;
	while(e=e.offsetParent)t+=e.offsetTop;
	return t
}
//菜单显示
function telescopic_menu(obj,id)
{
	if(typeof(obj)=="object")
	{
		document.getElementById(id).style.top	=getT(obj)+20+'px';
		document.getElementById(id).style.left	=getL(obj)+'px';
		var html=document.getElementById(id).innerHTML;
		htmls=html.toLowerCase();
		var htmla=htmls.split("<div");
		var h=(htmla.length)*30;
	}	
	document.getElementById(id).style.display='';
}
function bjmenu(obj,e)
{
	if(e)
	{
		obj.style.background="#bae1fd";
	}else{
		obj.style.background="#f3f8fc";
	}
}
function bj_newserver(obj,e)
{
	if(e)
	{
		obj.style.background="#f8f8f5";
	}else{
		obj.style.background="#FFFEF9";
	}
}