
var c_browse="";
if (document.getElementById) // IE5+,NN6+;
{ c_browse="ie5"; }
else if (document.all)
{ c_browse="ie4"; }
else if (document.layers)
{ c_browse="ns4"; }

function getobjid(strname)
{
  switch (c_browse)
  {
    case "ie5":
      return document.getElementById(strname);break;
    case "ns4":
      return document.layers[strname];break;
    default: //"ie4"
      return document.all(strname);break;
  }
}
function getparentobjid(strname)
{
  switch (c_browse)
  {
    case "ie5":
      return parent.document.getElementById(strname);break;
    case "ns4":
      return parent.document.layers[strname];break;
    default:
      return parent.document.all(strname);break;
  }
}

var gameviewbaseurl="";
var gamesearchbaseurl=""

var aCH = new Array(90);  //棋盘
var aPPic = new Array(16) //棋子图片
var aDHJ = new Array(60)  //棋局参数
var cachesearch= new Array(2) //搜索查找结果
var reExp = new RegExp();
var gamedata = "";
var isself = (top.location == self.location);
for(i=0;i<16;i++){aPPic[i] = new Image();}

var gnCurrRB=0;
var gclastMoveStr=""; //最后一步走法
var gclastMovePiece=1;    //最后移的棋子
var gclastStyleId="";    //最后移步颜色
var gcCurrMovelist="";
var gnCurrMove=0;
var gcCurrDiv="";
var gnSecAutoLoadNextGame = 5;
cachesearch[0] = "您还未进行任何局面搜索!"
cachesearch[1] = "您还未进行任何棋谱查询!"

function initaDHJArray()
{
for(i=0;i<51;i++) aCH[i]="";
}

function getgamedata()
{
if(isself)
  {if(getobjid("DHJHtmlXQ")!=null) gamedata = getobjid("DHJHtmlXQ").innerHTML;}
else
  {if(getparentobjid(self.name)!=null) gamedata = getparentobjid(self.name).innerHTML;}
for (i=0;i<61;i++){aDHJ[i]=getRegExp(gamedata,"(DHJHtmlXQ_"+i+"])(.*?)(\\[/DHJHtmlXQ_"+i+"])")}
}

function initboardArray(tcfen)  //初始棋盘数组
{
 var nPIdx=0,i=0;
 if(undefined==tcfen || tcfen=="") tcfen=aDHJ[31];
 for(i=0;i<90;i++) aCH[i]=GetPIdx(tcfen.charAt(i)); //初始化棋盘数组。
}

function chk_arrgamedate_init()
{
   if (aDHJ[0]=="" || aDHJ[0]==undefined) aDHJ[0]="Web打谱程序1.0 BY 打虎将 2005-11-18";
   if (aDHJ[1]=="" || aDHJ[1]==undefined) aDHJ[1]="not";
   arr_changeInt_default(2,400,1000,550) // iframe width
   arr_changeInt_default(3,200,800,350) // iframe height
   //if (aDHJ[4]=="" || aDHJ[4]==undefined) aDHJ[4]="playgame/images/ChessCImg/Skin1/"; //aDHJ[4]=
   arr_changeInt_default(5,32,48,38) // piece pic width
   arr_changeInt_default(6,32,48,38) // piece pic height

   if (aDHJ[7]=="" || aDHJ[7]==undefined) aDHJ[7]="DHJHtmlXQ_01xq"; //cookies name 
   arr_changeInt_default(8,0,1,0) //is database infomation

   if (aDHJ[31]=="" || aDHJ[31]==undefined) aDHJ[31]="rnbakabnr**********c*****c*p*p*p*p*p******************P*P*P*P*P*C*****C**********RNBAKABNR"; //盘面初始
   arr_changeInt_default(32,0,1,0);   //gnInitrb 轮到谁走 0红方
   arr_changeInt_default(33,0,9999,0);   //nCurrmoved 已走步数
   if (aDHJ[34]==undefined) aDHJ[34]="";   //gcMoveList 着法串 
   aDHJ[35]=""+Math.floor(aDHJ[34].length/4)+""; //nTotalmoves 总步数
   convertmovelist(); //原棋库中的着法串坐标有差异
   
   arr_changeInt_default(35,0,9999,0);
   if (aDHJ[33]>aDHJ[35]) aDHJ[33]=aDHJ[35];
   
   gcCurrMovelist=aDHJ[34];
   gnCurrMove=aDHJ[33];

   arr_changeInt_default(47,0,9999999,0); //浏览次数 

   arr_changeInt_default(50,0,1024,0);  // aDHJ[50] 默认状态 0。0 1,2,4,8,16,32,64,128 2的级数和组合
   aDHJ[51] = (RCookie("dhj_gameisautomove")=="yes")?1:0; // aDHJ[51] 自动走子 0 非自动,1自动
   arr_changeInt_default(52,0,1,0); // aDHJ[52] 是否上下对调棋盘 
   arr_changeInt_default(53,0,1,0); // aDHJ[53] 是否左右对调棋盘
   arr_changeInt_default(54,0,8,0); // aDHJ[54] 棋子原 X 位置
   arr_changeInt_default(55,0,9,0); // gnoldY 棋子原 Y 位置 
   arr_changeInt_default(56,0,8,0); // aDHJ[56] 棋子新 X 位置
   arr_changeInt_default(57,0,9,0); // aDHJ[57] 棋子新 Y 位置 
   arr_changeInt_default(58,0,89,-1); // aDHJ[58] 拿起棋子在棋盘数组中的下标，-1表示没有拿起过棋子
   arr_changeInt_default(59,0,89,-1); // aDHJ[59] 放下棋子的位置，-1表示没有放下
   arr_changeInt_default(60,0,1,0); // aDHJ[60] 将军标志  0非将军状态,1将军中
     
   Reloadpiecepic();
}             

//棋子路径:
function Reloadpiecepic(tntype)
 {
   if (aDHJ[4]=="" || aDHJ[4]==undefined || tntype==1)  //配置中未指定路径或强制重置棋子路径
    {
      var lnpiecePathidx = parseInt(RCookie("dhj_gamepiecepath"));
      aDHJ[5]=38;aDHJ[6]=38; //棋子宽高默认38
      
      if(isNaN(lnpiecePathidx) || lnpiecePathidx<1 || lnpiecePathidx>4)
      {
       aDHJ[4] ="playgame/images/ChessCImg/Skin1/";
      }
      else
      {
        aDHJ[4]="playgame/images/ChessCImg/Skin" + lnpiecePathidx + "/";
       }
      if(lnpiecePathidx==10 || lnpiecePathidx==11){aDHJ[5]=32;aDHJ[6]=32;}
     }
   for(i=0;i<16;i++){aPPic[i].src = aDHJ[4] + ",fl66,wr66,wn66,wb66,wa66,wk66,wc66,wp66,br66,bn66,bb66,ba66,bk66,bc66,bp66".substr((i*5+1),4)+".gif"}
 }



