<!--
  //***数据区***
  //图片名数组
  var gameName = new Array();
  gameName[0] = "Ys The Ark of Napishtim";
  gameName[1] = "Yu-Gi-Oh! GX The Beginning of Destiny";
  gameName[2] = "Frogger beyond",
  gameName[3] = "Food force";
  gameName[4] = "Frogger ancient shadow";
  gameName[5] = "Parodius",
  gameName[6] = "Gradius";
  gameName[7] = "Touch sports challenge";
  gameName[8] = "Frogger Temple of the frog";
  gameName[9] = "DisneySports Skateboard";
  gameName[10] = "MMORPG";
  gameName[11] = "Rhythem Chase";
  gameName[12] = "QiangQiang KungFu";
  gameName[13] = "Rhythm Painter";
  gameName[14] = "Magic";
  gameName[15] = "3D CowRacing";
  gameName[16] = "Socialgaming Mikigogo";
  gameName[17] = "Dragon Power";
  gameName[18] = "Pet Laser";
  gameName[19] = "Comic Superman";
  gameName[20] = "Brain Train";
  gameName[21] = "Game SpectralForce";
  gameName[22] = "Game Megami Tensei";
  
  //游戏类型，类型颜色
  var gametype = [["PS2", "7A39DB"],["PC", "37C759"],["PSP", "666666"],["NDS", "FF66FF"],["GBA", "F77603"],["Mobile", "0D4BC6"],["PS2 XBOX NGC PC", "E43030"]];
  var phototype = ["jpg", "png", "bmp"];
   
  //游戏类型，图片类型，图片数量
  var style = [[0,0,24],[0,0,11],[6,0,27],[1,0,12],[1,0,22],[2,0,18],[2,0,18],[3,0,40],[4,0,27],[4,0,18],[5,0,23],[5,0,12],[5,0,6],[5,0,12],[5,0,7],[5,0,7],[5,0,8],[5,0,11],[5,0,7],[5,0,5],[5,0,12],[5,0,10],[5,0,11]];
  
  //当前页页码
  page = 0;
  curGameIndex = 0;
  
  //***数据区***
  //***功能区***
  //切换到gamephotos页面
  function initGamePhoto() {
	  gameIndex = parseInt(GetParam());
	  changeGameDetail(gameIndex);
	  curGameIndex = gameIndex;
  }
  
  //game页面翻页
  function changePage(pageIndex) {
  	page = pageIndex;
	for (i=pageIndex*10; i<pageIndex*10+10; i++) {
	  curIndex = i%10;
	  currow = Math.floor(curIndex/5);
	  curcell = curIndex%5;
	  if (i < gameName.length) {
		//加载入表格
		document.getElementById("phototable").rows[currow].cells[curcell].innerHTML="<p><div style=\"width:144px; height:144px; overflow:auto; overflow:hidden;\"><a href=\"gamephotos.html?gameIndex="+i+"\"><img src=\"gameviews/gameview"+i+"/gameview"+i+"_0."+phototype[style[i][1]]+"\" alt=\""+gameName[i]+"\" onload = \"DrawMinResizeImage(this,144,144)\"/></a></div></p><p style=\"margin-top: 10px; font-weight: bold; line-height:normal;\">"+gameName[i]+"</p><p style=\" font-size:12px; color: #"+gametype[style[i][0]][1]+"; font-weight: bold;\">"+gametype[style[i][0]][0]+"</p>";
	  } else {
		document.getElementById("phototable").rows[currow].cells[curcell].innerHTML="";
	  }
	} 
	//更新页码
	code="";
	for (i=0; i<3; i++) {
		code = code+"<a ";
		if (pageIndex == i) {
		code = code+"style=\"color:#333333\" ";
		}
		code = code+"onclick=\"javascript:changePage("+i+"); return false;\" href=\"#\">"+(i+1)+"</a> ";
	}
	document.getElementById("phototable").rows[2].cells[0].innerHTML=code;
  } 
  
  //上一页(gamephotos页面)
  function preGame() {
	  if (curGameIndex != 0) {
		curGameIndex = curGameIndex-1;
	  } else {
		curGameIndex = gameName.length-1;
	  }
	  changeGameDetail(curGameIndex);
  }
  //下一页(gamephotos页面)
  function nextGame() {
	  if (curGameIndex < gameName.length-1) {
		curGameIndex = curGameIndex+1;
	  } else {
		curGameIndex = 0;
	  }
	  changeGameDetail(curGameIndex);
  }
  
  //切换gamephotos页面对应游戏
  function changeGameDetail(gameIndex) {
	  //左边预览画面
	  path = "gameviews/gameview"+gameIndex+"/gameview"+gameIndex+"_0."+phototype[style[gameIndex][1]]+"";
	  code1 = "<div style=\"width:545px; height:510px; overflow:auto; overflow:hidden;\"><a href="+path+" target=\"_blank\"><img src="+path+" alt=\""+gameName[gameIndex]+" 1\" onload = \"DrawMinResizeImage(this,525,545)\"/></a></div>";
	  //右边列表
	  code2 = "<ul>";
	  for (i=0; i<style[gameIndex][2]; i++) {
		code2 = code2+"<li><a onclick=\"javascript:previewToDetail("+gameIndex+","+i+"); return false;\" href=\"#\"><img src=\"gameviews/gameview"+gameIndex+"/gameview"+gameIndex+"_"+i+"."+phototype[style[gameIndex][1]]+"\" alt=\""+gameName[gameIndex]+" "+(i+1)+"\" onload = \"DrawMinResizeImage(this,90,90)\" align=\"center\"/></a></li>";
	  }
	  code2 = code2+"</ul></td></tr>";
	  document.getElementById("phototable").rows[0].cells[0].innerHTML=code1;
	  document.getElementById("phototable").rows[0].cells[1].innerHTML=code2;
  }
  
  //切换gamephotos页面对应预览
  function previewToDetail(gameIndex, photoIndex) {
	  path = "gameviews/gameview"+gameIndex+"/gameview"+gameIndex+"_"+photoIndex+"."+phototype[style[gameIndex][1]]+"";
	document.getElementById("phototable").rows[0].cells[0].innerHTML="<div style=\"width:545px; height:510px; overflow:auto; overflow:hidden;\"><a href="+path+" target=\"_blank\"><img src="+path+" alt=\""+gameName[gameIndex]+" 1\" onload = \"DrawMinResizeImage(this,525,545)\"/></a></div>";
  }
  
  //***功能区***
  //***工具区***
  
  //接收传递的参数返回字符串
  function GetParam(){
	var path=window.location.href;
	var pos=path.indexOf("=");
	if(pos > 0){
	  var parm=path.substring(pos+1,path.length);
	}
	return parm;
  }
  
  //自定义尺寸，以最适缩放图片并居中
  function DrawMinResizeImage(ImgD, iw, ih){
	var image=new Image();
 	var iwidth = iw;  //定义允许图片宽度
 	var iheight = ih;  //定义允许图片高度
	image.src=ImgD.src;
	//按最大比例将图片完整缩放在上述设定的区域内
	if(image.width>0 && image.height>0){
	  if(image.width/image.height >= iwidth/iheight){
 		if(image.width>iwidth){  
  		  ImgD.width=iwidth;
  		  ImgD.height=(image.height*iwidth)/image.width;
  		}else{
  		  ImgD.width=image.width;  
  		  ImgD.height=image.height;
  		}
  	  }
 	  else{
  		if(image.height>iheight){  
  		  ImgD.height=iheight;
  		  ImgD.width=(image.width*iheight)/image.height;  
  		}else{
  		  ImgD.width=image.width;  
  		  ImgD.height=image.height;
  		}
  	  }
 	}
	//自动调节设置图片居中
	var tagdiv=ImgD.parentNode;
	if (tagdiv.nodeName=="A"){
		tagdiv=tagdiv.parentNode;
	}
	divh=parseInt(document.all?tagdiv.currentStyle.height:window.getComputedStyle(tagdiv,null).height);
	imgh=ImgD.height;
	imgmtop=(divh-imgh)/2;
	ImgD.style.display='block';
	ImgD.style.margin=imgmtop+'px auto';
  }
  //***工具区***
//-->
