var move=function(e){
	e.preventDefault && e.preventDefault();
	e.returnValue=false;
	e.stopPropagation && e.stopPropagation();
	return false;
}
var keyFunc=function(e){
	var currKey=0,e=e||event; currKey=e.keyCode||e.which||e.charCode;
	if((37<=currKey && currKey<=40) || currKey<=32){
		return move(e);
	}
}

var _intNextHeight;
function chgFull(num){
	if(num==1){//全屏模式
		document.body.onkeydown=keyFunc;
		_intNextHeight = player.playbox.style.height.replace("px","");
		fullpage();
		document.getElementById("fullpage0").className = "ovhid";
		document.getElementById("fullpage2").className = "method";
		document.getElementById("fullpage2").style.right = "0px";
		document.getElementById("fullpage2").style.display = "block";
		document.getElementById("fullpage1").style.display = "block";
		document.getElementById("fullpage3").style.display = "none";
		if(document.getElementById("optionnote")){
			document.getElementById("methodinfo").innerHTML = document.getElementById("optionnote").innerHTML;
		}
		if(document.getElementById("randtip")){
			document.getElementById("randtip").className = document.getElementById("randtip").className.replace("--w","_t").replace("--b","_t");
		}
		document.getElementById("gtitle").className = document.getElementById("gtitle").className.replace("--b","--w");
		window.scrollTo(0,0);
	}else{//退出
		document.body.onkeydown = function(){return true;}
		document.getElementById("fullpage0").className = "";
		document.getElementById("fullpage2").className = "method method_cur";
		document.getElementById("fullpage2").style.display = "none";
		document.getElementById("fullpage2").style.right = "2000px";
		document.getElementById("fullpage1").style.display = "none";
		document.getElementById("fullpage3").style.display = "none";
		var box_style = getCookie("box_style");
		if(!box_style){box_style="--w";}
		if(document.getElementById("randtip")){
			document.getElementById("randtip").className = document.getElementById("randtip").className.replace("_t",box_style);
		}
		document.getElementById("gtitle").className = document.getElementById("gtitle").className.replace("--w",box_style);
		GoToBestPosition();
		ReSize("full_page");
	}
}

function fullzoom(num){
	if(num==1){//放大
		var clientheight = get_screen_height()-40; 
		thish = $('#gameobj').height()+60;
		//var thish = parseInt(document.getElementById("swfdiv").style.height.replace("px",""))+60;
		alert(thish)
		var thisw = GetSize(0,thish,"w");
		alert(thisw)
		if(clientheight-thish>=0){
			document.getElementById("swfdiv").style.height = thish+"px";
			document.getElementById("swfdiv").style.width = thisw+"px";
			player.playbox.style.height = thish+"px";
			player.playbox.style.width = thisw+"px";
			document.getElementById("swfdiv").style.marginTop = parseInt((clientheight - thish)/2)+"px";
		}
	}else{
		var clientheight = get_screen_height()-40; 
		var thish = parseInt(document.getElementById("swfdiv").style.height.replace("px",""))-60;
		var thisw = GetSize(0,thish,"w");
		if((thish*thisw)>67710){
			document.getElementById("swfdiv").style.height = thish+"px";
			document.getElementById("swfdiv").style.width = thisw+"px";
			player.playbox.style.height = thish+"px";
			player.playbox.style.width = thisw+"px";
			document.getElementById("swfdiv").style.marginTop = parseInt((clientheight - thish)/2)+"px";
		}
	}
}

function chgTips(){
	if(document.getElementById("fullpage3").style.display == "none"){
		document.getElementById("fullpage2").className = "method method_cur";
		document.getElementById("fullpage2").style.right = "200px";
		document.getElementById("fullpage2").style.display = "block";
		document.getElementById("fullpage3").style.display = "block";
	}else{
		document.getElementById("fullpage2").className = "method";
		document.getElementById("fullpage2").style.display = "block";
		document.getElementById("fullpage2").style.right = "0px";
		document.getElementById("fullpage3").style.display = "none";
	}
}