function CreateMoveText()
{
 var aoldCH=aCH,noldrb=gnCurrRB,TmpExp="",TmpExpLeft2=""
 var nX0,nY0,nX1,nY1,nCurrrb,iRe,lctmpflag;
 aDHJ[35] = Math.floor(gcCurrMovelist.length/4);
 movetexttitle.innerHTML = aDHJ[18] + " " +aDHJ[28]+" "+ aDHJ[22];
 var s;
 s="<table id='movecontent' width='100%' border='0' cellspacing='0' cellpadding='1'>";
 s+="<tr><td width=16></td><td></td></tr>"
 s+="<tr><td colspan=2 align=center><a id='move0_0' href='javascript:d(0,0)'>棋局开始 ("+aDHJ[35]+")</a>";
 lctmpflag = getRegExp(gamedata,"(comment_0_0])(.*?)(\\[/comment_0_0])");
 if(lctmpflag!="") s+="<font color=red>*</font>";
 s+="("+"红黑".charAt(aDHJ[32])+"先)</td></tr>"
 
 gnCurrRB=aDHJ[32]
 initboardArray(aDHJ[31]);
 
 for (iRe=1;iRe<aDHJ[35]+1;iRe++)
  {
   nX0 = parseInt(gcCurrMovelist.charAt((iRe-1)*4))
   nY0 = parseInt(gcCurrMovelist.charAt((iRe-1)*4+1))
   nX1 = parseInt(gcCurrMovelist.charAt((iRe-1)*4+2))
   nY1 = parseInt(gcCurrMovelist.charAt((iRe-1)*4+3))   
   
   TmpExp = GetPExp(aCH[nX0*9+nY0])+GetPExpNum(Math.abs((gnCurrRB+aDHJ[52]+1)%2*8-nY0)+gnCurrRB*9); //走法前二个汉字。
   //检查同一纵向相同棋子,修正
    TmpExpLeft2=GetPExpLeft2(nX0,nY0);
    if(TmpExpLeft2!=="") {TmpExp = TmpExpLeft2 + TmpExp.substr(0,1);}
    TmpExp+=GetPExpRight2(nX0,nY0,nX1,nY1); //走法后二个汉字
    gnCurrRB=(gnCurrRB+1)%2;
    aCH[nX1*9+nY1] = aCH[nX0*9+nY0]
    aCH[nX0*9+nY0] = 0
    if(iRe%2==1) 
    {s+="<tr><td align='center' class=gray>"+iRe+".</td>";}
     else
    {s+="<tr><td></td>";}
    
    s+="<td style='letter-spacing:3pt'><a id='Move0_"+iRe+"' href='javascript:d("+iRe+");'>"+TmpExp+"</a> ";
    lctmpflag = getRegExp(gamedata,"(comment_0_"+iRe+"])(.*?)(\\[/comment_0_"+iRe+"])");
    if(lctmpflag!="") s+="<font color=red>*</font>";
    lctmpflag = getRegExp(gamedata,"(branch_0_"+iRe+"])(.*?)(\\[/branch_0_"+iRe+"])")
    if(lctmpflag!="")
     { s+="<a href=\"javascript:expandm('cch_branch_0_"+iRe+"')\"><font color=blue>+</font></a></td></tr>";
       s+="<tr><td colspan=2 style='display:none;' id='cch_branch_0_"+iRe+"' isload='false'></td></tr>";}
    else
     {
    s+="</td></tr>"
      }
    }
    aCH=aoldCH;
    gnCurrRB = noldrb;
    s+="</table>"
    movetext.innerHTML = s;
    d(aDHJ[33]);
    ShowgameInf();
    adjobjHeigh('movetipsdiv',240,240,240);
    if (aDHJ[51]==1) {aDHJ[51]=0;SetAutoMove();} //加载时默认为自动打谱时
  }
  
function w(m){m = "" + m + "";if (undefined != m){document.write(m);}}
function GetXYToIdx(tnX,tnY){return tnX*9+tnY;}
function GetPE2(tnIndex){return "前后".substr(tnIndex,1);}
function GetPE3(tnIndex){return "前中后".substr(tnIndex,1);}
function GetPE4(tnIndex){return "前二三后".substr(tnIndex,1);}
function GetPE5(tnIndex){return "前二三四后".substr(tnIndex,1);}
function GetPExp(tnIndex){return " 车马相仕帅炮兵车马象士将炮卒".substr(tnIndex,1);}
function GetPExpNum(tnIndex){return "一二三四五六七八九１２３４５６７８９".substr(tnIndex,1);}
function GetPExpA(tnIndex){return "*RNBAKCPrnbakcp".substr(tnIndex,1);}
function GetRelatX0(tnIndex){return Math.abs(9*Math.abs(gnCurrRB-aDHJ[52])-(9-tnIndex));} //棋子相对于本方底线位置
function drawboardA() {for(i=0;i<90;i++) {document.images["qsp_"+Math.floor(i/9)+i%9].src=aPPic[aCH[i]].src;}} 
function drawboardB(tcPos) {for(i=0;i<90;i++) {document.images["qsp_"+Math.floor(i/9)+i%9].src=aPPic[GetPIdx(tcPos.charAt(i))].src;}}  
function RotateCellY(tnPos){return (Math.floor(tnPos/9)*9+(8-tnPos%9));}
function RotateCellXY(tnPos){return ((9-Math.floor(tnPos/9))*9+(8-tnPos%9));}
function GetPIdx(tcStr){var nIdx="*RNBAKCPrnbakcp".indexOf(tcStr);if(nIdx==-1) nIdx=0;return nIdx;}
function arr_changeInt_default(tnarrIdx,tnMin,tnMax,nDefault){aDHJ[tnarrIdx] = parseInt(aDHJ[tnarrIdx]);if(isNaN(aDHJ[tnarrIdx]) || aDHJ[tnarrIdx]<tnMin || aDHJ[tnarrIdx]>tnMax) aDHJ[tnarrIdx] = nDefault;}
function convertmovelist()
{
var tmps=""
for(i=0;i<aDHJ[34].length/2;i++)
 {tmps+=""+(9-parseInt(aDHJ[34].charAt(i*2+1)))+aDHJ[34].charAt(i*2);}
 aDHJ[34] = tmps;
}

//旋转180度。
function rotateXY()
{
  aDHJ[52] = (aDHJ[52]+1)%2;
  aDHJ[53] = (aDHJ[53]+1)%2;
  var tmpStr="";
  for (m=0;m<gcCurrMovelist.length;m++){tmpStr+=(m%2==0)?(9-parseInt(gcCurrMovelist.charAt(m))):(8-parseInt(gcCurrMovelist.charAt(m)));}
  gcCurrMovelist=tmpStr;
  aCH=aCH.reverse();
  tmpStr="";
  for (m=0;m<aDHJ[31].length;m++){n=RotateCellXY(m);tmpStr+=aDHJ[31].charAt(n);}
  aDHJ[31]=tmpStr;
  d(aDHJ[33]);
  aDHJ[58]=-1
}

