﻿var game=[[12986,"蜘蛛纸牌","20059/6/20059614291844900.jpg"],[22121,"蜘蛛纸牌经典版","20075/16/2007516233440.jpg"],[270,"果蔬连连看","200412/8/27022.jpg"],[23337,"麻将移移看","20077/31/2007731154639.jpg"],[30221,"拖拉机","20085/14/2008514230104.jpg"],[3486,"花花连连看","20052/22/3486.jpg"],[3484,"汽车标志连连看","20052/22/3484.jpg"],[18328,"宠物连连看3.0版","20066/30/2006630131728.jpg"],[32297,"奥维斗地主","200812/29/20081229224715.jpg"],[46447,"中国象棋","20108/24/2010824101227.jpg"],[13675,"花园种花","20059/23/20059231258890789.gif"],[7590,"消小球","20056/4/2005641565738678.jpg"],[34991,"轰炸笑脸小人2","20096/15/2009615131125.jpg"],[40039,"我和美女打麻将","20102/27/201022794155.jpg"],[22694,"奥维麻将塔","20076/19/2007619144023.jpg"],[50699,"开心斗地主","20111/26/2011126211714.jpg"],[3482,"美女连连看","20052/22/3482.jpg"],[22035,"双人麻将","20075/11/2007511144345.jpg"],[24031,"对对碰","20079/8/20079892243.jpg"],[1337,"上海麻将","200412/15/1337.jpg"],[35698,"彩珠消消看2","20097/23/2009723145917.gif"],[18376,"宠物连连看3.1版","20067/4/20067484630.jpg"],[32779,"麻将连连看2","20092/7/20092785821.jpg"],[37255,"明星三缺一","200910/26/2009102610258.jpg"],[14591,"宠物连连看2.6版","200511/4/2005114213955.gif"],[38077,"宠物连连看跳关版","200912/3/2009123152130.jpg"],[21806,"数独大师","20074/22/2007422113933.jpg"],[35439,"美少女斗地主","20097/8/200978141959.jpg"],[66,"宠物连连看2.5版","200411/22/66.jpg"],[10686,"智力渡河","20058/1/20058110475272256.jpg"],[519,"麻雀连连看","200411/24/519.jpg"],[6965,"中国跳棋","20055/25/200552516483118754.jpg"],[11849,"麻将接龙","20058/23/200582313302354219.jpg"],[20691,"麻将消消看","200612/30/20061230135634.jpg"],[15354,"撞击金块","200512/6/200512685121.gif"],[692,"北京麻将","200411/27/692.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","")}
}
