// (C) 2009, Lee J Haywood.
g30=['Blue','Red','Rose','Green','Yellow','Orange','Black','Cyan','Grey','Purple','Teal','Lime','Brown','Sand','Puce']
g62=g30.length
g66=8
g67=Math.round(Math.log(g66)/Math.log(2))
g52='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._'
g19=_40('cellsize')
if(g19.match(/^(5|[1-4][05]|50)$/)){g19=parseInt(g19,10)
_30('i34',g19)}
else{g19=25}
g12=_58('i4')
g49=_58('i7')
g50=_58('i8')
g22=_58('i5')
g14=_58('i6')
g45=_58('i9')
g10=_58('i35')
g70=_58('i21')
g11=_58('i26')
g27=_58('i23')
g42=_58('i22')
g28=_58('i25')
g63=_58('i24')
g25=_58('i28')
g47=_58('i11')
g23=_58('i12')
g55=_58('i13')
g39=_58('i14')
g71=_58('i16')
g36=_58('i17')
g64=_58('i18')
g29=_58('i10')
g5=_58('i19')
g33=_58('i20')
g9=_58('i36')
g48='http://'+window.location.host+window.location.pathname
g65=null
g68=new
Array
g46=0
g6=''
g59=0
g35=false
g72=null
g53=null
try{g53=new
ActiveXObject('Msxml2.XMLHTTP')}
catch(dummyObjectException){try{g53=new
ActiveXObject('Microsoft.XMLHTTP')}
catch(dummyObjectException2){g53=null}}
if(g53==null&&typeof
XMLHttpRequest!='undefined'){g53=new
XMLHttpRequest()}
g4=navigator.appName.substring(0,9)!='Microsoft'
g32=null
g69=new
Array
g43=new
Array
g51=0
g24=0
g73=new
Array
_38()
function
_3(y){var n,s,l,d
if(y==''){return}
_28(g14,false)
if(_6(g14,-1,['tr',['td',{colSpan:
3},['b','Top-rated puzzles']]])==null){return}
n=y.split('\n')
for(var f=0;f<n.length;f++){s=n[f].split('\t')
if(s[2]>0){l=s[2]/s[1]}
else{l=0}
d=g41==s[0]||s.length==5
if(_6(g14,-1,['tr',{title:
'Score '+l.toString().substr(0,5)+'\xA0 ('+s[1]+' rating'+(s[1]=='1'?'':'s')+')'},['td',['ul.star',['li.now',{style:
'width:'+Math.round(20*l)+'px;background:url(star.gif) left center!important;left:0px!important;margin:0px!important'}]]],['td'+(d?'.cThis':''),{id:
(d?'xThis':'')},['a',{href:
g48+'?id='+s[0]},(s[3]==''?'Puzzle '+s[0]:s[3])]]])==null){return}}
var j=_50(g22),b=j.y+g14.offsetHeight+8,g=_54()
if(b>=g&&g>64){b=g-32}
g22.style.height=(b-j.y)+'px'
g22.style.width=g14.offsetWidth+'px'
var p=g22.offsetWidth
g22.style.overflow='auto'
var u=g22.offsetWidth
if(u==p){u=g22.clientWidth}
g22.style.width=(p+(p-u))+'px'}
function
_15(l,r){if(l>0){return (20*r)/l}
return 0}
function
_36(i){g59=i
_58('xRate').style.width=(i*20)+'px'
g36.focus()}
function
_57(){if(g59<=0||(g35&&g36.value=='')){_61(g64)}
else{_53(g64)}
g72=setTimeout('_57()',250)}
function
_33(){if(g59==0||(g35&&g36.value=='')){return}
_11('lf','?d='+_12(false,true)+(g35&&g36.value!=''?'&n='+g36.value:'')+'&r='+g59+'&a='+g6)
g43[g51]=false
if(g1){_61(g23)
_52(g55)
_61(g71)
_61(g36)
_61(g64)
_61(g33)
_29(g39)}
else{_47()}}
function
_47(){_52(g47)
_52(g29)
if(g72!=null){clearTimeout(g72)
g72=null}
_37(true,false,false)
if(!g1){_29(g70)
_29(g25)}}
function
_11(d,s){var g,y
if(d=='iw'){g74=null}
if(window.location.hostname=='localhost'){return}
g68[g46++]=new
_59(d,s)
if(g46==1&&g65==null){_66()}}
function
_66(){g65=g68[0].p
var i=g68[0].q
for(var o=1;o<g46;o++){g68[o-1]=g68[o]}
g46--
if(g65.substring(0,1)=='i'){g12.innerHTML='\xA0Loading...\xA0\xA0'}
else{g12.innerHTML='\xA0Saving...\xA0\xA0'}
_29(g12)
if(g65=='iw'&&g41<0&&!g43[g51]){i='?d='+_12(false,true)+'&l=y'
if(document.referrer!=''){i+='&f='+encodeURIComponent(document.referrer)}}
g53.open('GET','unify.php'+i,true)
g53.onreadystatechange=_55
g53.send(null)}
function
_55(){if(g53.readyState!=4){return}
_52(g12)
_52(g39)
try{if(g53.status!=200){_32('Failed with status '+g53.status+': '+g53.statusText,1)
_49()
return}}
catch(dummyException){_32('There was a problem whilst communicating with the Discussionator server.')
_49()
return}
var l=g53.responseText
if(l.substring(0,4)=='ERR '){_32(l.substring(4)+' ['+g65+']',1)
_31()}
else
if(g53.responseXML==null&&l.substring(0,2)!='OK'){_32('Unexpected error: '+l+' ['+g65+']',1)
_31()}
else{l=l.substring(2)
switch(g65){case
'iv':_5(l)
if(g1){_29(g63)
_41()}
break
case
'iw':_3(l)
break
case
'iy':if(l=='y'){_47()}
else{g59=0
var d=l.substr(1).split('\t')
g6=d[0]
_52(g39)
_53(g23)
_29(g55)
_58('xRate').style.width='0px'
if(l.charAt(0)=='e'){_52(g71)
_53(g36)
g36.value=d[1]
g36.setAttribute('readOnly','readonly')
g35=false}
else{_53(g71)
_53(g36)
g36.removeAttribute('readOnly')
g36.value=''
g35=true}
_53(g33)
_57()}
break
case
'lf':if(g35&&(l=='N'||l=='R')){_32('Sorry, that name is '+(l=='N'?'already taken':'unavailable')+'.\nPlease choose another.')
_53(g23)
_29(g55)
_53(g71)
_53(g36)
_53(g64)
_53(g33)
_52(g39)}
else{_63(2500)
if(g1){_47()}}
break
default:_32("Internal error - unknown state '"+g65+"'.")}}
_49()}
function
_49(){if(g46<=0){g65=null}
else{_66()}}
function
_31(){if(g65=='iy'){_47()}}
function
_41(){if(g1){g69[++g51]=new
_69('')
g24++}
g60=null
g8=null
g13=0
g26=0
g20=0
document.onmouseup=_14
document.onmousemove=_4
_43()
_11('iw','')
var f=new
Array
for(var g=1;g<=5;g++){f[g]='javascript:_36('+g+')'}
var s=[['li',['a.star1',{href:
f[1],title:
'Very easy'},1],['a.star2',{href:
f[2],title:
'Fairly easy'},2],['a.star3',{href:
f[3],title:
'Average'},3],['a.star4',{href:
f[4],title:
'Quite difficult'},4],['a.star5',{href:
f[5],title:
'Very difficult'},5]]]
_6(g55,-1,['table',['tr',['td',['ul.star',['li.now',{id:
'xRate',style:
'width:0px;background:url(star.gif) left center!important;left:0px!important;margin:0px!important'}]].concat(s)]]])
_29(g70)
_29(g25)
_13(false)}
function
_37(w,q,v){var c
_61(g42)
_61(g28)
_61(g63)
_62()
if(w){_64()
setTimeout('_37(0,'+q+',0)',100)
return}
if(g1&&!v){g57=_12(true,true)}
else
if(q){c=_40('unify')
if(c!=''){_18('unify','',-1)
_5(c)
if(g1){g1=false
g51++
g24++
_65()
g69[g51]=new
_69(c)
_18('unify',c,1461)}
else{alert('Sorry, failed to load previous game from cookie')
_27()}
return}}
g3=_45('i29')
g37=_45('i30')
g38=_45('i31')
g58=_45('i32')
g62=_45('i33')
if(g38>g3){g38=g3
_30('i31',g38)}
if(g58>g37){g58=g37
_30('i32',g58)}
_10(false)
_8()
if(g1){_12(true,true)
var m=g11.href
_64()
_5(g57)
_12(true,true)
_29(g70)
_29(g25)
window.location=m}
else{g51++
if(g24++
>
0){_53(g42)}
_65()
c=_12(true,true)
g69[g51]=new
_69(c)
g43[g51]=true
_18('unify',c,1461)
_13(true)}
_12(false,false)}
function
_39(){_61(g42)
_61(g28)
_61(g63)
g69[g51].b=_12(true,true)
if(g51<g24){_64()
_5(g69[++g51].b)
g1=false
_65()}
else{_37(true,false,false)}
_53(g42)
_13(true)
_62()
if(!g43[g51]){_63(1000)}}
function
_60(){_61(g42)
g69[g51].b=_12(true,true)
_64()
_5(g69[--g51].b)
g1=false
if(g51>1){_53(g42)}
_52(g63)
_29(g28)
_53(g28)
_13(true)
_62()
if(!g43[g51]){_63(1000)}}
function
_65(){if(g51<g24){_52(g63)
_29(g28)
_53(g28)}
else{_52(g28)
_29(g63)
_53(g63)}}
function
_62(){var k=_58('xThis')
if(k){k.className=''
k.id=''}}
function
_63(h){if(g74!=null){clearTimeout(g74)}
g74=setTimeout("_11('"+'iw'+"','')",h)}
function
_68(){if(g1){g57=_12(true,true)}
_64()
g3=16
g37=16
g38=8
g58=8
g62=10
g19=25
_18('cellsize',g19)
_30('i29',g3)
_30('i30',g37)
_30('i31',g38)
_30('i32',g58)
_30('i33',g62)
_30('i34',g19)
_37(false,false,true)}
function
_8(){var p,f,j,u,g,s,y,q
_24()
g40=new
Array
var n=0,b=g38*g58
for(j=g62-1;j>=0;j--){u=_19(b,0)
if(u==null){return}
if(g17[u.y][u.x]==-2){n--}
g17[u.y][u.x]=j
b--
g40[j]=new
_42(j,u.y,u.x)
for(g=0;g<4;g++){p=u.y
f=u.x
switch(g){case
0:p--
break
case
1:p++
break
case
2:f--
break
case
3:f++
break}
if(p>=0&&p<g38&&f>=0&&f<g58){if(g17[p][f]==-1){g17[p][f]=-2
n++}}}}
while(n>0){u=_19(n--,-1)
if(u==null){return}
s=new
Array
y=0
for(g=0;g<4;g++){p=u.y
f=u.x
switch(g){case
0:p--
break
case
1:p++
break
case
2:f--
break
case
3:f++
break}
if(p>=0&&p<g38&&f>=0&&f<g58){j=g17[p][f]
if(j>=0){s[y++]=j}
else
if(j==-1){g17[p][f]=-2
n++}}}
j=s[_16(y)]
p=u.y
f=u.x
g17[p][f]=j
q=g40[j]
if(p<q.w){q.w=p
q.u++}
if(p==q.w+q.u){q.u++}
if(f<q.n){q.n=f
q.m++}
if(f==q.n+q.m){q.m++}}
_35()
_1()
if(g57==null){_12(false,true)}
setTimeout('_12(1,1)',100)}
function
_10(n){var j=((g3*g19)+2),f=((g37*g19)+2)
g45.style.height=j+'px'
g45.style.width=f+'px'
var u=_50(g45)
g56=u.y+2
g2=u.x+2
g61=g56+(g3*g19)
g15=g2+(g37*g19)
g22.style.position='absolute'
g22.style.top='45px'
g22.style.left='0px'
if(n){_52(g70)
_52(g25)
_29(g47)
_29(g39)
_61(g23)
_52(g55)
_29(g71)
_61(g71)
_61(g36)
_61(g64)
if(g62<g30.length){_53(g5)}
else{_61(g5)}
_61(g33)
var b=u.y+Math.floor((j-g47.offsetHeight)/2),p=u.x+Math.floor((f-g47.offsetWidth)/2)
if(b<0){b=0}
if(p<0){p=0}
g47.style.position='absolute'
g47.style.top=b+'px'
g47.style.left=p+'px'
_29(g29)
g29.style.position='absolute'
g29.style.top=g56+'px'
g29.style.left=g2+'px'
g29.style.height=(j-2)+'px'
g29.style.width=(f-2)+'px'}}
function
_24(){var l
g17=new
Array(g3)
for(var r=g3-1;r>=0;r--){g17[r]=new
Array(g37)
for(l=g37-1;l>=0;l--){g17[r][l]=-1}}}
function
_35(){var t,h,l,a,k,x,e,z,r
for(var o=g62-1;o>=0;o--){t=g40[o]
l=t.w
a=t.n
h=new
Array
for(k=0;k<t.u;k++){r=0
for(x=t.m-1;x>=0;x--){r
<<=
1
if(g17[l+k][a+x]==o){r++}}
h[k]=r}
t.b=h
z=_9(o,h,g30[o],l,a)
if(z==null){return}
t.c=z
_22(z)}}
function
_9(t,l,a,x,h){var v,c,z,d,q,o,w,i,k=new
Array
var r=0,e=0
for(var m=0;m<=l.length;m++){z=new
Array
if(m==l.length){d=0}
else{d=l[m]}
q=d
v=0
c=0
o=''
w=1
i=0
while(q>0||(g4&&(v<e||o==a||o=='B'||o=='BL'||o=='TL'))){if(d&w){if(t>=0){g17[x+m][h+v]=t}
o=a}
else
if(!g4){o='Null'}
else
if(r&w){if(d&i){o='TL'}
else
if(r&i){o='B'}
else{o='BL'}}
else
if(d&i){if(r&i){o='R'}
else{o='TR'}}
else
if(o=='B'||o=='BL'||o=='TL'){o='BR'}
else{o='Null'}
z=z.concat([['td.c'+o,{height:
(m<l.length?g19:9)+'px',width:
g19+'px'}]])
v++
if(d&w){c=v}
q
>>=
1
i=w
w
<<=
1}
r=d
e=c
k=k.concat([['tr'].concat(z)])}
return _6(g45,-1,['table',{cellSpacing:
0,cellPadding:
0,border:
0},['tbody'].concat(k)])}
function
_1(){var k,y,h,t,d,r,z,g
for(k=g62-1;k>=0;k--){y=g40[k]
_34(y,y.w,y.n,-1)}
var a=Math.floor((g3-g38)/2),l=Math.floor((g37-g58)/2)
for(k=g62-1;k>=0;k--){y=g40[k]
y.w+=a
y.n+=l
h=y.c
_34(y,y.w,y.n,k)}
for(var e=g62*173;e>=0;e--){k=_16(g62)
y=g40[k]
d=y.w
r=y.n
_34(y,d,r,-1)
for(t=17;t>=0;t--){z=_16((g3-y.u)+1)
g=_16((g37-y.m)+1)
if((z!=d||g!=r)&&_20(y,z,g,1)){y.w=z
y.n=g
break}}
_34(y,y.w,y.n,k)}
for(k=g62-1;k>=0;k--){y=g40[k]
y.o=y.w
y.f=y.n
h=y.c
h.style.top=(g56+(y.w*g19))+'px'
h.style.left=(g2+(y.n*g19))+'px'}}
function
_22(f){f.style.position='absolute'
f.onmousedown=_44}
function
_44(x){var a=_21(x),o=_51(a.y,a.x)
if(o.y<0||o.y>=g3||o.x<0||o.x>=g37){return true}
var h=g17[o.y][o.x]
if(h>=0){g60=new
Array
g8=new
Array
var v=g40[h]
g60[0]=v
g8[0]=g60[0].c
g20=1
var k=_50(g8[0])
g13=a.x-k.x
g26=a.y-k.y
g18=v.w
g54=v.n
g31=v.w+v.u
g34=v.n+v.m
g7=new
Array
if(!x){x=window.event}
var i=(x.which)?x.which:x.keyCode
if(x.ctrlKey){_7(h)
g44=false}
for(var m=0;m<g20;m++){_34(g60[m],g60[m].w,g60[m].n,-1)}}
return false}
function
_7(o){var k,c,x,i,v,w,m,h=new
Array
h[o]=true
do{k=false
for(c=0;c<g3;c++){for(x=0;x<g37;x++){o=g17[c][x]
if(o>=0&&!h[o]){for(i=0;i<4;i++){v=c
w=x
switch(i){case
0:v--
break
case
1:v++
break
case
2:w--
break
case
3:w++
break}
if(v>=0&&v<g3&&w>=0&&w<g37&&h[g17[v][w]]){m=g40[o]
g60.push(m)
g8.push(m.c)
g20++
g18=Math.min(g18,m.w)
g54=Math.min(g54,m.n)
g31=Math.max(g31,m.w+m.u)
g34=Math.max(g34,m.n+m.m)
h[o]=true
k=true
i=4
break}}}}}}
while(k)}
function
_4(m){var k,u,x,pv,f,j,v,w,n,a,o,z,l
if(g8==null){return true}
var t=_21(m),c=t.y-g26,y=t.x-g13,d=g60[0],o=(d.w-g18)*g19,z=(d.n-g54)*g19,i=g56-(c-o)
if(i>0){c+=i}
i=g2-(y-z)
if(i>0){y+=i}
o=(g31-d.w)*g19
i=g61-(c+o)
if(i<0){c+=i}
z=(g34-d.n)*g19
i=g15-(y+z)
if(i<0){y+=i}
var s=new
Array
var g=new
Array
var h=true
for(x=g20-1;x>=0;x--){pv=g60[x]
f=c+((pv.w-d.w)*g19)
j=y+((pv.n-d.n)*g19)
if(!_20(pv,f,j,4)){h=false}
s[x]=f
g[x]=j}
if(h){for(x=g20-1;x>=0;x--){g8[x].style.top=s[x]+'px'
g8[x].style.left=g[x]+'px'}
if(g32!=null){for(x=g32.length-1;x>=0;x--){_28(g32[x],true)}
g32=null}}
else{if(g32==null){g32=new
Array
for(x=g20-1;x>=0;x--){g32[x]=_9(-1,g60[x].b,'Ghost',0,0)
g32[x].style.position='absolute'
g32[x].style.zIndex=5}}
for(x=g20-1;x>=0;x--){g32[x].style.top=s[x]+'px'
g32[x].style.left=g[x]+'px'}
var e=_50(g8[0])
v=Math.floor(((Math.min(e.y,c)-g56)/g19))
n=Math.ceil(((Math.max(e.y,c)-g56)/g19))
w=Math.floor(((Math.min(e.x,y)-g2)/g19))
a=Math.ceil(((Math.max(e.x,y)-g2)/g19))
c-=g56
y-=g2
v=Math.min(Math.max(0,v),g3-g60[0].u)
w=Math.min(Math.max(0,w),g37-g60[0].m)
n=Math.min(Math.max(0,n),g3-g60[0].u)
a=Math.min(Math.max(0,a),g37-g60[0].m)
var b=new
Array
var p=0
for(k=v;k<=n;k++){for(u=w;u<=a;u++){if(!g7[k+'_'+u]){o=Math.abs(c-(k*g19))
z=Math.abs(y-(u*g19))
if(o==0){l=z}
else
if(z==0){l=o}
else{l=Math.sqrt(o*z)}
b[p++]=[l,k,u]}}}
b.sort(_67)
for(var q=0;q<p;q++){c=b[q][1]
y=b[q][2]
for(x=g20-1;x>=0;x--){pv=g60[x]
f=c+(pv.w-d.w)
j=y+(pv.n-d.n)
if(!_20(pv,f,j,1)){break}
s[x]=f
g[x]=j}
if(x<0){for(x=g20-1;x>=0;x--){k=g56+(s[x]*g19)
u=g2+(g[x]*g19)
g8[x].style.top=k+'px'
g8[x].style.left=u+'px'}
break}
g7[c+'_'+y]=true}}
return false}
function
_14(y){var b,n
if(g8!=null){if(g32!=null){for(var c=g32.length-1;c>=0;c--){_28(g32[c],true)}
g32=null}
for(var u=0;u<g20;u++){b=g60[u]
n=g8[u]
var p=_50(n)
p=_26(p.y,p.x)
n.style.top=(g56+(g19*p.y))+'px'
n.style.left=(g2+(g19*p.x))+'px'
b.w=p.y
b.n=p.x
_34(b,p.y,p.x,b.j)}
g8=null
var g=g3,s=0,q=g37,w=0
for(var m=0;m<g62;m++){b=g40[m]
g=Math.min(g,b.w)
s=Math.max(s,b.w+b.u)
q=Math.min(q,b.n)
w=Math.max(w,b.n+b.m)}
var j=_12(true,true),f=g69[g51]
if(!g1){f.b=j}
var d=_25()
if(!(d
in
f.i)){f.v++
f.i[d]=true}
if((s-g)*(w-q)==g38*g58){j=_12(false,true)
if(f.v>=15&&j.length<=2048){f.v=0
_10(true)
_11('iy','?d='+j+'&t=y')}
else{f.v=0
_37(true,false,false)}}
else{_13(true)}}}
function
_13(d){var g,x,j,a,o,f,e,u,h,k=new
Array
var s=new
Array(g37)
for(g=0;g<g37;g++){s[g]=0}
var z=0
for(var r=0;r<g3;r++){j=0
for(g=0;g<g37;g++){if(g17[r][g]>=0){x=s[g]
if(j>0){a=k[j]
if(r>0&&x>0){o=k[x]
o[2]=r
if(j!=x){o[0]=Math.min(a[0],o[0])
o[1]=Math.min(a[1],o[1])
o[2]=Math.max(a[2],o[2])
o[3]=Math.max(a[3],o[3])
for(h=0;h<g37;h++){if(s[h]==j){s[h]=x}}
k[j]=null
j=x}}
else{s[g]=j
a[3]=Math.max(a[3],g)}}
else{if(r>0&&x>0){j=x
k[x][2]=r}
else{j=++z
s[g]=z
k[z]=[r,g,r,g]}}}
else{s[g]=0
j=0}}}
var l=0,b=0,v=0,t=0,y=0,i=0
while(z>0){o=k[z--]
if(o!=null){l++
e=(o[2]-o[0])+1
u=(o[3]-o[1])+1
f=e*u
if(f>t){v=z+1
t=f
y=e
i=u
b=1}
else
if(f==t){b++}}}
if(b==1&&l<g62){if(navigator.userAgent.indexOf('Firefox')<0){_61(g10)}
else{o=k[v]
_53(g10)
g10.style.position='absolute'
g10.style.zIndex=1
g10.style.top=(g56+(o[0]*g19))+'px'
g10.style.left=(g2+(o[1]*g19))+'px'
g10.style.height=(y*g19)+'px'
g10.style.width=(i*g19)+'px'}
if(d){_53(g50)
if(g44){g50.innerHTML='Tip: Hold Ctrl to drag linked shapes'
g44=false}
else{if(y>g38){y='<SPAN CLASS="cErr">'+y+'</SPAN>'}
if(i>g58){i='<SPAN CLASS="cErr">'+i+'</SPAN>'}
g50.innerHTML=y+' &times; '+i}}}
else{_61(g50)}}
function
_25(){var e,z=''
for(var t=0;t<g62;t++){e=g40[t]
z+=' '+e.w+','+e.n}
return z.substr(1)}
function
_12(a,n){var c,k,l,p,x,i,h,q,t,v,c=[5,g3,g37,g38,g58,g62]
if(n){var z=false
for(k=0;k<g62;k++){l=g40[k]
c.push(l.o)
c.push(l.f)
c.push(l.u)
c.push(l.m)
for(p=0;p<l.u;p++){x=l.b[p]
if(l.m<7){c.push(x)}
else{c.push(Math.floor(x/64))
c.push(x%64)}}
if(l.w!=l.o||l.n!=l.f){z=true}}
if(a&&z){for(k=0;k<g62;k++){l=g40[k]
c.push(l.w)
c.push(l.n)}}}
var r='',o=63,m=0
for(v=0;v<c.length;v++){x=c[v]
r+=_23(x)
i=(x%64)<<m
o^=i%64+Math.floor(i/64)
m=(m+1)%6}
while(r.length%6>0){r+='0'}
var e=''
for(v=0;v<r.length;v+=6){x=0
t=1
for(h=0;h<6;h++){if(r.charAt(v+h)=='1'){x+=t}
t
<<=
1}
e+=g52.charAt(x)}
if(o<0||o>63){_61(g27)
_61(g11)
_32('Unable to save ('+o+')')
return}
e+=g52.charAt(o)
var w=g48+'?'+e
if(n){if(a){g11.href=w
if(w==g27.href){_61(g11)}
else{_53(g11)}
_18('unify',e,1461)}
else{g27.href=w}}
else{_58('i27').href=w}
return e}
function
_5(b){var a,p,o,v,x,w,r,h,m,j,e
if(!b){alert('Internal error - missing state data.')
_27()
return}
if(!b.match(/^[A-Za-z0-9._]+$/)){alert('Sorry, the saved game state is invalid.')
_27()
return}
var i=''
for(h=0;h<b.length-1;h++){a=g52.indexOf(b.charAt(h))
j=1
for(m=0;m<6;m++){i+=(a&j?'1':'0')
j
<<=
1}}
var n=_2(i),z=63,f=0
for(h=0;h<n.length;h++){p=(n[h]%64)<<f
z^=p%64+Math.floor(p/64)
f=(f+1)%6}
if(b.charAt(b.length-1)!=g52.charAt(z)){alert('Sorry, the saved game state is corrupt.')
_27()
return}
g40=new
Array
var k=0,t=0,c=0,u=0,q=true
for(var h=0;h<n.length;h++){a=n[h]
if(h==0){o=a}
else
if(h<=o){switch(h){case
1:g3=a
_30('i29',g3)
break
case
2:g37=a
_30('i30',g37)
_24()
_10(false)
break
case
3:g38=a
_30('i31',g38)
break
case
4:g58=a
_30('i32',g58)
break
case
5:g62=a
_30('i33',g62)
break}}
else
if(k<g62){g1=true
if(t<4){switch(++t){case
1:v=a
break
case
2:x=a
break
case
3:w=a
break
case
4:e=new
_42(k,v,x)
g40[k]=e
e.u=w
e.m=a
e.b=new
Array
c=0
q=true}}
else{if(e.m<7){e.b[c++]=a}
else{if(q){u=a}
else{e.b[c++]=(u*64)+a}
q=!q}
if(c>=e.u){r=_9(k,e.b,g30[k],v,x)
if(r==null){return}
r.style.top=(g56+(v*g19))+'px'
r.style.left=(g2+(x*g19))+'px'
_22(r)
e.c=r
k++
t=0
q=true}}}
else{p=k-g62
if(p==0){_24()
if(g57==null){_12(false,true)}}
e=g40[p]
if(q){v=a
e.w=v}
else{e.n=a
_34(e,v,a,p)
r=e.c
r.style.top=(g56+(v*g19))+'px'
r.style.left=(g2+(a*g19))+'px'
k++}
q=!q}}
if(k==0){_37(false,false,false)}
else
if(k==g62&&g57==null){_12(false,true)}
else
if(k<g62){alert('Sorry, the saved game state appears to be truncated.')
_27()
return}
_12(true,true)
_12(false,false)}
function
_56(){_61(g45)
_61(g70)
_61(g25)
_61(g22)
_29(g9)
g9.scrollTop=0
var r=_54()
if(r>100){g9.style.height=(r-50)+'px'}
else{g9.style.height='500px'}
window.scrollTo(0,0)}
function
_48(){_52(g9)
_53(g45)
_53(g70)
_53(g25)
_53(g22)}
function
_32(p){_29(g49)
while(g49.firstChild!=null){g49.removeChild(g49.firstChild)}
var j=p.split("\n")
for(var q=0;q<j.length;q++){if(q>0){g49.appendChild(document.createElement('BR'))}
var n=document.createTextNode(j[q])
g49.appendChild(n)}
setTimeout("_52(g49)",5000)}
function
_27(){window.location=g48}
function
_45(c){var w=_58(c)
return parseInt(w.options[w.selectedIndex].text,10)}
function
_30(w,c){try{_58(w).value=c}
catch(m){;}}
function
_46(){var q,p
g19=_45('i34')
_18('cellsize',g19)
_64()
_10(false)
for(var n=0;n<g62;n++){q=g40[n]
p=_9(n,q.b,g30[n],q.w,q.n)
if(p==null){return}
p.style.top=(g56+(q.w*g19))+'px'
p.style.left=(g2+(q.n*g19))+'px'
_22(p)
q.c=p}}
function
_20(h,w,q,x){var u,m,i,v,o,n,j,k,p
for(var c=h.b.length-1;c>=0;c--){u=0
m=h.b[c]
while(m>0){if(m%2){if(x==1){v=w+c
i=q+u}
else{v=w+(c*g19)
i=q+(u*g19)}
for(o=0;o<x;o++){switch(o){case
0:p=v
k=i
break
case
1:p=v+(g19-1)
k=i
break
case
2:p=v
k=i+(g19-1)
break
case
3:p=v+(g19-1)
k=i+(g19-1)
break}
if(x==1){j=g17[p][k]}
else{n=_51(p,k)
j=g17[n.y][n.x]}
if(j>=0&&j!=h.j){return false}}}
u++
m
>>=
1}}
return true}
function
_34(b,f,y,s){var g,d,u
for(g=b.b.length-1;g>=0;g--){d=0
u=b.b[g]
while(u>0){if(u%2){g17[f+g][y+d]=s}
d++
u
>>=
1}}}
function
_64(){for(var x=0;x<g62;x++){if(_28(g40[x].c,true)){break}}}
function
_67(m,v){return m[0]-v[0]}
function
_50(u){var j=u.offsetTop,b=u.offsetLeft
while(u.offsetParent){u=u.offsetParent
j+=u.offsetTop
b+=u.offsetLeft}
return {
x:b,y:j}}
function
_51(s,f){return {
x:
Math.floor((f-g2)/g19),y:
Math.floor((s-g56)/g19)}}
function
_26(a,k){return {
x:
Math.round((k-g2)/g19),y:
Math.round((a-g56)/g19)}}
function
_21(b){if(b==null){b=window.event}
if(b.pageX||b.pageY){return {
x:b.pageX,y:b.pageY}}
return {
x:(b.clientX+document.body.scrollLeft)-document.body.clientLeft,y:(b.clientY+document.body.scrollTop)-document.body.clientTop}}
function
_54(){if(window.innerHeight!=null){return window.innerHeight}
if(document.documentElement&&document.documentElement.clientHeight){return document.documentElement.clientHeight}
if(document.body!=null){document.body.clientHeight}
return null}
function
_6(a,r){var d,y,z,e,g,t,l
for(var s=2;s<arguments.length;s++){d=arguments[s]
if(d==undefined){_32('Error - undefined DOM tree.')
return null}
if(d.constructor==String){y=document.createTextNode(d)}
else{z=null
for(l=0;l<d.length;l++){if(l==0&&d[l].constructor==String){e=d[l].match(/^([a-z][a-z0-9]*)\.([a-z][a-z0-9 ]+)$/i)
if(e){y=document.createElement(e[1])
y.className=e[2]
continue}
e=d[l].match(/^([a-z][a-z0-9]*)$/i)
if(e){if(r<0||e[1]!='tr'){y=document.createElement(e[1])}
else{y=a.insertRow(r++)}
continue}
_32('Malformed DOM tree ('+d[l]+').')
return null}
if(d[l]==undefined){t='#'+l
while(--l>=0){if(d[l].constructor==String){t=d[l]+', '+t}
else
if(d[l].constructor==Array&&d[l][0].constructor==String){t='['+d[l][0]+'], '+t}
else
if(d[l].constructor==Object){t='}, '+t
for(g
in
d[l]){t=g+':'+d[l][g]+' '+t}
t='{'+t}
else{t='?, '+t}}
_32('Undefined value in DOM tree\n['+t+']')
return null}
if(d[l].constructor==String||d[l].constructor==Array){z=_6(y,-1,d[l])
if(z==null){return null}}
else
if(d[l].constructor==Number){z=_6(y,-1,d[l].toString())
if(z==null){return null}}
else
if(d[l].constructor==Object){for(g
in
d[l]){if(typeof(d[l][g])=='function'){y[g]=d[l][g]}
else{if(g=='checked'){if(d[l][g]){y.setAttribute('checked','checked')}
else{y.removeAttribute('checked')}}
else{y.setAttribute(g,d[l][g])}}}}
else{_32('Bad type in DOM tree: '+d[l].constructor)
return null}}}
if(a&&r<0){a.appendChild(y)}}
return y}
function
_28(o,h){try{if(o.hasChildNodes()){for(var i=o.childNodes.length-1;i>=0;i--){_28(o.childNodes[i],false)
o.removeChild(o.childNodes[i])}}
if(h){o.parentNode.removeChild(o)}}
catch(x){alert('Failed to destroy shape... sorry about this.  :-(')
_27()
return true}
return false}
function
_43(){var r,e,t=_50(g45)
if(g56!=t.y+2||g2!=t.x+2){g56=t.y+2
g2=t.x+2
g61=g56+(g3*g19)
g15=g2+(g37*g19)
for(var z=0;z<g62;z++){r=g40[z]
e=r.c
e.style.top=(g56+(r.w*g19))+'px'
e.style.left=(g2+(r.n*g19))+'px'}}
if(g22.style.position=='absolute'){if(g22.offsetWidth>g2){g22.style.position='relative'}}
setTimeout('_43()',500)}
function
_19(t,r){var a,l=_16(t),z=0
for(var e=0;e<g38;e++){for(a=0;a<g58;a++){if(g17[e][a]<r){if(z++
==
l){return {
x:
a,y:
e}}}}}
alert("Fatal error - didn't find randomly selected cell ("+r+' - '+l+'/'+t+')')
return null}
function
_61(a){a.style.visibility='hidden'}
function
_53(y){y.style.visibility='visible'}
function
_52(g){g.style.display='none'}
function
_29(v){v.style.display=''}
function
_58(e){return document.getElementById(e)}
function
_18(s,d,g){var y
y=new
Date()
y.setTime(y.getTime()+(g*86400000))
document.cookie=s+'='+d+'; expires='+y.toGMTString()+'; path=/'}
function
_40(u){var j,b,p
j=document.cookie.split(';')
for(p=0;p<j.length;p++){b=j[p]
while(b.charAt(0)==' '){b=b.substring(1,b.length)}
if(b.indexOf(u+'=')==0){return b.substring(u.length+1,
b.length).replace(/\+/g,' ')
}}
return ''}
function
_23(g){var s,y=''
for(s=Math.floor(g/g66);s>=1;s--){y+='0'}
y+='1'
var d=1
for(s=g67;s>=1;s--){y+=(g&d?'1':'0')
d
<<=
1}
return y}
function
_2(m){var v,x,w,q,o=new
Array
var i=m.length,c=0
while(c<i){v=0
x=0
while(m.charAt(c++)=='0'){x++
if(c==i){return o}}
w=1
for(q=g67;q>=1;q--){if(m.charAt(c++)=='1'){v+=w}
w
<<=
1}
v+=x*g66
o.push(v)}
return o}
function
_16(h){return Math.floor(Math.random()*h)}
function
_38(){for(var n
in
window){if(n.charAt(0)=='v'&&n.charAt(1)>='A'&&n.charAt(1)<='Z'&&!(n
in
g73)){g73[n]=true
alert('Variable '+n+' not declared.')}}
setTimeout('_38()',2500)}
function
_59(t,z){this.p=t
this.q=z}
function
_69(c){this.b=c
this.i=new
Array
this.i[_25()]=true
this.v=0}
function
_42(l,d,y){this.j=l
this.b=null
this.c=null
this.o=d
this.f=y
this.w=d
this.n=y
this.u=1
this.m=1}
g1=false
g57=null
g41=-1
g44=true
if(window.location.search.match('\\?id=[1-9][0-9]*$')){
g41=window.location.search.replace(/.*\?id=/,'')
_11('iv','?i='+g41)}
else
if(window.location.search.match('\\?')){
_5(window.location.search.replace(/.*\?/,''))
if(g1){_29(g63)
_41()}}
else{_37(false,true,false)
_41()}