//左右旋转。
function rotateY()
{
  aDHJ[53] = (aDHJ[53]+1)%2;
  var tmpStr="";
  for (m=0;m<gcCurrMovelist.length;m++){tmpStr+=(m%2==1)?(8-parseInt(gcCurrMovelist.charAt(m))):(gcCurrMovelist.charAt(m));}
  gcCurrMovelist=tmpStr;
  for (m=0;m<90;m++)
  {
    if(m%9<4)
    {
      n=RotateCellY(m);
      tmpPiece=aCH[m];
      aCH[m] = aCH[n];
      aCH[n] = tmpPiece;
    }
  } 
  tmpStr="";
  for (m=0;m<aDHJ[31].length;m++){n=RotateCellY(m);tmpStr+=aDHJ[31].charAt(n);}
  aDHJ[31]=tmpStr;
  CreateMoveText();
  aDHJ[58]=-1;
}

function GetPExpLeft2(tnCurrX,tnCurrY){
//检查同一纵相同棋子的情况
    var tmpStrExp="",nTmpCurrPIdx,nTmpXRank=0,nTmpPs=0,nTmpXotherP=-1;
    nTmpCurrPIdx=aCH[tnCurrX*9+tnCurrY]
    for (i=0;i<10;i++)
      { if(aCH[i*9+tnCurrY]==nTmpCurrPIdx){
        nTmpPs+=1;
        if(i==tnCurrX) {nTmpXRank=nTmpPs;} else {nTmpXotherP=i;}}
      }
    if(nTmpPs==2 && nTmpXotherP!==-1) {tmpStrExp=GetPE2((GetRelatX0(nTmpXotherP)<GetRelatX0(tnCurrX))?0:1);}
    if(nTmpPs==3 && nTmpXRank>0) {tmpStrExp=GetPE3((Math.abs(gnCurrRB-aDHJ[52])%2==0)?(nTmpXRank-1):(nTmpPs-nTmpXRank));}
    if(nTmpPs==4 && nTmpXRank>0) {tmpStrExp=GetPE4((Math.abs(gnCurrRB-aDHJ[52])%2==0)?(nTmpXRank-1):(nTmpPs-nTmpXRank));}
    if(nTmpPs==5 && nTmpXRank>0) {tmpStrExp=GetPE5((Math.abs(gnCurrRB-aDHJ[52])%2==0)?(nTmpXRank-1):(nTmpPs-nTmpXRank));}
    return tmpStrExp;
}

function GetPExpRight2(tnX0,tnY0,tnX1,tnY1){
  var TmpoldXto0=GetRelatX0(tnX0),TmpnewXto0=GetRelatX0(tnX1),tmpstr="";
  switch ( aCH[tnX0*9+tnY0] - gnCurrRB*7 )
 {
  case 1: //车、炮、帅、兵，有“平”
  case 5:
  case 6:
  case 7:
     if(TmpnewXto0>TmpoldXto0) tmpstr="进"+GetPExpNum(Math.abs(TmpnewXto0-TmpoldXto0-1)+Math.floor(aCH[tnX0*9+tnY0]/8)*9); 
       else if(TmpnewXto0<TmpoldXto0) tmpstr="退"+GetPExpNum(Math.abs(TmpoldXto0-TmpnewXto0-1)+Math.floor(aCH[tnX0*9+tnY0]/8)*9);
       else tmpstr="平"+GetPExpNum(Math.abs(8*Math.abs(gnCurrRB-aDHJ[52])-(8-tnY1))+Math.floor(aCH[tnX0*9+tnY0]/8)*9);  
     break;
  case 4:
  case 2:
  case 3:
     if(TmpnewXto0>TmpoldXto0)  tmpstr="进"+GetPExpNum(Math.abs(8*Math.abs(gnCurrRB-aDHJ[52])-(8-tnY1))+Math.floor(aCH[tnX0*9+tnY0]/8)*9);
      else  tmpstr="退"+GetPExpNum(Math.abs(8*Math.abs(gnCurrRB-aDHJ[52])-(8-tnY1))+Math.floor(aCH[tnX0*9+tnY0]/8)*9);
     break;
 }
 return tmpstr;
}

//******* 简化后的走子程序 *******
 function p(x,y)
 {
  if(aDHJ[58]<0)
   {
    if(document.images["qsp_"+x+y].src==aPPic[0].src) return;  
    aDHJ[58]=(x*9+y);  //提起棋子
   }
  else       //放下棋子
   {
   if(aDHJ[58]==(x*9+y)){aDHJ[58]=-1;return;}  //放回原处 
   document.images["qsp_"+x+""+y].src=document.images["qsp_"+Math.floor(aDHJ[58]/9)+""+(aDHJ[58] % 9)].src ;
   document.images["qsp_"+Math.floor(aDHJ[58]/9)+""+(aDHJ[58] % 9)].src=aPPic[0].src; 
   aDHJ[58] = -1; 
    }
 } 
 
function Moveable(tnIdx,tnx0,tny0,tnx1,tny1)
{return;}

function invalid(tcTips)  //非法移动
{return; }
  
function chkChess()  //检查有没有被将军
{return;}

  
function dfirst() {d(0);}
function dback(){if(aDHJ[33]>0) d(aDHJ[33]-1);}
function dfore(){if(aDHJ[33]<aDHJ[35]) d(aDHJ[33]+1);}

function dlast(){
 if (aDHJ[51]==1) {SetAutoMove();}
 d(aDHJ[35]);
}

function showautomovenext()
{
  //alert("yes " +gnSecAutoLoadNextGame);
  if(gnSecAutoLoadNextGame<=0) {if(typeof(oAutoLoad)=="number") window.clearInterval(oAutoLoad);window.location.replace("game_view.asp?id="+aDHJ[46].substr(aDHJ[46].indexOf(",")+1));}
  getobjid("autoloadgamesec").innerHTML= ""+gnSecAutoLoadNextGame+""; 
  gnSecAutoLoadNextGame = (gnSecAutoLoadNextGame - 1);
}