function fullpage(){
	window.scrollTo(0,0);
	var f_width = "100%";
	var f_height = get_screen_height()-40; 
	var ff_width = GetSize(0,f_height,"w");
	
	document.getElementById("left_box").style.height = f_height+"px";
	document.getElementById("left_box").style.width = f_width;
	
	document.getElementById("addiv").style.height = f_height+"px";
	document.getElementById("addiv").style.width = f_width;
	
	if(fixsize==1 && _wset>0 && _hset>0){
		__f_height = _hset;
		__ff_width = _wset;
		__magintop = parseInt((f_height-_hset)/2);
	}else{
		__f_height = f_height;
		__ff_width = ff_width;
		__magintop = 0;
	}
	
	player.playbox.style.height = __f_height+"px";
	player.playbox.style.width = __ff_width+"px";
	
	document.getElementById("swfdiv").style.height = __f_height+"px";
	document.getElementById("swfdiv").style.width = __ff_width+"px";
	document.getElementById("swfdiv").style.marginTop = __magintop+"px";
	
	document.getElementById("methodinfo").style.height = (f_height-15)+"px";
	document.getElementById("fullpage2").style.top = parseInt((f_height-94)/2)+"px";
	
	if(document.getElementById("randtip")){
		if(get_screen_width()<1034){
			document.getElementById("randtip").style.display = "none";
		}else{
			document.getElementById("randtip").style.display = "block";
		}
	}
}
//获取屏幕高度
function get_screen_height(){
  if(window.self&&self.innerHeight) return self.innerHeight;
  if(document.documentElement&&document.documentElement.clientHeight) return document.documentElement.clientHeight;
  return document.body.clientHeight;
}

//获取屏幕宽度
function get_screen_width(){
  if(window.self&&self.innerWidth) return self.innerWidth;
  if(document.documentElement&&document.documentElement.clientWidth) return document.documentElement.clientWidth;
  return document.body.clientWidth;
}

function FullPlay(sUrl) {
	var movie;
	if(getOs()==0){
		movie = document.getElementById("flashgame");
	}
	else{
		movie = document.getElementById("flashgame1");
	}
	if(movie.PercentLoaded()==100){
		if(sUrl.substr(sUrl.length-4,4).toLowerCase()==".swf")
			sUrl = sUrl.substr(0,sUrl.length-4);
		if (_playscript==1){
			window.open("FullPlay2.htm?"+sUrl,"4399","fullscreen");
		}
		else{
			window.open("FullPlay.htm?"+sUrl,"4399","fullscreen");
		}
		window.opener =null;
		window.close();
	}
	else{
		alert("请等动画下载完毕再全屏播放，Thanks：）");
	}
}

/*dcr和简介页全屏*/
function FullPlay1(sUrl) {
	if(sUrl.substr(sUrl.length-4,4).toLowerCase()==".swf")
		sUrl = sUrl.substr(0,sUrl.length-4);

	if (_playscript==1){
		window.open("FullPlay2.htm?"+sUrl,"4399","fullscreen");
	}
	else{
		window.open("FullPlay.htm?"+sUrl,"4399","fullscreen");
	}
	window.opener =null;
	window.close();
}
/*iframe全屏*/
function FullPlay3(sUrl) {
	window.open("FullPlay1.htm?"+sUrl,"4399","menubar=no,toolbar=no,location=no,status=no,fullscreen=yes");
	window.opener =null;
	window.close();
}

