﻿var game=[[55792,"是男人就把她搞大","20119/29/2011929131926.jpg"],[39097,"泡沫射手","20101/15/2010115104944.jpg"],[30678,"祖玛印加古青蛙","20086/26/2008626114657.jpg"],[1411,"吞食鱼","200412/20/1411.jpg"],[7154,"冒泡射击","20055/28/20055281257232709.jpg"],[37760,"Ben10大战斗","201012/20/1091220103030.jpg"],[41682,"口袋战士nova0.6","20104/16/2010416134854.jpg"],[42354,"英雄大作战V0.2.2","20105/5/20105595412.jpg"],[34687,"拳皇wing1.3","20095/25/200952523417.jpg"],[45488,"高速路抢车","20107/22/201072215322.jpg"],[47085,"拳皇wing1.4","20109/11/2010911142019.jpg"],[51485,"雷炎之怒1.1","20112/25/2011225134530.jpg"],[35100,"黄小人闯关","20096/23/2009623153436.jpg"],[10641,"挑战点西瓜","20057/29/200572915181312364.jpg"],[45902,"电击小子格斗2修改版","20108/4/201084104733.jpg"],[12278,"狂扁小朋友","20058/29/200582913284749039.gif"],[31844,"旋转泡泡","200811/21/20081121135358.gif"],[52583,"炎龙传说3炽凤","20113/31/201133110956.jpg"],[30829,"驾驶员停车","20087/16/2008716130522.gif"],[41380,"卡通超级格斗2","20104/10/2010410153617.jpg"],[42197,"恐龙格斗","20104/29/2010429111724.jpg"],[53903,"拳皇wing2.0","20116/22/2011622115447.jpg"],[18354,"飞龙营救","20067/1/200671155306.gif"],[35999,"英雄大作战","20098/11/2009811151555.gif"],[43589,"口袋战士nova0.6英文修改版","20106/1/201061103020.jpg"],[30830,"激情披萨","20087/16/2008716142514.gif"],[18144,"完美停车","20066/14/2006614151742.gif"],[13931,"仿真汽车驾驶","200510/10/20051010140701.gif"],[34579,"度假岛停车","20095/20/2009520163842.jpg"],[33793,"飞机驾驶员","20093/26/2009326103852.jpg"],[22230,"疯狂小人战斗","20075/23/2007523101848.gif"],[50753,"拳皇wing1.5","20111/30/2011130194118.jpg"],[31187,"拳皇wing1.2","20089/23/200892315461.jpg"],[38771,"动漫明星大乱斗1.2","200912/30/20091230173647.jpg"],[38923,"Ben10武士","20101/7/201017155418.jpg"],[35599,"小嘟嘟停车场","20097/15/2009715171852.jpg"]]

var picpath="http://img.yx007.com:88/thumb/";
var tpic="/images/blank.gif";
var step = 1;
var downpics = 12;

var gamehtml="";var ndomain;var i=0;
for(key in game){
	var murl="http://www.yx007.com/list/play_"+game[key][0]+".htm";
	if(i >= downpics){
		gamehtml+='<li><a href="'+murl+'" target="_0"><img pic="'+picpath+game[key][2]+'" src="'+tpic+'" /><br />'+game[key][1]+'</a></li>'
	}
	else{
		gamehtml+='<li><a href="'+murl+'" target="_0"><img pic="" src="'+picpath+game[key][2]+'" /><br />'+game[key][1]+'</a></li>'
	}
	gamehtml+='\n';i++
}
var twidth=960;var alldown=false;var mnow=false;var as=80;var asm=20;var spd=as;var asx=4;
function setmove(){
	if($('games').offsetWidth<=twidth)return;
	var a=document.createElement("UL");
	a.innerHTML=$('games').innerHTML;
	$('gamesdiv').appendChild(a);
	$('mleft').onclick=function(){if(!mnow){downpic("r");movegame(twidth,"r")}};
	$('mright').onclick=function(){if(!mnow){downpic("l");movegame(twidth,"l")}}
}
function movegame(n,f){
	mnow=true;
	if(f=="l"&&$('mcontent').scrollLeft>=$('games').offsetWidth)$('mcontent').scrollLeft=0;
	if(f=="r"&&$('mcontent').scrollLeft==0)$('mcontent').scrollLeft=$('games').offsetWidth;
	if(f=="l")$('mcontent').scrollLeft+=spd;
	if(f=="r")$('mcontent').scrollLeft-=spd;
	n=n-spd;
	if(n==0) spd=20;
	if(n+as==0){
		mnow=false;
		clearTimeout(mto);
		f=f=="l"?"r":"l";
		spd=as;
		var a=window.setTimeout(function(){movegamex(as,f)},10)
	}else{
		var mto=window.setTimeout(function(){movegame(n,f)},10)
	}
}
function movegamex(n,f){
	mnow=true;
	if(f=="l"&&$('mcontent').scrollLeft>=$('games').offsetWidth)$('mcontent').scrollLeft=0;
	if(f=="r"&&$('mcontent').scrollLeft==0)$('mcontent').scrollLeft=$('games').offsetWidth;
	if(f=="l")$('mcontent').scrollLeft+=asx;
	if(f=="r")$('mcontent').scrollLeft-=asx;n=n-asx;
	if(n==0){mnow=false;clearTimeout(a)}
	else{var a=window.setTimeout(function(){movegamex(n,f)},10)}
}
function getdownnum(o){
	if(alldown)return false;
	for(i=0;i<o.length;i++)if(o[i].getAttribute("pic")!="")return o.length;
	alldown=true
}
function downpic(t){
	var a=$('games').getElementsByTagName("IMG");
	var b=getdownnum(a);
	if(!b)return;
	var c=(t=="l")?$('mcontent').scrollLeft+twidth:$('mcontent').scrollLeft-twidth;
	if(!t)c=0;
	var f=c/as;
	if(f<0)f=a.length+f;
	if(f>a.length-1)f=f-a.length;
	var t=f+downpics;
	if(t>a.length-1)t=a.length-1;
	for(i=f;i<=t;i++){if(a[i].getAttribute("pic")!="")a[i].src=a[i].getAttribute("pic");a[i].setAttribute("pic","")}
}