function SetAutoMove(){
 if(aDHJ[51]==1)
 {
  window.clearInterval(oAutoMove);
  document.QSPsform.CmdAuto.value = "a";
  document.QSPsform.CmdAuto.title='自动(AUTO)';
  aDHJ[51] = 0;

 //在自动演示状态下自动转到下一局,暂停止

  if (aDHJ[33] > 0 && aDHJ[33]>=aDHJ[35])
  return;
  {var lcIsauto = RCookie("dhj_gameisautoload");
    
    if (lcIsauto=="yes")
     {

        var lcNextGameIdx = aDHJ[46].substr(aDHJ[46].indexOf(",")+1);
        if (lcNextGameIdx!="") 
          {
             gnSecAutoLoadNextGame = 10;
             getobjid("movetipsdiv").innerHTML="<center><br>　正在自动跳转到下一局 ==> 立刻跳转请点击：<a href=javascript:window.location.replace('game_view.asp?id="+aDHJ[46].substr(aDHJ[46].indexOf(",")+1)+"')>"+aDHJ[46].substr(0,aDHJ[46].indexOf(","))+"</a> <font color=red><h4><div id='autoloadgamesec'>"+gnSecAutoLoadNextGame+"</div></h4></font><br> 不跳转请点击：<a href='javascript:if(typeof(oAutoLoad)==\"number\") window.clearInterval(oAutoLoad);'>停止跳转</a></center>";
             gcCurrDiv = "autoLoad"
             oAutoLoad = window.setInterval("showautomovenext()",1000);
             return;
           }
        else
          {getobjid("movetipsdiv").innerHTML="　　准备自动跳转到下一局... 没有下一局!";}
      }
   }

  }

 else
 {
  var nSec=1;
  nSec=parseInt(document.QSPsform.oSpeed.options[document.QSPsform.oSpeed.selectedIndex].value);
  nSec=nSec*1000;
  oAutoMove = window.setInterval("dfore()",nSec);
  document.QSPsform.CmdAuto.value = ";";
  document.QSPsform.CmdAuto.title='停止(STOP)';
  aDHJ[51] = 1;
 }

 if (aDHJ[35] == 0 || aDHJ[35]==aDHJ[33]) 
 { document.QSPsform.CmdAuto.value = "a";
   document.QSPsform.CmdAuto.title='自动(AUTO)';
   aDHJ[51] = 0;
   if(typeof(oAutoMove)=="number") window.clearInterval(oAutoMove); 
 }
}
 
 
function d(tnStep,nflag)
{
  //if (nflag==undefined) var nflag="";

  tnStep=parseInt(tnStep);
  if(tnStep>aDHJ[35]) tnStep=aDHJ[35];
  if(tnStep<0) tnStep=0;

   var aoldCH=aCH,noldrb=gnCurrRB;
   var nX0,nY0,nX1,nY1,nCurrrb,iRe;
   gnCurrRB=aDHJ[32];
   initboardArray(aDHJ[31]);
   for (iRe=1;iRe<tnStep+1;iRe++)
    {
     nX0 = parseInt(gcCurrMovelist.charAt((iRe-1)*4))
     nY0 = parseInt(gcCurrMovelist.charAt((iRe-1)*4+1))
     nX1 = parseInt(gcCurrMovelist.charAt((iRe-1)*4+2))
     nY1 = parseInt(gcCurrMovelist.charAt((iRe-1)*4+3))   
     aCH[nX1*9+nY1] = aCH[nX0*9+nY0]
     aCH[nX0*9+nY0] = 0
     gnCurrRB=(gnCurrRB+1)%2;
    }
    drawboardA();
    aCH=aoldCH;
    
    gnCurrRB =noldrb;
    aDHJ[33] = tnStep;
    
    if (getobjid(gclastStyleId)!=null) getobjid(gclastStyleId).style.background ="";  
    if(undefined==nflag) {;gclastStyleId="Move0_"+tnStep;} else {gclastStyleId = "Move0_"+nflag+"_"+tnStep;}
    
    var tmpobj = getobjid(gclastStyleId)
    if (tmpobj!=null) {tmpobj.style.background ="#FFFF00";tmpobj.focus();}
    tmpobj = getobjid("qsplink_"+nX1+""+nY1);
    if (tmpobj!=null) {getobjid("qsplink_"+nX1+""+nY1).focus();}
    
    //document.QSPsform.status.value="轮到 "+"红黑".charAt(gnCurrRB)+" 方走棋。";
    document.QSPsform.s.value = tnStep
    document.QSPsform.CmdSear.disabled = (aDHJ[33]<5 || aDHJ[33]>40);
    //document.QSPsform.CmdSearchNewWin.disabled = (aDHJ[33]<5 || aDHJ[33]>40);

     // 变着及注释
    var s = getRegExp(gamedata,"(comment_0_"+tnStep+"])(.*?)(\\[/comment_0_"+tnStep+"])")
    if (s=="")
      {
        if(gcCurrDiv != "gameInf") ShowgameInf();adjobjHeigh('movetipsdiv',240,240,240);gcCurrDiv = "gameInf";
       }
     else
      {
         gcCurrDiv = "comment";
         getobjid("movetipsdiv").innerHTML="<center><table width='100%' border='0' cellspacing='4' cellpadding='4' style='line-height:130%; letter-spacing:1.5pt;'><tr><td align=left>"+s+"</td></tr></table></center>";
       }

    if(aDHJ[51]==1 && aDHJ[33] >= aDHJ[35]){SetAutoMove();}

}

function getRegExp(tcdata,tcExp){
   reExp.compile(tcExp,"ig");
   if(reExp.exec(tcdata)!=null) return(RegExp.$2);
   return("");
}