function FillFullPlay22(){
	var strUrl = _strGamePath;
	if (strUrl.indexOf("http://")==-1){
		strUrl = webServer + strUrl
	}

	if(unilogin==1){
		if (document.getElementById("FullScreenBtn3")){
			document.getElementById("FullScreenBtn3").href = "/flash/swf_unilogin.htm?gamepath="+strUrl+"&gamemark="+_gameMark+"&gamename="+escape(title);
		}
	}

	var arrFullScreenLink = document.getElementsByName("FullScreenLink2");

	for (var j=0;j<arrFullScreenLink.length;j++){
		arrFullScreenLink[j].href = "/flash/swf.htm?gamepath="+strUrl+"&gamemark="+_gameMark+"&gamename="+title;
		if (arrFullScreenLink[j].target=="_self"){
			arrFullScreenLink[j].target ="";
		}
	}
}

function FullPlay333() {
	var strUrl = _strGamePath;
	if (strUrl.indexOf("http://")==-1){
		strUrl = webServer + strUrl
	}

	var i = strUrl.lastIndexOf(".");
	var strGameType = strUrl.substr(i+1);

	if (strGameType!="dcr"){
		strUrl = strUrl.substr(0,i);
	}

	if (_playMode==4){
		window.open("/flash/FullPlay1.htm?"+strUrl,"4399","menubar=no,toolbar=no,location=no,status=no,fullscreen=yes");
	}
	else{
		if (_playscript==1){
			window.open("/flash/FullPlay2.htm?"+strUrl,"4399","fullscreen");
		}
		else{
			window.open("/flash/FullPlay.htm?"+strUrl,"4399","fullscreen");
		}
	}
	ReSize(screenWidth,0);
	//window.opener =null;
	//window.close();
}

//显示尺寸
function ReSize(strSize){
	var intLeftBoxHeight=480;                 //左侧容器高
	var intAdDivHeight=480;                   //广告的高
	var intMarginTop = 0;                     //顶部的间隙
	var intNextWidth;
	var intNextHeight;

	if (_w==0){
		_w = 750;                             //默认的宽
	}

	if (_h==0){
		_h = 563;                             //默认的高
	}

	if (_playMode==4&&arguments.length!=1){  //IFRAME情况
		intNextWidth = _w;
		intNextHeight = _h;
	}
	else{
		switch (strSize){                                      //各种分辨率下的情况
		case "1280":
			intNextWidth = 1000;
			intNextHeight = GetSize(intNextWidth,728,"h");			
			break;
		case "1024":
			//intNextWidth = 660;
			//intNextHeight = GetSize(intNextWidth,480,"h");
			//2010-11-25 修改显示规则,使得在1024*768分辨率下,高度恒定在480,宽度根据宽高比自动缩放。
			if(_wset==0 && _hset==0){//数据库中设置的宽和高
				intNextHeight = 480;
				intNextWidth = GetSize(0,intNextHeight,"w");
			}else{
				intNextHeight = _hset;
				intNextWidth = _wset;
			}
			break;
		case "800":
			intNextWidth = 550;
			intNextHeight = GetSize(intNextWidth,400,"h");
			break;
		case "min":
			intNextWidth = 437;
			intNextHeight = GetSize(intNextWidth,281,"h");
			break;
		case "1152":
			intNextHeight = 569;
			intNextWidth = GetSize(0,intNextHeight,"w");
			break;
		case "1280k":
			intNextHeight = 505;
			intNextWidth = GetSize(0,intNextHeight,"w");
			break;
		case "1366":
			intNextHeight = 499;
			intNextWidth = GetSize(0,intNextHeight,"w");
			break;
		case "1440":
			intNextHeight = 605;
			intNextWidth = GetSize(0,intNextHeight,"w");
			break;
		case "full_page":
			intNextHeight = _intNextHeight;
			intNextWidth = GetSize(0,intNextHeight,"w");
			break;
		default :
			if(_wset>660){
				intNextWidth = _w;
				intNextHeight = _h;
			}else{
				if(_wset==0 && _hset==0){//数据库中设置的宽和高
					intNextHeight = 480;
					intNextWidth = GetSize(0,intNextHeight,"w");
				}else{
					intNextHeight = _hset;
					intNextWidth = _wset;
				}	
			}
			break;
		}
	}

	//当当前高度小于480的时候，上方下方都留出差值的一半高度
	if (intNextHeight<480){
		intMarginTop = Math.floor((480-intNextHeight)/2);
	}

	player.playbox.style.width = intNextWidth + "px";
	player.playbox.style.height = intNextHeight + "px";

	var result={"w":intNextWidth,"h":intNextHeight,"m":intMarginTop}

	if(result.w<=660){viewbox(1,result);}
	else if(result.w>660 && result.w<950){viewbox(2,result);}//原<=970
	else if(result.w >= 950){viewbox(3,result);}//原>970
	if(arguments.length==1){
		GoToBestPosition();
	}
}

