<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>欢迎您</title>
<script type="text/javascript" src="../js/basic/prototype.js"></script>
<script type="text/javascript" src="../js/basic/svg.js"></script>
<script type="text/javascript" src="../js/basic/wqclass.js"></script>
<script type="text/javascript" language="javascript">
var step = "";
var xhshou = -1;
var key = "";
var sp = 30;
var wqArr = [];
var x0 = 150;
var y0 = 50;
var r = 10;
var wq = null;
var curSel = null;
function Init()
{
var obj = dialogArguments;
xhshou = obj.xh;
key = obj.key;
CreateQp();
}
function CreateQp()
{
var src = "http://"+window.location.hostname+"/wq/qp.svg";
if ( window.location.port != "" )
{
src = "http://"+window.location.hostname+":"+window.location.port+"/wq/qp.svg";
}
Svg.CreateEmbed($("qp"),0,0,"800","600","absolute","em1",src);
Svg.RunAfterGetDoc = InitQp;
Svg.GetDoc();
}
function InitQp()
{
var s = "000000000000000000000"
for(var i=0;i<21;i++)
{
wqArr.push($A(s));
}
for(var i=1;i<=19;i++)
{
for(var j=1;j<=19;j++)
{
wqArr[i][j] = null;
}
}
wq = new wqClass(0);
Svg.DrawRect(x0-10,y0-10,"580px","580px","yellow","none",0);
curSel = Svg.DrawRect(0,0,2*r,2*r,"white","black",1);
curSel.setAttribute("display","none");
for ( var i=0;i<19;i++)
{
Svg.DrawLine(x0,y0+i*sp,x0+18*sp,y0+i*sp,"blue",1);
}
for ( var i=0;i<19;i++)
{
Svg.DrawLine(x0+i*sp,y0,x0+i*sp,y0+18*sp,"blue",1);
}
for ( var i=3;i<=15;i=i+6)
{
for (var j=3;j<=15;j=j+6)
{
Svg.DrawCircle(x0+i*sp,y0+j*sp,5,"blue","none",0);
}
}
for ( var i=0;i<19;i++)
{
for ( var j=0;j<19;j++)
{
var obj = Svg.DrawCircle(x0+j*sp,y0+i*sp,r,"white","none",1);
obj.setAttribute("status",0);
obj.setAttribute("fill-opacity",0.0001);
obj.setAttribute("onclick","ClickQz("+(j+1)+","+(i+1)+");");
wqArr[j+1][i+1] = obj;
}
}
SetQpByqpStatus();
GetQpstep();
}
function ClickQz(x,y)
{
if (((xhshou==1)&&(wq.step%2==1))||((xhshou==2)&&(wq.step%2==0)))
{
return;
}
var b = wq.Run(x,y);
if (b)
{
SetQpByqpStatus();
var r = wqArr[x][y].getAttribute("r");
var l = wqArr[x][y].getAttribute("cx") - r;
var t = wqArr[x][y].getAttribute("cy") - r;
curSel.setAttribute("x",l);
curSel.setAttribute("y",t);
curSel.setAttribute("display","");
var s = wq.step + "|" + x + "|" + y;
$("ifmcon").src = "help.ashx?method=setstep&rnd="+Math.random()+"&key="+key+"&value="+s;
}
}
function SetQpByqpStatus()
{
for(var i=1;i<=19;i++)
{
for(var j=1;j<=19;j++)
{
if ( wqArr[i][j].getAttribute("status")!=wq.qpStatus[i][j] )
{
switch(wq.qpStatus[i][j])
{
case 0:
wqArr[i][j].setAttribute("status",0);
wqArr[i][j].setAttribute("fill","white");
wqArr[i][j].setAttribute("stroke","none");
wqArr[i][j].setAttribute("fill-opacity",0.0001);
break;
case 1:
wqArr[i][j].setAttribute("status",1);
wqArr[i][j].setAttribute("fill","black");
wqArr[i][j].setAttribute("stroke","black");
wqArr[i][j].setAttribute("fill-opacity",1);
break;
case 2:
wqArr[i][j].setAttribute("status",2);
wqArr[i][j].setAttribute("fill","white");
wqArr[i][j].setAttribute("stroke","black");
wqArr[i][j].setAttribute("fill-opacity",1);
break;
}
}
}
}
}
function GetQpstep()
{
$("ifmcon").src = "help.ashx?method=getstep&rnd="+Math.random()+"&key="+key;
}
function AfterGetStep()
{
if ( step != "" )
{
var arr = step.split('|');
var stp = parseInt(arr[0],10);
if ( stp > wq.step )
{
var x = parseInt(arr[1],10);
var y = parseInt(arr[2],10);
wq.Run(x,y);
SetQpByqpStatus();
var r = wqArr[x][y].getAttribute("r");
var l = wqArr[x][y].getAttribute("cx") - r;
var t = wqArr[x][y].getAttribute("cy") - r;
curSel.setAttribute("x",l);
curSel.setAttribute("y",t);
curSel.setAttribute("display","");
}
}
setTimeout(GetQpstep,1000);
}
</script>
<style type="text/css">
#qp {}
#connect {display:none;}
</style>
</head>
<body onload="Init();">
<div id="qp"></div>
<div id="connect"><iframe id="ifmcon" name="ifmcon" src=""></iframe></div>
</body>
</html>