function ShowSetting(tntype)
{
if (tntype==undefined) {var tntype=0;}
var tmpCooike,icount;
var s="<center><br><table width='460' border='1' cellspacing='0' cellpadding='2' rules=rows>";
 s+="<tr><td colspan=2 valign=center align=center height=30><b>QSP1.2WEB打谱程序自定义设置</b></td></tr>";
 
 s+="<tr><td width=180 align=right>页面背景：</td><td width=280 align=left>";
 tmpCooike = parseInt(RCookie("dhj_gamebodybg"));
 if (isNaN(tmpCooike)) tmpCooike=1;
 for(icount=1;icount<13;icount++)
 {s+="<a href='javascript:WCookie(\"dhj_gamebodybg\",\""+icount+"\");ShowSetting(1);'";
 if (tmpCooike==icount) s+=" class=red" ;
 s+=">"+icount+"</a> "}
 s+="</td></tr>"
 if (tntype==1 && tmpCooike>0) document.body.background="playgame/images/ChessCImg/backg/bg" + tmpCooike + ".jpg";
 
 tmpCooike = parseInt(RCookie("dhj_gameboardbg"));

 if (isNaN(tmpCooike)) tmpCooike=1;
 s+="<tr><td align=right>棋盘图片：</td><td align=left>";
 for(icount=1;icount<13;icount++)
 {s+="<a href='javascript:WCookie(\"dhj_gameboardbg\",\""+icount+"\");ShowSetting(1);'";
 if (tmpCooike==icount) s+=" class=red" ;
 s+=">"+icount+"</a> "}
 s+="</td></tr>";
 if (tntype==1 && tmpCooike>0) getobjid("gameboardtable").background="playgame/images/ChessCImg/backg/bg" + tmpCooike + ".jpg";


tmpCooike = parseInt(RCookie("dhj_gameboardline"));
 if (isNaN(tmpCooike)) tmpCooike=1;
 s+="<tr><td align=right>棋盘格线：</td><td align=left>";
 for(icount=1;icount<2;icount++)
 {s+="<a href='javascript:WCookie(\"dhj_gameboardline\",\""+icount+"\");ShowSetting(1);'";
 if (tmpCooike==icount) s+=" class=red" ;
 s+=">"+icount+"</a> "}
 s+="</td></tr>";

 if (tntype==1 && tmpCooike>0) getobjid("gameboardtd").background="playgame/images/ChessCImg/boardline/boardline" + tmpCooike + ".gif";


 tmpCooike = parseInt(RCookie("dhj_gamepiecepath"));
 if (isNaN(tmpCooike)) tmpCooike=1;
 s+="<tr><td align=right>棋子图片：</td><td align=left>";
 for(icount=1;icount<5;icount++)
 {s+="<a href='javascript:WCookie(\"dhj_gamepiecepath\",\""+icount+"\");ShowSetting(1);'";
 if (tmpCooike==icount) s+=" class=red" ;
 s+=">"+icount+"</a> "}
 s+="</td></tr>"
 if (tntype==1 && tmpCooike>0) {Reloadpiecepic(1);drawboardA();}
//alert("tmpCooike " + tmpCooike + ".gif  " + getobjid("gameboardtd").background);
 
 tmpCooike = parseInt(RCookie("dhj_gameautotimer"));
 if (isNaN(tmpCooike)) tmpCooike=1;
 s+="<tr><td align=right>自动秒数：</td><td align=left>";
 for(icount=1;icount<11;icount++)
 {s+="<a href='javascript:WCookie(\"dhj_gameautotimer\",\""+icount+"\");ShowSetting(1);'";
 if (tmpCooike==icount) s+=" class=red" ;
 s+=">"+icount+"</a> "}
 s+="<a href='javascript:WCookie(\"dhj_gameautotimer\",\"11\");ShowSetting(1);'"+((tmpCooike==11)?" class=red":"")+">20</a> "
 s+="<a href='javascript:WCookie(\"dhj_gameautotimer\",\"12\");ShowSetting(1);'"+((tmpCooike==12)?" class=red":"")+">30</a> "
 s+="<a href='javascript:WCookie(\"dhj_gameautotimer\",\"13\");ShowSetting(1);'"+((tmpCooike==13)?" class=red":"")+">60</a> "
 s+="</td></tr>"
 if (tntype==1 && tmpCooike>0 && tmpCooike<14) document.QSPsform.oSpeed.options[tmpCooike-1].selected="true";

 WCookie("dhj_gameisautoload","no");
 //tmpCooike = RCookie("dhj_gameisautoload");
 //s+="<tr><td align=right title='自动打谱时，对局结束后是否自动跳转到下一局　以及 打开下一局时是否自动打谱。'>自动跳转下一局：</td>";
 //if(tmpCooike=="yes")
 // {s+="<a href='javascript:WCookie(\"dhj_gameisautoload\",\"yes\");ShowSetting(1);' class=red>是</a> <a href='javascript:WCookie(\"dhj_gameisautoload\",\"no\");ShowSetting(1);'>否</a>　";}
 //else
 //  {s+="<a href='javascript:WCookie(\"dhj_gameisautoload\",\"yes\");ShowSetting(1);'>是</a> <a href='javascript:WCookie(\"dhj_gameisautoload\",\"no\");ShowSetting(1);' class=red>否</a>　";}


 tmpCooike = RCookie("dhj_gameisautomove");
  s+="<tr><td align=right>打开对局自动演示：<td align=left>";
  if(tmpCooike=="yes")
  {s+="<a href='javascript:WCookie(\"dhj_gameisautomove\",\"yes\");ShowSetting(1);' class=red>是</a> <a href='javascript:WCookie(\"dhj_gameisautomove\",\"no\");ShowSetting(1);'>否</a>　";}
 else
   {s+="<a href='javascript:WCookie(\"dhj_gameisautomove\",\"yes\");ShowSetting(1);'>是</a> <a href='javascript:WCookie(\"dhj_gameisautomove\",\"no\");ShowSetting(1);' class=red>否</a>　";}
 s+="</td></tr>" 
 s+="</table></center>"


getobjid("movetipsdiv").innerHTML=s
gcCurrDiv = "Setting";

}
function ShowverInf()
{
var s="<center><table width='80%' border='0' cellspacing='2' cellpadding='0'>";
if(aDHJ[0]=="")
  {s+="<tr><td height=80>QSP打谱程序 BY 打虎将 <br>最后修改时间：2005.11.23 <br> Email：<a href='mailto:webmaster@stqiyuan.com'>webmaster@stqiyuan.com</a></td></tr>";}
 else
  {s+="<tr><td height=80>" + aDHJ[0]+"</td></tr>";}
s+="</table>";
getobjid("movetipsdiv").innerHTML=s
gcCurrDiv = "verInf"
}