function getTop(e){
	var offset=e.offsetTop;
	if(e.offsetParent!=null) offset+=getTop(e.offsetParent);
	return offset;
}

function GoToBestPosition(){
	if(document.getElementById("fullpage0").className == ''){
		var objBestPosition = document.getElementById("bestposition");
		var intBestPosition = getTop(objBestPosition);
		window.scrollTo(0,intBestPosition);
	}
}

var pltnum = 0;
function GoToPL(){
	var objBestPosition = document.getElementById("PL");
	var intBestPosition = parseInt(getTop(objBestPosition));
	window.scrollTo(0,intBestPosition);
	if(pltnum<3){
		setTimeout(GoToPL,500);
		pltnum++;
	}
}

function GetSize(w, h, m){
	var t;
	if(m == "w"){
		t = parseInt(_w * h/_h);
		return t;
	}else{
		t = parseInt(w * _h/_w);
		return t;
	}
}
var screenWidth = location.search.split('?')[1];

function getOs(){
	if(document.getElementById("flashgame1")){
		return 1;	
	}else{
		return 0;
	}
}

//显示进度条flash代码
function showNewLoading(){
	var this_width = document.getElementById("swfdiv").style.width;
	var this_height = document.getElementById("swfdiv").style.height;
	var loading = '<object id="loadingframe" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="'+this_width+'" height="'+this_height+'">';
	loading += '<param name="movie" value="gameloader2.swf" />';
	loading += '<param name="quality" value="high" />';
	loading += '<param name="wmode" value="transparent" />';
	loading += '<param name="allowScriptAccess" value="always" />'
	loading += '<embed id="loadingframe1" name="loadingframe1" src="gameloader2.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+this_width+'" height="'+this_height+'" allowScriptAccess="always"></embed>';
	loading += '</object>';
	
	document.getElementById("addiv").innerHTML = loading;//加载新版进度条，并默默加载游戏
}

//显示旧版细长进度条
function showLoading(){
	var this_width = "100%";
	var this_height = "12";
	var loading = '<object id="loadingframecell" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="'+this_width+'" height="'+this_height+'">';
	loading += '<param name="movie" value="/flash/cell.swf" />';
	loading += '<param name="quality" value="high" />';
	loading += '<param name="wmode" value="transparent" />';
	loading += '<param name="allowScriptAccess" value="always" />'
	loading += '<embed id="loadingframecell1" name="loadingframe1" src="/flash/cell.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+this_width+'" height="'+this_height+'" allowScriptAccess="always"></embed>';
	loading += '</object>';
	
	document.getElementById("loadingdiv").innerHTML = loading;//加载新版进度条，并默默加载游戏
}

//调用flash进度条
function newLoadingFlash(){//进度值,当前加载项，单文件，默认传1，总加载项，单文件，默认传1
	var objThisFlash = getFlashObj();
	var intPercentage=0;
	
	try {if (objThisFlash) intPercentage = objThisFlash.PercentLoaded();}
	catch(e){}
	if (intPercentage < 0) intPercentage = 100;
	if (_playMode!=1) intPercentage = 100;
	setloaded(intPercentage,1,1);
	if (intPercentage == 100) {
		document.getElementById("addiv").style.display = "none";
		try{document.getElementById("progresser").style.display = "none";}catch(e){}
		player.isloading = false;
		return;
	}
	window.setTimeout(newLoadingFlash,300);
}

