-
Notifications
You must be signed in to change notification settings - Fork 3
/
gs.js
151 lines (151 loc) · 67.6 KB
/
gs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
var m,aa;function ba(a){for(var b="",c=0;c<a.length;c++)switch(a.charCodeAt(c)){case 13:b+="<br />";break;case 63368:b+="à";break;case 63374:b+="é";break;default:b+=a.charAt(c)}return b}function ca(a,b){var c={top:0,left:0,width:0,height:0},d;if(d=ea(2*a))if(c.width=d.width,c.height=d.height,fa(c,b,c)){a:{for(var e=c.top;e<c.top+c.height;e++)for(var g=(e>>1)*d.r,k,h=c.left;h<c.left+c.width;h++)if(k=d.data[g+(h>>2)],ga&&(k=ga[k]),k=k>>(h&2?0:4)&15){c=!0;break a}c=!1}return c}return!1}
function ha(a){var b={top:0,left:0,width:0,height:0},c=ia(a),d=0;c&&c.a&&(d=ja(c.a.children,a));if(d){d--;var e=c.a.children[d];if(0==e.width||0==e.height)a=ka(a,c,!0),c.a.children[d].top=a.top,c.a.children[d].left=a.left,c.a.children[d].width=a.width,c.a.children[d].height=a.height;b.top=c.a.children[d].top;b.left=c.a.children[d].left;b.width=c.a.children[d].width;b.height=c.a.children[d].height}else(c=ea(2*a))?(b.top=2*p(a,2),b.left=2*p(a,1),b.width=c.width,b.height=c.height):(b.top=0,b.left=0,
b.width=0,b.height=0);return b}function la(a){a=ea(2*a);var b=a.width,c=a.height,d=$(document.createElement("canvas"));d.addClass("proxy");d.attr("width",b);d.attr("height",c);desktop.append(d);a.k(d,0,0);return d}var ma=!1;function na(a){a=oa(a);var b=a.left,c=a.right-a.left;ma||(b*=2,c*=2);return pa(a.pa,b,2*a.top,c,2*(a.bottom-a.top))};function qa(a){"3"==a[0]&&"/"==a[1]&&(a=a.substring(2));return ra(a.toLowerCase(),2)}var r=void 0;
function ra(a,b){r.seek(512*b+2,r.set);var c=t(r),d=v(r);240!=(d&240)&&224!=(d&240)&&fatal("Corrupt directory");r.seek(30,r.n);var e=v(r),g=v(r),k=v(r),h=1,f=0,d=a.indexOf("/"),l="";0<d&&(l=a.substring(d+1),a=a.substring(0,d));for(;f<k;){r.seek(512*b+e*h+4,r.set);d=v(r);if(0!=d){if(sa(r,d&15).toLowerCase()==a){if(208==(d&240))return r.seek(16-(d&15),r.n),c=t(r),ra(l,c);r.seek(512*b+e*h+21,r.set);c=t(r);r.seek(2,r.n);e=ta(r)&16777215;l=c;c=e;e="";switch(d&240){case 16:e=ua(l,c);break;case 32:e=va(l,
c);break;case 48:d=l;l=c;c="";for(e=0;0<l;){r.seek(512*d+e,r.set);k=v(r);r.seek(512*d+e+256,r.set);k|=v(r)<<8;g=l;131072<g&&(g=131072);if(k)c+=va(k,g);else for(k=0;k<g;k++)c+=String.fromCharCode(0);l-=g;e++}e=c}return new wa(e)}f++}h++;h==g&&(h=0,b=c,r.seek(512*b+2,r.set),c=t(r))}return!1}function ua(a,b){r.seek(512*a,r.set);return sa(r,b)}
function va(a,b){for(var c="",d=0;0<b;){r.seek(512*a+d,r.set);var e=v(r);r.seek(512*a+d+256,r.set);var e=e|v(r)<<8,g=b;512<g&&(g=512);if(e)c+=ua(e,g);else for(e=0;e<g;e++)c+=String.fromCharCode(0);b-=g;d++}return c};var w,ga,xa=!0;function ya(a,b,c){this.width=a>>1;this.height=2*b;this.r=c;this.H=a;this.J=b;this.data=Array(b*c)}
ya.prototype.k=function(a,b,c){if(0!=this.width&&0!=this.height){var d=a.get(0).getContext("2d"),e=0,g=0;0>b&&(e=-b,b=0);0>c&&(g=-c,c=0);var k=this.width,h=this.height;k+b>=a.width()&&(k=a.width()-b);h+c>=a.height()&&(h=a.height()-c);if(0!=k&&0!=h){a=d.getImageData(b,c,k,h);for(var f=g;f<h;f++)for(var l=(f>>1)*this.r,s=(f-g)*a.width*4,n,q=e;q<k;q++)n=this.data[l+(q>>2)],ga&&(n=ga[n]),(n=3*(n>>(q&2?0:4)&15))?(a.data[s++]=w[n++],a.data[s++]=w[n++],a.data[s++]=w[n++],a.data[s++]=255):s+=4;d.putImageData(a,
b,c)}}};ya.prototype.Y=function(a,b){var c=this.data[(b>>1)*this.r+(a>>2)];ga&&(c=ga[c]);return 0!=(c>>(a&2?0:4)&15)};function za(a,b,c,d){this.width=a;this.height=b;this.r=c;this.Z=d;this.data=Array(b*c)}
za.prototype.k=function(a,b,c){if(0!=this.width&&0!=this.height){var d=a.get(0).getContext("2d"),e=this.width,g=2*this.height,k=0,h=0;0>b&&(k=-b,b=0);0>c&&(h=-c,c=0);e+b>=a.width()&&(e=a.width()-b);g+c>=a.height()&&(g=a.height()-c);if(0!=e&&0!=g){a=d.getImageData(b,c,e,g);for(var f=h;f<g;f++)for(var l=(f>>1)*this.r,s=(f-h)*a.width*4,n,q=k;q<e;q++)n=this.data[l+(q>>2)],n=3*(n>>6-2*(q&3)&3),a.data[s++]=this.Z[n++],a.data[s++]=this.Z[n++],a.data[s++]=this.Z[n++],a.data[s++]=255;d.putImageData(a,b,c)}}};
function Aa(){var a=qa(Ba(8)),b=oa(6),c=b.right-b.left,b=b.bottom-b.top;a.seek(8,a.set);for(var d=[],e=0;4>e;e++)x(a),d.push(x(a)&255),d.push(x(a)&255),d.push(x(a)&255);for(var g=c+7>>2,c=new za(c,b,g,d),e=0;e<g*b;e++)c.data[e]=v(a);return c};function Ba(a){y.seek(368+32*a,y.set);a=v(y);return sa(y,a)}function Ca(){y.seek(496,y.set);var a=v(y);return sa(y,a)}function oa(a){y.seek(10*a);a={};a.top=t(y);a.left=t(y);a.bottom=t(y);a.right=t(y);a.pa=t(y);return a}function Da(){y.seek(1464,y.set);var a=v(y);return ba(sa(y,a))}function Ea(){y.seek(1008,y.set);var a=v(y);return ba(sa(y,a))}var y;function Fa(a){for(a={v:a,j:0};Ga(a););}
function Ga(a){var b=!1;if("."==a.v[a.j]||"."==a.v[a.j+1])return!1;" "==a.v[a.j++]&&(b=!0);a.j++;for(var c="";"\\"!=a.v[a.j];)c+=a.v[a.j++];a.j++;for(var d="",e=!0,g=0,k=!1;"\r"!=a.v[a.j];)switch(a.v[a.j++]){case "*":d=a.v[a.j++];a.j++;break;case "B":c="<b>"+c+"</b>";break;case "C":a.j++;break;case "D":e=!1;break;case "H":g=a.v.charCodeAt(a.j++)&255;g|=(a.v.charCodeAt(a.j++)&255)<<8;break;case "I":c="<i>"+c+"</i>";break;case "N":break;case "U":break;case "V":k=!0;break;case "X":break;default:fatal("Unknown menu control code")}a.j++;
if(b)return Ha(c,g,d,e),k&&Ha("-",0,"",!1),!0;z={id:g};z.b=$(document.createElement("div"));"@"==c?z.b.addClass("apple"):z.b.html(c);z.b.data("refCon",z);z.b.mousedown(function(a){if(A)return!1;Ia(a);return!1});z.q=$(document.createElement("table"));z.q.addClass("menu");z.body=$(document.createElement("tbody"));z.q.append(z.body);z.items=[];c.match(/(Edit)|(Font)/i)||Ja.append(z.b);B.push(z);return!0};var Ka=2,La=24,Ma=20,Na=4,Oa=32,Qa=24,Ra=34,Sa=32,Ta=2,Ua,Va=["\u0001J\u0001\x00All rights reserved.\r\u0001J\u0001\x00Programming by Sean Kasun\r\u0001J\u0001\x00Original Development Team: Todd Squires, Craig Erickson, Kurt Nelson, Steven Hays, Terry Schulenburg, Darin Adler, Jay Zipnick, Waldemar Horwat, Mark Waterman, Dave Marsh, Karl Roelofs","\u0001J\u0001\x00All rights reserved.\r\u0001J\u0001\x00Programming by Sean Kasun\r\u0001J\u0001\x00Original Development Team: Jay Zipnick, Billy Wolfe, Terry Schulenburg, Mark Waterman, Darin Adler, Dave Marsh, Todd Squires, Karl Roelofs, Tod Zipnick, Steven Hays, Waldemar Horwat, Craig Erickson",
"\u0001J\u0001\x00^0 is a registered trademark of Zojoi LLC. All rights reserved.\r\u0001J\u0001\x00Programming by Sean Kasun\r\u0001J\u0001\x00Original Development Team: Dave Marsh, Karl Roelofs, Terry Schulenburg, Dave Feldman, Jay Zipnick, Todd Squires, Darin Adler, Tod Zipnick, Waldemar Horwat, Steven Hays","\u0001J\u0001\x00All rights reserved.\r\u0001J\u0001\x00Programming by Sean Kasun\r\u0001J\u0001\x00Original Development Team: Darin Adler, Mitch Adler, Fred Allen, Brian Baker, Ed Dluzen, David Feldman, Steven Hays, Jay Zipnick, Julia Ulano, David Marsh, Karl Roelofs, Paul Snively, Todd Squires, Tod Zipnick, Waldemar Horwat, Michael Manning"];
function Wa(){var a=Xa(168,41,310,237);a.add(C([96,205,118,20],1,10,["OK"]));var b;b="\u0001J\u0001\x00^0\r\u0001J\u0001\x00© 2014 Zojoi LLC.\r"+Va[RELEASE-1];a.add(C([10,14,290,160],2,32790,[b]));a.param([Ea()]);return a}function Ya(){var a=Xa(80,80,480,200);a.add(C([214,150,50,20],1,10,["OK"]));a.add(C([100,80,280,22],2,24,[0,0,100]));var b=C([20,30,440,30],3,15,["Sound Volume"]);b.b.css("text-align","center");a.add(b);return a}
function Za(a){var b=Xa(92,146,456,108);b.add(C([24,68,120,22],1,10,["YES"]));b.add(C([168,68,120,22],3,10,["NO"]));b.add(C([312,68,120,22],2,10,["CANCEL"]));b.add(C([100,10,340,38],4,32790,["Save changes before ^0 "]));switch(a){case 0:b.param(["starting a new game?"]);break;case 1:b.param(["opening another game?"]);break;case 2:b.param(["quitting?"])}return b}
function $a(){var a=Xa(50,70,520,228);a.add(C([12,8,298,30],4,22,["Load which game:"]));a.add(C([12,50,298,164],3,23,[]));a.add(C([320,158,190,24],1,10,["Open"]));a.add(C([320,194,190,24],2,10,["Cancel"]));return a}function ab(){var a=Xa(50,70,540,256);a.add(C([22,50,298,124],4,23,[]));a.add(C([22,182,298,30],5,22,["Save game as:"]));a.add(C([22,200,290,36],3,17,[""]));a.add(C([330,186,200,22],1,10,["Save"]));a.add(C([330,222,200,22],2,10,["Cancel"]));return a}
function bb(){for(var a=D.left,b=D.top,c=0;c<D.S;c++)a+=D.xa,b+=D.ya,388<=b&&(b=D.top),628<=a&&(a=D.left);D.S++;a=pa(D.pa,a,b,D.width,D.height);a.kind=14;return a}function cb(){var a=Xa(10,352,620,40);a.add(C([10,8,60,24],1,10,["Print"]));a.add(C([544,8,64,24],2,10,["Quit"]));a.add(C([84,10,450,26],3,32790,["\u0001J\u0001\x00^0"]));a.param([Da()]);return a}function db(){var a,b,c;y.seek(70,y.set);a=t(y);b=t(y);c=t(y);a=C([b,2*a-20,c,20],5,17,[""]);a.b.css("text-align","center");return a}
function eb(){var a=Xa(140,136,430,128);a.add(C([14,56,122,26],1,10,["YES"]));a.add(C([260,56,152,26],3,10,["NO"]));a.add(C([14,92,398,26],4,10,["Yes, I'll use a saved game."]));a.add(C([14,10,398,38],2,15,["You have lost ... Would you\nlike to have another try?"]));return a}function fb(){var a=Xa(20,92,600,140);a.add(C([10,99,50,20],1,10,["OK"]));a.add(C([96,99,120,20],2,10,["CANCEL"]));a.add(C([10,10,580,36],4,22,["^0"]));a.add(C([10,56,580,28],3,17,[""]));return a}
function pa(a,b,c,d,e){var g="dbox",k=!1,h=!1;a&32768&&(g="document");a&16&&(g="info");a&8192&&(g="alert");a&4096&&(k=!0);a&2048&&(h=!0);a=new gb(g,a&16384,a&256,k,h,b,c,d,e);a.hide();hb(a);return a};function ib(a){var b=jb(4,a);a=new wa(b);var c=void 0;switch(b.charCodeAt(7)){case 0:for(var c=0,d=x(a),b=0;b<d;b++)x(a),c+=x(a),x(a),x(a);a.seek(8,a.set);for(var b=x(a),c=new kb(c,b),e=0,b=0;b<d;b++){a.seek(2+8*b,a.set);var g=x(a),k=x(a);a.seek(g,a.set);for(g=0;g<k;g++)c.data[e++]=v(a)}break;case 2:e=0;b=x(a);for(c=0;c<b;c++)x(a),e+=2*x(a),x(a),x(a);a.seek(8,a.set);c=x(a);e=new kb(e,c);for(c=k=0;c<b;c++){a.seek(2+8*c,a.set);var h=x(a),g=2*x(a);a.seek(h,a.set);for(h=0;h<g;h++)d=h&1?d>>4:v(a),e.data[k++]=
lb[d&15]}c=e}if(void 0==c)return 0;mb&&!nb&&c.play();return c.time()}var lb=[127,126,124,120,112,96,64,1,128,129,131,135,143,159,191,255];function wa(a){this.set=0;this.n=1;this.end=2;this.data=a;this.length=a.length;this.m=this.f=0}function v(a){return a.data.charCodeAt(a.f++)&255}function x(a){var b=(a.data.charCodeAt(a.f++)&255)<<8;return b|=a.data.charCodeAt(a.f++)&255}function t(a){var b=a.data.charCodeAt(a.f++)&255;return b|=(a.data.charCodeAt(a.f++)&255)<<8}function ob(a){var b=(a.data.charCodeAt(a.f++)&255)<<16,b=b|(a.data.charCodeAt(a.f++)&255)<<8;return b|=a.data.charCodeAt(a.f++)&255}
function pb(a){var b=(a.data.charCodeAt(a.f++)&255)<<24,b=b|(a.data.charCodeAt(a.f++)&255)<<16,b=b|(a.data.charCodeAt(a.f++)&255)<<8;return b|=a.data.charCodeAt(a.f++)&255}function ta(a){var b=a.data.charCodeAt(a.f++)&255,b=b|(a.data.charCodeAt(a.f++)&255)<<8,b=b|(a.data.charCodeAt(a.f++)&255)<<16;return b|=(a.data.charCodeAt(a.f++)&255)<<24}
function qb(a){var b=(a.data.charCodeAt(a.f)&255)<<24,b=b|(a.data.charCodeAt(a.f+1)&255)<<16,b=b|(a.data.charCodeAt(a.f+2)&255)<<8;return b|=a.data.charCodeAt(a.f+3)&255}wa.prototype.seek=function(a,b){switch(b){case this.n:a+=this.f;break;case this.end:a+=this.length}this.f=a};function sa(a,b){var c=a.f;a.f+=b;return a.data.substring(c,a.f)}wa.prototype.g=function(a){var b=qb(this),b=b>>>32-this.m-a;this.m+=a;this.m&16&&(this.m&=15,this.f+=2);return b&(1<<a)-1};function rb(){if(void 0!=r){E=0;y=qa("3/RESOURCE.DAT");aa.remove();delete aa;var a=Ba(6),b=qa(a);b.seek(8,b.set);w=[];for(var c=0;16>c;c++)x(b),w.push(x(b)&255),w.push(x(b)&255),w.push(x(b)&255);a=new ya(1280,200,160);for(c=0;32E3>c;c++)a.data[c]=v(b);b=new gb("plainDBox",!1,!1,!1,!1,0,0,640,400);b.hide();hb(b);sb=b;sb.show();tb(sb.port,0);a.k(sb.port,0,0);a=[3,1,2,0,5];for(b=0;5>b;b++){var d=Ba(a[b]),c=b,d=qa(d),e={Ba:0,ga:!1};d.seek(0,d.set);var g=d.length,k=pb(d),h=void 0;if(k&2147483648){k&=2147483647;
e.ga=!0;d.seek(k,d.set);e.O=x(d);for(var g=Array(16),h=Array(16),f=0;15>f;f++)g[f]=x(d);for(f=0;16>f;f++)h[f]=v(d);e.la=Array(e.O);e.ha=Array(e.O);for(var l=0,s=void 0,f=0;f<e.O;f++){if(0==(f&63)){d.seek(k+6*(f>>6)+48,d.set);var n=ob(d),s=ob(d),l=n&7;d.seek(k+(n>>3),d.set)}e.la[f]=s;n=pb(d)>>>16-l&65535;d.seek(-4,d.n);var q;for(q=0;16>q&&!(g[q]>n);q++);n=h[q];l+=n&15;l&16&&(l&=15,d.seek(2,d.n));n>>=4;q=0;n&&(q=qb(d),n--,q=0==n?0:q>>>32-n-l,q&=(1<<n)-1,q|=1<<n,l+=n,l&16&&(l&=15,d.seek(2,d.n)),s+=q);
e.ha[f]=q}h=k-4}else h=g-=4,e.ua=k,e.O=g/k|0;d.seek(4,d.set);e.data=sa(d,h);ub[c]=e}y.seek(76,y.set);a=t(y);b=t(y);t(y);c=t(y);t(y);t(y);d=[];for(h=0;24>h;h++)d.push(v(y));e=[];for(h=0;64>h;h++)e.push(v(y));k=[];for(h=0;64>h;h++)k.push(t(y));g=[];for(h=0;64>h;h++)g.push(v(y));vb=a;wb=b;xb=c;yb=e;zb=k;Ab=g;Bb=d;D=oa(5);D.top*=2;D.left*=2;D.width=2*D.right-D.left;D.height=2*D.bottom-D.top;D.ya=20;D.xa=20;D.S=0;Cb=[];Db();F=[];G=[];Eb=[];Fb=[];H=Array(2*vb);if(1676!=y.length){a={};y.seek(1676,y.set);
a.length=t(y);a.ja=[];y.seek(1680,y.set);for(b=0;b<a.length;b++)a.ja.push(t(y));a.ia=[];y.seek(1868,y.set);for(b=0;b<a.length;b++)a.ia.push(v(y));a.oa=[];y.seek(1964,y.set);for(b=0;b<a.length;b++)a.oa.push(v(y))}else a=void 0;void 0!=a&&(Gb=a,Hb=!1);a=[];y.seek(720,y.set);for(b=0;16>b;b++)a.push(t(y));w=[];for(b=0;16>b;b++)c=a[b]>>4&15,d=a[b]&15,w.push(17*(a[b]>>8&15)),w.push(17*c),w.push(17*d);a=[];y.seek(752,y.set);for(b=0;256>b;b++)a.push(v(y));ga=a;y.seek(1092,y.set);Ua=t(y);Ib=na(3);Ib.kind=
9;Ib.addClass("commands");a=[{name:"3/SHADOWGATE",start:49390,L:-3272},{name:"3/DEJAVU",start:49390,L:-3272},{name:"3/DEJAVUII",start:4014,L:66},{name:"3/UNINVITED",start:49390,L:-3272}];for(b=0;b<a.length;b++)if(c=qa(a[b].name)){for(d=0;9>d;d++)c.seek(a[b].start+11*d,c.set),e=2*t(c),k=2*t(c),g=2*t(c)-e,h=2*t(c)-k,f=v(c),l=t(c),l=l&15|l&61440,c.seek(a[b].start+115+4*d,c.set),q=t(c),c.seek(q+a[b].L),s=t(c),n=sa(c,s*g),c.seek(a[b].start+151+4*d,c.set),q=t(c),c.seek(q+a[b].L),t(c),q=sa(c,s*g),Ib.add(C([k,
e,h,g],f,l,[s,n,q]));break}I=na(0);I.kind=10;Jb=na(1);Jb.kind=11;J=$(document.createElement("div"));J.addClass("textEdit");a=Jb;b=J;c=a.port.attr("width");d=a.port.attr("height");a.port.remove();b.css("top","0px");b.css("left","0px");b.css("width",c+"px");b.css("height",d+"px");a.port=b;a.e.append(b);Kb=na(4);Kb.kind=12;Kb.a={id:0,x:0,y:0,children:[{id:1,top:0,left:0,width:0,height:0}]};K=na(2);Lb(K,"Exits");K.kind=13;K.addClass("exits");Ja=$(document.createElement("div"));Ja.addClass("menubar");
a=[">L File \\H\u0002\x00\r LNew\\V*NnH\x00\u0081\r LOpen...\\*OoH\u0002\u0081\r LSave\\*SsH\u0003\u0081\r LSave As...\\VH\u0004\u0081\r LQuit\\*QqH\u0006\u0081\r.",">L Edit \\H\u0003\x00\r LUndo\\DV*ZzH\x00\u0082\r LCut\\D*XxH\u0002\u0082\r LCopy\\D*CcH\u0003\u0082\r LPaste\\DV*VvH\u0004\u0082\r LClear\\DH\u0005\u0082\r.",">L Special \\H\u0004\x00\r LClean Up\\DH\x00\u0083\r LMess Up\\DH\u0001\u0083\r."];y.seek(1024);b=sa(y,48);Fa(b);for(b=0;b<a.length;b++)Fa(a[b]);z=B[0];Ha("More Games...",2305,
"",!0);z=B[0];Ha("Adjust Volume...",2304,"",!0);z=B[0];Ha("Help",2307,"",!0);var u;try{u="localStorage"in window&&null!==window.localStorage}catch(V){u=!1}u?(Mb(33026),Mb(33027),Mb(33028)):(Nb(33026),Nb(33027),Nb(33028));mb?Mb(2304):Nb(2304);Lb(Jb,"Untitled");if(1<gameparts.length)Ob=gameparts[1],u=window.JSON.parse(window.localStorage.getItem(Ob).toString()),Pb=u.gamedata,Qb=u.globals,J.html(u.text),Lb(Jb,Ob);else{u=qa(Ca());Pb=Array(xb);Qb=Array(wb);for(a=0;a<xb;a++)for(Pb[a]=Array(vb),b=0;b<vb;b++)Pb[a][b]=
x(u);for(a=0;a<wb;a++)Qb[a]=x(u)}Rb();""==Ob&&(L=!0,M=1,N.push(p(1,0)));setTimeout(Sb,500)}else setTimeout(rb,10)}function Rb(){for(var a,b,c=0;c<2*vb;c++)H[c]=0;for(c=vb-1;c;c--)a=Pb[0][c],(b=H[2*a])&&(H[2*c+1]=b),H[2*a]=c}function Tb(){for(var a=[],b=0;b<O.length;b++)10!=O[b].kind&&14!=O[b].kind||a.push(O[b]);for(b in a)Ub(a[b]);D.S=0;G=[];Eb=[];Fb=[];Cb=[]}var H;
function Sb(){Vb(sb);delete sb;desktop.append(Ja);Ib.show();Kb.show();P(Kb);K.show();Jb.show();I.show();E=1;Wb=J.get(0).scrollHeight;J.scrollTop(Wb-Wb%15);Xb(p(1,0),6,1);Yb=!1;Q()};var E=0,Yb=!1,Wb=0,F,N,M=void 0,L=!1,Zb,$b,Bb,Cb,G,Eb,Fb,sb,ac,I,Ib,Jb,Kb,K,J,vb,wb,xb,Ab,zb,yb,D,Pb,Qb,bc,R,S,Ob="";function cc(){}var dc=!1,ec=!1,fc=!1,A=!1,T=void 0;function Q(){if(4==E)window.location="index.html";else{dc||gc(!1);if(L||dc){dc=!1;if(hc()){A=dc=!0;return}A=!1;if(gc(!0))return;ic()}2!=E&&3!=E||jc();kc()}}
function hc(){if(ec)return ec=!1,lc(!1)?ec=!0:!1;if(fc){fc=!1;if(lc(!1))return fc=!0;if(gc(!0))return!0}for(;N.length;){var a=N.shift();if((0==E||1==E)&&mc(a)){if(nc(M,a))return fc=!0;if(gc(!0))return!0}}if(1==M)Yb=!1;else if((0==E||1==E)&&nc(3,M))return ec=!0;return!1}
function mc(a){if(!oc(a)||2<=(M?Bb[M]:3E3)&&0<R&&!oc(R))return!1;if(5!=M)return!0;if(0!=p(a,3)||0!=p(a,4)||0!=p(a,5))return!1;if(p(1,0)!=R)return!0;var b={top:0,left:0,width:I.port.width(),height:I.port.height()};b.top-=2*p(a,2)+2*S.d;b.left-=2*p(a,1)+2*S.c;return ca(a,b)}function oc(a){for(var b=p(1,0);0!=a&&1!=a&&a!=b;)a=p(a,0);return a}function gc(a){pc();var b=qc();rc(a)&&(b=!0);return b}
function jc(){if(2==E){sc();var a=Aa();ma=!0;ac=na(6);ac.show();a.k(ac.port,0,0);tc();E=4}else if(3==E){ic();var b=eb();b.show(function(a){Vb(b);switch(a){case 1:uc();break;case 3:E=4;Q();break;case 4:vc()}})}}function tc(){var a=document.createElement("link");a.type="text/css";a.rel="stylesheet";a.href="print.css";a.media="print";$("head").append(a);a=cb();A=!0;var b=db();ac.add(b);b.b.focus();a.show(function(a){switch(a){case 1:b.b.blur();window.print();break;case 2:Q()}})}
function pc(){for(;G.length;){for(var a,b=0,c=0;c<G.length;c++)G[c].id>b&&(b=G[c].id,a=c);b=G.splice(a,1)[0];switch(b.id){case 2:wc(b.val);break;case 3:xc(b.val);break;case 4:yc(b.val);break;case 7:a:{var c=b.val,d=!1,b=c.b,e=Cb.indexOf(b);-1!=e&&Cb.splice(e,1);if(1==b)c.parent!=p(b,0)&&G.push({id:12}),c.ka==p(b,3)&&c.fa==p(b,4)||P(ia(b));else if(c.parent!=p(b,0)||c.x!=2*p(b,1)||c.y!=2*p(b,2)){if(e=zc(c.parent))d=e,void 0!=d.a&&(e=ja(d.a.children,b),0!=e&&(d.a.children.splice(e-1,1),d.a.t=!0,P(d))),
d=!0;if(e=ia(b)){d=e;if(void 0!=d.a){e=void 0;for(e=0;e<d.a.children.length&&b>d.a.children[e].id;e++);if(e==d.a.children.length||b!=d.a.children[e].id)d.a.children.splice(e,0,{id:b,top:0,left:0,width:0,height:0}),d.a.t=!0,P(d)}d=!0}}else c.ka==p(b,3)&&c.fa==p(b,4)||P(ia(b));p(b,8)&&(d||c.hidden!=p(b,11)||c.sa!=p(b,9)||c.ta!=p(b,10))&&Ac(b);c=zc(b);d=b;for(e=p(1,0);d!=e&&0!=d&&p(d,6);)d=p(d,0);if(d==e){if(c)break a;G.push({id:3,val:b})}else{if(!c)break a;G.push({id:4,val:b})}b=Bc(b,!0);for(e=0;e<
b.length;e++)Cc(b[e])}break;case 8:b=b.val;d=zc(b.R);(c=e=zc(b.Q))||(c=d);c&&(d=U(b.Q),Lb(c,d),Dc(b.Q,c),c.a.t=!0,P(c));break;case 12:Xb(I.a.id,6,0);Xb(p(1,0),6,1);break;case 13:for(;F.length;)Ec(F.pop());break;case 14:Fc(b.val)}}}function wc(a){a&&(a=zc(a))&&hb(a)}
function xc(a){if(!zc(a))if(a==p(1,0)){Dc(a,I);P(I);Gc();var b=U(a);Lb(I,b.substr(0,1).toUpperCase()+b.substr(1))}else{var c={c:2*p(a,1),d:2*p(a,2)};Hc(ia(a),c);Ic(c);var b=U(a),d=bb();Lb(d,b);Dc(a,d);d.a.t=!0;var e=$(document.createElement("div"));e.addClass("zoom");desktop.append(e);e.css("top",c.d+"px");e.css("left",c.c+"px");e.css("width","0px");e.css("height","0px");e.animate({top:d.top+"px",left:d.left+"px",width:d.width+"px",height:d.height+"px"},500,"swing",function(){e.remove();d.show();
P(d)})}}function yc(a){var b=Ub(zc(a));if(void 0!=b&&(a=ia(b.b),void 0!=a)){var c=$(document.createElement("div"));c.addClass("zoom");desktop.append(c);c.css("top",b.top+"px");c.css("left",b.left+"px");c.css("width",b.width+"px");c.css("height",b.height+"px");b={c:2*p(b.b,1),d:2*p(b.b,2)};Hc(a,b);Ic(b);c.animate({top:b.d+"px",left:b.c+"px",width:"0px",height:"0px"},500,"swing",function(){c.remove();D.S--})}}
function Ec(a){var b=K.find(a);b&&(-1!=F.indexOf(a)?b.select():b.K());a==p(1,0)&&(-1!=F.indexOf(a)?K.addClass("selected"):K.removeClass("selected"));P(ia(a))}function Fc(a){desktop.append(T);var b={c:2*p(a,1),d:2*p(a,2)};Hc(ia(a),b);Ic(b);T.animate({top:b.d+"px",left:b.c+"px"},300,"swing",function(){T.remove()})}
function qc(){if(J.get(0).scrollHeight==J.innerHeight()){var a=J.clone();a.css("height","");a.css("visibility","hidden");$("body").append(a);Wb=a.innerHeight();a.remove();delete a}for(;Fb.length;)switch(a=Fb.splice(0,1)[0],a.id){case 1:J.append(a.val);Yb=!0;break;case 2:J.append("<br/>");Yb=!0;break;case 3:Jc=a.val[1],Kc=a.val[0],J.append(U(a.val[2])),Yb=!0}return Lc()}
function Lc(){var a=J.get(0).scrollHeight,b=J.innerHeight();J.scrollTop(Wb-Wb%15);Wb=J.scrollTop()+b+15;Mc(Jb,{left:0,right:0,top:0,bottom:a});return Wb<a?(Nc(),Oc(),A=!0):!1}function rc(a){for(var b=0;Eb.length;){var c=Eb.splice(0,1)[0];switch(c.id){case 1:ib(c.val);break;case 2:b=ib(c.val)}}return a&&b?(setTimeout(Q,1E3*b),!0):!1}
function Xb(a,b,c){if(0==b){var d=c,e=Pb[0][a];if(d!=a){for(var g=2*e,e=H[g];e!=a;)g=2*e+1,e=H[g];H[g]=H[2*e+1];g=2*d;for(e=H[g];e&&e<=a;)g=2*e+1,e=H[g];H[2*a+1]=e;H[g]=a}}12>b&&Cc(a);d=yb[b];c<<=Ab[b];c&=zb[b];Pb[d][a]=c|Pb[d][a]&~zb[b];Yb=!0}function p(a,b){var c,d=yb[b];if(d&128){var e=jb(0,a);if(0==e.length)return 0;d&=127;c=(e.charCodeAt(2*d)&255)<<8;c|=e.charCodeAt(2*d+1)&255}else c=Pb[d][a];c&=zb[b];return W(c>>Ab[b])}
function P(a){if(void 0!=a&&void 0!=a.a&&(a==Kb||1==p(a.a.id,6))){if(a==I){var b=ea(2*a.a.id);void 0!=b&&b.k(I.port,0,0)}else tb(a.port,Ua);for(b=0;b<a.a.children.length;b++){var c=ka(a.a.children[b].id,a,0);a.a.children[b].top=c.top;a.a.children[b].left=c.left;a.a.children[b].width=c.width;a.a.children[b].height=c.height}if(14==a.kind&&a.a.t){b={top:0,left:0,right:0,bottom:0};a.a.t=!1;for(c=0;c<a.a.children.length;c++){var d=a.a.children[c];b.right==b.left||b.bottom==b.top?(b.top=d.top,b.left=d.left,
b.bottom=d.top+d.height,b.right=d.left+d.width):(b.top=Math.min(b.top,d.top),b.left=Math.min(b.left,d.left),b.bottom=Math.max(b.bottom,d.top+d.height),b.right=Math.max(b.right,d.left+d.width))}b.right==b.left||b.bottom==b.top?(b.top=a.a.y,b.left=a.a.x,b.bottom=a.a.y,b.right=a.a.x):(b.left>a.a.x&&(b.left=a.a.x),b.right<a.a.x&&(b.right=a.a.x),b.top>a.a.y&&(b.top=a.a.y),b.bottom<a.a.y&&(b.bottom=a.a.y));Mc(a,b)}}}function Pc(a){a=Ib.find(a);a!=bc&&(bc&&bc.K(),(bc=a)&&a.select())}
function Qc(a){var b=X[0].C;Kc=X[0].target;Jc=b;var c=fb();c.param([U(a)]);c.getItem(3).b.keypress(function(a){return 13==a.which?(c.getItem(1).b.mousedown(),!1):!0});c.show(function(a){Rc=c.getItem(3).b.val();1==a?X[0].state.push(65535):X[0].state.push(0);Vb(c);Q()})}
function Sc(a){switch(a){case 256:Tc();break;case 32768:Tc();break;case 33024:Uc();break;case 33026:Vc();break;case 33027:cc=function(){};Wc();break;case 33028:cc=function(){};Xc();break;case 33030:Yc();break;case 2304:Zc();break;case 2305:window.cefQuery({request:"moregames"});break;case 2306:E=2;Q();break;case 2307:window.open(helpURL);break;case 33280:break;case 33282:break;case 33283:break;case 33284:break;case 33285:break;case 33536:$c();break;case 33537:ad();break;default:fatal("Unknown menuitem: "+
a.toString(16))}}window.menuSelect=Sc;function bd(a,b){var c=a.e;if(2==c.kind)c.ra(a.p);else if(c==K)A||cd(a.p,K,b,!1);else if(255==a.p){for(var c=Ib,d=0;d<c.h.length;d++)255==c.h[d].p&&c.h[d].hide();dd(Ib);Lc()||Q()}else if(!A){bc&&a!=bc&&bc.K();M=a.p;Pc(M);switch(M?Bb[M]:3E3){case 0:L=!0;break;case 1:L=0!=N.length;break;case 2:0<R&&(L=!0)}Q()}}
function cd(a,b,c,d){b==K&&(b=I);if(c.shiftKey)if(a)-1!=N.indexOf(a)?ed(a):fd(a),Q();else if(14==b.kind)gd(b,c,d);else{if(0==N.length||b!=ia(N[0]))-1!=N.indexOf(b.a.id)?ed(b.a.id):fd(b.a.id);Q()}else if(M&&N.length&&1<(M?Bb[M]:3E3))a?hd(a):hd(b.a.id),Q();else if(a||(id(),14==b.kind?gd(b,c,d):a=b.a.id),a){var e;300>=c.timeStamp-Zb&&c.target==$b?(Zb=0,$b=void 0,e=!0):e=!1;e?(-1==N.indexOf(a)&&id(),fd(a),jd(a,b,c,d)):(-1==N.indexOf(a)&&id(),fd(a),kd(a,b,c,d))}}
function gd(a,b,c){var d,e,g,k,h={c:a.a.x,d:a.a.y};Hc(a,h);Ic(h);d=h.c;e=h.d;g=h.c+a.port.width();k=h.d+a.port.height();var f=$(document.createElement("div"));f.addClass("lasso");desktop.append(f);var l={c:Math.floor(b.pageX/pageZoom),d:Math.floor(b.pageY/pageZoom)};Ic(l);f.css("top",l.d+"px");f.css("left",l.c+"px");f.css("width","0px");f.css("height","0px");$(document).mousemove(function(a){var b={c:Math.floor(a.pageX/pageZoom),d:Math.floor(a.pageY/pageZoom)};Ic(b);a=Math.max(Math.min(l.c,b.c),d);
var c=Math.max(Math.min(l.d,b.d),e),h=Math.min(Math.max(l.c,b.c),g),b=Math.min(Math.max(l.d,b.d),k);f.css("top",c+"px");f.css("left",a+"px");f.css("width",h-a+"px");f.css("height",b-c+"px")});$(document).mouseup(function(h){$(document).unbind("mousemove");$(document).unbind("mouseup");h={c:Math.floor(h.pageX/pageZoom),d:Math.floor(h.pageY/pageZoom)};Ic(h);var n=Math.max(Math.min(l.c,h.c),d),q=Math.max(Math.min(l.d,h.d),e),u=Math.min(Math.max(l.c,h.c),g),V=Math.min(Math.max(l.d,h.d),k);f.remove();
h={c:n,d:q};var Pa=desktop.offset();h.d+=Pa.top;h.c+=Pa.left;ld(a,h);q={top:h.d,left:h.c,width:u-n,height:V-q};n=[];for(u=0;u<a.a.children.length;u++){var da=a.a.children[u].id;p(da,4)||(q.left=h.c-2*p(da,1),q.top=h.d-2*p(da,2),ca(da,q)&&n.push(da))}if(b.shiftKey){if(0==n.length){if(0==N.length||a!=ia(N[0]))-1!=N.indexOf(a.a.id)?ed(a.a.id):fd(a.a.id)}else for(;n.length;)da=n.shift(),-1!=N.indexOf(da)?ed(da):fd(da);Q()}else{if(0==n.length)da=a.a.id;else for(;n.length;)da=n.shift(),fd(da);cd(da,a,b,
c)}})}
function jd(a,b,c,d){var e=Math.floor(c.pageX/pageZoom),g=Math.floor(c.pageY/pageZoom),k={c:0,d:0},h=!1;T=void 0;d&&$(document).mousemove(function(c){if(void 0==T){if(7>=Math.abs(Math.floor(c.pageX/pageZoom)-e)+Math.abs(Math.floor(c.pageY/pageZoom)-g))return!1;h=!0;T=la(a);var d=ja(b.a.children,a);d&&(d--,k.c=b.a.children[d].left,k.d=b.a.children[d].top);Hc(b,k);Ic(k);T.css("top",k.d+"px");T.css("left",k.c+"px")}d=T.position();T.css("top",d.top+(Math.floor(c.pageY/pageZoom)-g)+"px");T.css("left",d.left+
(Math.floor(c.pageX/pageZoom)-e)+"px");e=Math.floor(c.pageX/pageZoom);g=Math.floor(c.pageY/pageZoom);return!1});$(document).mouseup(function(c){var e;d&&($(document).unbind("mousemove"),T&&(e=T.position(),T.remove()));$(document).unbind("mouseup");h&&(S.c=e.left,S.d=e.top,c=md(Math.floor(c.pageX/pageZoom),Math.floor(c.pageY/pageZoom)),R=c.id,S.c-=k.c,S.d-=k.d,c.e!=b&&(Hc(b,S),c.e&&ld(c.e,S)),S.c=Math.round(S.c/2),S.d=Math.round(S.d/2),M=5,Pc(5),L=!0);L||(hd(a),M||(M=4,Pc(4),L=!0));Q()})}
function kd(a,b,c,d){var e=Math.floor(c.pageX/pageZoom),g=Math.floor(c.pageY/pageZoom),k={c:0,d:0},h=!1;T=void 0;d&&$(document).mousemove(function(c){if(void 0==T){if(7>=Math.abs(Math.floor(c.pageX/pageZoom)-e)+Math.abs(Math.floor(c.pageY/pageZoom)-g))return!1;h=!0;T=la(a);var d=ja(b.a.children,a);d&&(d--,k.c=b.a.children[d].left,k.d=b.a.children[d].top);Hc(b,k);Ic(k);T.css("top",k.d+"px");T.css("left",k.c+"px")}d=T.position();T.css("top",d.top+(Math.floor(c.pageY/pageZoom)-g)+"px");T.css("left",
d.left+(Math.floor(c.pageX/pageZoom)-e)+"px");e=Math.floor(c.pageX/pageZoom);g=Math.floor(c.pageY/pageZoom);return!1});$(document).mouseup(function(a){Zb=a.timeStamp;$b=a.target;var c;d&&($(document).unbind("mousemove"),T&&(c=T.position(),T.remove()));$(document).unbind("mouseup");h&&(S.c=c.left,S.d=c.top,a=md(Math.floor(a.pageX/pageZoom),Math.floor(a.pageY/pageZoom)),R=a.id,S.c-=k.c,S.d-=k.d,a.e!=b&&(Hc(b,S),a.e&&ld(a.e,S)),S.c=Math.round(S.c/2),S.d=Math.round(S.d/2),M=5,Pc(5),L=!0);1==(M?Bb[M]:
3E3)&&(L=!0);Q()})}function id(){for(;N.length;)ed(N.shift())}function fd(a){N.length&&ia(a)!=ia(N[0])&&id();-1==N.indexOf(a)&&N.push(a);-1==F.indexOf(a)&&(F.push(a),Ec(a))}function ed(a){var b=N.indexOf(a);-1!=b&&N.splice(b,1);-1!=(b=F.indexOf(a))&&(F.splice(b,1),Ec(a))}function hd(a){if(a!=R){var b;0<R&&-1!=(b=F.indexOf(R))&&-1==N.indexOf(R)&&(F.splice(b,1),Ec(R));R=a;-1==F.indexOf(R)&&(F.push(R),Ec(R));L=!0}}
function ka(a,b,c){var d=2*p(a,1),e=2*p(a,2),g=p(a,3);if(c||!g||!p(a,4)){var k=1;g||c?k=0:-1!=F.indexOf(a)&&(k=2);c=d-b.a.x;var e=e-b.a.y,h=b.port,d=k,k={top:0,left:0,width:0,height:0};if(a=ea(2*a))switch(k={top:e,left:c,width:a.width,height:a.height},d){case 1:a.k(h,c,e);break;case 2:if(0!=a.width&&0!=a.height){var d=h.get(0).getContext("2d"),f=g=0;0>c&&(g=-c,c=0);0>e&&(f=-e,e=0);var l=a.width,s=a.height;l+c>=h.width()&&(l=h.width()-c);s+e>=h.height()&&(s=h.height()-e);if(0!=l&&0!=s){for(var h=d.getImageData(c,
e,l,s),n=f;n<s;n++)for(var q=(n>>1)*a.r,u=(n-f)*h.width*4,V,Pa=g;Pa<l;Pa++)V=a.data[q+(Pa>>2)],ga&&(V=ga[V]),(V=V>>(Pa&2?0:4)&15)?(V^=15,V*=3,h.data[u++]=w[V++],h.data[u++]=w[V++],h.data[u++]=w[V++],h.data[u++]=255):u+=4;d.putImageData(h,c,e)}}}k.top+=b.a.y;k.left+=b.a.x;return k}return{top:0,left:0,width:0,height:0}}function Gc(){for(var a=K,b=0;b<a.h.length;b++)a.h[b].b.remove();a.h=[];a=Bc(p(1,0),!0);for(b=0;b<a.length;b++)Ac(a[b])}
function Ac(a){if(p(a,8)){var b=K.find(a);b&&K.remove(b);p(a,11)||p(a,0)!=p(1,0)||K.add(C([2*p(a,9),2*p(a,10),14,12],a,2,[]))}}function Tc(){var a=Wa();A=!0;a.show(function(){Vb(a);A=!1})}function Zc(){var a=Ya(),b=nd();null==b&&(b=50);od(a.getItem(2),b);A=!0;a.show(function(){var b=a.getItem(2).value,d=new Date;d.setTime(d.getTime()+31536E6);document.cookie="webventure_volume="+escape(b)+"; expires="+d.toGMTString()+"; path=/";Vb(a);A=!1})}
function Uc(){if(Yb){var a=Za(0);A=!0;a.show(function(b){Vb(a);switch(b){case 1:cc=Uc;Wc();break;case 3:uc();break;case 2:A=!1}})}else uc()}function uc(){Ob="";for(var a=qa(Ca()),b=0;b<xb;b++)for(var c=0;c<vb;c++)Pb[b][c]=x(a);for(b=0;b<wb;b++)Qb[b]=x(a);Tb();Rb();Lb(Jb,"Untitled");J.html("");M=1;N=[p(1,0)];E=1;Xb(p(1,0),6,1);fc=ec=dc=Yb=!1;X=[];L=!0;Q()}function Vc(){if(Yb){var a=Za(1);A=!0;a.show(function(b){Vb(a);switch(b){case 1:cc=Vc;Wc();break;case 3:vc();break;case 2:A=!1}})}else vc()}
function vc(){var a=$a();A=!0;for(var b=a.getItem(3),c=void 0,d=0;d<window.localStorage.length;d++){var e=window.localStorage.key(d);if(null!=e&&window.JSON.parse(window.localStorage.getItem(e).toString()).game==gamename){var g=$(document.createElement("div"));g.addClass("listitem");g.mousedown(function(){return!1});g.click(function(a){c&&c.removeClass("active");c=$(a.target);c.addClass("active")});g.dblclick(function(){a.getItem(1).b.mousedown()});g.text(e.toString());b.b.append(g)}}a.show(function(b){switch(b){case 1:if(void 0==
c)break;Ob=c.text();Vb(a);A=!1;b=window.JSON.parse(window.localStorage.getItem(Ob).toString());Pb=b.gamedata;Qb=b.globals;Tb();Rb();Lb(Jb,Ob);J.html(b.text);Wb=J.get(0).scrollHeight;J.scrollTop(Wb);E=1;fc=ec=dc=!1;N=[];M=0;X=[];Xb(p(1,0),6,1);Yb=!1;Q();break;case 2:Vb(a),A=!1}})}function Wc(){""==Ob?Xc():(window.localStorage.setItem(Ob,window.JSON.stringify({game:gamename,gamedata:Pb,globals:Qb,text:J.html()})),Lb(Jb,Ob),Yb=!1,cc())}
function Xc(){var a=ab();A=!0;a.getItem(3).b.keypress(function(b){return 13==b.which?(a.getItem(1).b.mousedown(),!1):!0});for(var b=a.getItem(4),c=void 0,d=0;d<window.localStorage.length;d++){var e=window.localStorage.key(d);if(null!=e&&window.JSON.parse(window.localStorage.getItem(e).toString()).game==gamename){var g=$(document.createElement("div"));g.addClass("listitem");g.mousedown(function(){return!1});g.click(function(b){c&&c.removeClass("active");c=$(b.target);c.addClass("active");a.getItem(3).b.val(c.text())});
g.dblclick(function(){a.getItem(1).b.mousedown()});g.text(e.toString());b.b.append(g)}}a.show(function(b){switch(b){case 1:Ob=a.getItem(3).b.val();Vb(a);A=!1;Wc();break;case 2:Vb(a),A=!1,cc()}})}function Yc(){if(Yb){var a=Za(2);A=!0;a.show(function(b){Vb(a);switch(b){case 1:cc=Yc;Wc();break;case 3:E=4;Q();break;case 2:A=!1}})}else E=4,Q()}
function nd(){for(var a=document.cookie.split(";"),b=0;b<a.length;b++){for(var c=a[b];" "==c.charAt(0);)c=c.substring(1,c.length);if(0==c.indexOf("webventure_volume="))return unescape(c.substring(18,c.length))}return null}function Db(){M=0;bc=void 0;N=[];R=0;S={c:0,d:0};Rc="";L=!1;Zb=0}function Cc(a){if(-1==Cb.indexOf(a)){Cb.push(a);var b={b:a};b.parent=p(a,0);b.x=2*p(a,1);b.y=2*p(a,2);b.sa=p(a,9);b.ta=p(a,10);b.hidden=p(a,11);b.ka=p(a,3);b.fa=p(a,4);G.push({id:7,val:b})}}
function pd(a){a&128&&(a=-((a^255)+1));return a}function W(a){a&32768&&(a=-((a^65535)+1));return a}function zc(a){switch(a){case 65532:return K;case 65533:return Kb;case 65534:return Jb;case 65535:return Ib}a:{for(var b=0;b<O.length;b++)if((10==O[b].kind||14==O[b].kind)&&void 0!=O[b].a&&O[b].a.id==a){a=O[b];break a}a=void 0}return a}function Bc(a,b){for(var c=[],d=H[2*a];d;)c.push(d),b||(c=c.concat(Bc(d,!1))),d=H[2*d+1];return c}
function ja(a,b){var c;for(c=0;c<a.length&&a[c].id!=b;c++);return c==a.length?0:c+1}function ia(a){return 1==a?Kb:(a=p(a,0))?zc(a):void 0}function Dc(a,b){var c=Bc(a,!0);b.a={id:a,x:0,y:0,t:!1,children:[]};for(var d=32767,e=32767,g=0;g<c.length;g++)if(1!=c[g]){var k={id:c[g],top:0,left:0,width:0,height:0};if(b!=I){var h=2*p(c[g],1),f=2*p(c[g],2);d>h&&(d=h);e>f&&(e=f)}b.a.children.push(k)}32767!=d&&(b.a.x=d);32767!=e&&(b.a.y=e);b!=I&&(b.a.t=!0)}
function ic(){for(void 0!=bc&&bc.K();F.length;)Ec(F.pop());Db()}
function md(a,b){var c;a:if(c=desktop.offset(),b>=c.top&&b<c.top+24&&a>=c.left&&a<c.left+desktop.width())c={id:1,e:void 0};else{for(c=0;c<O.length;c++){var d=O[c].Y(a,b);if(void 0!=d){c=d;break a}}c={id:0,e:void 0}}d=0;void 0!=c.e&&(d=c.e.kind);if(3!=c.id||14!=d&&10!=d)switch(d){case 9:c.id=-1;break;case 11:c.id=-2;break;case 12:c.id=-3;break;case 13:c.id=-4;break;default:switch(c.id){case 0:c.id=-5;break;case 1:c.id=-6;break;case 2:c.id=-7;break;case 3:c.id=-8;break;case 4:c.id=-9;break;case 5:c.id=
-10;break;case 6:c.id=-11;break;default:c.id=-12}}else c.id=c.e.a.id;return c}function Ic(a){var b=desktop.offset();a.d-=b.top;a.c-=b.left}function kc(){14==O[0].kind?(Mb(33536),Mb(33537)):(Nb(33536),Nb(33537));Nb(33280);Nb(33282);Nb(33283);Nb(33284);Nb(33285)}function qd(){return{width:8,items:[]}}function rd(a,b,c){a.width+=8+c[b].width;a.items.push(b)}function sd(a,b,c){var d=a.items[b];a.width-=8+c[d].width;a.items.splice(b,1);return d}
function td(a,b,c,d){for(var e=b?32767:-32768,g=!0,k=-1,h=0;h<a.items.length;h++){var f=a.items[h],l=c[f].top+c[f].height>d.top+d.height||c[f].top>d.top;b&&(l=!l);g&&l&&(g=!1,e=b?32767:-32768);if(g||l)if(f=c[f].width/2|0,l=!1,l=b?e>=f:e<=f)k=h,e=f}return sd(a,k,c)}
function $c(){var a=O[0],b={};b.top=a.a.y;b.left=a.a.x;b.width=a.port.width();b.height=a.port.height();for(var c=a.a.children,d=[],e=qd(),g=qd(),k=qd(),h=qd(),f=c.length-1;0<=f;f--){var l=c[f];l.top+l.height>b.top+b.height||l.top<b.top?rd(g,f,c):16+l.width>b.width?rd(g,f,c):rd(e,f,c)}for(var s=b.top+8;e.items.length||g.items.length;){for(var n=32767,q=-1,u=0,f=e.items.length-1;0<=f;f--)l=e.items[f],c[l].top<n&&(n=c[l].top,u=c[l].height,q=f);if(-1!=q){rd(k,sd(e,q,c),c);do for(q=!0,f=e.items.length-
1;0<=f;f--)l=e.items[f],c[l].top<n+u&&(u<c[l].height&&(q=!1,u=c[l].height),rd(k,sd(e,f,c),c));while(!q)}for(;k.items.length&&k.width>b.width;)rd(e,td(k,!1,c,b),c);u=0;for(f=k.items.length-1;0<=f;f--)l=k.items[f],u<c[l].height&&(u=c[l].height);for(;g.items.length&&k.width<b.width;)f=td(g,!0,c,b),e.items.length&&c[f].height>u?rd(h,f,c):k.width+8+c[f].width<=b.width?(u<c[f].height&&(u=c[f].height),rd(k,f,c)):rd(h,f,c);for(;h.items.length;)rd(g,sd(h,0,c),c);!k.items.length&&g.items.length&&(f=sd(g,0,
c),u<c[f].height&&(u=c[f].height),rd(k,f,c));for(l=b.left+8;k.items.length;)f=td(k,!0,c,b),d.push({id:c[f].id,left:l,top:s+(u-c[f].height)/2|0}),l+=c[f].width+8;s+=u+8}ud(d,a)}function ad(){var a=O[0],b,c,d,e;b=a.a.y;c=a.a.x;d=a.port.width();e=a.port.height();for(var g=a.a.children,k=[],h=0;h<g.length;h++){var f=e-g[h].height;0>f&&(f=0);var l=(Math.random()*f|0)+b,f=d-g[h].width;0>f&&(f=0);k.push({id:g[h].id,left:(Math.random()*f|0)+c,top:l})}ud(k,a)}
function ud(a,b){for(var c=0;c<a.length;c++){var d=ha(a[c].id);if(d.top!=a[c].top||d.left!=a[c].left)Xb(a[c].id,1,Math.round(a[c].left/2)),Xb(a[c].id,2,Math.round(a[c].top/2))}b.a.t=!0;P(b)};function ea(a){a=jb(3,a);if(2>a.length)a=void 0;else if(2==a.length)a=ea((a.charCodeAt(0)&255)<<8|a.charCodeAt(1)&255);else{a=new wa(a);var b=a.g(3),c,d;xa&&a.g(2);d=a.g(1)?a.g(10):a.g(6);if((c=a.g(1)?a.g(10):a.g(6))&&d){c=new ya(c,d,c+15>>3&65534);switch(b){case 0:b=c.H>>4;d=c.H&15;for(var e,g=0,k=0;k<c.J;k++){for(var h=0;h<b;h++)e=qb(a),a.seek(2,a.n),e>>>=16-a.m,c.data[g++]=e>>8&255,c.data[g++]=e&255;d&&(e=a.g(d),e<<=16-d,c.data[g++]=e>>8&255,c.data[g++]=e&255)}break;case 1:vd(wd,xd,yd,c,a);break;
case 2:vd(zd,Ad,Bd,c,a);break;case 3:b=Array(17);for(g=0;255!=(d=Cd[g++]);){for(e=a.g(d);255!=(d=Cd[g++]);)b[Cd[g++]]=e%d,e=e/d|0;b[Cd[g++]]=e}b[16]=0;for(e=16;0<e;e--)for(d=e;16>=d;d++)b[d]>=b[e-1]&&b[d]++;for(e=16;0<=e;e--)if(16==b[e]){b[e]=255;break}g=Array(17);k=Array(17);d=a.g(2)+1;for(e=h=0;15>e;e++){if(e)for(;!a.g(1);)d++;k[e]=d;g[e]=h;h+=1<<16-d}for(g[15]=h;h&1<<16-d;)d++;g[16]=h|1<<16-d;k[15]=d;k[16]=d;vd(g,k,b,c,a)}a=c}else a=void 0}return a}
function tb(a,b){if(0!=a.width()){for(var c=a.width(),d=a.height(),e=a.get(0).getContext("2d"),g=e.getImageData(0,0,c,d),k=0;k<d;k++)for(var h=k*g.width*4,f=0;f<c;f++){if(b==Ua)g.data[h++]=100,g.data[h++]=203,g.data[h++]=254;else{var l=3*(b>>4*(f&3)&15);g.data[h++]=w[l++];g.data[h++]=w[l++];g.data[h++]=w[l++]}g.data[h++]=255}e.putImageData(g,0,0)}}
function fa(a,b,c){var d=b.top,e=b.left,g=e+b.width;b=d+b.height;d<a.top&&(d=a.top);e<a.left&&(e=a.left);b>a.top+a.height&&(b=a.top+a.height);g>a.left+a.width&&(g=a.left+a.width);if(g<=e||b<=d)d=b=e=g=0;c.top=d;c.left=e;c.width=g-e;c.height=b-d;return 0!=c.height}
var wd=[0,8192,16384,20480,24576,28672,32768,36864,40960,45056,49152,53248,55296,57344,59392,61440,63488],xd=[3,3,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5],yd=[0,15,3,5,6,7,8,9,10,12,255,1,2,4,11,13,14],zd=[0,16384,32768,49152,51200,53248,55296,57344,59392,61440,62464,62976,63488,64E3,64512,65024,65280],Ad=[2,2,2,5,5,5,5,5,5,6,7,7,7,7,7,8,8],Bd=[255,0,15,1,3,7,14,12,8,6,2,4,9,13,11,10,5],Cd=[8,15,2,255,0,4,255,1,7,9,8,255,3,4,255,4,10,7,10,11,6,255,5,6,6,11,255,7,3,255,9,4,3,14,255,12,2,255,13,1,255,15,255];
function vd(a,b,c,d,e){var g;Y=Z=0;g=d.H&3?e.g(5):e.g(4)<<1;var k=0,h=d.H&15;h&&(h>>=2,k=h&1,h=2-(h>>1));for(var f=0,l=0;l<d.J;l++){for(var s=0;s<d.H>>3;s++){var n=Dd(a,b,c,e)<<4;d.data[f++]=Dd(a,b,c,e)|n}k&&(d.data[f]=Dd(a,b,c,e)<<4);f+=h}if(s=d.H&3)for(var f=d.r-h,q=0,l=h=0;l<d.J;l++)g&1?(q<s&&(n=Dd(a,b,c,e)<<4,h|=n>>>q,q+=4),q-=s,n=h,h<<=s,h&=255):(n=e.g(s),n<<=8-s),k&&(n>>>=4),d.data[f]|=n&255,f+=d.r;if(g&8)for(l=f=0;l<d.J;l++)if(n=0,g&2)for(s=0;s<d.r;s++)d.data[f]^=n,n=d.data[f++];else for(s=
0;s<d.r;s++)h=d.data[f]^n,h^=h>>>4&15,d.data[f++]=h,n=h<<4&255;if(g&4)for(a=4*d.r,g&2&&(a*=2),f=0,g=a,b=0;b<d.J*d.r-a;b++)d.data[g++]^=d.data[f++]}var Z=0,Y=0;function Dd(a,b,c,d){if(Z)return Z--,Y=Y<<8&65280|Y>>8,Y&255;var e=qb(d),e=e>>>16-d.m,e=e&65535,g;for(g=0;16>g&&!(a[g+1]>e);g++);d.m+=b[g];d.m&16&&(d.m&=15,d.seek(2,d.n));a=c[g];if(255==a)return d.g(1)||(Y&=255,Y|=Y<<8),Z=d.g(3),3>Z&&(Z<<=4,Z|=d.g(4),8>Z&&(Z<<=8,Z|=d.g(8))),Z-=2,Y=Y<<8&65280|Y>>8,Y&255;Y<<=8;Y|=a;Y&=65535;return a};function Ha(a,b,c,d){var e={id:b},g=$(document.createElement("tr"));if("-"==a[0]){var k=$(document.createElement("td"));k.attr("colspan","2");k.addClass("divider");k.append(document.createElement("hr"))}else g.addClass("menuitem"),k=$(document.createElement("td")),k.html(ba(a)),g.append(k),k=$(document.createElement("td")),""!=c&&(k.addClass("shortcut"),Ed.push({key:c,id:b}),k.text(c));g.append(k);e.b=g;e.enabled=d;e.enabled||e.b.addClass("disabled");z.body.append(e.b);z.items.push(e)}
function Fd(a){for(var b=0;b<B.length;b++)for(var c=0;c<B[b].items.length;c++)if(B[b].items[c].id==a)return B[b].items[c]}function Mb(a){if(a=Fd(a))a.enabled=!0,a.b.removeClass("disabled")}function Nb(a){if(a=Fd(a))a.enabled=!1,a.b.addClass("disabled")}
function Ia(a){for(var b=$(a.target);void 0==b.data("refCon");)b=b.parent();b.addClass("active");var c=b.data("refCon");desktop.append(c.q);a=b.position();c.q.css("top",a.top+24+"px");c.q.css("left",a.left+"px");var d=-1;$(document).mousemove(function(a){var g=Ja.offset();if(Math.floor(a.pageX/pageZoom)>=g.left&&Math.floor(a.pageY/pageZoom)>g.top&&Math.floor(a.pageX/pageZoom)<g.left+Ja.width()&&Math.floor(a.pageY/pageZoom)<g.top+Ja.height()){for(var k=0;k<B.length;k++)if(g=B[k].b.offset(),Math.floor(a.pageX/
pageZoom)>=g.left&&Math.floor(a.pageX/pageZoom)<g.left+B[k].b.outerWidth()){c.q.remove();b.removeClass("active");b=B[k].b;b.addClass("active");c=b.data("refCon");desktop.append(c.q);g=b.position();c.q.css("top",g.top+24+"px");c.q.css("left",g.left+"px");break}for(k=0;k<c.items.length;k++)c.items[k].b.removeClass("active");d=-1}else if(g=c.q.offset(),Math.floor(a.pageX/pageZoom)>=g.left&&Math.floor(a.pageY/pageZoom)>=g.top&&Math.floor(a.pageX/pageZoom)<g.left+c.q.outerWidth()&&Math.floor(a.pageY/pageZoom)<
g.top+c.q.outerHeight())for(k=0;k<c.items.length;k++){var h=c.items[k].b;h.hasClass("menuitem")&&c.items[k].enabled&&(g=h.offset(),Math.floor(a.pageY/pageZoom)>=g.top&&Math.floor(a.pageY/pageZoom)<g.top+h.outerHeight()?(d=k,h.addClass("active")):h.removeClass("active"))}else{for(k=0;k<c.items.length;k++)c.items[k].b.removeClass("active");d=-1}});$(document).mouseup(function(){$(document).unbind("mousemove");$(document).unbind("mouseup");c.q.remove();b.removeClass("active");-1!=d&&(c.items[d].b.removeClass("active"),
Sc(c.items[d].id))})}var Ja,B=[],Ed=[],z=void 0;$("body").keydown(function(a){if("text"==a.target.type||!a.altKey||A)return!0;for(var b=0;b<Ed.length;b++)if(Ed[b].key.charCodeAt(0)==a.which){a=Ed[b].id;for(b=0;b<B.length;b++)for(var c=0;c<B[b].items.length;c++)B[b].items[c].id==a&&B[b].items[c].enabled&&Gd(B[b],a);return!1}return!0});function Gd(a,b){a.b.addClass("active");setTimeout(function(){a.b.removeClass("active");Sc(b)},200)};function gb(a,b,c,d,e,g,k,h,f){var l=this;this.I=void 0;this.h=[];this.X=c;this.W=b;this.G=d;this.F=e;this.e=$(document.createElement("div"));this.e.addClass(a);if("document"==a||"info"==a||"noGrowDoc"==a||"zoomDoc"==a||"rDoc4"==a)b="<span></span>",this.title=$(document.createElement("div")),this.title.addClass("title"),this.title.mousedown(function(a){A||Hd(Math.floor(a.pageX/pageZoom),Math.floor(a.pageY/pageZoom),l);return!1}),this.W&&(b='<div class="close"></div>'+b),this.X&&(b+='<div class="resize"></div>'),
this.title.html(b),this.W&&(b=this.title.children("div.close"),b.mousedown(function(){return!1}),b.click(function(){A||(14==l.kind&&(id(),fd(l.a.id),M=2,Pc(2),L=!0),Q());return!1})),this.X&&(b=this.title.children("div.resize"),b.mousedown(function(){return!1}),b.click(function(){if(!A){var a=l.e.position(),a={x:a.left,y:a.top};a.za=l.e.width();a.c=l.e.height();void 0!=l.I?(l.e.css("left",l.I.x+"px"),l.e.css("top",l.I.y+"px"),l.resize(l.I.za,l.I.c)):(l.e.css("left","0px"),l.e.css("top","24px"),l.resize(desktop.width(),
desktop.height()-24));l.I=a}return!1})),this.e.append(this.title);this.port=$(document.createElement("canvas"));this.port.mousedown(function(a){if(!A)switch(hb(l),l.kind){case 9:Hd(Math.floor(a.pageX/pageZoom),Math.floor(a.pageY/pageZoom),l);break;case 10:case 14:var b=Id(Math.floor(a.pageX/pageZoom),Math.floor(a.pageY/pageZoom),l),c=!1;b&&!p(b,3)&&(c=!0);cd(b,l,a,c);break;case 12:b=Id(Math.floor(a.pageX/pageZoom),Math.floor(a.pageY/pageZoom),l);1==b?cd(b,l,a,!1):Hd(Math.floor(a.pageX/pageZoom),Math.floor(a.pageY/
pageZoom),l);break;case 13:cd(p(1,0),l,a,!1)}return!1});this.port.attr("width",h);this.port.attr("height",f);this.e.append(this.port);this.top=k;this.height=f;this.left=g;this.width=h;"document"==a||"noGrowDoc"==a||"zoomDoc"==a||"rDoc4"==a?(this.top-=La+Ka,this.height+=La,this.left-=Ka):"info"==a?(this.top-=Ma+Ka,this.height+=Ma,this.left-=Ka):"alert"==a?(this.top-=2*Na,this.left-=2*Na,this.width+=Na,this.height+=Na):(this.top-=Ka,this.left-=Ka);this.G&&(this.width+=Oa);this.F&&(this.height+=Qa);
this.e.css("top",this.top+"px");this.e.css("left",this.left+"px");this.e.css("width",this.width+"px");this.e.css("height",this.height+"px");desktop.append(this.e);(this.G||this.F)&&Jd(this)}m=gb.prototype;m.show=function(a){this.ra=a;this.e.show();dd(this)};m.hide=function(){this.e.hide()};
function Lb(a,b){if(void 0!=a.title){var c=a.title.children("span");c.html("");if(""==b)c.hide();else{var d="none"==a.e.css("display");a.e.show();c.css({position:"absolute",visibility:"hidden",display:"block"});var e=a.port.width();a.W&&(e-=30);a.X&&(e-=30);for(var g=0;g<b.length;g++)if(c.append(b.substring(g,g+1)),c.width()>e){c.html(b.substring(0,g-1));break}c.css({position:"",visibility:"",display:""});d&&a.e.hide()}}}m.addClass=function(a){this.e.addClass(a)};m.removeClass=function(a){this.e.removeClass(a)};
m.add=function(a){var b=this.port.position().top,c=parseInt(a.b.css("top"),10);a.b.css("top",c+b+"px");this.e.append(a.b);a.e=this;this.h.push(a);"none"!=this.e.css("display")&&a.k()};m.remove=function(a){var b=this.h.indexOf(a);-1!=b&&this.h.splice(b,1);a.b.remove()};m.find=function(a){for(var b=0;b<this.h.length;b++)if(this.h[b].p==a)return this.h[b]};function Nc(){for(var a=Ib,b=0;b<a.h.length;b++)a.h[b].hide()}function dd(a){for(var b=0;b<a.h.length;b++)255!=a.h[b].p&&a.h[b].show()}
function Oc(){for(var a=Ib,b=0;b<a.h.length;b++)255==a.h[b].p&&a.h[b].show()}m.close=function(){this.e.remove()};function ld(a,b){var c=a.port.offset();b.c-=Math.floor(c.left)+1;b.d-=Math.floor(c.top)+2;a.a&&(b.c+=a.a.x,b.d+=a.a.y)}function Hc(a,b){var c=a.port.offset();b.c+=Math.floor(c.left)+1;b.d+=Math.floor(c.top)+2;a.a&&(b.c-=a.a.x,b.d-=a.a.y)}
function Jd(a){if(a.F){a.u=$(document.createElement("div"));a.u.addClass("hscroll");a.u.css("top",a.height-Qa+"px");a.u.css("width",a.width-32+"px");a.u.mousedown(function(b){hb(a);var d=a.o.offset().left;Math.floor(b.pageX/pageZoom)<d?Kd(a,-20,0):Kd(a,20,0);return!1});var b=$(document.createElement("div"));b.addClass("leftarrow");b.mousedown(function(){Kd(a,-5,0);return!1});a.u.append(b);a.P=$(document.createElement("div"));a.P.addClass("rightarrow");a.P.css("left",a.width-Ra-32+"px");a.P.mousedown(function(){Kd(a,
5,0);return!1});a.u.append(a.P);a.o=$(document.createElement("div"));a.o.addClass("slider");a.o.mousedown(function(b){Ld(a,Math.floor(b.pageX/pageZoom),!0);return!1});a.u.append(a.o);a.e.append(a.u)}a.G&&(a.w=$(document.createElement("div")),a.w.addClass("vscroll"),a.w.css("left",a.width-Oa+"px"),a.w.css("height",a.height-24-La+"px"),a.w.mousedown(function(b){hb(a);var d=a.i.offset().top;Math.floor(b.pageY/pageZoom)<d?Kd(a,0,-20):Kd(a,0,20);return!1}),b=$(document.createElement("div")),b.addClass("uparrow"),
b.mousedown(function(){Kd(a,0,-5);return!1}),a.w.append(b),a.M=$(document.createElement("div")),a.M.addClass("downarrow"),a.M.css("top",a.height-24-24-La+"px"),a.M.mousedown(function(){Kd(a,0,5);return!1}),a.w.append(a.M),a.i=$(document.createElement("div")),a.i.addClass("slider"),a.i.mousedown(function(b){Ld(a,Math.floor(b.pageY/pageZoom),!1);return!1}),a.w.append(a.i),a.e.append(a.w));a.D=$(document.createElement("div"));a.D.addClass("grow");a.D.css("top",a.height-24+"px");a.D.css("left",a.width-
32+"px");a.D.mousedown(function(b){if(A)return!1;hb(a);var d=$(document.createElement("div"));d.addClass("resizeProxy");desktop.append(d);var e=a.e.position();d.css("top",e.top+"px");d.css("left",e.left+"px");var g=a.e.width(),k=a.e.height();d.css("width",g+"px");d.css("height",k+"px");var h=Math.floor(b.pageX/pageZoom),f=Math.floor(b.pageY/pageZoom);$(document).mousemove(function(a){var b=g+(Math.floor(a.pageX/pageZoom)-h),c=k+(Math.floor(a.pageY/pageZoom)-f);100<b&&(g=b,d.css("width",g+"px"),h=
Math.floor(a.pageX/pageZoom));100<c&&(k=c,d.css("height",k+"px"),f=Math.floor(a.pageY/pageZoom))});$(document).mouseup(function(){$(document).unbind("mousemove");$(document).unbind("mouseup");d.remove();a.resize(g,k)});return!1});a.e.append(a.D)}
m.resize=function(a,b){var c=this.width-this.port.width(),d=this.height-this.port.height();this.width=a;this.height=b;this.e.css("width",a+"px");this.e.css("height",b+"px");this.F&&(this.u.css("top",b-Qa+"px"),this.u.css("width",a-32+"px"),this.P.css("left",a-Ra-32+"px"));this.G&&(this.w.css("left",a-Oa+"px"),this.w.css("height",b-24-La+"px"),this.M.css("top",b-24-24-La+"px"));this.D.css("top",b-24+"px");this.D.css("left",a-32+"px");this.a?(this.port.attr("width",a-c),this.port.attr("height",b-d),
this.a.t=!0,P(this)):(this.port.css("width",a-c),this.port.css("height",b-d),Wb=this.port.get(0).scrollHeight,Lc())};
function Mc(a,b){if(11==a.kind)a.i.data("min",b.top),a.i.data("max",b.bottom),Md(a);else{b.left>a.a.x&&(a.a.x=b.left);b.right<a.a.x+Math.floor(a.port.width())&&(b.right=a.a.x+Math.floor(a.port.width()));b.top>a.a.y&&(a.a.y=b.top);b.bottom<a.a.y+Math.floor(a.port.height())&&(b.bottom=a.a.y+Math.floor(a.port.height()));a.F&&(a.o.data("min",b.left),a.o.data("max",b.right));a.G&&(a.i.data("min",b.top),a.i.data("max",b.bottom));if(a.F){var c=a.o.data("min"),d=a.o.data("max");if(c<d){var e=a.a.x-c,g=a.port.width(),
e=e*(a.port.width()-Sa-Ra)/(d-c)|0,c=g*(a.port.width()-Sa-Ra-Ta)/(d-c)|0;a.o.css("left",e+Sa+"px");a.o.css("width",c+"px")}else a.o.css("left",Sa+"px"),a.o.css("width",a.port.width()-Sa-Ra+"px")}a.G&&(c=a.i.data("min"),d=a.i.data("max"),c<d?(e=a.a.y-c,g=a.port.height(),e=e*(a.port.height()-22-24)/(d-c)|0,c=g*(a.port.height()-22-24-2)/(d-c)|0,a.i.css("top",e+22+"px"),a.i.css("height",c+"px")):(a.i.css("top","22px"),a.i.css("height",a.port.height()-22-24+"px")))}}
function Md(a){var b=a.port.scrollTop(),c=a.i.data("min"),d=a.i.data("max");if(c<d){var e=b-c,b=b+a.port.height(),e=e*(a.height-La-24-22-24)/(d-c)|0,c=b*(a.height-La-24-22-24-2)/(d-c)|0;a.i.css("top",e+22+"px");a.i.css("height",c-e+"px")}else a.i.css("top","22px"),a.i.css("height",a.height-24-La-24+"px")}
m.Y=function(a,b){var c=this.e.offset();if(a>=c.left&&a<c.left+this.e.width()&&b>=c.top&&b<c.top+this.e.height())return c=this.port.offset(),a>=c.left&&a<c.left+this.port.width()&&b>=c.top&&b<c.top+this.port.height()?{id:3,e:this}:{id:4,e:this}};
function Nd(){for(var a=I,b=a.port.get(0).getContext("2d"),c=a.port.width(),a=a.port.height(),c=b.getImageData(0,0,c,a),a=0;a<c.height;a++)for(var d=a*c.width*4,e=0;e<c.width;e++)c.data[d++]^=255,c.data[d++]^=255,c.data[d++]^=255,c.data[d++]=255;b.putImageData(c,0,0)}m.param=function(a){for(var b=0;b<this.h.length;b++)if(this.h[b].U){var c=this.h[b].U(),d;do if(d=c.indexOf("^"),0<=d){var e=c.substr(0,d),e=e+a[parseInt(c.substr(d+1,1),10)],e=e+c.substr(d+2);this.h[b].T(e);c=e}while(0<=d)}};
m.getItem=function(a){for(var b=0;b<this.h.length;b++)if(this.h[b].p==a)return this.h[b]};
function Kd(a,b,c){if(11==a.kind){a.port.scrollTop(a.port.scrollTop()+c);Md(a);var d=setTimeout(function(){Kd(a,b,c)},50)}else{a.a.x+=b;a.a.y+=c;if(a.F){var e=a.o.data("min"),g=a.o.data("max");a.a.x<e&&(a.a.x=e);a.a.x>g-Math.floor(a.port.width())&&(a.a.x=g-Math.floor(a.port.width()))}a.G&&(e=a.i.data("min"),g=a.i.data("max"),a.a.y<e&&(a.a.y=e),a.a.y>g-Math.floor(a.port.height())&&(a.a.y=g-Math.floor(a.port.height())));a.a.t=!0;P(a);d=setTimeout(function(){Kd(a,b,c)},50)}$(document).mouseup(function(){$(document).unbind("mouseup");
clearTimeout(d)})}
function Ld(a,b,c){if(11==a.kind)Od(a,b);else{var d=b;$(document).mousemove(function(b){if(c){a.a.x+=Math.floor(b.pageX/pageZoom)-d;d=Math.floor(b.pageX/pageZoom);b=a.o.data("min");var g=a.o.data("max");a.a.x<b&&(a.a.x=b);a.a.x>g-Math.floor(a.port.width())&&(a.a.x=g-Math.floor(a.port.width()))}else a.a.y+=Math.floor(b.pageY/pageZoom)-d,d=Math.floor(b.pageY/pageZoom),b=a.i.data("min"),g=a.i.data("max"),a.a.y<b&&(a.a.y=b),a.a.y>g-Math.floor(a.port.height())&&(a.a.y=g-Math.floor(a.port.height()));a.a.t=
!0;P(a)});$(document).mouseup(function(){$(document).unbind("mouseup");$(document).unbind("mousemove")})}}function Od(a,b){var c=b;$(document).mousemove(function(b){var e=a.i.data("min"),g=a.i.data("max"),e=(Math.floor(b.pageY/pageZoom)-c)*(g-e)/(a.height-La-24-22-24)|0;c=Math.floor(b.pageY/pageZoom);a.port.scrollTop(a.port.scrollTop()+e);Md(a)});$(document).mouseup(function(){$(document).unbind("mouseup");$(document).unbind("mousemove")})}
function sc(){for(var a=[],b=0;b<O.length;b++)14==O[b].kind?a.push(O[b]):O[b].hide();for(b in a)Ub(a[b])}function Vb(a){for(var b=0;b<O.length;b++)if(O[b]==a){a.close();O.splice(b,1);break}O.length&&hb(O[0])}function Ub(a){if(void 0!=a){var b=a.a.id;if(10==a.kind)a.a={},Lb(a,"");else{var c={d:0,c:0},d={d:a.port.height(),c:a.port.width()};Hc(a,c);Hc(a,d);a.a={};Vb(a);return{b:b,top:c.d,left:c.c,width:d.c-c.c,height:d.d-c.d}}}}
function hb(a){if(O[0]==a)a.e.addClass("active");else{void 0!=O[0]&&O[0].e.removeClass("active");for(var b=0;b<O.length;b++)O[b]==a&&O.splice(b,1);O.unshift(a);a.e.addClass("active");kc()}}function Xa(a,b,c,d){a=new gb("alert",!1,!1,!1,!1,a,b,c,d);a.kind=2;a.hide();hb(a);return a}var O=[];
function Hd(a,b,c){var d=a,e=b;hb(c);$(document).mousemove(function(a){var b=c.e.position();c.e.css("top",b.top+(Math.floor(a.pageY/pageZoom)-e)+"px");c.e.css("left",b.left+(Math.floor(a.pageX/pageZoom)-d)+"px");d=Math.floor(a.pageX/pageZoom);e=Math.floor(a.pageY/pageZoom)});$(document).mouseup(function(a){$(document).unbind("mousemove");$(document).unbind("mouseup");var b=c.e.position();c.e.css("top",b.top+(Math.floor(a.pageY/pageZoom)-e)+"px");c.e.css("left",b.left+(Math.floor(a.pageX/pageZoom)-
d)+"px")})}function Id(a,b,c){a={c:a,d:b};var d=0;b=c.a.children.length;for(ld(c,a);0<b&&0==d;){b--;var d=a,e=c.a.children[b],g=0;if(!p(e.id,4)&&d.c>=e.left&&d.d>=e.top&&d.c<e.left+e.width&d.d<e.top+e.height){var k=void 0;(k=ea(2*e.id))?k.Y(d.c-e.left,d.d-e.top)&&(g=e.id):g=e.id}d=g}return d};function nc(a,b){var c=S;X.unshift({aa:a,C:b,target:R,ma:c.c,na:c.d,state:new Pd,l:[],j:[]});return lc(!0)}function lc(a){for(;X.length;)if(Qd(a))return!0;return!1}var X=[];function Pd(){this.stack=Array(128);this.A=128}Pd.prototype.push=function(a){this.stack[--this.A]=Rd(a)};Pd.prototype.pop=function(){return this.stack[this.A++]};function Sd(a,b){return a.stack[a.A+b]}Pd.prototype.clear=function(){this.A=128};Pd.prototype.size=function(){return 128-this.A};
function Rd(a){0>a&&(a=(-a^65535)+1);return a&65535}function Qd(a){var b=!1,c=X[0];if(c.ea||a){c.ea=!1;if(b=a?Td(0):Ud())return c.ea=!0;b=!0;c.ba=0;a=p(1,0);a=[a].concat(Bc(a,!1));c.family=a}if(c.da||b)for(c.da=!1,a=c.ba;a<c.family.length;a++){if(b=b?Td(c.family[a]):Ud())return c.da=!0,c.ba=a,!0;b=!0}var d;if(c.V&&(c.V=!1,Ud()))return c.V=!0;do{for(a=b=0;a<c.l.length;a++)b<c.l[a].s&&(b=c.l[a].s,d=a);if(b&&(c.l[d].s=0,Td(c.l[d].ca)))return c.V=!0}while(b);X.shift();return!1}
function Td(a){var b;return(b=jb(1,a))?(X[0].j[0]=new wa(b),X[0].Aa=a,Vd()):!1}function Ud(){var a=Vd();if(a)return a;X[0].j.shift();return X[0].j.length?Ud():!1}var Wd;
function Vd(){var a,b,c,d,e,g,k,h;d=X[0].j[0];for(var f=X[0].state;!(d.f>=d.length);)if(a=v(d),a&128)switch(a){case 128:b=f.pop();c=f.pop();f.push(p(b,c));break;case 129:b=f.pop();c=f.pop();a=W(f.pop());Xb(b,c,a);break;case 130:b=f.pop();c=f.pop();a=0!=f.pop();f.push(Xd(b,c,a));break;case 131:f.push(X[0].aa);break;case 132:f.push(X[0].C);break;case 133:f.push(X[0].target);break;case 134:f.push(X[0].ma);break;case 135:f.push(X[0].na);break;case 136:f.push(v(d));break;case 137:f.push(x(d));break;case 138:c=
f.pop();f.push(Qb[c]);break;case 139:c=f.pop();a=W(f.pop());Qb[c]=a;Yb=!0;break;case 140:a=f.pop();f.push(Math.round((a-1)*Math.random()));break;case 141:a=Sd(f,0);f.push(a);break;case 142:c=f.pop();for(b=c-1;c--;)a=Sd(f,b),f.push(a);break;case 143:b=f.pop();h=f.pop();f.push(b);f.push(h);break;case 144:c=f.pop();h=Sd(f,c);b=Sd(f,0);f.stack[f.A+c]=Rd(b);f.stack[f.A+0]=Rd(h);break;case 145:f.pop();break;case 146:a=Sd(f,1);f.push(a);break;case 147:c=f.pop();a=Sd(f,c);f.push(a);break;case 148:h=f.pop();
b=f.pop();a=f.pop();f.push(h);f.push(a);f.push(b);break;case 149:k=W(f.pop());c=W(f.pop());k%=c;0>k&&(k+=c);e=g=0;for(a=1;a<c;a++)e+=k,e>=c&&(e-=c),e==g?(g++,e=g):(h=Sd(f,g),b=Sd(f,e),f.stack[f.A+g]=Rd(b),f.stack[f.A+e]=Rd(h));break;case 150:f.clear();break;case 151:f.push(f.size());break;case 152:b=f.pop();h=f.pop();f.push(h+b);break;case 153:b=f.pop();h=f.pop();f.push(h-b);break;case 154:b=f.pop();h=f.pop();f.push(h*b);break;case 155:b=f.pop();h=f.pop();f.push(h/b|0);break;case 156:b=f.pop();h=
f.pop();f.push(h%b);break;case 157:b=f.pop();h=f.pop();f.push(h%b);f.push(h/b|0);break;case 158:a=W(f.pop());0>a&&(a=-a);f.push(a);break;case 159:a=-W(f.pop());f.push(a);break;case 160:b=f.pop();h=f.pop();f.push(h&b);break;case 161:b=f.pop();h=f.pop();f.push(h|b);break;case 162:b=f.pop();h=f.pop();f.push(h^b);break;case 163:a=f.pop();f.push(a^65535);break;case 164:b=f.pop();h=f.pop();f.push(h&&b?65535:0);break;case 165:b=f.pop();h=f.pop();f.push(h||b?65535:0);break;case 166:b=f.pop();h=f.pop();f.push(!h!=
!b?65535:0);break;case 167:a=f.pop();f.push(0==a?65535:0);break;case 168:b=f.pop();h=f.pop();f.push(h>b?65535:0);break;case 169:b=f.pop();h=f.pop();f.push(h<b?65535:0);break;case 170:b=W(f.pop());h=W(f.pop());f.push(h>b?65535:0);break;case 171:b=W(f.pop());h=W(f.pop());f.push(h<b?65535:0);break;case 172:b=f.pop();h=f.pop();f.push(h==b?65535:0);break;case 173:b=U(f.pop());h=U(f.pop());f.push(h==b?1:0);break;case 174:b=U(f.pop());a=U(f.pop());f.push(-1!=a.toLowerCase().indexOf(b.toLowerCase())?1:0);
break;case 175:b=U(f.pop());a=U(f.pop());b=new RegExp("\\b"+b+"\\b","i");f.push(b.test(a)?65535:0);break;case 176:a=W(x(d));d.seek(a,d.n);break;case 177:a=pd(v(d));d.seek(a,d.n);break;case 178:a=W(x(d));b=f.pop();0!=b&&d.seek(a,d.n);break;case 179:a=pd(v(d));b=f.pop();0!=b&&d.seek(a,d.n);break;case 180:a=W(x(d));b=f.pop();0==b&&d.seek(a,d.n);break;case 181:a=pd(v(d));b=f.pop();0==b&&d.seek(a,d.n);break;case 182:a=f.pop();b=f.pop();X[0].l.push({s:a,ca:b});break;case 183:b=f.pop();for(a=0;a<X[0].l.length;a++)X[0].l[a].ca==
b&&(X[0].l[a].s=0);break;case 184:b=f.pop();for(a=0;a<X[0].l.length;a++)X[0].l[a].s<=b&&(X[0].l[a].s=0);break;case 185:c=f.pop();for(a=0;a<X[0].l.length;a++)X[0].l[a].s>=c&&(X[0].l[a].s=0);break;case 186:b=f.pop();c=f.pop();for(a=0;a<X[0].l.length;a++)X[0].l[a].s>=c&&X[0].l[a].s<=b&&(X[0].l[a].s=0);break;case 187:a={state:new Pd,l:[],j:[void 0]};a.aa=f.pop();a.C=f.pop();a.target=f.pop();a.ma=f.pop();a.na=f.pop();X.unshift(a);if(Qd(!0))return!0;break;case 188:a=f.pop();X[0].j.unshift(void 0);if(Td(a))return!0;
X[0].j.shift();d=X[0].j[0];break;case 189:b=f.pop();G.push({id:2,val:b});break;case 190:a={};a.R=f.pop();a.Q=f.pop();G.push({id:8,val:a});Xb(a.Q,6,p(a.R,6));Xb(a.R,6,0);b=Bc(a.R,!0);for(c=0;c<b.length;c++)Xb(b[c],0,a.Q);break;case 191:G.push({id:14,val:X[0].C});break;case 192:G.push({id:13});break;case 193:a=f.pop();Fb.push({id:3,val:[X[0].target,X[0].C,a]});break;case 194:Fb.push({id:2});break;case 195:a=f.pop();Fb.push({id:3,val:[X[0].target,X[0].C,a]});Fb.push({id:2});break;case 196:a=f.pop();
Fb.push({id:2});Fb.push({id:3,val:[X[0].target,X[0].C,a]});Fb.push({id:2});break;case 197:a=f.pop();Fb.push({id:1,val:a});break;case 198:f.push(2);break;case 199:b=f.pop();Eb.push({id:1,val:b});break;case 200:b=f.pop();Eb.push({id:2,val:b});break;case 201:Eb.push({id:3});break;case 202:a=new Date;f.push(a.getFullYear());f.push(a.getMonth()+1);f.push(a.getDate());f.push(a.getHours());f.push(a.getMinutes());f.push(a.getSeconds());break;case 203:a=new Date;f.push(a.getDay()+1);break;case 204:a=0!=f.pop();
b=f.pop();b=Bc(b,a);for(a=0;a<b.length;a++)f.push(b[a]);f.push(b.length);break;case 205:a=0!=f.pop();b=f.pop();b=Bc(b,a);f.push(b.length);break;case 206:f.push(86);break;case 207:f.push(RELEASE);break;case 208:f.push(1);break;case 209:b=f.pop();a=ha(b);f.push(Math.round(a.width/2));f.push(Math.round(a.height/2));break;case 210:b=f.pop();h=f.pop();f.push(Yd(b,h));break;case 211:a=b=f.pop();b=[];c=Bc(p(a,0),1);for(h=0;h<c.length;h++)a<c[h]&&40<=Yd(c[h],a)&&b.push(c[h]);for(;b.length;)Xb(b.pop(),0,a);
break;case 212:b=f.pop();a=Bc(b,1);b=p(b,0);for(c=0;c<a.length;c++)Xb(a[c],0,b);break;case 213:return d=f.pop(),Qc(d),!0;case 214:Pc(f.pop());break;case 215:E=3;break;case 216:E=2;break;case 217:return d=f.pop(),setTimeout(Q,d/60*1E3),!0;case 218:return gc(!1),Nc(),Oc(),A=!0;case 219:pc();break;case 220:if(rc(!0))return!0;break;case 221:if(qc())return!0;break;case 222:if(gc(!0))return!0;break;case 223:return d=f.pop(),Nd(),setTimeout(Zd,d/60*1E3),!0;case 224:f.pop();break;case 225:f.pop();break;case 226:b=
f.pop();h=f.pop();h*=b;a=f.pop();h/=a;f.push(h|0);break;case 227:b=f.pop();a=void 0;if(a=p(1,0)==b?I:zc(b))wc(b),pc(),P(a);break;case 228:f.push(0);break;case 229:break;case 230:f.push(Wd);break;case 231:c=f.pop();b=1;for(a=Wd=0;a<c;a++)Wd+=b,Wd^=b,b^=Wd,Wd^=b;break;default:fatal("Unknown function:"+a.toString(16))}else f.push(a);return!1}function Zd(){Nd();Q()}function Xd(a,b,c){var d=0;a=Bc(a,c);for(c=0;c<a.length;c++)d+=p(a[c],b);return d}
function Yd(a,b){if(p(a,0)!=p(b,0))return 0;var c=ha(a),d=ha(b);return fa(d,c,d)?d.width*d.height*100/(c.width*c.height)|0:0};function C(a,b,c,d){switch(c&255){case 2:return new $d(a,b,d);case 10:return new ae(a,b,d);case 15:return new be(a,b,d);case 17:return new ce(a,b,d);case 22:return new de(a,b,d);case 23:return new ee(a,b);case 24:return new fe(a,b,d);case 25:return new ge(a,b,d);default:fatal("Unknown control:"+c.toString(16))}}
function $d(a,b,c){var d=this,e=$(document.createElement("canvas"));e.addClass("cbutton");e.css("left",a[0]+"px");e.css("top",a[1]+"px");e.attr("width",a[2]);e.attr("height",a[3]);e.mousedown(function(a){bd(d,a);return!1});this.b=e;this.p=b;this.selected=!1;this.qa=c[0];this.g=c[1];this.va=c[2]}m=$d.prototype;m.hide=function(){this.b.hide()};m.show=function(){this.b.show();this.k()};
m.k=function(){var a=this.b.get(0).getContext("2d"),b=this.b.width(),c=this.b.height(),d=a.getImageData(0,0,b,c),e=this.selected?this.va:this.g;if(e)for(var g=0;g<c;g++)for(var k=(g>>1)*this.qa,h=g*d.width*4,f,l=0;l<b;l++)f=e.charCodeAt(k+(l>>2)),f=3*(f>>(l&2?0:4)&15),d.data[h++]=w[f++],d.data[h++]=w[f++],d.data[h++]=w[f++],d.data[h++]=255;else for(g=0;g<c;g++)for(h=g*d.width*4,l=0;l<b;l++){f=this.selected?0:255;if(2>g||4>l||g>c-3||l>b-5)f=0;d.data[h++]=f;d.data[h++]=f;d.data[h++]=f;d.data[h++]=255}a.putImageData(d,
0,0)};m.select=function(){this.selected=!0;this.k()};m.K=function(){this.selected=!1;this.k()};function ae(a,b,c){var d=this,e=$(document.createElement("div"));e.addClass("button");e.css("left",a[0]+"px");e.css("top",a[1]+"px");e.css("width",a[2]+"px");e.css("height",a[3]+"px");e.css("line-height",a[3]+"px");e.html(c[0]);e.mousedown(function(a){bd(d,a);return!1});this.b=e;this.p=b}ae.prototype.hide=function(){this.b.hide()};ae.prototype.show=function(){this.b.show()};ae.prototype.k=function(){};
function be(a,b,c){this.b=$(document.createElement("div"));this.b.addClass("textblock");this.b.css("left",a[0]+"px");this.b.css("top",a[1]+"px");this.b.css("width",a[2]+"px");this.b.css("height",a[3]+"px");this.p=b;this.T(c[0])}m=be.prototype;m.U=function(){return this.b.html()};m.T=function(a){this.b.html(a)};m.hide=function(){this.b.hide()};m.show=function(){this.b.show()};m.k=function(){};
function ce(a,b,c){var d=$(document.createElement("input"));d.addClass("textinput");d.css("left",a[0]+"px");d.css("top",a[1]+"px");d.css("width",a[2]+"px");d.css("height",a[3]+"px");d.val(c[0]);d.mousedown(function(){d.focus();return!1});this.b=d;this.p=b}ce.prototype.hide=function(){this.b.hide()};ce.prototype.show=function(){this.b.show();this.b.focus()};ce.prototype.k=function(){};
function de(a,b,c){this.b=$(document.createElement("div"));this.b.addClass("textblock");this.b.css("left",a[0]+"px");this.b.css("top",a[1]+"px");this.b.css("width",a[2]+"px");this.b.css("height",a[3]+"px");this.p=b;this.T(c[0])}m=de.prototype;m.hide=function(){this.b.hide()};m.show=function(){this.b.show()};m.k=function(){};m.U=function(){return this.b.html()};
m.T=function(a){for(var b="",c=0;c<a.length;c++)1==a.charCodeAt(c)?(74==a.charCodeAt(c+1)&&this.b.css("text-align","center"),c+=2):b=13==a.charCodeAt(c)?b+"<br />":b+a.charAt(c);this.b.html(b)};function ee(a,b){this.b=$(document.createElement("div"));this.b.addClass("list");this.b.css("left",a[0]+"px");this.b.css("top",a[1]+"px");this.b.css("width",a[2]+"px");this.b.css("height",a[3]+"px");this.p=b}ee.prototype.hide=function(){this.b.hide()};ee.prototype.show=function(){this.b.show()};
ee.prototype.k=function(){};
function fe(a,b,c){var d=this;this.value=parseInt(c[0],10);this.p=b;this.min=parseInt(c[1],10);this.max=parseInt(c[2],10);this.width=a[2];b=$(document.createElement("div"));b.addClass("hscroll");b.css("left",a[0]+"px");b.css("top",a[1]+"px");b.css("width",a[2]+"px");b.css("height",a[3]+"px");this.b=b;c=$(document.createElement("div"));c.addClass("leftarrow");c.css("top","0px");c.css("left","0px");b.append(c);var e=$(document.createElement("div"));e.addClass("rightarrow");e.css("top","0px");e.css("left",
a[2]-Ra+"px");b.append(e);var g=$(document.createElement("div"));g.addClass("slider");g.css("top","0px");g.css("left","50px");g.css("width","20px");b.append(g);this.wa=g;b.mousedown(function(a){var b=g.offset().left;Math.floor(a.pageX/pageZoom)<b?he(d,-20):he(d,20);return!1});c.mousedown(function(){he(d,-5);return!1});e.mousedown(function(){he(d,5);return!1});g.mousedown(function(a){ie(d,Math.floor(a.pageX/pageZoom));return!1})}fe.prototype.hide=function(){this.b.hide()};
fe.prototype.show=function(){this.b.show();this.k()};fe.prototype.k=function(){this.wa.css("left",(this.value*(this.width-Sa-Ra-20-Ta)/(this.max-this.min)|0)+Sa+"px")};function od(a,b){a.value=parseInt(b,10);a.k()}function he(a,b){a.value+=b;a.value<a.min&&(a.value=a.min);a.value>a.max&&(a.value=a.max);a.k();var c=setTimeout(function(){he(a,b)},50);$(document).mouseup(function(){$(document).unbind("mouseup");clearTimeout(c)})}
function ie(a,b){var c=b;$(document).mousemove(function(b){var e=(Math.floor(b.pageX/pageZoom)-c)*(a.max-a.min)/(a.width-Sa-Ra-20-Ta)|0;c=Math.floor(b.pageX/pageZoom);a.value+=e;a.value<a.min&&(a.value=a.min);a.value>a.max&&(a.value=a.max);a.k()});$(document).mouseup(function(){$(document).unbind("mouseup");$(document).unbind("mousemove")})}
function ge(a,b,c){var d=this,e=$(document.createElement("div"));e.addClass("sbutton");e.css("left",a[0]+"px");e.css("top",a[1]+"px");e.css("width",a[2]-2+"px");e.css("height",a[3]-2+"px");e.html(c[0]);e.mousedown(function(a){bd(d,a);return!1});this.b=e;this.p=b}m=ge.prototype;m.hide=function(){this.b.hide()};m.show=function(){this.b.show()};m.select=function(){this.b.addClass("active")};m.K=function(){this.b.removeClass("active")};m.k=function(){};var Hb=!0,Gb=void 0,Rc="",Jc=void 0,Kc=void 0;
function U(a){if(Hb){if(a&32768)a=Rc;else{a=new wa(jb(2,a));for(var b=!1,c="",d=x(a);d--;){var e=a.g(5);if(0<e&&27>e)e|=64,b&&(e|=32),b=!0,c+=String.fromCharCode(e);else switch(e){case 0:c+=" ";break;case 27:c+=b?".":",";b=!0;break;case 28:c+=b?"'":'"';b=!0;break;case 29:b=a.g(16);b&32768?(b^=65535,b=je(b)):b=U(b);b&&(c+=b);b=!0;break;case 30:c+=String.fromCharCode(a.g(8));b=!0;break;case 31:b=!b}}a=ba(c)}return a}if(a&32768)return Rc;a=new wa(jb(2,a));d="";for(c=a.g(1)?a.g(15):a.g(7);c--;){b=qb(a);
b>>=16-a.m;b&=65535;for(e=0;e<Gb.length-1&&!(b<Gb.ja[e]);e++);a.m+=Gb.ia[e];a.m&16&&(a.m&=15,a.seek(2,a.n));b=Gb.oa[e];1==b&&(b=a.g(7));2!=b?d+=String.fromCharCode(b):(a.g(1)?(b=a.g(15),b=U(b)):(b=a.g(8),b=je(b)),b&&(d+=b))}return ba(d)}function je(a){var b,c;b=a&8?Kc:Jc;if(1==(a&3))b=p(b,7),c=["he","she","it"][(b>>4&3)+1-1];else switch(c=U(b),a&3){case 2:c=ke(0,b)+c;break;case 3:c=ke(2,b)+c}c.length&&a&4&&(c=c.substr(0,1).toUpperCase()+c.substr(1));return c}
function ke(a,b){var c=p(b,7)>>a&3;return c?["the ","a ","an "][c-1]:""};function jb(a,b){if(b>=ub[a].O)return"";var c,d;ub[a].ga?(c=ub[a].ha[b],d=ub[a].la[b]):(c=ub[a].ua,d=b*c);return c?ub[a].data.substring(d,d+c):""}var ub=[];var mb=!1,nb=!1;try{var le=document.createElement("audio").canPlayType("audio/wav"),mb=""!=le&&"no"!=le}catch(me){}function kb(a,b){this.data=Array(a);this.B=a;this.N=b}kb.prototype.time=function(){return this.B/this.N};kb.prototype.play=function(){var a=$(document.createElement("audio"));$(document.body).append(a);a.attr("src","data:audio/x-wav;base64,"+ne(this));var b=nd();null==b&&(b=50);a.attr("volume",b/100);a.bind("ended",function(){a.remove()});a.get(0).play()};
function ne(a){var b=Array(44+a.B);b[0]=82;b[1]=73;b[2]=70;b[3]=70;var c=36+a.B;b[4]=c&255;b[5]=c>>8&255;b[6]=c>>16&255;b[7]=c>>24&255;b[8]=87;b[9]=65;b[10]=86;b[11]=69;b[12]=102;b[13]=109;b[14]=116;b[15]=32;b[16]=16;b[17]=0;b[18]=0;b[19]=0;b[20]=1;b[21]=0;b[22]=1;b[23]=0;b[24]=a.N&255;b[25]=a.N>>8&255;b[26]=a.N>>16&255;b[27]=a.N>>24&255;b[28]=b[24];b[29]=b[25];b[30]=b[26];b[31]=b[27];b[32]=1;b[33]=0;b[34]=8;b[35]=0;b[36]=100;b[37]=97;b[38]=116;b[39]=97;b[40]=a.B&255;b[41]=a.B>>8&255;b[42]=a.B>>16&
255;b[43]=a.B>>24&255;for(c=0;c<a.B;c++)b[44+c]=a.data[c];a="";var d,e,g,k=0;do d=b[k++],e=b[k++],g=b[k++],c=d>>2,d=(d&3)<<4,void 0==e?e=g=64:void 0==g?(d|=e>>4,e=(e&15)<<2,g=64):(d|=e>>4,e=(e&15)<<2|g>>6,g&=63),a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g);
while(k<b.length);return a};var oe=document.createElement("link");oe.type="text/css";oe.rel="stylesheet";oe.href="gs.css";$("head").append(oe);aa=$(document.createElement("img"));aa.attr("src","images/gs/start.png");aa.css("width","100%");aa.css("height","100%");desktop.append(aa);
$.ajax({url:gamename,beforeSend:function(a){a.overrideMimeType("text/html; charset=x-user-defined")},complete:function(a){a=new wa(a.responseText);var b=a.data.substring(a.f,a.f+4);a.f+=4;"2IMG"!=b&&fatal("Not a valid 2mg file");a.seek(12,a.set);1!=ta(a)&&fatal("Not in ProDOS format");a.seek(20,a.set);var b=512*ta(a),c=ta(a);a.seek(c,a.set);r=new wa(sa(a,b));delete a}});setTimeout(rb,10);