function ShowgameInf()
{
var s="<center><table width='96%' border='0' cellspacing='2' cellpadding='0'>";
if(aDHJ[9]=="")
  {s+="<tr><td colspan=2 height=10></td></tr>";}
 else
  {s+="<tr><td colspan=2 class=gray height=20 align=center>标题： " + aDHJ[9]+"</td></tr>";}
s+="<tr>";
  s+="<td valign=top>";
if(aDHJ[26]!="") s+="<span class=gray>棋局类型：</span>" + aDHJ[26]+"<br>";
if(aDHJ[27]!="") s+="<span class=gray>棋局性质：</span>" + aDHJ[27]+"<br>";
if(aDHJ[35]>0)   s+="<span class=gray>棋局步数：</span>" + aDHJ[35]+"<br>";
if(aDHJ[28]!="") s+="<span class=gray>棋局结果：</span>" + aDHJ[28]+"<br>";
if(aDHJ[29]!="") s+="<span class=gray>红方用时：</span>" + aDHJ[29]+"<br>";
if(aDHJ[30]!="") s+="<span class=gray>黑方用时：</span>" + aDHJ[30]+"<br>";
if(aDHJ[36]!="") s+="<span class=gray>开局名称：</span>" + aDHJ[36]+"<br>";
if(aDHJ[37]!="") s+="<span class=gray>开局变着：</span>" + aDHJ[37]+"<br>";
if(aDHJ[41]!="") s+="<span class=gray>棋谱来源：</span>" + aDHJ[41].link("m_game_list.asp?c="+aDHJ[41])+"<br>";
if(aDHJ[40]!="") s+="<span class=gray>棋局评注：</span>" + aDHJ[40].link("m_game_list.asp?r="+aDHJ[40])+"<br>";
if(aDHJ[42]!="") s+="<span class=gray>棋局录入：</span>" + aDHJ[42].link("m_game_list.asp?u="+aDHJ[42])+"<br>";
if(aDHJ[43]!="") s+="<span class=gray>联系方式：</span>" + aDHJ[43]+"<br>";
if(aDHJ[44]!="") s+="<span class=gray>录入时间：</span>" + aDHJ[44]+"<br>";
if(aDHJ[48]!="") s+="<span class=gray>项目信息：</span>" + aDHJ[48]+"<br>";
if(aDHJ[47]>0) s+="<span class=gray>浏览次数：</span><font color=red>" + aDHJ[47]+"</font><br>";

s+="</td>";
s+="<td valign=top>";
if(aDHJ[11]!="") s+="<span class=gray>项目名称：</span>" + aDHJ[11]+"<br>";
if(aDHJ[12]!="") s+="<span class=gray>项目类型：</span>" + aDHJ[12]+"<br>";
if(aDHJ[13]!="") s+="<span class=gray>棋局日期：</span>" + aDHJ[13]+"<br>";
if(aDHJ[14]!="") s+="<span class=gray>比赛地点：</span>" + aDHJ[14]+"<br>";
if(aDHJ[15]!="") s+="<span class=gray>轮　　次：</span>" + aDHJ[15]+"<br>";
if(aDHJ[16]!="") s+="<span class=gray>台　　号：</span>" + aDHJ[16]+"<br>";
if(aDHJ[17]!="") s+="<span class=gray>红方单位：</span>" + aDHJ[17]+"<br>";
if(aDHJ[18]!="") s+="<span class=gray>红方姓名：</span>" + aDHJ[18]+"<br>"; 
if(aDHJ[19]!="") s+="<span class=gray>红方级别：</span>" + aDHJ[19]+"<br>";
if(aDHJ[20]!="") s+="<span class=gray>红等级分：</span>" + aDHJ[20]+"<br>";
if(aDHJ[21]!="") s+="<span class=gray>黑方单位：</span>" + aDHJ[21]+"<br>";
if(aDHJ[22]!="") s+="<span class=gray>黑方姓名：</span>" + aDHJ[22]+"<br>";
if(aDHJ[23]!="") s+="<span class=gray>黑方级别：</span>" + aDHJ[23]+"<br>";
if(aDHJ[24]!="") s+="<span class=gray>黑等级分：</span>" + aDHJ[24]+"<br>";
if(aDHJ[25]!="") s+="<span class=gray>本局备注：</span>" + aDHJ[25]+" www.stqiyuan.com<br>";
s+="</td>";
s+="</tr>";

if(aDHJ[45]!="" || aDHJ[46]!="")
{
s+="<tr><td colspan=2 align=center height=36>";
if(aDHJ[45]!="") {s+="上一局：<a href=javascript:locationurl('game_view.asp?id="+aDHJ[45].substr(aDHJ[45].indexOf(",")+1)+"')>"+aDHJ[45].substr(0,aDHJ[45].indexOf(","))+"</a>　　"}
if(aDHJ[46]!="") {s+="下一局：<a href=javascript:locationurl('game_view.asp?id="+aDHJ[46].substr(aDHJ[46].indexOf(",")+1)+"')>"+aDHJ[46].substr(0,aDHJ[46].indexOf(","))+"</a>"}
s+="</td></tr>";
}

s+="</table></center>";
getobjid("movetipsdiv").innerHTML=s
gcCurrDiv = "gameInf";
}

function locationurl(tcurl,tntype)
{

if(isself)
 {
    if (tntype==1) {window.open(tcurl);} else {window.location.replace(tcurl);}
  }
else
  {
    if (tntype==1) {window.open(tcurl);} else {parent.location.replace(tcurl);} 
  }
}


function ShowsearchInf()
{
getobjid("movetipsdiv").innerHTML=cachesearch[0];
gcCurrDiv = "searchInf";
}


function HKey(ik)
{
if(ik==37){dback();}
else if (ik==39) dfore();
else if (ik==38) dfirst();
else if (ik==40) dlast();
}

// ******* Cookies *********
function RCookie(CookieName)
{
  var search = CookieName + "="
  var offset = document.cookie.indexOf(search) 
  if (offset != -1) {
    offset += search.length ;
    var end = document.cookie.indexOf(";", offset) ;
    if (end == -1)
      end = document.cookie.length;
    return document.cookie.substring(offset, end);
  }
  else return "";
}

function WCookie(cookieName,cookieVal) 
{ 
 var expDate = new Date();
 expDate.setTime(expDate.getTime()+100000000000);
 document.cookie=cookieName+"="+escape (cookieVal)+"; expires="+expDate.toGMTString(); 
 }

function adjobjHeigh(tcobj,nIncrease,nMinHeight,nMaxHeight)
{
  var tobj=getobjid(tcobj);
  if (tobj!=null){
  var nh=parseInt(tobj.style.height)+nIncrease
  if(nh<nMinHeight) {tobj.style.height=nMinHeight;return;}
  if(nh>nMaxHeight) {tobj.style.height=nMaxHeight;return;}
  tobj.style.height = nh
  }
}

// **************　局面搜索代码 *******************
function SubmitChk(tntype)
{
var Piece = Array(380285831,728844260,678973583,629056778,905937278,856080375,933226334,-983357396,-208280654,-684093006,-184043006,-960972997,-911099224,-861241239);
var BoardHash = Array(10);
BoardHash[0]=Array(-2073735317,-148827795,-266959415,-855810025,-1978614243,-1369935806,1361935907,225237609,841261290);
BoardHash[1]=Array(1641553676,1425406710,1228078650,-1001203659,-612695940,-742504784,484945285,1508848219,2125994065);
BoardHash[2]=Array(445712065,-1032546025,-209158931,-675194354,79955056,-1446387078,1427560246,-1356294176,-1931752052);
BoardHash[3]=Array(-272390951,784538591,-2070007202,1920374805,565143147,-1802222527,-1157794867,-73281817,-592696839);
BoardHash[4]=Array(-1082956168,1884314466,2110570356,2046277032,-1657921955,-167263722,-411395310,-1750404631,1188261071);
BoardHash[5]=Array(-1755169626,-1256930217,339684842,58239774,-1403318044,1763920330,1223262280,1843264110,-1296965772);
BoardHash[6]=Array(-259031930,-427375112,-1212243726,-1209845585,-262872309,125786418,1793663557,98957418,360805318);
BoardHash[7]=Array(477882000,2072660893,-1701663141,1425983706,567553959,-768046288,1263202570,637851690,615400409);
BoardHash[8]=Array(915720808,2012652823,-1282222554,579484685,-41182645,-1658044033,-104486731,1019834815,-770312213);
BoardHash[9]=Array(2064764045,947200470,-1989404371,-1262268328,-1044202988,853154850,-1397277422,1315837641,261616551);

var Board = Array(10);
for (i = 0; i < 10; i ++) {
  Board[i] = Array(9);
}
//",fl66,wr66,wn66,wb66,wa66,wk66,wc66,wp66,br66,bn66,bb66,ba66,bk66,bc66,bp66".substr((i*5+1),4)+".gif"

for(var i=0;i<10;i++){
  for(var i2=0;i2<9;i2++){
   ImgSrc = document.images[i*9+i2].src
   Board[i][i2]=ImgSrc.substr(ImgSrc.lastIndexOf("/")+1,4)
}}

  var nPieceIdx;
  var nRK=0,nBK=0,nHash=0,nHash2=0;
  for(var i=0;i<10;i++){
    for(var i2=0;i2<9;i2++){
     nPieceIdx = GetPieceIdx(Board[i][i2]);
     if (nPieceIdx>-1)
     {
       if("wb66,wa66,wk66,wp66,bb66,ba66,bk66,bp66,".indexOf(Board[i][i2])>-1)
       {
        if (tntype==0 && !ChkErr(i,i2,nPieceIdx)){
          alert("(第"+(i+1)+"行，第"+(i2+1)+"列) 棋子摆放错误！(注：搜索局面时要求红方在下方、黑在上方)");
          return;}
        if(nPieceIdx==4) nRK+=1;
        if(nPieceIdx==11) nBK+=1;
       } 
        nHash+=(Piece[nPieceIdx]^BoardHash[i][i2]);
        nHash2+=(Piece[nPieceIdx]^BoardHash[i][8-i2]);
       }    
    }
   }
  if (tntype==0){
  if(nRK!==1){alert("红 帅 必须摆放，并且只能摆一个。");return;}
  if(nBK!==1){alert("黑 将 必须摆放，并且只能摆一个。");return;}
  getobjid("movetipsdiv").innerHTML="<br>　　<font class=red>正在搜索中，请稍候。。。</font>" ; 
  document.iframeSear.location.replace(gamesearchbaseurl+"gamesearchServ.asp?n="+nHash+"&m="+nHash2);
  gcCurrDiv = "searchInf";
  }
  else
  {
      document.QSPsform.action = "http://www.stqiyuan.com/gamesearch.asp?h="+nHash
      document.QSPsform.h.value=nHash;
      document.QSPsform.submit();
   }
  return;
}