//定时调用（新版大进度条）
function setloaded(intPercentage,loaded,total){
	if(isIE()){
		try {document.getElementById("loadingframe").setloaded(intPercentage,1,1);}catch(e){}
	}else{
		try {document.getElementById("loadingframe1").setloaded(intPercentage,1,1);}catch(e){}
	}		
}

//定时调用（旧版小进度条）
function setloadedcell(intPercentage,loaded,total){
	if(isIE()){
		try {document.getElementById("loadingframecell").setloaded(intPercentage,1,1);}catch(e){}
	}else{
		try {document.getElementById("loadingframecell1").setloaded(intPercentage,1,1);}catch(e){}
	}		
}

function loadingFlash(){
	var objThisFlash = getFlashObj();
	var intPercentage=0;
	
	try {if (objThisFlash) intPercentage = objThisFlash.PercentLoaded();}
	catch(e){}
	
	if (intPercentage < 0) intPercentage = 100;
	if (_playMode!=1) intPercentage = 100;
	setloadedcell(intPercentage,1,1);
	if (intPercentage == 100) {
		document.getElementById("loadingdiv").style.display = "none";
		try{document.getElementById("progresser").style.display = "none";}catch(e){}
		return;
	}
	window.setTimeout(loadingFlash,300);
}

function getFlashObj() {
	if(isIE()){
		return document.getElementById("flashgame");	
	}else{
		return document.getElementById("flashgame1");
	}
}

//12-21修改，增加google浏览器，苹果浏览器兼容
function Replay(){
	var strMovieUrl;
	switch (_playMode){
	case "4":
		player.playbox.src = player.playbox.src;
		break;
	default:
		//if(player.playbox.PercentLoaded()==100 || player.playbox.PercentLoaded()<0){
			if(getOs()==0){
				strMovieUrl = player.playbox.movie;
				player.playbox.movie = " ";
				player.playbox.movie = strMovieUrl;
			}
			else{
				//兼容google chrome浏览器的重新玩游戏
				document.getElementById("swfdiv").innerHTML = document.getElementById("swfdiv").innerHTML;
				player.playbox = document.getElementById("flashgame1");
			}
		//}
	}
}

function showswf(){
	document.getElementById("swfdiv").style.display="block";
	document.getElementById("addiv").style.display="none";
	if(isIE() || u3dAD){Replay();}
	player.isloading = false;
}

var player = {
	playbox:null,
	defaultsize:{"w":_w,"h":_h},
	adsize:{"w":640,"h":480},
	isloading:true,
	wmode:0,
	getboxsize:function(o){
		if(!o)return {"w":0,"h":0};
		return{"w":o.clientWidth,"h":o.clientHeight};
	},
	adjustboxsize:function(c,a){//原始宽比高数值大，则c的宽度+a，高度按原始比例增加
		if(this.defaultsize.w>this.defaultsize.h){
			return{"w":c.w+a,"h":Math.floor((c.w+a)*this.defaultsize.h/this.defaultsize.w),"m":0};
		}
		else{
			return{"w":Math.floor((c.h+a)*this.defaultsize.w/this.defaultsize.h),"h":c.h+a,"m":0};
		}
	},
	setboxsize:function(o,size){//设置o的宽高
		o.style.width = size.w == "100%" ? size.w : size.w + "px";
		o.style.height = (size.h == "100%" || size.h == "auto") ? size.h : size.h + "px";
	},
	zoom:function(p){
		var a = 150*p,current=this.getboxsize(this.playbox),result=this.adjustboxsize(current,a);

		if(result.h<480){
			result.m = Math.floor((480-result.h)/2);
		}
		//alert(current);
		if(this.isloading && (result.w <= this.adsize.w || result.h <= this.adsize.h)){current = null,result=null;return;}
		if(current.w*current.h < 60000 && p<0){current=null,result=null;return;}
		
		if(result.w<=660){viewbox(1,result);}
		else if(result.w>660 && result.w<950){viewbox(2,result);}//原<=970
		else if(result.w >= 950){viewbox(3,result);}//原>970

		this.setboxsize(this.playbox,result);
		GoToBestPosition();
	}
}