function GetPieceIdx(tcStr){
var nIdx;
var Pstring="wr66,wn66,wb66,wa66,wk66,wc66,wp66,br66,bn66,bb66,ba66,bk66,bc66,bp66,";
nIdx=Pstring.indexOf(tcStr+",");
if(nIdx!==-1) nIdx=Math.ceil(nIdx/5);
return nIdx
}

function ChkErr(tnX,tnY,tnPieceIdx){
var ImageIdx
ImageIdx=tnX*9+tnY
  switch (tnPieceIdx) {
  case 2: //相
    return (ImageIdx==87 || ImageIdx==83 || ImageIdx==67 || ImageIdx==47 || ImageIdx==51 || ImageIdx==63 || ImageIdx==71);
  case 3:
    return (ImageIdx==86 || ImageIdx==84 || ImageIdx==66 || ImageIdx==68 || ImageIdx==76);
  case 4:
    return (ImageIdx>=84 && ImageIdx<=86) || (ImageIdx>=66 && ImageIdx<=68) || (ImageIdx>=75 && ImageIdx<=77);
  case 6: //兵
    return ImageIdx<45 || (tnX==5 && (tnY==0 || tnY==2 || tnY==4 || tnY==6 || tnY==8)) || (tnX==6 && (tnY==0 || tnY==2 || tnY==4 || tnY==6 || tnY==8));
  case 9: //象
    return (ImageIdx==2 || ImageIdx==6 || ImageIdx==22 || ImageIdx==42 || ImageIdx==38 || ImageIdx==26 || ImageIdx==18);
  case 10:
    return (ImageIdx==3 || ImageIdx==5 || ImageIdx==23 || ImageIdx==21 || ImageIdx==13);
  case 11:
    return (ImageIdx>=3 && ImageIdx<=5) || (ImageIdx>=21 && ImageIdx<=23) || (ImageIdx>=12 && ImageIdx<=14);
  case 13:
    return ImageIdx>44 || (tnX==3 && (tnY==0 || tnY==2 || tnY==4 || tnY==6 || tnY==8)) || (tnX==4 && (tnY==0 || tnY==2 || tnY==4 || tnY==6 || tnY==8));
  default:
    return false;
  }
}

function Searchdetail(tnHash,tcMove,tnobjIdx,tnHash2,tnRecc,tnRes,tnCurrPage)
{
  var targetImg=document.getElementById("SearImg"+tnobjIdx);
  var targetDiv=document.getElementById("sear"+tnobjIdx);
  var targetTD =document.getElementById("seartd"+tnobjIdx);
  if (tnRecc == undefined){var tnRecc="";}else{tnRecc="&recc="+tnRecc;}
  if (tnRes == undefined){var tnRes="";}else{tnRes="&r="+tnRes;}
  if (tnCurrPage == undefined){var tnCurrPage="";}else{tnCurrPage="&page="+tnCurrPage;}

  if ("object"==typeof(targetTD))
  {
     if (targetImg.loaded=="no" || targetImg.loaded!=""+tnRes+""+tnCurrPage)
      {document.iframeSear.location.replace(gamesearchbaseurl+"gamesearchdetail.asp?n="+tnHash+"&m="+tcMove+"&o="+tnobjIdx+"&n2="+tnHash2+tnRecc+tnRes+tnCurrPage);
        targetDiv.style.display="block";
        targetImg.src="./../skin/skin_1/small/fk_minus.gif";
      }
      else
      {
           if (targetDiv.style.display=='block')
             {targetDiv.style.display="none";targetImg.src="skin/skin_1/small/fk_plus.gif";}
           else
             {targetDiv.style.display="block"; targetImg.src="skin/skin_1/small/fk_minus.gif";}
      }
     targetImg.loaded=""+tnRes+""+tnCurrPage
   }
}


// **************　局面搜索代码结束 *******************