function isIE6(){
	return !!window.ActiveXObject && !window.XMLHttpRequest;	
}

function isIE(){
	return 	!!window.ActiveXObject;
}
var isslide = false;
function viewbox(m,s){
	if(s.h){
		s.h = parseInt(s.h);
	}
	switch(m){
		case 1 :
			var minsize = s.h+128;
			if(minsize<606){minsize=606;}
			document.getElementById("mb_content").style.height = minsize+"px";
			document.getElementById("padswf").style.height = minsize+"px";//ie6
			document.getElementById("mb_content").style.width="970px";
			document.getElementById("mb_game").style.width="943px";
			document.getElementById("left_box").style.width="660px";//12-21修改
			if(s.h<480){
				document.getElementById("left_box").style.height="480px";
				document.getElementById("addiv").style.height="480px";
				if(newLoading==1){
					document.getElementById("addiv").style.marginTop=s.m+"px";	
				}
			}else{
				document.getElementById("left_box").style.height=(s.h+4)+"px";
				document.getElementById("addiv").style.height=(s.h+4)+"px";
				document.getElementById("addiv").style.marginTop=s.m+"px";
			}

			//增加左高右低游戏，右边框架自适应高度
			if(s.h>480){
				if(document.getElementById("rightdivheight")){
					document.getElementById("rightdivheight").style.height = parseInt(s.h-480+444)+"px";
				}
				if(document.getElementById("optionnote")){
					document.getElementById("optionnote").style.height = parseInt(s.h-480+444)+"px";
				}
			}else{
				if(document.getElementById("rightdivheight")){
					document.getElementById("rightdivheight").style.height = "444px";
				}
				if(document.getElementById("optionnote")){
					document.getElementById("optionnote").style.height = "444px";
				}
			}
			
			document.getElementById("swfdiv").style.marginTop=s.m+"px";
			document.getElementById("swfdiv").style.width=s.w+"px";
			document.getElementById("swfdiv").style.height=s.h+"px";
			if(!isslide){
				document.getElementById("right_box").style.display = "block";
				$("#right_box").show("fast",function(){
					$("#slide").wslide({
						width: 260,
						height: 418,
						pos: 1,
						horiz: true
					});
				 });
				isslide = true;
			}else{
				$("#right_box").show();
			}
			if(document.getElementById("plike")){
				document.getElementById("plike").style.display = "none";
			}
			break;
		case 2 :
			if(s.h>480){
				minsize = s.h+128;
			}else{
				minsize = 480+128;	
			}
			document.getElementById("mb_content").style.height = minsize+"px";
			document.getElementById("padswf").style.height = minsize+"px";//ie6
			document.getElementById("mb_content").style.width="970px";
			document.getElementById("mb_game").style.width="950px";
			document.getElementById("left_box").style.width="950px";
			if(s.h<480){
				document.getElementById("left_box").style.height="480px";
				document.getElementById("addiv").style.height="480px";
				if(newLoading==1){
					document.getElementById("addiv").style.marginTop=s.m+"px";	
				}
			}else{
				document.getElementById("left_box").style.height=(s.h+4)+"px";
				document.getElementById("addiv").style.height=(s.h+4)+"px";
				document.getElementById("addiv").style.marginTop=s.m+"px";
			}
			document.getElementById("swfdiv").style.marginTop=s.m+"px";
			document.getElementById("swfdiv").style.width=s.w+"px";
			document.getElementById("swfdiv").style.height=s.h+"px";
			document.getElementById("right_box").style.display = "none";
			showr_t();
			break;
		case 3 :
			if(s.h>480){
				minsize = s.h+128;
			}else{
				minsize = 480+128;	
			}
			document.getElementById("mb_content").style.height = minsize+"px";
			document.getElementById("padswf").style.height = minsize+"px";//ie6
			document.getElementById("mb_content").style.width=(s.w+32)+"px";
			document.getElementById("mb_game").style.width=(s.w+3)+"px";
			document.getElementById("left_box").style.width=(s.w+4)+"px";
			if(s.h<480){
				document.getElementById("left_box").style.height="480px";
				document.getElementById("addiv").style.height="480px";
				if(newLoading==1){
					document.getElementById("addiv").style.marginTop=s.m+"px";	
				}
			}else{
				document.getElementById("left_box").style.height=(s.h+4)+"px";
				document.getElementById("addiv").style.height=(s.h+4)+"px";
				document.getElementById("addiv").style.marginTop=s.m+"px";
			}
			document.getElementById("swfdiv").style.marginTop=s.m+"px";
			document.getElementById("swfdiv").style.width=s.w+"px";
			document.getElementById("swfdiv").style.height=s.h+"px";
			document.getElementById("right_box").style.display = "none";
			showr_t();
			break;
		default:break;
	}
}


//当右侧相关游戏不可见的情况,下方自动加载你可能喜欢玩的游戏
function showr_t(){
	var rt = myGetElementsByName("div","r_t");
	var str = "";
	var fy = 1;
	var lis = "<ul class='l_game_ul' id='pg"+fy+"'>";
	for(j=0;j<rt.length;j++){
		str += rt[j].innerHTML.replace(/<dl>/gi,"").replace(/<\/dl>/gi,"").replace(/<dt>/gi,"<li>").replace(/<\/dt>/gi,"</li>");
	}
	strs = str.split("</li>");
	if(strs.length>=40){
		for(var i=1;i<=40;i++){
			var li = strs[i-1].replace(/lz_src/g,"src");
			if(i>8){
				lis += li.replace(/src/g,"lz_src")+"</li>";
			}else{
				lis += li+"</li>";
			}
			if(i%8==0 && i<40){
				fy++;
				lis += "</ul><ul class='l_game_ul' style='display:none' id='pg"+fy+"'>";
			}
		}
		lis += "</ul>";
		document.getElementById("plike").style.display = "block";
		document.getElementById("r_t").innerHTML = lis;
	}
}

function switchpage(totalpage,controller,page){
	var prepage = page-1;
	if(prepage<1){prepage=totalpage}
	var prestring = document.getElementById(controller+"_pre").href;
	prestring = prestring.replace(/,[0-9]+\)+/g,","+prepage+"\)");
	document.getElementById(controller+"_pre").href = prestring;
	
	var nextpage = page+1;
	if(nextpage>totalpage){nextpage=1}
	var nextstring = document.getElementById(controller+"_nex").href;
	nextstring = nextstring.replace(/,[0-9]+\)+/g,","+nextpage+"\)");
	document.getElementById(controller+"_nex").href = nextstring;
	
	for(var i=1;i<=totalpage;i++){
		if(i==page){	
			document.getElementById(controller+i).style.display = "block";
			document.getElementById("tfpg"+i).className = "pagon";
			document.getElementById(controller+i).innerHTML = document.getElementById(controller+i).innerHTML.replace(/lz_src/g,"src");
		}else{
			document.getElementById("tfpg"+i).className = "";
			document.getElementById(controller+i).style.display = "none";
		}
	}
}

var arrTemp = _gameMark.split("|");
var _playMode = arrTemp[0];
var _playscript = arrTemp[1];

window.onresize = function(){
	if(document.getElementById("fullpage0").className == 'ovhid'){
		fullpage();
	}
}