function DrawGameBoard(tnid)
{
getgamedata();
chk_arrgamedate_init();

var lcSubPath,c,iBoard,jBoard,lcWH,lcTurn,lcTmps,lcBoardJpg,lcbodybgJpg,lcBoardline

lcSubPath = RCookie("dhj_gamebodybg");
lcbodybgJpg=((lcSubPath=="") ? "playgame/images/ChessCImg/backg/bg1.jpg" : "playgame/images/ChessCImg/backg/bg" + lcSubPath + ".jpg");
document.body.background=lcbodybgJpg;

lcSubPath = RCookie("dhj_gameboardbg");
lcBoardJpg=((lcSubPath=="") ? "playgame/images/ChessCImg/backg/bg1.jpg" : "playgame/images/ChessCImg/backg/bg" + lcSubPath + ".jpg");

lcSubPath = RCookie("dhj_gameboardline");
lcBoardline=((lcSubPath=="") ? "playgame/images/ChessCImg/boardline/boardline1.gif" : "playgame/images/ChessCImg/boardline/boardline" + lcSubPath + ".gif");


lcTurn=((aDHJ[32]==0) ? "红" : "黑");
lcWH= " width='"+aDHJ[5]+"' height='"+aDHJ[6]+"'";
w("  <table border='1' cellpadding='0' cellspacing='0'>");
w("<form name='QSPsform' method='get' action='http://www.stqiyuan.com/gamesearch.asp' target=_blank>");
w("    <tr>");
w("      <td>")
w("<table id='gameboardtable' background='"+lcBoardJpg+"' border='0' cellpadding='1' cellspacing='0' valign='top'  bgcolor='#f7f7f7'>"); 
        w("<tr><td id='gameboardtd' background='"+lcBoardline+"'>");
w("        <table border='0' cellpadding='1' cellspacing='0' valign='top'>"); 
          for(i=0;i<=9;i++)
          {
w("           <tr>");
                for(var i2=0;i2<=8;i2++)
                {w("<td "+lcWH+"><a href=javascript:p("+i+","+i2+") id='qsplink_"+i+""+i2+"'><img src='"+aDHJ[4]+"fl66.gif' border='0' name='qsp_"+i+""+i2+"'></a></td>");}
w("            </tr>");
            }
w("          </table>");
w("        </tr>");
w("      </table>");

w("      <input type='hidden' id='s' value='0'>");
w("      <input type='hidden' id='id' value='"+aDHJ[48]+"'>");
w("      <input type='hidden' name='h' value=''>");
w("      <table width='100%' border='1' cellspacing='0' cellpadding='0'>");
w("        <tr height='28'>");
w("          <td align='center' bgcolor='#ABC6E9'>");
w("          <input type='button' value='a' onmouseup='javascript:SetAutoMove()' name='CmdAuto' class='btnmove' title='自动(AUTO)'>");
w("          <select width='50' id='oSpeed' OnChange='javascript:SetAutoMove()'>");
w("          <option value='1'>1</option>");
w("          <option value='2'>2</option>");
w("          <option value='3' selected>3</option>");
w("          <option value='4'>4</option>");
w("          <option value='5'>5</option>");
w("          <option value='6'>6</option>");
w("          <option value='7'>7</option>");
w("          <option value='8'>8</option>");
w("          <option value='9'>9</option>");
w("          <option value='10'>10</option>");
w("          <option value='20'>20</option>");
w("          <option value='30'>30</option>");
w("          <option value='60'>60</option>");
w("          </select>秒 ");
w("          <input type='button' value='y' name='CmdTurn' onmouseup='rotateY();'class='btnmove' title='左右翻转(ROTATE X)'>");
w("          <input type='button' value='9' onmouseup='javascript:dfirst();' name='CmdPre'class='btnmove' title='第一步(TOP)'>");
w("          <input type='button' value='3' onmouseup='javascript:dback();' name='CmdTop'class='btnmove' title='上一步(PRE)'>");
w("          <input type='button' value='4' onmouseup='javascript:dfore();' name='CmdNext'class='btnmove' title='下一步(NEXT)'>");
w("          <input type='button' value=':' onmouseup='javascript:dlast();' name='CmdBottom' class='btnmove' title='最后步(BOTT)'>");
w("          <input type='button' value='q' name='CmdSwap' onmouseup='rotateXY();' class='btnmove' title='上下翻转(ROTATE XY)'>");
w("          <input type='button' value='s' disabled='false' name='CmdSear' onmouseup='SubmitChk(0);' class='btnmove' title='局面搜索(SEARCH)'>");
w("          <input type='button' value='@' name='CmdSet' onclick=\"ShowSetting();adjobjHeigh('movetipsdiv',180,180,180);\" class='btnmove' title='系统设置(SETTING)'>");
//w("          <input type='button' value='新窗搜局' id='CmdSearchNewWin' onmouseup='SubmitChk(1);' title='打开新窗口搜索当前局面'>");
w("          </td>");
w("        </tr>");
w("      </table>");
w("      </td>");
w("      <td valign='top' align='left' width='180'>");
w("      <table width='100%' border='1' cellspacing='0' cellpadding='0'>");
w("        <tr>");
w("         <td id='movetexttitle' bgcolor=#ABC6E9 align=center valign=center height=22>");  
w("           <a href='javascript:d(0)'>--- 棋局开始 ---</a>");
w("        </td>");
w("         </tr>");
w("        <tr>");
w("         <td>");
w("           <div style='overflow:scroll;overflow-x:hidden;height:"+(aDHJ[6]*10-2)+";margin-left:0px; border:0px;scrollbar-arrow-color:#FF0000;scrollbar-highlight-color: #ffffff;scrollbar-face-color: #eeeeee;scrollbar-shadow-color: #dee3e7;background:#f7f7f7;'>");
w("           <table border='0' cellspacing='0' cellpadding='0' width='100%' rules='rows' style='border-collapse; collapse;margin-top:6px;background:#f7f7f7; letter-spacing:2pt'>");
w("           <tr><td id='movetext'>")
w("            </td>");  
w("            </tr>");    
w("           </table>");
w("          </div>");
w("         </td>");
w("        </tr>");
w("        <tr height='28'>");
w("          <td id='TdInfContrl' valign=center align=center bgcolor='#ABC6E9'>");
w("          |<a href=\"javascript:ShowgameInf();adjobjHeigh('movetipsdiv',240,240,240);\" title='显示棋局信息'>信息</a>|<a href='javascript:ShowsearchInf();' title='显示上一次搜索局面结果'>局面</a>");
w("|<a href=\"javascript:ShowverInf();adjobjHeigh('movetipsdiv',80,80,80);\" title='版本信息'>关于</a>|");
w("           </td>");
w("        </tr>");
w("      </table>");
w("     </td>");
w("    </tr>");
w("   </form>");
w("  </table>");
w("  <table border='1' cellspacing='0' cellpadding='0'>");
w("   <tr>");
w("    <td id='movetipstd' width='"+(aDHJ[5]*9+180)+"'>");
w("      <div id='movetipsdiv' style='overflow:scroll;overflow-x:hidden;height:120;width:"+(aDHJ[5]*9+180)+";margin-left:0px; border:0px;scrollbar-arrow-color:#FF0000;scrollbar-highlight-color: #ffffff;scrollbar-face-color: #eeeeee;scrollbar-shadow-color: #dee3e7;background:#f7f7f7;'>");
w("      </div>");
w("    </td>");
w("    <td width='18' align=center valign=top bgcolor=#ABC6E9>");
w("    <a href='javascript:adjobjHeigh(\"movetipsdiv\",-500,80,500);'><b>↑</b></a><br><a href='javascript:adjobjHeigh(\"movetipsdiv\",-60,60,500);'><b>←</b></a>");
w("    <br><a href='javascript:adjobjHeigh(\"movetipsdiv\",60,60,500);'><b>→</b></a><br><a href='javascript:adjobjHeigh(\"movetipsdiv\",500,60,500);'><b>↓</b></a>");
w("    </td>");
w("   </tr>");
w("  </table>");
w("</center>");
w("<iframe width=0 height=0 src='' id='iframeSear' name='iframeSear'></iframe>");

lcSubPath = parseInt(RCookie("dhj_gameautotimer"));
if(lcSubPath>0 && lcSubPath<14) document.QSPsform.oSpeed.options[lcSubPath-1].selected="true";
}


