var Prototype={Version:"1.6.1",Browser:(function(){var b=navigator.userAgent;var a=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!a,Opera:a,WebKit:b.indexOf("AppleWebKit/")>-1,Gecko:b.indexOf("Gecko")>-1&&b.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(b)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var a=window.Element||window.HTMLElement;return !!(a&&a.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var c=document.createElement("div");var b=document.createElement("form");var a=false;if(c.__proto__&&(c.__proto__!==b.__proto__)){a=true}c=b=null;return a})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Abstract={};var Try={these:function(){var c;for(var b=0,d=arguments.length;b<d;b++){var a=arguments[b];try{c=a();break}catch(f){}}return c}};var Class=(function(){function a(){}function b(){var g=null,f=$A(arguments);if(Object.isFunction(f[0])){g=f.shift()}function d(){this.initialize.apply(this,arguments)}Object.extend(d,Class.Methods);d.superclass=g;d.subclasses=[];if(g){a.prototype=g.prototype;d.prototype=new a;g.subclasses.push(d)}for(var e=0;e<f.length;e++){d.addMethods(f[e])}if(!d.prototype.initialize){d.prototype.initialize=Prototype.emptyFunction}d.prototype.constructor=d;return d}function c(k){var f=this.superclass&&this.superclass.prototype;var e=Object.keys(k);if(!Object.keys({toString:true}).length){if(k.toString!=Object.prototype.toString){e.push("toString")}if(k.valueOf!=Object.prototype.valueOf){e.push("valueOf")}}for(var d=0,g=e.length;d<g;d++){var j=e[d],h=k[j];if(f&&Object.isFunction(h)&&h.argumentNames().first()=="$super"){var l=h;h=(function(i){return function(){return f[i].apply(this,arguments)}})(j).wrap(l);h.valueOf=l.valueOf.bind(l);h.toString=l.toString.bind(l)}this.prototype[j]=h}return this}return{create:b,Methods:{addMethods:c}}})();(function(){var d=Object.prototype.toString;function i(q,s){for(var r in s){q[r]=s[r]}return q}function l(q){try{if(e(q)){return"undefined"}if(q===null){return"null"}return q.inspect?q.inspect():String(q)}catch(r){if(r instanceof RangeError){return"..."}throw r}}function k(q){var s=typeof q;switch(s){case"undefined":case"function":case"unknown":return;case"boolean":return q.toString()}if(q===null){return"null"}if(q.toJSON){return q.toJSON()}if(h(q)){return}var r=[];for(var u in q){var t=k(q[u]);if(!e(t)){r.push(u.toJSON()+": "+t)}}return"{"+r.join(", ")+"}"}function c(q){return $H(q).toQueryString()}function f(q){return q&&q.toHTML?q.toHTML():String.interpret(q)}function o(q){var r=[];for(var s in q){r.push(s)}return r}function m(q){var r=[];for(var s in q){r.push(q[s])}return r}function j(q){return i({},q)}function h(q){return !!(q&&q.nodeType==1)}function g(q){return d.call(q)=="[object Array]"}function p(q){return q instanceof Hash}function b(q){return typeof q==="function"}function a(q){return d.call(q)=="[object String]"}function n(q){return d.call(q)=="[object Number]"}function e(q){return typeof q==="undefined"}i(Object,{extend:i,inspect:l,toJSON:k,toQueryString:c,toHTML:f,keys:o,values:m,clone:j,isElement:h,isArray:g,isHash:p,isFunction:b,isString:a,isNumber:n,isUndefined:e})})();Object.extend(Function.prototype,(function(){var k=Array.prototype.slice;function d(o,l){var n=o.length,m=l.length;while(m--){o[n+m]=l[m]}return o}function i(m,l){m=k.call(m,0);return d(m,l)}function g(){var l=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return l.length==1&&!l[0]?[]:l}function h(n){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var l=this,m=k.call(arguments,1);return function(){var o=i(m,arguments);return l.apply(n,o)}}function f(n){var l=this,m=k.call(arguments,1);return function(p){var o=d([p||window.event],m);return l.apply(n,o)}}function j(){if(!arguments.length){return this}var l=this,m=k.call(arguments,0);return function(){var n=i(m,arguments);return l.apply(this,n)}}function e(n){var l=this,m=k.call(arguments,1);n=n*1000;return window.setTimeout(function(){return l.apply(l,m)},n)}function a(){var l=d([0.01],arguments);return this.delay.apply(this,l)}function c(m){var l=this;return function(){var n=d([l.bind(this)],arguments);return m.apply(this,n)}}function b(){if(this._methodized){return this._methodized}var l=this;return this._methodized=function(){var m=d([this],arguments);return l.apply(null,m)}}return{argumentNames:g,bind:h,bindAsEventListener:f,curry:j,delay:e,defer:a,wrap:c,methodize:b}})());Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+'Z"'};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(b,a){this.callback=b;this.frequency=a;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer){return}clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=false}catch(a){this.currentlyExecuting=false;throw a}}}});Object.extend(String,{interpret:function(a){return a==null?"":String(a)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,(function(){function prepareReplacement(replacement){if(Object.isFunction(replacement)){return replacement}var template=new Template(replacement);return function(match){return template.evaluate(match)}}function gsub(pattern,replacement){var result="",source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern)){pattern=RegExp.escape(pattern)}if(!(pattern.length||pattern.source)){replacement=replacement("");return replacement+source.split("").join(replacement)+replacement}while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length)}else{result+=source,source=""}}return result}function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0){return match[0]}return replacement(match)})}function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this)}function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?"...":truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this)}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"")}function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,"img");var matchOne=new RegExp(Prototype.ScriptFragment,"im");return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||["",""])[1]})}function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}function escapeHTML(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function unescapeHTML(){return this.stripTags().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match){return{}}return match[1].split(separator||"&").inject({},function(hash,pair){if((pair=pair.split("="))[0]){var key=decodeURIComponent(pair.shift());var value=pair.length>1?pair.join("="):pair[0];if(value!=undefined){value=decodeURIComponent(value)}if(key in hash){if(!Object.isArray(hash[key])){hash[key]=[hash[key]]}hash[key].push(value)}else{hash[key]=value}}return hash})}function toArray(){return this.split("")}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function times(count){return count<1?"":new Array(count+1).join(this)}function camelize(){var parts=this.split("-"),len=parts.length;if(len==1){return parts[0]}var camelized=this.charAt(0)=="-"?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++){camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1)}return camelized}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function underscore(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()}function dasherize(){return this.replace(/_/g,"-")}function inspect(useDoubleQuotes){var escapedString=this.replace(/[\x00-\x1f\\]/g,function(character){if(character in String.specialChar){return String.specialChar[character]}return"\\u00"+character.charCodeAt().toPaddedString(2,16)});if(useDoubleQuotes){return'"'+escapedString.replace(/"/g,'\\"')+'"'}return"'"+escapedString.replace(/'/g,"\\'")+"'"}function toJSON(){return this.inspect(true)}function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,"$1")}function isJSON(){var str=this;if(str.blank()){return false}str=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern){return this.indexOf(pattern)===0}function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===d}function empty(){return this==""}function blank(){return/^\s*$/.test(this)}function interpolate(object,pattern){return new Template(this,pattern).evaluate(object)}return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim?String.prototype.trim:strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,toJSON:toJSON,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate}})());var Template=Class.create({initialize:function(a,b){this.template=a.toString();this.pattern=b||Template.Pattern},evaluate:function(a){if(a&&Object.isFunction(a.toTemplateReplacements)){a=a.toTemplateReplacements()}return this.template.gsub(this.pattern,function(d){if(a==null){return(d[1]+"")}var f=d[1]||"";if(f=="\\"){return d[2]}var b=a,g=d[3];var e=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;d=e.exec(g);if(d==null){return f}while(d!=null){var c=d[1].startsWith("[")?d[2].replace(/\\\\]/g,"]"):d[1];b=b[c];if(null==b||""==d[3]){break}g=g.substring("["==d[3]?d[1].length:d[0].length);d=e.exec(g)}return f+String.interpret(b)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function c(y,x){var w=0;try{this._each(function(A){y.call(x,A,w++)})}catch(z){if(z!=$break){throw z}}return this}function r(z,y,x){var w=-z,A=[],B=this.toArray();if(z<1){return B}while((w+=z)<B.length){A.push(B.slice(w,w+z))}return A.collect(y,x)}function b(y,x){y=y||Prototype.K;var w=true;this.each(function(A,z){w=w&&!!y.call(x,A,z);if(!w){throw $break}});return w}function i(y,x){y=y||Prototype.K;var w=false;this.each(function(A,z){if(w=!!y.call(x,A,z)){throw $break}});return w}function j(y,x){y=y||Prototype.K;var w=[];this.each(function(A,z){w.push(y.call(x,A,z))});return w}function t(y,x){var w;this.each(function(A,z){if(y.call(x,A,z)){w=A;throw $break}});return w}function h(y,x){var w=[];this.each(function(A,z){if(y.call(x,A,z)){w.push(A)}});return w}function g(z,y,x){y=y||Prototype.K;var w=[];if(Object.isString(z)){z=new RegExp(RegExp.escape(z))}this.each(function(B,A){if(z.match(B)){w.push(y.call(x,B,A))}});return w}function a(w){if(Object.isFunction(this.indexOf)){if(this.indexOf(w)!=-1){return true}}var x=false;this.each(function(y){if(y==w){x=true;throw $break}});return x}function q(x,w){w=Object.isUndefined(w)?null:w;return this.eachSlice(x,function(y){while(y.length<x){y.push(w)}return y})}function l(w,y,x){this.each(function(A,z){w=y.call(x,w,A,z)});return w}function v(x){var w=$A(arguments).slice(1);return this.map(function(y){return y[x].apply(y,w)})}function p(y,x){y=y||Prototype.K;var w;this.each(function(A,z){A=y.call(x,A,z);if(w==null||A>=w){w=A}});return w}function n(y,x){y=y||Prototype.K;var w;this.each(function(A,z){A=y.call(x,A,z);if(w==null||A<w){w=A}});return w}function e(z,x){z=z||Prototype.K;var y=[],w=[];this.each(function(B,A){(z.call(x,B,A)?y:w).push(B)});return[y,w]}function f(x){var w=[];this.each(function(y){w.push(y[x])});return w}function d(y,x){var w=[];this.each(function(A,z){if(!y.call(x,A,z)){w.push(A)}});return w}function m(x,w){return this.map(function(z,y){return{value:z,criteria:x.call(w,z,y)}}).sort(function(B,A){var z=B.criteria,y=A.criteria;return z<y?-1:z>y?1:0}).pluck("value")}function o(){return this.map()}function s(){var x=Prototype.K,w=$A(arguments);if(Object.isFunction(w.last())){x=w.pop()}var y=[this].concat(w).map($A);return this.map(function(A,z){return x(y.pluck(z))})}function k(){return this.toArray().length}function u(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:c,eachSlice:r,all:b,every:b,any:i,some:i,collect:j,map:j,detect:t,findAll:h,select:h,filter:h,grep:g,include:a,member:a,inGroupsOf:q,inject:l,invoke:v,max:p,min:n,partition:e,pluck:f,reject:d,sortBy:m,toArray:o,entries:o,zip:s,size:k,inspect:u,find:t}})();function $A(c){if(!c){return[]}if("toArray" in Object(c)){return c.toArray()}var b=c.length||0,a=new Array(b);while(b--){a[b]=c[b]}return a}function $w(a){if(!Object.isString(a)){return[]}a=a.strip();return a?a.split(/\s+/):[]}Array.from=$A;(function(){var s=Array.prototype,m=s.slice,o=s.forEach;function b(w){for(var v=0,x=this.length;v<x;v++){w(this[v])}}if(!o){o=b}function l(){this.length=0;return this}function d(){return this[0]}function g(){return this[this.length-1]}function i(){return this.select(function(v){return v!=null})}function u(){return this.inject([],function(w,v){if(Object.isArray(v)){return w.concat(v.flatten())}w.push(v);return w})}function h(){var v=m.call(arguments,0);return this.select(function(w){return !v.include(w)})}function f(v){return(v!==false?this:this.toArray())._reverse()}function k(v){return this.inject([],function(y,x,w){if(0==w||(v?y.last()!=x:!y.include(x))){y.push(x)}return y})}function p(v){return this.uniq().findAll(function(w){return v.detect(function(x){return w===x})})}function q(){return m.call(this,0)}function j(){return this.length}function t(){return"["+this.map(Object.inspect).join(", ")+"]"}function r(){var v=[];this.each(function(w){var x=Object.toJSON(w);if(!Object.isUndefined(x)){v.push(x)}});return"["+v.join(", ")+"]"}function a(x,v){v||(v=0);var w=this.length;if(v<0){v=w+v}for(;v<w;v++){if(this[v]===x){return v}}return -1}function n(w,v){v=isNaN(v)?this.length:(v<0?this.length+v:v)+1;var x=this.slice(0,v).reverse().indexOf(w);return(x<0)?x:v-x-1}function c(){var A=m.call(this,0),y;for(var w=0,x=arguments.length;w<x;w++){y=arguments[w];if(Object.isArray(y)&&!("callee" in y)){for(var v=0,z=y.length;v<z;v++){A.push(y[v])}}else{A.push(y)}}return A}Object.extend(s,Enumerable);if(!s._reverse){s._reverse=s.reverse}Object.extend(s,{_each:o,clear:l,first:d,last:g,compact:i,flatten:u,without:h,reverse:f,uniq:k,intersect:p,clone:q,toArray:q,size:j,inspect:t,toJSON:r});var e=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(e){s.concat=c}if(!s.indexOf){s.indexOf=a}if(!s.lastIndexOf){s.lastIndexOf=n}})();function $H(a){return new Hash(a)}var Hash=Class.create(Enumerable,(function(){function e(q){this._object=Object.isHash(q)?q.toObject():Object.clone(q)}function f(r){for(var q in this._object){var s=this._object[q],t=[q,s];t.key=q;t.value=s;r(t)}}function k(q,r){return this._object[q]=r}function c(q){if(this._object[q]!==Object.prototype[q]){return this._object[q]}}function n(q){var r=this._object[q];delete this._object[q];return r}function p(){return Object.clone(this._object)}function o(){return this.pluck("key")}function m(){return this.pluck("value")}function g(r){var q=this.detect(function(s){return s.value===r});return q&&q.key}function i(q){return this.clone().update(q)}function d(q){return new Hash(q).inject(this,function(r,s){r.set(s.key,s.value);return r})}function b(q,r){if(Object.isUndefined(r)){return q}return q+"="+encodeURIComponent(String.interpret(r))}function a(){return this.inject([],function(s,t){var r=encodeURIComponent(t.key),q=t.value;if(q&&typeof q=="object"){if(Object.isArray(q)){return s.concat(q.map(b.curry(r)))}}else{s.push(b(r,q))}return s}).join("&")}function l(){return"#<Hash:{"+this.map(function(q){return q.map(Object.inspect).join(": ")}).join(", ")+"}>"}function j(){return Object.toJSON(this.toObject())}function h(){return new Hash(this)}return{initialize:e,_each:f,set:k,get:c,unset:n,toObject:p,toTemplateReplacements:p,keys:o,values:m,index:g,merge:i,update:d,toQueryString:a,inspect:l,toJSON:j,clone:h}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function d(){return this.toPaddedString(2,16)}function e(){return this+1}function a(k,j){$R(0,this,true).each(k,j);return this}function b(l,k){var j=this.toString(k||10);return"0".times(l-j.length)+j}function f(){return isFinite(this)?this.toString():"null"}function i(){return Math.abs(this)}function h(){return Math.round(this)}function g(){return Math.ceil(this)}function c(){return Math.floor(this)}return{toColorPart:d,succ:e,times:a,toPaddedString:b,toJSON:f,abs:i,round:h,ceil:g,floor:c}})());function $R(c,a,b){return new ObjectRange(c,a,b)}var ObjectRange=Class.create(Enumerable,(function(){function b(f,d,e){this.start=f;this.end=d;this.exclusive=e}function c(d){var e=this.start;while(this.include(e)){d(e);e=e.succ()}}function a(d){if(d<this.start){return false}if(this.exclusive){return d<this.end}return d<=this.end}return{initialize:b,_each:c,include:a}})());var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(a){this.responders._each(a)},register:function(a){if(!this.include(a)){this.responders.push(a)}},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(d,b,c,a){this.each(function(f){if(Object.isFunction(f[d])){try{f[d].apply(f,[b,c,a])}catch(g){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(a){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,a||{});this.options.method=this.options.method.toLowerCase();if(Object.isString(this.options.parameters)){this.options.parameters=this.options.parameters.toQueryParams()}else{if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()}}}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,b,a){$super(a);this.transport=Ajax.getTransport();this.request(b)},request:function(b){this.url=b;this.method=this.options.method;var d=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){d._method=this.method;this.method="post"}this.parameters=d;if(d=Object.toQueryString(d)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+d}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){d+="&_="}}}try{var a=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(a)}Ajax.Responders.dispatch("onCreate",this,a);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||d):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(c){this.dispatchException(c)}},onStateChange:function(){var a=this.transport.readyState;if(a>1&&!((a==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var e={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){e["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){e.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var c=this.options.requestHeaders;if(Object.isFunction(c.push)){for(var b=0,d=c.length;b<d;b+=2){e[c[b]]=c[b+1]}}else{$H(c).each(function(f){e[f.key]=f.value})}}for(var a in e){this.transport.setRequestHeader(a,e[a])}},success:function(){var a=this.getStatus();return !a||(a>=200&&a<300)},getStatus:function(){try{return this.transport.status||0}catch(a){return 0}},respondToReadyState:function(a){var c=Ajax.Request.Events[a],b=new Ajax.Response(this);if(c=="Complete"){try{this._complete=true;(this.options["on"+b.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(b,b.headerJSON)}catch(d){this.dispatchException(d)}var f=b.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&f&&f.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+c]||Prototype.emptyFunction)(b,b.headerJSON);Ajax.Responders.dispatch("on"+c,this,b,b.headerJSON)}catch(d){this.dispatchException(d)}if(c=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var a=this.url.match(/^\s*https?:\/\/[^\/]*/);return !a||(a[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))},getHeader:function(a){try{return this.transport.getResponseHeader(a)||null}catch(b){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(a){(this.options.onException||Prototype.emptyFunction)(this,a);Ajax.Responders.dispatch("onException",this,a)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(c){this.request=c;var d=this.transport=c.transport,a=this.readyState=d.readyState;if((a>2&&!Prototype.Browser.IE)||a==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(d.responseText);this.headerJSON=this._getHeaderJSON()}if(a==4){var b=d.responseXML;this.responseXML=Object.isUndefined(b)?null:b;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(a){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(a){return null}},getResponseHeader:function(a){return this.transport.getResponseHeader(a)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var a=this.getHeader("X-JSON");if(!a){return null}a=decodeURIComponent(escape(a));try{return a.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}},_getResponseJSON:function(){var a=this.request.options;if(!a.evalJSON||(a.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(a.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,a,c,b){this.container={success:(a.success||a),failure:(a.failure||(a.success?null:a))};b=Object.clone(b);var d=b.onComplete;b.onComplete=(function(e,f){this.updateContent(e.responseText);if(Object.isFunction(d)){d(e,f)}}).bind(this);$super(c,b)},updateContent:function(d){var c=this.container[this.success()?"success":"failure"],a=this.options;if(!a.evalScripts){d=d.stripScripts()}if(c=$(c)){if(a.insertion){if(Object.isString(a.insertion)){var b={};b[a.insertion]=d;c.insert(b)}else{a.insertion(c,d)}}else{c.update(d)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,a,c,b){$super(b);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=a;this.url=c;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},updateComplete:function(a){if(this.options.decay){this.decay=(a.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=a.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(b){if(arguments.length>1){for(var a=0,d=[],c=arguments.length;a<c;a++){d.push($(arguments[a]))}return d}if(Object.isString(b)){b=document.getElementById(b)}return Element.extend(b)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(f,a){var c=[];var e=document.evaluate(f,$(a)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var b=0,d=e.snapshotLength;b<d;b++){c.push(Element.extend(e.snapshotItem(b)))}return c}}if(!window.Node){var Node={}}if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}(function(c){var b=(function(){var f=document.createElement("form");var e=document.createElement("input");var d=document.documentElement;e.setAttribute("name","test");f.appendChild(e);d.appendChild(f);var g=f.elements?(typeof f.elements.test=="undefined"):null;d.removeChild(f);f=e=null;return g})();var a=c.Element;c.Element=function(f,e){e=e||{};f=f.toLowerCase();var d=Element.cache;if(b&&e.name){f="<"+f+' name="'+e.name+'">';delete e.name;return Element.writeAttribute(document.createElement(f),e)}if(!d[f]){d[f]=Element.extend(document.createElement(f))}return Element.writeAttribute(d[f].cloneNode(false),e)};Object.extend(c.Element,a||{});if(a){c.Element.prototype=a.prototype}})(this);Element.cache={};Element.idCounter=1;Element.Methods={visible:function(a){return $(a).style.display!="none"},toggle:function(a){a=$(a);Element[Element.visible(a)?"hide":"show"](a);return a},hide:function(a){a=$(a);a.style.display="none";return a},show:function(a){a=$(a);a.style.display="";return a},remove:function(a){a=$(a);a.parentNode.removeChild(a);return a},update:(function(){var b=(function(){var e=document.createElement("select"),f=true;e.innerHTML='<option value="test">test</option>';if(e.options&&e.options[0]){f=e.options[0].nodeName.toUpperCase()!=="OPTION"}e=null;return f})();var a=(function(){try{var f=document.createElement("table");if(f&&f.tBodies){f.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var h=typeof f.tBodies[0]=="undefined";f=null;return h}}catch(g){return true}})();var d=(function(){var f=document.createElement("script"),h=false;try{f.appendChild(document.createTextNode(""));h=!f.firstChild||f.firstChild&&f.firstChild.nodeType!==3}catch(g){h=true}f=null;return h})();function c(f,g){f=$(f);if(g&&g.toElement){g=g.toElement()}if(Object.isElement(g)){return f.update().insert(g)}g=Object.toHTML(g);var e=f.tagName.toUpperCase();if(e==="SCRIPT"&&d){f.text=g;return f}if(b||a){if(e in Element._insertionTranslations.tags){while(f.firstChild){f.removeChild(f.firstChild)}Element._getContentFromAnonymousElement(e,g.stripScripts()).each(function(h){f.appendChild(h)})}else{f.innerHTML=g.stripScripts()}}else{f.innerHTML=g.stripScripts()}g.evalScripts.bind(g).defer();return f}return c})(),replace:function(b,c){b=$(b);if(c&&c.toElement){c=c.toElement()}else{if(!Object.isElement(c)){c=Object.toHTML(c);var a=b.ownerDocument.createRange();a.selectNode(b);c.evalScripts.bind(c).defer();c=a.createContextualFragment(c.stripScripts())}}b.parentNode.replaceChild(c,b);return b},insert:function(c,e){c=$(c);if(Object.isString(e)||Object.isNumber(e)||Object.isElement(e)||(e&&(e.toElement||e.toHTML))){e={bottom:e}}var d,f,b,g;for(var a in e){d=e[a];a=a.toLowerCase();f=Element._insertionTranslations[a];if(d&&d.toElement){d=d.toElement()}if(Object.isElement(d)){f(c,d);continue}d=Object.toHTML(d);b=((a=="before"||a=="after")?c.parentNode:c).tagName.toUpperCase();g=Element._getContentFromAnonymousElement(b,d.stripScripts());if(a=="top"||a=="after"){g.reverse()}g.each(f.curry(c));d.evalScripts.bind(d).defer()}return c},wrap:function(b,c,a){b=$(b);if(Object.isElement(c)){$(c).writeAttribute(a||{})}else{if(Object.isString(c)){c=new Element(c,a)}else{c=new Element("div",c)}}if(b.parentNode){b.parentNode.replaceChild(c,b)}c.appendChild(b);return c},inspect:function(b){b=$(b);var a="<"+b.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(f){var e=f.first(),c=f.last();var d=(b[e]||"").toString();if(d){a+=" "+c+"="+d.inspect(true)}});return a+">"},recursivelyCollect:function(a,c){a=$(a);var b=[];while(a=a[c]){if(a.nodeType==1){b.push(Element.extend(a))}}return b},ancestors:function(a){return Element.recursivelyCollect(a,"parentNode")},descendants:function(a){return Element.select(a,"*")},firstDescendant:function(a){a=$(a).firstChild;while(a&&a.nodeType!=1){a=a.nextSibling}return $(a)},immediateDescendants:function(a){if(!(a=$(a).firstChild)){return[]}while(a&&a.nodeType!=1){a=a.nextSibling}if(a){return[a].concat($(a).nextSiblings())}return[]},previousSiblings:function(a){return Element.recursivelyCollect(a,"previousSibling")},nextSiblings:function(a){return Element.recursivelyCollect(a,"nextSibling")},siblings:function(a){a=$(a);return Element.previousSiblings(a).reverse().concat(Element.nextSiblings(a))},match:function(b,a){if(Object.isString(a)){a=new Selector(a)}return a.match($(b))},up:function(b,d,a){b=$(b);if(arguments.length==1){return $(b.parentNode)}var c=Element.ancestors(b);return Object.isNumber(d)?c[d]:Selector.findElement(c,d,a)},down:function(b,c,a){b=$(b);if(arguments.length==1){return Element.firstDescendant(b)}return Object.isNumber(c)?Element.descendants(b)[c]:Element.select(b,c)[a||0]},previous:function(b,d,a){b=$(b);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(b))}var c=Element.previousSiblings(b);return Object.isNumber(d)?c[d]:Selector.findElement(c,d,a)},next:function(c,d,b){c=$(c);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(c))}var a=Element.nextSiblings(c);return Object.isNumber(d)?a[d]:Selector.findElement(a,d,b)},select:function(b){var a=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(b,a)},adjacent:function(b){var a=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(b.parentNode,a).without(b)},identify:function(a){a=$(a);var b=Element.readAttribute(a,"id");if(b){return b}do{b="anonymous_element_"+Element.idCounter++}while($(b));Element.writeAttribute(a,"id",b);return b},readAttribute:function(c,a){c=$(c);if(Prototype.Browser.IE){var b=Element._attributeTranslations.read;if(b.values[a]){return b.values[a](c,a)}if(b.names[a]){a=b.names[a]}if(a.include(":")){return(!c.attributes||!c.attributes[a])?null:c.attributes[a].value}}return c.getAttribute(a)},writeAttribute:function(e,c,f){e=$(e);var b={},d=Element._attributeTranslations.write;if(typeof c=="object"){b=c}else{b[c]=Object.isUndefined(f)?true:f}for(var a in b){c=d.names[a]||a;f=b[a];if(d.values[a]){c=d.values[a](e,f)}if(f===false||f===null){e.removeAttribute(c)}else{if(f===true){e.setAttribute(c,c)}else{e.setAttribute(c,f)}}}return e},getHeight:function(a){return Element.getDimensions(a).height},getWidth:function(a){return Element.getDimensions(a).width},classNames:function(a){return new Element.ClassNames(a)},hasClassName:function(a,b){if(!(a=$(a))){return}var c=a.className;return(c.length>0&&(c==b||new RegExp("(^|\\s)"+b+"(\\s|$)").test(c)))},addClassName:function(a,b){if(!(a=$(a))){return}if(!Element.hasClassName(a,b)){a.className+=(a.className?" ":"")+b}return a},removeClassName:function(a,b){if(!(a=$(a))){return}a.className=a.className.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," ").strip();return a},toggleClassName:function(a,b){if(!(a=$(a))){return}return Element[Element.hasClassName(a,b)?"removeClassName":"addClassName"](a,b)},cleanWhitespace:function(b){b=$(b);var c=b.firstChild;while(c){var a=c.nextSibling;if(c.nodeType==3&&!/\S/.test(c.nodeValue)){b.removeChild(c)}c=a}return b},empty:function(a){return $(a).innerHTML.blank()},descendantOf:function(b,a){b=$(b),a=$(a);if(b.compareDocumentPosition){return(b.compareDocumentPosition(a)&8)===8}if(a.contains){return a.contains(b)&&a!==b}while(b=b.parentNode){if(b==a){return true}}return false},scrollTo:function(a){a=$(a);var b=Element.cumulativeOffset(a);window.scrollTo(b[0],b[1]);return a},getStyle:function(b,c){b=$(b);c=c=="float"?"cssFloat":c.camelize();var d=b.style[c];if(!d||d=="auto"){var a=document.defaultView.getComputedStyle(b,null);d=a?a[c]:null}if(c=="opacity"){return d?parseFloat(d):1}return d=="auto"?null:d},getOpacity:function(a){return $(a).getStyle("opacity")},setStyle:function(b,c){b=$(b);var e=b.style,a;if(Object.isString(c)){b.style.cssText+=";"+c;return c.include("opacity")?b.setOpacity(c.match(/opacity:\s*(\d?\.?\d*)/)[1]):b}for(var d in c){if(d=="opacity"){b.setOpacity(c[d])}else{e[(d=="float"||d=="cssFloat")?(Object.isUndefined(e.styleFloat)?"cssFloat":"styleFloat"):d]=c[d]}}return b},setOpacity:function(a,b){a=$(a);a.style.opacity=(b==1||b==="")?"":(b<0.00001)?0:b;return a},getDimensions:function(c){c=$(c);var g=Element.getStyle(c,"display");if(g!="none"&&g!=null){return{width:c.offsetWidth,height:c.offsetHeight}}var b=c.style;var f=b.visibility;var d=b.position;var a=b.display;b.visibility="hidden";if(d!="fixed"){b.position="absolute"}b.display="block";var h=c.clientWidth;var e=c.clientHeight;b.display=a;b.position=d;b.visibility=f;return{width:h,height:e}},makePositioned:function(a){a=$(a);var b=Element.getStyle(a,"position");if(b=="static"||!b){a._madePositioned=true;a.style.position="relative";if(Prototype.Browser.Opera){a.style.top=0;a.style.left=0}}return a},undoPositioned:function(a){a=$(a);if(a._madePositioned){a._madePositioned=undefined;a.style.position=a.style.top=a.style.left=a.style.bottom=a.style.right=""}return a},makeClipping:function(a){a=$(a);if(a._overflow){return a}a._overflow=Element.getStyle(a,"overflow")||"auto";if(a._overflow!=="hidden"){a.style.overflow="hidden"}return a},undoClipping:function(a){a=$(a);if(!a._overflow){return a}a.style.overflow=a._overflow=="auto"?"":a._overflow;a._overflow=null;return a},cumulativeOffset:function(b){var a=0,c=0;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;b=b.offsetParent}while(b);return Element._returnOffset(c,a)},positionedOffset:function(b){var a=0,d=0;do{a+=b.offsetTop||0;d+=b.offsetLeft||0;b=b.offsetParent;if(b){if(b.tagName.toUpperCase()=="BODY"){break}var c=Element.getStyle(b,"position");if(c!=="static"){break}}}while(b);return Element._returnOffset(d,a)},absolutize:function(b){b=$(b);if(Element.getStyle(b,"position")=="absolute"){return b}var d=Element.positionedOffset(b);var f=d[1];var e=d[0];var c=b.clientWidth;var a=b.clientHeight;b._originalLeft=e-parseFloat(b.style.left||0);b._originalTop=f-parseFloat(b.style.top||0);b._originalWidth=b.style.width;b._originalHeight=b.style.height;b.style.position="absolute";b.style.top=f+"px";b.style.left=e+"px";b.style.width=c+"px";b.style.height=a+"px";return b},relativize:function(a){a=$(a);if(Element.getStyle(a,"position")=="relative"){return a}a.style.position="relative";var c=parseFloat(a.style.top||0)-(a._originalTop||0);var b=parseFloat(a.style.left||0)-(a._originalLeft||0);a.style.top=c+"px";a.style.left=b+"px";a.style.height=a._originalHeight;a.style.width=a._originalWidth;return a},cumulativeScrollOffset:function(b){var a=0,c=0;do{a+=b.scrollTop||0;c+=b.scrollLeft||0;b=b.parentNode}while(b);return Element._returnOffset(c,a)},getOffsetParent:function(a){if(a.offsetParent){return $(a.offsetParent)}if(a==document.body){return $(a)}while((a=a.parentNode)&&a!=document.body){if(Element.getStyle(a,"position")!="static"){return $(a)}}return $(document.body)},viewportOffset:function(d){var a=0,c=0;var b=d;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;if(b.offsetParent==document.body&&Element.getStyle(b,"position")=="absolute"){break}}while(b=b.offsetParent);b=d;do{if(!Prototype.Browser.Opera||(b.tagName&&(b.tagName.toUpperCase()=="BODY"))){a-=b.scrollTop||0;c-=b.scrollLeft||0}}while(b=b.parentNode);return Element._returnOffset(c,a)},clonePosition:function(b,d){var a=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});d=$(d);var e=Element.viewportOffset(d);b=$(b);var f=[0,0];var c=null;if(Element.getStyle(b,"position")=="absolute"){c=Element.getOffsetParent(b);f=Element.viewportOffset(c)}if(c==document.body){f[0]-=document.body.offsetLeft;f[1]-=document.body.offsetTop}if(a.setLeft){b.style.left=(e[0]-f[0]+a.offsetLeft)+"px"}if(a.setTop){b.style.top=(e[1]-f[1]+a.offsetTop)+"px"}if(a.setWidth){b.style.width=d.offsetWidth+"px"}if(a.setHeight){b.style.height=d.offsetHeight+"px"}return b}};Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(d,b,c){switch(c){case"left":case"top":case"right":case"bottom":if(d(b,"position")==="static"){return null}case"height":case"width":if(!Element.visible(b)){return null}var e=parseInt(d(b,c),10);if(e!==b["offset"+c.capitalize()]){return e+"px"}var a;if(c==="height"){a=["border-top-width","padding-top","padding-bottom","border-bottom-width"]}else{a=["border-left-width","padding-left","padding-right","border-right-width"]}return a.inject(e,function(f,g){var h=d(b,g);return h===null?f:f-parseInt(h,10)})+"px";default:return d(b,c)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(c,a,b){if(b==="title"){return a.title}return c(a,b)})}else{if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(c,b){b=$(b);try{b.offsetParent}catch(f){return $(document.body)}var a=b.getStyle("position");if(a!=="static"){return c(b)}b.setStyle({position:"relative"});var d=c(b);b.setStyle({position:a});return d});$w("positionedOffset viewportOffset").each(function(a){Element.Methods[a]=Element.Methods[a].wrap(function(f,c){c=$(c);try{c.offsetParent}catch(h){return Element._returnOffset(0,0)}var b=c.getStyle("position");if(b!=="static"){return f(c)}var d=c.getOffsetParent();if(d&&d.getStyle("position")==="fixed"){d.setStyle({zoom:1})}c.setStyle({position:"relative"});var g=f(c);c.setStyle({position:b});return g})});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(b,a){try{a.offsetParent}catch(c){return Element._returnOffset(0,0)}return b(a)});Element.Methods.getStyle=function(a,b){a=$(a);b=(b=="float"||b=="cssFloat")?"styleFloat":b.camelize();var c=a.style[b];if(!c&&a.currentStyle){c=a.currentStyle[b]}if(b=="opacity"){if(c=(a.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(c[1]){return parseFloat(c[1])/100}}return 1}if(c=="auto"){if((b=="width"||b=="height")&&(a.getStyle("display")!="none")){return a["offset"+b.capitalize()]+"px"}return null}return c};Element.Methods.setOpacity=function(b,e){function f(g){return g.replace(/alpha\([^\)]*\)/gi,"")}b=$(b);var a=b.currentStyle;if((a&&!a.hasLayout)||(!a&&b.style.zoom=="normal")){b.style.zoom=1}var d=b.getStyle("filter"),c=b.style;if(e==1||e===""){(d=f(d))?c.filter=d:c.removeAttribute("filter");return b}else{if(e<0.00001){e=0}}c.filter=f(d)+"alpha(opacity="+(e*100)+")";return b};Element._attributeTranslations=(function(){var b="className";var a="for";var c=document.createElement("div");c.setAttribute(b,"x");if(c.className!=="x"){c.setAttribute("class","x");if(c.className==="x"){b="class"}}c=null;c=document.createElement("label");c.setAttribute(a,"x");if(c.htmlFor!=="x"){c.setAttribute("htmlFor","x");if(c.htmlFor==="x"){a="htmlFor"}}c=null;return{read:{names:{"class":b,className:b,"for":a,htmlFor:a},values:{_getAttr:function(d,e){return d.getAttribute(e)},_getAttr2:function(d,e){return d.getAttribute(e,2)},_getAttrNode:function(d,f){var e=d.getAttributeNode(f);return e?e.value:""},_getEv:(function(){var d=document.createElement("div");d.onclick=Prototype.emptyFunction;var g=d.getAttribute("onclick");var e;if(String(g).indexOf("{")>-1){e=function(f,h){h=f.getAttribute(h);if(!h){return null}h=h.toString();h=h.split("{")[1];h=h.split("}")[0];return h.strip()}}else{if(g===""){e=function(f,h){h=f.getAttribute(h);if(!h){return null}return h.strip()}}}d=null;return e})(),_flag:function(d,e){return $(d).hasAttribute(e)?e:null},style:function(d){return d.style.cssText.toLowerCase()},title:function(d){return d.title}}}}})();Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(a,b){a.checked=!!b},style:function(a,b){a.style.cssText=b?b:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(a){Element._attributeTranslations.write.names[a.toLowerCase()]=a;Element._attributeTranslations.has[a.toLowerCase()]=a});(function(a){Object.extend(a,{href:a._getAttr2,src:a._getAttr2,type:a._getAttr,action:a._getAttrNode,disabled:a._flag,checked:a._flag,readonly:a._flag,multiple:a._flag,onload:a._getEv,onunload:a._getEv,onclick:a._getEv,ondblclick:a._getEv,onmousedown:a._getEv,onmouseup:a._getEv,onmouseover:a._getEv,onmousemove:a._getEv,onmouseout:a._getEv,onfocus:a._getEv,onblur:a._getEv,onkeypress:a._getEv,onkeydown:a._getEv,onkeyup:a._getEv,onsubmit:a._getEv,onreset:a._getEv,onselect:a._getEv,onchange:a._getEv})})(Element._attributeTranslations.read.values);if(Prototype.BrowserFeatures.ElementExtensions){(function(){function a(e){var b=e.getElementsByTagName("*"),d=[];for(var c=0,f;f=b[c];c++){if(f.tagName!=="!"){d.push(f)}}return d}Element.Methods.down=function(c,d,b){c=$(c);if(arguments.length==1){return c.firstDescendant()}return Object.isNumber(d)?a(c)[d]:Element.select(c,d)[b||0]}})()}}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=(b==1)?0.999999:(b==="")?"":(b<0.00001)?0:b;return a}}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=(b==1||b==="")?"":(b<0.00001)?0:b;if(b==1){if(a.tagName.toUpperCase()=="IMG"&&a.width){a.width++;a.width--}else{try{var d=document.createTextNode(" ");a.appendChild(d);a.removeChild(d)}catch(c){}}}return a};Element.Methods.cumulativeOffset=function(b){var a=0,c=0;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;if(b.offsetParent==document.body){if(Element.getStyle(b,"position")=="absolute"){break}}b=b.offsetParent}while(b);return Element._returnOffset(c,a)}}}}}if("outerHTML" in document.documentElement){Element.Methods.replace=function(c,e){c=$(c);if(e&&e.toElement){e=e.toElement()}if(Object.isElement(e)){c.parentNode.replaceChild(e,c);return c}e=Object.toHTML(e);var d=c.parentNode,b=d.tagName.toUpperCase();if(Element._insertionTranslations.tags[b]){var f=c.next();var a=Element._getContentFromAnonymousElement(b,e.stripScripts());d.removeChild(c);if(f){a.each(function(g){d.insertBefore(g,f)})}else{a.each(function(g){d.appendChild(g)})}}else{c.outerHTML=e.stripScripts()}e.evalScripts.bind(e).defer();return c}}Element._returnOffset=function(b,c){var a=[b,c];a.left=b;a.top=c;return a};Element._getContentFromAnonymousElement=function(c,b){var d=new Element("div"),a=Element._insertionTranslations.tags[c];if(a){d.innerHTML=a[0]+b+a[1];a[2].times(function(){d=d.firstChild})}else{d.innerHTML=b}return $A(d.childNodes)};Element._insertionTranslations={before:function(a,b){a.parentNode.insertBefore(b,a)},top:function(a,b){a.insertBefore(b,a.firstChild)},bottom:function(a,b){a.appendChild(b)},after:function(a,b){a.parentNode.insertBefore(b,a.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};(function(){var a=Element._insertionTranslations.tags;Object.extend(a,{THEAD:a.TBODY,TFOOT:a.TBODY,TH:a.TD})})();Element.Methods.Simulated={hasAttribute:function(a,c){c=Element._attributeTranslations.has[c]||c;var b=$(a).getAttributeNode(c);return !!(b&&b.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(a){if(!Prototype.BrowserFeatures.ElementExtensions&&a.__proto__){window.HTMLElement={};window.HTMLElement.prototype=a.__proto__;Prototype.BrowserFeatures.ElementExtensions=true}a=null})(document.createElement("div"));Element.extend=(function(){function c(g){if(typeof window.Element!="undefined"){var i=window.Element.prototype;if(i){var k="_"+(Math.random()+"").slice(2);var h=document.createElement(g);i[k]="x";var j=(h[k]!=="x");delete i[k];h=null;return j}}return false}function b(h,g){for(var j in g){var i=g[j];if(Object.isFunction(i)&&!(j in h)){h[j]=i.methodize()}}}var d=c("object");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(d){return function(h){if(h&&typeof h._extendedByPrototype=="undefined"){var g=h.tagName;if(g&&(/^(?:object|applet|embed)$/i.test(g))){b(h,Element.Methods);b(h,Element.Methods.Simulated);b(h,Element.Methods.ByTag[g.toUpperCase()])}}return h}}return Prototype.K}var a={},e=Element.Methods.ByTag;var f=Object.extend(function(i){if(!i||typeof i._extendedByPrototype!="undefined"||i.nodeType!=1||i==window){return i}var g=Object.clone(a),h=i.tagName.toUpperCase();if(e[h]){Object.extend(g,e[h])}b(i,g);i._extendedByPrototype=Prototype.emptyFunction;return i},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(a,Element.Methods);Object.extend(a,Element.Methods.Simulated)}}});f.refresh();return f})();Element.hasAttribute=function(a,b){if(a.hasAttribute){return a.hasAttribute(b)}return Element.Methods.Simulated.hasAttribute(a,b)};Element.addMethods=function(c){var i=Prototype.BrowserFeatures,d=Element.Methods.ByTag;if(!c){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods)})}if(arguments.length==2){var b=c;c=arguments[1]}if(!b){Object.extend(Element.Methods,c||{})}else{if(Object.isArray(b)){b.each(g)}else{g(b)}}function g(k){k=k.toUpperCase();if(!Element.Methods.ByTag[k]){Element.Methods.ByTag[k]={}}Object.extend(Element.Methods.ByTag[k],c)}function a(m,l,k){k=k||false;for(var o in m){var n=m[o];if(!Object.isFunction(n)){continue}if(!k||!(o in l)){l[o]=n.methodize()}}}function e(n){var k;var m={OPTGROUP:"OptGroup",TEXTAREA:"TextArea",P:"Paragraph",FIELDSET:"FieldSet",UL:"UList",OL:"OList",DL:"DList",DIR:"Directory",H1:"Heading",H2:"Heading",H3:"Heading",H4:"Heading",H5:"Heading",H6:"Heading",Q:"Quote",INS:"Mod",DEL:"Mod",A:"Anchor",IMG:"Image",CAPTION:"TableCaption",COL:"TableCol",COLGROUP:"TableCol",THEAD:"TableSection",TFOOT:"TableSection",TBODY:"TableSection",TR:"TableRow",TH:"TableCell",TD:"TableCell",FRAMESET:"FrameSet",IFRAME:"IFrame"};if(m[n]){k="HTML"+m[n]+"Element"}if(window[k]){return window[k]}k="HTML"+n+"Element";if(window[k]){return window[k]}k="HTML"+n.capitalize()+"Element";if(window[k]){return window[k]}var l=document.createElement(n);var o=l.__proto__||l.constructor.prototype;l=null;return o}var h=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(i.ElementExtensions){a(Element.Methods,h);a(Element.Methods.Simulated,h,true)}if(i.SpecificElementExtensions){for(var j in Element.Methods.ByTag){var f=e(j);if(Object.isUndefined(f)){continue}a(d[j],f.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){return{width:this.getWidth(),height:this.getHeight()}},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};(function(b){var g=Prototype.Browser,e=document,c,d={};function a(){if(g.WebKit&&!e.evaluate){return document}if(g.Opera&&window.parseFloat(window.opera.version())<9.5){return document.body}return document.documentElement}function f(h){if(!c){c=a()}d[h]="client"+h;b["get"+h]=function(){return c[d[h]]};return b["get"+h]()}b.getWidth=f.curry("Width");b.getHeight=f.curry("Height")})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:function(b){if(!(b=$(b))){return}var a;if(b===window){a=0}else{if(typeof b._prototypeUID==="undefined"){b._prototypeUID=[Element.Storage.UID++]}a=b._prototypeUID[0]}if(!Element.Storage[a]){Element.Storage[a]=$H()}return Element.Storage[a]},store:function(b,a,c){if(!(b=$(b))){return}if(arguments.length===2){Element.getStorage(b).update(a)}else{Element.getStorage(b).set(a,c)}return b},retrieve:function(c,b,a){if(!(c=$(c))){return}var e=Element.getStorage(c),d=e.get(b);if(Object.isUndefined(d)){e.set(b,a);d=a}return d},clone:function(c,a){if(!(c=$(c))){return}var e=c.cloneNode(a);e._prototypeUID=void 0;if(a){var d=Element.select(e,"*"),b=d.length;while(b--){d[b]._prototypeUID=void 0}}return Element.extend(e)}});var Selector=Class.create({initialize:function(a){this.expression=a.strip();if(this.shouldUseSelectorsAPI()){this.mode="selectorsAPI"}else{if(this.shouldUseXPath()){this.mode="xpath";this.compileXPathMatcher()}else{this.mode="normal";this.compileMatcher()}}},shouldUseXPath:(function(){var a=(function(){var e=false;if(document.evaluate&&window.XPathResult){var d=document.createElement("div");d.innerHTML="<ul><li></li></ul><div><ul><li></li></ul></div>";var c=".//*[local-name()='ul' or local-name()='UL']//*[local-name()='li' or local-name()='LI']";var b=document.evaluate(c,d,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);e=(b.snapshotLength!==2);d=null}return e})();return function(){if(!Prototype.BrowserFeatures.XPath){return false}var b=this.expression;if(Prototype.Browser.WebKit&&(b.include("-of-type")||b.include(":empty"))){return false}if((/(\[[\w-]*?:|:checked)/).test(b)){return false}if(a){return false}return true}})(),shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI){return false}if(Selector.CASE_INSENSITIVE_CLASS_NAMES){return false}if(!Selector._div){Selector._div=new Element("div")}try{Selector._div.querySelector(this.expression)}catch(a){return false}return true},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m,len=ps.length,name;if(Selector._cache[e]){this.matcher=Selector._cache[e];return}this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i=0;i<len;i++){p=ps[i].re;name=ps[i].name;if(m=e.match(p)){this.matcher.push(Object.isFunction(c[name])?c[name](m):new Template(c[name]).evaluate(m));e=e.replace(m[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher},compileXPathMatcher:function(){var h=this.expression,j=Selector.patterns,c=Selector.xpath,g,b,a=j.length,d;if(Selector._cache[h]){this.xpath=Selector._cache[h];return}this.matcher=[".//*"];while(h&&g!=h&&(/\S/).test(h)){g=h;for(var f=0;f<a;f++){d=j[f].name;if(b=h.match(j[f].re)){this.matcher.push(Object.isFunction(c[d])?c[d](b):new Template(c[d]).evaluate(b));h=h.replace(b[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(a){a=a||document;var c=this.expression,b;switch(this.mode){case"selectorsAPI":if(a!==document){var d=a.id,f=$(a).identify();f=f.replace(/([\.:])/g,"\\$1");c="#"+f+" "+c}b=$A(a.querySelectorAll(c)).map(Element.extend);a.id=d;return b;case"xpath":return document._getElementsByXPath(this.xpath,a);default:return this.matcher(a)}},match:function(k){this.tokens=[];var q=this.expression,a=Selector.patterns,f=Selector.assertions;var b,d,g,o=a.length,c;while(q&&b!==q&&(/\S/).test(q)){b=q;for(var j=0;j<o;j++){d=a[j].re;c=a[j].name;if(g=q.match(d)){if(f[c]){this.tokens.push([c,Object.clone(g)]);q=q.replace(g[0],"")}else{return this.findElements(document).include(k)}}}}var n=true,c,l;for(var j=0,h;h=this.tokens[j];j++){c=h[0],l=h[1];if(!Selector.assertions[c](k,l)){n=false;break}}return n},toString:function(){return this.expression},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"}});if(Prototype.BrowserFeatures.SelectorsAPI&&document.compatMode==="BackCompat"){Selector.CASE_INSENSITIVE_CLASS_NAMES=(function(){var c=document.createElement("div"),a=document.createElement("span");c.id="prototype_test_id";a.className="Test";c.appendChild(a);var b=(c.querySelector("#prototype_test_id .test")!==null);c=a=null;return b})()}Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(a){if(a[1]=="*"){return""}return"[local-name()='"+a[1].toLowerCase()+"' or local-name()='"+a[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(a){a[1]=a[1].toLowerCase();return new Template("[@#{1}]").evaluate(a)},attr:function(a){a[1]=a[1].toLowerCase();a[3]=a[5]||a[6];return new Template(Selector.xpath.operators[a[2]]).evaluate(a)},pseudo:function(a){var b=Selector.xpath.pseudos[a[1]];if(!b){return""}if(Object.isFunction(b)){return b(a)}return new Template(Selector.xpath.pseudos[a[1]]).evaluate(a)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0)]",checked:"[@checked]",disabled:"[(@disabled) and (@type!='hidden')]",enabled:"[not(@disabled) and (@type!='hidden')]",not:function(f){var j=f[6],c=Selector.patterns,k=Selector.xpath,a,l,h=c.length,b;var d=[];while(j&&a!=j&&(/\S/).test(j)){a=j;for(var g=0;g<h;g++){b=c[g].name;if(f=j.match(c[g].re)){l=Object.isFunction(k[b])?k[b](f):new Template(k[b]).evaluate(f);d.push("("+l.substring(1,l.length-1)+")");j=j.replace(f[0],"");break}}}return"[not("+d.join(" and ")+")]"},"nth-child":function(a){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",a)},"nth-last-child":function(a){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",a)},"nth-of-type":function(a){return Selector.xpath.pseudos.nth("position() ",a)},"nth-last-of-type":function(a){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",a)},"first-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-of-type"](a)},"last-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](a)},"only-of-type":function(a){var b=Selector.xpath.pseudos;return b["first-of-type"](a)+b["last-of-type"](a)},nth:function(g,e){var h,i=e[6],d;if(i=="even"){i="2n+0"}if(i=="odd"){i="2n+1"}if(h=i.match(/^(\d+)$/)){return"["+g+"= "+h[1]+"]"}if(h=i.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(h[1]=="-"){h[1]=-1}var f=h[1]?Number(h[1]):1;var c=h[2]?Number(h[2]):0;d="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(d).evaluate({fragment:g,a:f,b:c})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(a){a[3]=(a[5]||a[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(a)},pseudo:function(a){if(a[6]){a[6]=a[6].replace(/"/g,'\\"')}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(a)},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:[{name:"laterSibling",re:/^\s*~\s*/},{name:"child",re:/^\s*>\s*/},{name:"adjacent",re:/^\s*\+\s*/},{name:"descendant",re:/^\s/},{name:"tagName",re:/^\s*(\*|[\w\-]+)(\b|$)?/},{name:"id",re:/^#([\w\-\*]+)(\b|$)/},{name:"className",re:/^\.([\w\-\*]+)(\b|$)/},{name:"pseudo",re:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/},{name:"attrPresence",re:/^\[((?:[\w-]+:)?[\w-]+)\]/},{name:"attr",re:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/}],assertions:{tagName:function(a,b){return b[1].toUpperCase()==a.tagName.toUpperCase()},className:function(a,b){return Element.hasClassName(a,b[1])},id:function(a,b){return a.id===b[1]},attrPresence:function(a,b){return Element.hasAttribute(a,b[1])},attr:function(b,c){var a=Element.readAttribute(b,c[1]);return a&&Selector.operators[c[2]](a,c[5]||c[6])}},handlers:{concat:function(d,c){for(var e=0,f;f=c[e];e++){d.push(f)}return d},mark:function(a){var d=Prototype.emptyFunction;for(var b=0,c;c=a[b];b++){c._countedByPrototype=d}return a},unmark:(function(){var a=(function(){var b=document.createElement("div"),e=false,d="_countedByPrototype",c="x";b[d]=c;e=(b.getAttribute(d)===c);b=null;return e})();return a?function(b){for(var c=0,d;d=b[c];c++){d.removeAttribute("_countedByPrototype")}return b}:function(b){for(var c=0,d;d=b[c];c++){d._countedByPrototype=void 0}return b}})(),index:function(a,d,g){a._countedByPrototype=Prototype.emptyFunction;if(d){for(var b=a.childNodes,e=b.length-1,c=1;e>=0;e--){var f=b[e];if(f.nodeType==1&&(!g||f._countedByPrototype)){f.nodeIndex=c++}}}else{for(var e=0,c=1,b=a.childNodes;f=b[e];e++){if(f.nodeType==1&&(!g||f._countedByPrototype)){f.nodeIndex=c++}}}},unique:function(b){if(b.length==0){return b}var d=[],e;for(var c=0,a=b.length;c<a;c++){if(typeof(e=b[c])._countedByPrototype=="undefined"){e._countedByPrototype=Prototype.emptyFunction;d.push(Element.extend(e))}}return Selector.handlers.unmark(d)},descendant:function(a){var d=Selector.handlers;for(var c=0,b=[],e;e=a[c];c++){d.concat(b,e.getElementsByTagName("*"))}return b},child:function(a){var e=Selector.handlers;for(var d=0,c=[],f;f=a[d];d++){for(var b=0,g;g=f.childNodes[b];b++){if(g.nodeType==1&&g.tagName!="!"){c.push(g)}}}return c},adjacent:function(a){for(var c=0,b=[],e;e=a[c];c++){var d=this.nextElementSibling(e);if(d){b.push(d)}}return b},laterSibling:function(a){var d=Selector.handlers;for(var c=0,b=[],e;e=a[c];c++){d.concat(b,Element.nextSiblings(e))}return b},nextElementSibling:function(a){while(a=a.nextSibling){if(a.nodeType==1){return a}}return null},previousElementSibling:function(a){while(a=a.previousSibling){if(a.nodeType==1){return a}}return null},tagName:function(a,j,c,b){var k=c.toUpperCase();var e=[],g=Selector.handlers;if(a){if(b){if(b=="descendant"){for(var f=0,d;d=a[f];f++){g.concat(e,d.getElementsByTagName(c))}return e}else{a=this[b](a)}if(c=="*"){return a}}for(var f=0,d;d=a[f];f++){if(d.tagName.toUpperCase()===k){e.push(d)}}return e}else{return j.getElementsByTagName(c)}},id:function(a,l,b,c){var k=$(b),g=Selector.handlers;if(l==document){if(!k){return[]}if(!a){return[k]}}else{if(!l.sourceIndex||l.sourceIndex<1){var a=l.getElementsByTagName("*");for(var e=0,d;d=a[e];e++){if(d.id===b){return[d]}}}}if(a){if(c){if(c=="child"){for(var f=0,d;d=a[f];f++){if(k.parentNode==d){return[k]}}}else{if(c=="descendant"){for(var f=0,d;d=a[f];f++){if(Element.descendantOf(k,d)){return[k]}}}else{if(c=="adjacent"){for(var f=0,d;d=a[f];f++){if(Selector.handlers.previousElementSibling(k)==d){return[k]}}}else{a=g[c](a)}}}}for(var f=0,d;d=a[f];f++){if(d==k){return[k]}}return[]}return(k&&Element.descendantOf(k,l))?[k]:[]},className:function(b,a,c,d){if(b&&d){b=this[d](b)}return Selector.handlers.byClassName(b,a,c)},byClassName:function(c,b,f){if(!c){c=Selector.handlers.descendant([b])}var h=" "+f+" ";for(var e=0,d=[],g,a;g=c[e];e++){a=g.className;if(a.length==0){continue}if(a==f||(" "+a+" ").include(h)){d.push(g)}}return d},attrPresence:function(c,b,a,g){if(!c){c=b.getElementsByTagName("*")}if(c&&g){c=this[g](c)}var e=[];for(var d=0,f;f=c[d];d++){if(Element.hasAttribute(f,a)){e.push(f)}}return e},attr:function(a,j,h,k,c,b){if(!a){a=j.getElementsByTagName("*")}if(a&&b){a=this[b](a)}var l=Selector.operators[c],f=[];for(var e=0,d;d=a[e];e++){var g=Element.readAttribute(d,h);if(g===null){continue}if(l(g,k)){f.push(d)}}return f},pseudo:function(b,c,e,a,d){if(b&&d){b=this[d](b)}if(!b){b=a.getElementsByTagName("*")}return Selector.pseudos[c](b,e,a)}},pseudos:{"first-child":function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(Selector.handlers.previousElementSibling(e)){continue}c.push(e)}return c},"last-child":function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(Selector.handlers.nextElementSibling(e)){continue}c.push(e)}return c},"only-child":function(b,g,a){var e=Selector.handlers;for(var d=0,c=[],f;f=b[d];d++){if(!e.previousElementSibling(f)&&!e.nextElementSibling(f)){c.push(f)}}return c},"nth-child":function(b,c,a){return Selector.pseudos.nth(b,c,a)},"nth-last-child":function(b,c,a){return Selector.pseudos.nth(b,c,a,true)},"nth-of-type":function(b,c,a){return Selector.pseudos.nth(b,c,a,false,true)},"nth-last-of-type":function(b,c,a){return Selector.pseudos.nth(b,c,a,true,true)},"first-of-type":function(b,c,a){return Selector.pseudos.nth(b,"1",a,false,true)},"last-of-type":function(b,c,a){return Selector.pseudos.nth(b,"1",a,true,true)},"only-of-type":function(b,d,a){var c=Selector.pseudos;return c["last-of-type"](c["first-of-type"](b,d,a),d,a)},getIndices:function(d,c,e){if(d==0){return c>0?[c]:[]}return $R(1,e).inject([],function(a,b){if(0==(b-c)%d&&(b-c)/d>=0){a.push(b)}return a})},nth:function(c,s,u,r,e){if(c.length==0){return[]}if(s=="even"){s="2n+0"}if(s=="odd"){s="2n+1"}var q=Selector.handlers,p=[],d=[],g;q.mark(c);for(var o=0,f;f=c[o];o++){if(!f.parentNode._countedByPrototype){q.index(f.parentNode,r,e);d.push(f.parentNode)}}if(s.match(/^\d+$/)){s=Number(s);for(var o=0,f;f=c[o];o++){if(f.nodeIndex==s){p.push(f)}}}else{if(g=s.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(g[1]=="-"){g[1]=-1}var v=g[1]?Number(g[1]):1;var t=g[2]?Number(g[2]):0;var w=Selector.pseudos.getIndices(v,t,c.length);for(var o=0,f,k=w.length;f=c[o];o++){for(var n=0;n<k;n++){if(f.nodeIndex==w[n]){p.push(f)}}}}}q.unmark(c);q.unmark(d);return p},empty:function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(e.tagName=="!"||e.firstChild){continue}c.push(e)}return c},not:function(a,d,k){var g=Selector.handlers,l,c;var j=new Selector(d).findElements(k);g.mark(j);for(var f=0,e=[],b;b=a[f];f++){if(!b._countedByPrototype){e.push(b)}}g.unmark(j);return e},enabled:function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(!e.disabled&&(!e.type||e.type!=="hidden")){c.push(e)}}return c},disabled:function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(e.disabled){c.push(e)}}return c},checked:function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(e.checked){c.push(e)}}return c}},operators:{"=":function(b,a){return b==a},"!=":function(b,a){return b!=a},"^=":function(b,a){return b==a||b&&b.startsWith(a)},"$=":function(b,a){return b==a||b&&b.endsWith(a)},"*=":function(b,a){return b==a||b&&b.include(a)},"~=":function(b,a){return(" "+b+" ").include(" "+a+" ")},"|=":function(b,a){return("-"+(b||"").toUpperCase()+"-").include("-"+(a||"").toUpperCase()+"-")}},split:function(b){var a=[];b.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(c){a.push(c[1].strip())});return a},matchElements:function(f,g){var e=$$(g),d=Selector.handlers;d.mark(e);for(var c=0,b=[],a;a=f[c];c++){if(a._countedByPrototype){b.push(a)}}d.unmark(e);return b},findElement:function(b,c,a){if(Object.isNumber(c)){a=c;c=false}return Selector.matchElements(b,c||"*")[a||0]},findChildElements:function(e,g){g=Selector.split(g.join(","));var d=[],f=Selector.handlers;for(var c=0,b=g.length,a;c<b;c++){a=new Selector(g[c].strip());f.concat(d,a.findElements(e))}return(b>1)?f.unique(d):d}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(d,c){for(var e=0,f;f=c[e];e++){if(f.tagName!=="!"){d.push(f)}}return d}})}function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(a){a=$(a);a.reset();return a},serializeElements:function(g,b){if(typeof b!="object"){b={hash:!!b}}else{if(Object.isUndefined(b.hash)){b.hash=true}}var c,f,a=false,e=b.submit;var d=g.inject({},function(h,i){if(!i.disabled&&i.name){c=i.name;f=$(i).getValue();if(f!=null&&i.type!="file"&&(i.type!="submit"||(!a&&e!==false&&(!e||c==e)&&(a=true)))){if(c in h){if(!Object.isArray(h[c])){h[c]=[h[c]]}h[c].push(f)}else{h[c]=f}}}return h});return b.hash?d:Object.toQueryString(d)}};Form.Methods={serialize:function(b,a){return Form.serializeElements(Form.getElements(b),a)},getElements:function(e){var f=$(e).getElementsByTagName("*"),d,a=[],c=Form.Element.Serializers;for(var b=0;d=f[b];b++){a.push(d)}return a.inject([],function(g,h){if(c[h.tagName.toLowerCase()]){g.push(Element.extend(h))}return g})},getInputs:function(g,c,d){g=$(g);var a=g.getElementsByTagName("input");if(!c&&!d){return $A(a).map(Element.extend)}for(var e=0,h=[],f=a.length;e<f;e++){var b=a[e];if((c&&b.type!=c)||(d&&b.name!=d)){continue}h.push(Element.extend(b))}return h},disable:function(a){a=$(a);Form.getElements(a).invoke("disable");return a},enable:function(a){a=$(a);Form.getElements(a).invoke("enable");return a},findFirstElement:function(b){var c=$(b).getElements().findAll(function(d){return"hidden"!=d.type&&!d.disabled});var a=c.findAll(function(d){return d.hasAttribute("tabIndex")&&d.tabIndex>=0}).sortBy(function(d){return d.tabIndex}).first();return a?a:c.find(function(d){return/^(?:input|select|textarea)$/i.test(d.tagName)})},focusFirstElement:function(a){a=$(a);a.findFirstElement().activate();return a},request:function(b,a){b=$(b),a=Object.clone(a||{});var d=a.parameters,c=b.readAttribute("action")||"";if(c.blank()){c=window.location.href}a.parameters=b.serialize(true);if(d){if(Object.isString(d)){d=d.toQueryParams()}Object.extend(a.parameters,d)}if(b.hasAttribute("method")&&!a.method){a.method=b.method}return new Ajax.Request(c,a)}};Form.Element={focus:function(a){$(a).focus();return a},select:function(a){$(a).select();return a}};Form.Element.Methods={serialize:function(a){a=$(a);if(!a.disabled&&a.name){var b=a.getValue();if(b!=undefined){var c={};c[a.name]=b;return Object.toQueryString(c)}}return""},getValue:function(a){a=$(a);var b=a.tagName.toLowerCase();return Form.Element.Serializers[b](a)},setValue:function(a,b){a=$(a);var c=a.tagName.toLowerCase();Form.Element.Serializers[c](a,b);return a},clear:function(a){$(a).value="";return a},present:function(a){return $(a).value!=""},activate:function(a){a=$(a);try{a.focus();if(a.select&&(a.tagName.toLowerCase()!="input"||!(/^(?:button|reset|submit)$/i.test(a.type)))){a.select()}}catch(b){}return a},disable:function(a){a=$(a);a.disabled=true;return a},enable:function(a){a=$(a);a.disabled=false;return a}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(a,b){switch(a.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(a,b);default:return Form.Element.Serializers.textarea(a,b)}},inputSelector:function(a,b){if(Object.isUndefined(b)){return a.checked?a.value:null}else{a.checked=!!b}},textarea:function(a,b){if(Object.isUndefined(b)){return a.value}else{a.value=b}},select:function(c,f){if(Object.isUndefined(f)){return this[c.type=="select-one"?"selectOne":"selectMany"](c)}else{var b,d,g=!Object.isArray(f);for(var a=0,e=c.length;a<e;a++){b=c.options[a];d=this.optionValue(b);if(g){if(d==f){b.selected=true;return}}else{b.selected=f.include(d)}}}},selectOne:function(b){var a=b.selectedIndex;return a>=0?this.optionValue(b.options[a]):null},selectMany:function(d){var a,e=d.length;if(!e){return null}for(var c=0,a=[];c<e;c++){var b=d.options[c];if(b.selected){a.push(this.optionValue(b))}}return a},optionValue:function(a){return Element.extend(a).hasAttribute("value")?a.value:a.text}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,a,b,c){$super(c,b);this.element=$(a);this.lastValue=this.getValue()},execute:function(){var a=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(a)?this.lastValue!=a:String(this.lastValue)!=String(a)){this.callback(this.element,a);this.lastValue=a}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({initialize:function(a,b){this.element=$(a);this.callback=b;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var a=this.getValue();if(this.lastValue!=a){this.callback(this.element,a);this.lastValue=a}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(a){if(a.type){switch(a.type.toLowerCase()){case"checkbox":case"radio":Event.observe(a,"click",this.onElementEvent.bind(this));break;default:Event.observe(a,"change",this.onElementEvent.bind(this));break}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});(function(){var v={KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{}};var e=document.documentElement;var w="onmouseenter" in e&&"onmouseleave" in e;var o;if(Prototype.Browser.IE){var h={0:1,1:4,2:2};o=function(y,x){return y.button===h[x]}}else{if(Prototype.Browser.WebKit){o=function(y,x){switch(x){case 0:return y.which==1&&!y.metaKey;case 1:return y.which==1&&y.metaKey;default:return false}}}else{o=function(y,x){return y.which?(y.which===x+1):(y.button===x)}}}function r(x){return o(x,0)}function q(x){return o(x,1)}function k(x){return o(x,2)}function c(z){z=v.extend(z);var y=z.target,x=z.type,A=z.currentTarget;if(A&&A.tagName){if(x==="load"||x==="error"||(x==="click"&&A.tagName.toLowerCase()==="input"&&A.type==="radio")){y=A}}if(y.nodeType==Node.TEXT_NODE){y=y.parentNode}return Element.extend(y)}function m(y,A){var x=v.element(y);if(!A){return x}var z=[x].concat(x.ancestors());return Selector.findElement(z,A,0)}function p(x){return{x:b(x),y:a(x)}}function b(z){var y=document.documentElement,x=document.body||{scrollLeft:0};return z.pageX||(z.clientX+(y.scrollLeft||x.scrollLeft)-(y.clientLeft||0))}function a(z){var y=document.documentElement,x=document.body||{scrollTop:0};return z.pageY||(z.clientY+(y.scrollTop||x.scrollTop)-(y.clientTop||0))}function n(x){v.extend(x);x.preventDefault();x.stopPropagation();x.stopped=true}v.Methods={isLeftClick:r,isMiddleClick:q,isRightClick:k,element:c,findElement:m,pointer:p,pointerX:b,pointerY:a,stop:n};var t=Object.keys(v.Methods).inject({},function(x,y){x[y]=v.Methods[y].methodize();return x});if(Prototype.Browser.IE){function g(y){var x;switch(y.type){case"mouseover":x=y.fromElement;break;case"mouseout":x=y.toElement;break;default:return null}return Element.extend(x)}Object.extend(t,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});v.extend=function(y,x){if(!y){return false}if(y._extendedByPrototype){return y}y._extendedByPrototype=Prototype.emptyFunction;var z=v.pointer(y);Object.extend(y,{target:y.srcElement||x,relatedTarget:g(y),pageX:z.x,pageY:z.y});return Object.extend(y,t)}}else{v.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(v.prototype,t);v.extend=Prototype.K}function l(B,A,C){var z=Element.retrieve(B,"prototype_event_registry");if(Object.isUndefined(z)){d.push(B);z=Element.retrieve(B,"prototype_event_registry",$H())}var x=z.get(A);if(Object.isUndefined(x)){x=[];z.set(A,x)}if(x.pluck("handler").include(C)){return false}var y;if(A.include(":")){y=function(D){if(Object.isUndefined(D.eventName)){return false}if(D.eventName!==A){return false}v.extend(D,B);C.call(B,D)}}else{if(!w&&(A==="mouseenter"||A==="mouseleave")){if(A==="mouseenter"||A==="mouseleave"){y=function(E){v.extend(E,B);var D=E.relatedTarget;while(D&&D!==B){try{D=D.parentNode}catch(F){D=B}}if(D===B){return}C.call(B,E)}}}else{y=function(D){v.extend(D,B);C.call(B,D)}}}y.handler=C;x.push(y);return y}function f(){for(var x=0,y=d.length;x<y;x++){v.stopObserving(d[x]);d[x]=null}}var d=[];if(Prototype.Browser.IE){window.attachEvent("onunload",f)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}var j=Prototype.K;if(!w){j=function(y){var x={mouseenter:"mouseover",mouseleave:"mouseout"};return y in x?x[y]:y}}function s(A,z,B){A=$(A);var y=l(A,z,B);if(!y){return A}if(z.include(":")){if(A.addEventListener){A.addEventListener("dataavailable",y,false)}else{A.attachEvent("ondataavailable",y);A.attachEvent("onfilterchange",y)}}else{var x=j(z);if(A.addEventListener){A.addEventListener(x,y,false)}else{A.attachEvent("on"+x,y)}}return A}function i(C,A,D){C=$(C);var z=Element.retrieve(C,"prototype_event_registry");if(Object.isUndefined(z)){return C}if(A&&!D){var B=z.get(A);if(Object.isUndefined(B)){return C}B.each(function(E){Element.stopObserving(C,A,E.handler)});return C}else{if(!A){z.each(function(G){var E=G.key,F=G.value;F.each(function(H){Element.stopObserving(C,E,H.handler)})});return C}}var B=z.get(A);if(!B){return}var y=B.find(function(E){return E.handler===D});if(!y){return C}var x=j(A);if(A.include(":")){if(C.removeEventListener){C.removeEventListener("dataavailable",y,false)}else{C.detachEvent("ondataavailable",y);C.detachEvent("onfilterchange",y)}}else{if(C.removeEventListener){C.removeEventListener(x,y,false)}else{C.detachEvent("on"+x,y)}}z.set(A,B.without(y));return C}function u(A,z,y,x){A=$(A);if(Object.isUndefined(x)){x=true}if(A==document&&document.createEvent&&!A.dispatchEvent){A=document.documentElement}var B;if(document.createEvent){B=document.createEvent("HTMLEvents");B.initEvent("dataavailable",true,true)}else{B=document.createEventObject();B.eventType=x?"ondataavailable":"onfilterchange"}B.eventName=z;B.memo=y||{};if(document.createEvent){A.dispatchEvent(B)}else{A.fireEvent(B.eventType,B)}return v.extend(B)}Object.extend(v,v.Methods);Object.extend(v,{fire:u,observe:s,stopObserving:i});Element.addMethods({fire:u,observe:s,stopObserving:i});Object.extend(document,{fire:u.methodize(),observe:s.methodize(),stopObserving:i.methodize(),loaded:false});if(window.Event){Object.extend(window.Event,v)}else{window.Event=v}})();(function(){var d;function a(){if(document.loaded){return}if(d){window.clearTimeout(d)}document.loaded=true;document.fire("dom:loaded")}function c(){if(document.readyState==="complete"){document.stopObserving("readystatechange",c);a()}}function b(){try{document.documentElement.doScroll("left")}catch(f){d=b.defer();return}a()}if(document.addEventListener){document.addEventListener("DOMContentLoaded",a,false)}else{document.observe("readystatechange",c);if(window==top){d=b.defer()}}Event.observe(window,"load",a)})();Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(a,b){return Element.insert(a,{before:b})},Top:function(a,b){return Element.insert(a,{top:b})},Bottom:function(a,b){return Element.insert(a,{bottom:b})},After:function(a,b){return Element.insert(a,{after:b})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(b,a,c){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(b,a,c)}this.xcomp=a;this.ycomp=c;this.offset=Element.cumulativeOffset(b);return(c>=this.offset[1]&&c<this.offset[1]+b.offsetHeight&&a>=this.offset[0]&&a<this.offset[0]+b.offsetWidth)},withinIncludingScrolloffsets:function(b,a,d){var c=Element.cumulativeScrollOffset(b);this.xcomp=a+c[0]-this.deltaX;this.ycomp=d+c[1]-this.deltaY;this.offset=Element.cumulativeOffset(b);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+b.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+b.offsetWidth)},overlap:function(b,a){if(!b){return 0}if(b=="vertical"){return((this.offset[1]+a.offsetHeight)-this.ycomp)/a.offsetHeight}if(b=="horizontal"){return((this.offset[0]+a.offsetWidth)-this.xcomp)/a.offsetWidth}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(a){Position.prepare();return Element.absolutize(a)},relativize:function(a){Position.prepare();return Element.relativize(a)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(b,c,a){a=a||{};return Element.clonePosition(c,b,a)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(b){function a(c){return c.blank()?null:"[contains(concat(' ', @class, ' '), ' "+c+" ')]"}b.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(c,e){e=e.toString().strip();var d=/\s/.test(e)?$w(e).map(a).join(""):a(e);return d?document._getElementsByXPath(".//*"+d,c):[]}:function(e,f){f=f.toString().strip();var g=[],h=(/\s/.test(f)?$w(f):null);if(!h&&!f){return g}var c=$(e).getElementsByTagName("*");f=" "+f+" ";for(var d=0,k,j;k=c[d];d++){if(k.className&&(j=" "+k.className+" ")&&(j.include(f)||(h&&h.all(function(i){return !i.toString().blank()&&j.include(" "+i+" ")})))){g.push(Element.extend(k))}}return g};return function(d,c){return $(c||document.body).getElementsByClassName(d)}}(Element.Methods)}Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(a){this.element=$(a)},_each:function(a){this.element.className.split(/\s+/).select(function(b){return b.length>0})._each(a)},set:function(a){this.element.className=a},add:function(a){if(this.include(a)){return}this.set($A(this).concat(a).join(" "))},remove:function(a){if(!this.include(a)){return}this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);GlkOte=function(){var M=null;var e="windowport";var g="gameport";var V=0;var S=false;var B=null;var z=null;var ab=null;var f=false;var aa=0;var P=0;var ac=0;var O=null;var a=null;var b=false;var s=true;var G="\xa0";var af=200;var N={escape:Event.KEY_ESC,func1:112,func2:113,func3:114,func4:115,func5:116,func6:117,func7:118,func8:119,func9:120,func10:121,func11:122,func12:123};var p={};function ak(ap){if(!ap&&window.Game){ap=window.Game}if(!ap){d("No game interface object has been provided.");return}if(!ap.accept){d("The game interface object must have an accept() function.");return}M=ap;if(!window.Prototype){d("The Prototype library has not been loaded.");return}var al=Prototype.Version.split(".");if(al.length<2||(al[0]==1&&al[1]<6)){d("This version of the Prototype library is too old. (Version "+Prototype.Version+" found; 1.6.0 required.)");return}for(var ao in N){p[N[ao]]=ao}if(Prototype.Browser.MobileSafari){s=false}if(Prototype.Browser.IE){b=window.XMLHttpRequest!=null}z=new Hash();if(ap.windowport){e=ap.windowport}if(ap.gameport){g=ap.gameport}var an=$(e);if(!an){d("Cannot find windowport element #"+e+" in this document.");return}an.update();if(!Prototype.Browser.MobileSafari){Event.observe(document,"keypress",L)}Event.observe(window,"resize",q);var am=Q();if(Object.isString(am)){d(am);return}ab=am;D("init",null,ab)}function Q(){var ap={};var ao,at,aq,al,ar,an;ao=$(g);if(!ao){return"Cannot find gameport element #"+g+" in this document."}var am=ao.getDimensions();ap.width=am.width;ap.height=am.height;ao=$("layouttest_grid");if(!ao){return"Cannot find layouttest_grid element for window measurement."}aq=ao.getDimensions();an=$("layouttest_gridspan").getDimensions();al=$("layouttest_gridline").getDimensions();ar=$("layouttest_gridline2").getDimensions();ap.gridcharheight=($("layouttest_gridline2").positionedOffset().top-$("layouttest_gridline").positionedOffset().top);ap.gridcharwidth=(an.width/8);ap.gridmarginx=aq.width-an.width;ap.gridmarginy=aq.height-(al.height+ar.height);ao=$("layouttest_buffer");if(!ao){return"Cannot find layouttest_grid element for window measurement."}aq=ao.getDimensions();an=$("layouttest_bufferspan").getDimensions();al=$("layouttest_bufferline").getDimensions();ar=$("layouttest_bufferline2").getDimensions();ap.buffercharheight=($("layouttest_bufferline2").positionedOffset().top-$("layouttest_bufferline").positionedOffset().top);ap.buffercharwidth=(an.width/8);ap.buffermarginx=aq.width-an.width;ap.buffermarginy=aq.height-(al.height+ar.height);ap.outspacingx=0;ap.outspacingy=0;ap.inspacingx=0;ap.inspacingy=0;if(M.spacing!=undefined){ap.outspacingx=M.spacing;ap.outspacingy=M.spacing;ap.inspacingx=M.spacing;ap.inspacingy=M.spacing}if(M.outspacing!=undefined){ap.outspacingx=M.outspacing;ap.outspacingy=M.outspacing}if(M.inspacing!=undefined){ap.inspacingx=M.inspacing;ap.inspacingy=M.inspacing}if(M.inspacingx!=undefined){ap.inspacingx=M.inspacingx}if(M.inspacingy!=undefined){ap.inspacingy=M.inspacingy}if(M.outspacingx!=undefined){ap.outspacingx=M.outspacingx}if(M.outspacingy!=undefined){ap.outspacingy=M.outspacingy}return ap}function y(al){c();if(al.type=="error"){d(al.message);return}if(al.type=="pass"){return}if(al.type=="retry"){if(!a){F("Event has timed out; will retry...");I();a=J.delay(2)}else{F("Event has timed out, but a retry is already queued!")}return}if(al.type!="update"){F("Ignoring unknown message type "+al.type+".");return}if(al.gen==V){F("Ignoring repeated generation number: "+V);return}if(al.gen<V){F("Ignoring out-of-order generation number: got "+al.gen+", currently at "+V);return}V=al.gen;if(S){z.values().each(function(ao){if(ao.inputel){ao.inputel.disabled=false}});S=false}if(al.input!=null){T(al.input)}if(al.windows!=null){u(al.windows)}if(al.content!=null){o(al.content)}if(al.input!=null){r(al.input)}z.values().each(function(au){if(au.type=="buffer"&&au.needscroll){au.needscroll=false;if(!au.needspaging){var aw=au.frameel;if(!s){aw.scrollTop=aw.scrollHeight;au.needspaging=false}else{aw.scrollTop=au.topunseen-ab.buffercharheight;var at=aw.getHeight();var av=ad(aw);var aq=aw.scrollTop+at;if(aq>av){aq=av}if(au.topunseen<aq){au.topunseen=aq}if(aw.scrollTop+at>=aw.scrollHeight){au.needspaging=false}else{au.needspaging=true}}var ar=$("win"+au.id+"_moreprompt");if(!au.needspaging){if(ar){ar.remove()}}else{if(!ar){ar=new Element("div",{id:"win"+au.id+"_moreprompt","class":"MorePrompt"});t(ar,"More");var ap=au.coords.right+20;var ao=au.coords.bottom;ar.setStyle({bottom:ao+"px",right:ap+"px"});$(e).insert(ar)}}}}});v(false);S=false;if(al.disable){S=true;z.values().each(function(ao){if(ao.inputel){ao.inputel.disabled=true}})}var an=0;if(!S&&!ac){z.values().each(function(ao){if(ao.input){if(!an||ao.id==aa){an=ao.id}}})}if(an){var am=function(){var ao=z.get(an);if(ao.inputel){ao.inputel.focus()}};am.defer()}}function u(al){z.values().each(function(an){an.inplace=false});al.map(j);var am=z.values().reject(function(an){return an.inplace});am.map(K)}function j(ax){var ar,at;if(!ax){return}at=z.get(ax.id);if(at==null){at={id:ax.id,type:ax.type,rock:ax.rock};z.set(ax.id,at);var au;if(at.type=="grid"){au="GridWindow"}if(at.type=="buffer"){au="BufferWindow"}var ao="WindowRock_"+ax.rock;ar=new Element("div",{id:"window"+ax.id,"class":"WindowFrame "+au+" "+ao});ar.winid=ax.id;Event.observe(ar,"mousedown",function(ay){W(ay,ar)});if(s&&at.type=="buffer"){ar.onscroll=function(){m(ar)}}at.frameel=ar;at.gridheight=0;at.gridwidth=0;at.input=null;at.inputel=null;at.terminators={};at.reqhyperlink=false;at.needscroll=false;at.needspaging=false;at.topunseen=0;at.coords={left:null,top:null,right:null,bottom:null};at.history=new Array();at.historypos=0;$(e).insert(ar)}else{ar=at.frameel;if(at.type!=ax.type){d("Window "+ax.id+" was created with type "+at.type+", but now is described as type "+ax.type)}}at.inplace=true;if(at.type=="grid"){var ap;if(ax.gridheight>at.gridheight){for(ap=at.gridheight;ap<ax.gridheight;ap++){var an=new Element("div",{id:"win"+at.id+"_ln"+ap,"class":"GridLine"});an.insert(G);at.frameel.insert(an)}}if(ax.gridheight<at.gridheight){for(ap=ax.gridheight;ap<at.gridheight;ap++){var an=$("win"+at.id+"_ln"+ap);if(an){an.remove()}}}at.gridheight=ax.gridheight;at.gridwidth=ax.gridwidth}if(at.type=="buffer"){}var aq;if(Prototype.Browser.IE){var am=ax.width;var aw=ax.height;if(ax.type=="grid"){am-=ab.gridmarginx;aw-=ab.gridmarginy}if(ax.type=="buffer"){am-=ab.buffermarginx;aw-=ab.buffermarginy}if(am<0){am=0}if(aw<0){aw=0}aq={left:ax.left+"px",top:ax.top+"px",width:am+"px",height:aw+"px"};at.coords.left=ax.left;at.coords.top=ax.top;at.coords.right=ab.width-(ax.left+ax.width);at.coords.bottom=ab.height-(ax.top+ax.height)}else{var av=ab.width-(ax.left+ax.width);var al=ab.height-(ax.top+ax.height);aq={left:ax.left+"px",top:ax.top+"px",right:av+"px",bottom:al+"px"};at.coords.left=ax.left;at.coords.top=ax.top;at.coords.right=av;at.coords.bottom=al}ar.setStyle(aq)}function K(am){am.frameel.remove();z.unset(am.id);am.frameel=null;var al=$("win"+am.id+"_moreprompt");if(al){al.remove()}}var A=new RegExp("^ ");var aj=new RegExp(" $");var Y=new RegExp("  +","g");function w(am){var al=am.length;return(G.times(al-1))+" "}function o(al){al.map(U)}function U(ar){var aq=z.get(ar.id);if(aq==null){d("Got content update for window "+ar.id+", which does not exist.");return}if(aq.input&&aq.input.type=="line"){d("Got content update for window "+ar.id+", which is awaiting line input.");return}aq.needscroll=true;if(aq.type=="grid"){var am=ar.lines;var ap,aB;for(ap=0;ap<am.length;ap++){var aA=am[ap];var aC=aA.line;var aG=aA.content;var au=$("win"+aq.id+"_ln"+aC);if(!au){d("Got content for nonexistent line "+aC+" of window "+ar.id+".");continue}if(!aG||!aG.length){au.update(G)}else{au.update();for(aB=0;aB<aG.length;aB++){var ao=aG[aB];var aI,aJ,aE;if(ao.length===undefined){aI=ao.style;aJ=ao.text;aE=ao.hyperlink}else{aI=ao;aB++;aJ=aG[aB];aE=undefined}var an=new Element("span",{"class":"Style_"+aI});if(aE==undefined){t(an,aJ)}else{var aH=new Element("a",{href:"#"});t(aH,aJ);aH.onclick=ae(aq.id,aE);an.insert(aH)}au.insert(an)}}}}if(aq.type=="buffer"){var ay=ar.text;var ap,aB;if(aq.inputel){aq.inputel.remove()}var aK=$("win"+aq.id+"_cursor");if(aK){aK.remove()}aK=null;if(ar.clear){aq.frameel.update();aq.topunseen=0}for(ap=0;ap<ay.length;ap++){var av=ay[ap];var aG=av.content;var aF=null;if(av.append){if(!aG||!aG.length){continue}aF=l(aq.frameel)}if(aF==null){aF=new Element("div",{"class":"BufferLine"});aF.blankpara=true;aF.endswhite=true;aq.frameel.insert(aF)}if(!aG||!aG.length){if(aF.blankpara){aF.update(G)}continue}if(aF.blankpara){aF.blankpara=false;aF.update()}for(aB=0;aB<aG.length;aB++){var ao=aG[aB];var aI,aJ,aE;if(ao.length===undefined){aI=ao.style;aJ=ao.text;aE=ao.hyperlink}else{aI=ao;aB++;aJ=aG[aB];aE=undefined}var an=new Element("span",{"class":"Style_"+aI});aJ=aJ.replace(Y,w);if(aF.endswhite){aJ=aJ.replace(A,G)}if(aE==undefined){t(an,aJ)}else{var aH=new Element("a",{href:"#"});t(aH,aJ);aH.onclick=ae(aq.id,aE);an.insert(aH)}aF.insert(an);aF.endswhite=aj.test(aJ)}}var az=aq.frameel.childNodes;if(az){var ax=az.length-af;if(ax>0){var ap,aw;aq.topunseen-=az[ax].offsetTop;if(aq.topunseen<0){aq.topunseen=0}for(ap=0;ap<ax;ap++){aw=az.item(0);if(aw){aq.frameel.removeChild(aw)}}}}var aF=l(aq.frameel);if(aF){aK=new Element("span",{id:"win"+aq.id+"_cursor","class":"InvisibleCursor"});t(aK,G);aF.insert(aK);if(aq.inputel){var al=aq.inputel;var at=aK.positionedOffset();var aD=aq.frameel.getWidth()-(ab.buffermarginx+at.left+2);if(aD<1){aD=1}if(Prototype.Browser.Opera){al.setStyle({position:"relative",left:"0px",top:"0px",width:aD+"px"});aK.insert({top:al})}else{al.setStyle({position:"absolute",left:"0px",top:"0px",width:aD+"px"});aK.insert(al)}}}}}function T(al){var am=new Hash();al.map(function(an){if(an.type){am.set(an.id,an)}});z.values().each(function(ao){if(ao.input){var an=am.get(ao.id);if(an==null||an.gen>ao.input.gen){ao.input=null;if(ao.inputel){ao.inputel.remove();ao.inputel=null}}}})}function r(al){var am=new Hash();var an=new Hash();al.map(function(ao){if(ao.type){am.set(ao.id,ao)}if(ao.hyperlink){an.set(ao.id,true)}});z.values().each(function(ay){ay.reqhyperlink=an.get(ay.id);var ap=am.get(ay.id);if(ap==null){return}ay.input=ap;var ar=1;if(ap.type=="line"){ar=ap.maxlen}var aB=ay.inputel;if(aB==null){var au="Input";if(ap.type=="line"){au+=" LineInput"}else{if(ap.type=="char"){au+=" CharInput"}else{d("Window "+ay.id+" has requested unrecognized input type "+ap.type+".")}}aB=new Element("input",{id:"win"+ay.id+"_input","class":au,type:"text",maxlength:ar});if(Prototype.Browser.MobileSafari){aB.writeAttribute("autocapitalize","off")}if(ap.type=="line"){aB.onkeypress=k;aB.onkeydown=h;if(ap.initial){aB.value=ap.initial}ay.terminators={};if(ap.terminators){for(var at=0;at<ap.terminators.length;at++){ay.terminators[ap.terminators[at]]=true}}}else{if(ap.type=="char"){aB.onkeypress=ag;aB.onkeydown=H}}var av=ay.id;aB.onfocus=function(){x(av)};aB.onblur=function(){Z(av)};aB.winid=ay.id;ay.inputel=aB;ay.historypos=ay.history.length;ay.needscroll=true}if(ay.type=="grid"){var ax=$("win"+ay.id+"_ln"+ap.ypos);if(!ax){d("Window "+ay.id+" has requested input at unknown line "+ap.ypos+".");return}var aA=ax.positionedOffset();var aw=aA.left+Math.round(ap.xpos*ab.gridcharwidth);var aq=Math.round(ar*ab.gridcharwidth);var ao=ay.frameel.getWidth()-(ab.buffermarginx+aw+2);if(aq>ao){aq=ao}aB.setStyle({position:"absolute",left:aw+"px",top:aA.top+"px",width:aq+"px"});ay.frameel.insert(aB)}if(ay.type=="buffer"){var az=$("win"+ay.id+"_cursor");if(!az){az=new Element("span",{id:"win"+ay.id+"_cursor","class":"InvisibleCursor"});t(az,G);ay.frameel.insert(az)}var aA=az.positionedOffset();var aq=ay.frameel.getWidth()-(ab.buffermarginx+aA.left+2);if(aq<1){aq=1}if(Prototype.Browser.Opera){aB.setStyle({position:"relative",left:"0px",top:"0px",width:aq+"px"});az.insert({top:aB})}else{aB.setStyle({position:"absolute",left:"0px",top:"0px",width:aq+"px"});az.insert(aB)}}})}function ad(am){var al=am.childElements();if(al.length==0){return 0}return al[al.length-1].offsetTop}function v(an){ac=0;var am=0;if(s){z.values().each(function(ap){if(ap.needspaging){ac+=1;if(!am||ap.id==P){am=ap.id}}})}if(ac){P=am}if(!ac&&an){var ao=0;if(!S&&!ac){z.values().each(function(ap){if(ap.input){if(!ao||ap.id==aa){ao=ap.id}}})}if(ao){var al=z.get(ao);if(al.inputel){al.inputel.focus()}}}}function R(){return M}function F(al){if(window.console&&console.log){console.log(al)}else{if(window.opera&&opera.postError){opera.postError(al)}}}function d(am){var al=document.getElementById("errorcontent");ai(al);t(al,am);al=document.getElementById("errorpane");al.style.display="";c()}function X(al){D("external",null,al)}function J(){a=null;F("Retrying update...");D("refresh",null,null)}function i(){$("errorpane").hide()}function c(){if(B==false){return}B=false;var al=document.getElementById("loadingpane");if(al){al.style.display="none"}}function I(){if(B==true){return}B=true;var al=document.getElementById("loadingpane");if(al){al.style.display=""}}function t(am,an){var al=document.createTextNode(an);am.appendChild(al)}function ai(am){var an,al;al=am.childNodes;while(al.length>0){an=al.item(0);am.removeChild(an)}}function l(am){var al=am.childElements();if(!al||!al.length){return null}return al[al.length-1]}function ah(){var am=Object.keys(this);am.sort();var al=am.map(function(an){var ao=this[an];if(ao==ah){ao="[...]"}return an+":"+ao},this);return"{"+al.join(", ")+"}"}function E(am){var an=Object.keys(am);an.sort();var al=an.map(function(ao){var ap=am[ao];if(Object.isString(ap)){ap="'"+ap+"'"}else{if(!Object.isNumber(ap)){ap=E(ap)}}return ao+":"+ap},am);return"{"+al.join(", ")+"}"}function n(an,al,am){var ao=al.value;if(ao&&ao!=an.history.last()){an.history.push(ao);if(an.history.length>20){an.history.shift()}}D("line",an,ao,am)}function D(an,ap,aq,ao){if(S){return}var al=0;if(ap){al=ap.id}var am={type:an,gen:V};if(an=="line"){am.window=ap.id;am.value=aq;if(ao){am.terminator=ao}}else{if(an=="char"){am.window=ap.id;am.value=aq}else{if(an=="hyperlink"){am.window=ap.id;am.value=aq}else{if(an=="external"){am.value=aq}else{if(an=="init"||an=="arrange"){am.metrics=aq}}}}}if(!(an=="init"||an=="refresh")){z.values().each(function(au){var at=(an!="line"&&an!="char")||(au.id!=al);if(at&&au.input&&au.input.type=="line"&&au.inputel&&au.inputel.value){var ar=am.partial;if(!ar){ar={};am.partial=ar}ar[au.id]=au.inputel.value}})}M.accept(am)}function q(al){if(O!=null){window.clearTimeout(O);O=null}O=C.delay(0.5)}function C(){O=null;if(S){O=C.delay(0.5);return}ab=Q();D("arrange",null,ab)}function L(au){if(S){return}var ar=0;if(Prototype.Browser.IE){au=Event.extend(window.event);if(au){ar=au.keyCode}}else{if(au){ar=au.which}}if(au.target.tagName.toUpperCase()=="INPUT"){return}if(au.altKey||au.metaKey||au.ctrlKey){return}if(Prototype.Browser.Opera){if(!ar){return}if(ar<32&&ar!=13){return}}var aq;if(ac){aq=z.get(P);if(aq){if(!((ar>=32&&ar<=126)||ar==13)){return}au.preventDefault();var ap=aq.frameel;ap.scrollTop=aq.topunseen-ab.buffercharheight;var ao=ap.getHeight();var av=ad(ap);var an=ap.scrollTop+ao;if(an>av){an=av}if(aq.topunseen<an){aq.topunseen=an}if(aq.needspaging){if(ap.scrollTop+ao>=ap.scrollHeight){aq.needspaging=false;var al=$("win"+aq.id+"_moreprompt");if(al){al.remove()}v(true)}}return}}aq=z.get(aa);if(!aq){return}if(!aq.inputel){return}aq.inputel.focus();if(aq.input.type=="line"){if(ar==13){n(aq,aq.inputel,null);au.preventDefault();return}if(ar){if(ar>=32){var am=String.fromCharCode(ar);aq.inputel.value=aq.inputel.value+am}au.preventDefault();return}}else{var at=null;if(ar==13){at="return"}else{if(ar==Event.KEY_BACKSPACE){at="delete"}else{if(ar){at=String.fromCharCode(ar)}}}if(at){D("char",aq,at)}au.preventDefault();return}}function W(al,an){if(!an.winid){return}var am=z.get(an.winid);if(!am){return}if(am.inputel){aa=am.id;if(Prototype.Browser.MobileSafari){al.stop();am.inputel.focus()}}if(am.needspaging){P=am.id}else{if(am.inputel){P=0}}}function H(an){var al=0;if(!an){an=Event.extend(window.event)}if(an){al=an.keyCode}if(!al){return true}var am=null;switch(al){case Event.KEY_LEFT:am="left";break;case Event.KEY_RIGHT:am="right";break;case Event.KEY_UP:am="up";break;case Event.KEY_DOWN:am="down";break;case Event.KEY_BACKSPACE:am="delete";break;case Event.KEY_ESC:am="escape";break;case Event.KEY_TAB:am="tab";break;case Event.KEY_PAGEUP:am="pageup";break;case Event.KEY_PAGEDOWN:am="pagedown";break;case Event.KEY_HOME:am="home";break;case Event.KEY_END:am="end";break;case 112:am="func1";break;case 113:am="func2";break;case 114:am="func3";break;case 115:am="func4";break;case 116:am="func5";break;case 117:am="func6";break;case 118:am="func7";break;case 119:am="func8";break;case 120:am="func9";break;case 121:am="func10";break;case 122:am="func11";break;case 123:am="func12";break}if(am){if(!this.winid){return true}var ao=z.get(this.winid);if(!ao||!ao.input){return true}D("char",ao,am);return false}return true}function ag(an){var al=0;if(!an){an=Event.extend(window.event);if(an){al=an.keyCode}}else{if(an){al=an.which}}if(!al){return false}if(al==10&&Prototype.Browser.MobileSafari){al=13}var am;if(al==13){am="return"}else{am=String.fromCharCode(al)}if(!this.winid){return true}var ao=z.get(this.winid);if(!ao||!ao.input){return true}D("char",ao,am);return false}function h(am){var al=0;if(!am){am=Event.extend(window.event)}if(am){al=am.keyCode}if(!al){return true}if(al==Event.KEY_UP||al==Event.KEY_DOWN){if(!this.winid){return true}var an=z.get(this.winid);if(!an||!an.input){return true}if(al==Event.KEY_UP&&an.historypos>0){an.historypos-=1;if(an.historypos<an.history.length){this.value=an.history[an.historypos]}else{this.value=""}}if(al==Event.KEY_DOWN&&an.historypos<an.history.length){an.historypos+=1;if(an.historypos<an.history.length){this.value=an.history[an.historypos]}else{this.value=""}}return false}else{if(p[al]){if(!this.winid){return true}var an=z.get(this.winid);if(!an||!an.input){return true}if(an.terminators[p[al]]){n(an,an.inputel,p[al]);return false}}}return true}function k(am){var al=0;if(!am){am=Event.extend(window.event);if(am){al=am.keyCode}}else{if(am){al=am.which}}if(!al){return true}if(al==10&&Prototype.Browser.MobileSafari){al=13}if(al==13){if(!this.winid){return true}var an=z.get(this.winid);if(!an||!an.input){return true}n(an,this,null);return false}return true}function x(al){var am=z.get(al);if(!am){return}f=true;aa=al;P=al}function Z(al){var am=z.get(al);if(!am){return}f=false}function m(aq){if(!aq.winid){return}var ao=z.get(aq.winid);if(!ao){return}if(!ao.needspaging){return}var an=aq.getHeight();var ap=ad(aq);var al=aq.scrollTop+an;if(al>ap){al=ap}if(ao.topunseen<al){ao.topunseen=al}if(aq.scrollTop+an>=aq.scrollHeight){ao.needspaging=false;var am=$("win"+ao.id+"_moreprompt");if(am){am.remove()}v(true);return}}function ae(am,al){return function(){var an=z.get(am);if(!an){return false}if(!an.reqhyperlink){return false}D("hyperlink",an,al);return false}}return{version:"1.2.2",init:ak,update:y,extevent:X,getinterface:R,log:F,error:d}}();Dialog=function(){var dialog_el_id="dialog";var is_open=false;var dialog_callback=null;var will_save;var confirming;var cur_usage;var cur_usage_name;var cur_gameid;var cur_filelist;function dialog_open(tosave,usage,gameid,callback){if(is_open){throw"Dialog: dialog box is already open."}if(localStorage==null){throw"Dialog: your browser does not support local storage."}dialog_callback=callback;will_save=tosave;confirming=false;cur_usage=usage;cur_gameid=gameid;switch(cur_usage){case"data":cur_usage_name="data file";break;case"save":cur_usage_name="save file";break;case"transcript":cur_usage_name="transcript";break;case"command":cur_usage_name="command script";break;default:cur_usage_name="file";break}var root_el_id="windowport";var iface=window.Game;if(window.GlkOte){iface=window.GlkOte.getinterface()}if(iface&&iface.windowport){root_el_id=iface.windowport}var rootel=$(root_el_id);if(!rootel){throw"Dialog: unable to find root element #"+root_el_id+"."}var screen=$(dialog_el_id+"_screen");if(!screen){screen=new Element("div",{id:dialog_el_id+"_screen"});rootel.insert(screen)}var frame=$(dialog_el_id+"_frame");if(!frame){frame=new Element("div",{id:dialog_el_id+"_frame"});rootel.insert(frame)}var dia=$(dialog_el_id);if(dia){dia.remove()}dia=new Element("div",{id:dialog_el_id});var form,el,row;form=new Element("form");form.observe("submit",(will_save?evhan_accept_save_button:evhan_accept_load_button));dia.insert(form);row=new Element("div",{id:dialog_el_id+"_cap","class":"DiaCaption"});insert_text(row,"XXX");form.insert(row);if(will_save){row=new Element("div",{id:dialog_el_id+"_input","class":"DiaInput"});form.insert(row);el=new Element("input",{id:dialog_el_id+"_infield",type:"text",name:"filename"});row.insert(el)}row=new Element("div",{id:dialog_el_id+"_body","class":"DiaBody"});form.insert(row);row=new Element("div",{id:dialog_el_id+"_cap2","class":"DiaCaption"});row.hide();form.insert(row);row=new Element("div",{"class":"DiaButtons"});el=new Element("button",{id:dialog_el_id+"_cancel",type:"button"});insert_text(el,"Cancel");el.observe("click",evhan_cancel_button);row.insert(el);el=new Element("button",{id:dialog_el_id+"_accept",type:"submit"});insert_text(el,(will_save?"Save":"Load"));el.observe("click",(will_save?evhan_accept_save_button:evhan_accept_load_button));row.insert(el);form.insert(row);frame.insert(dia);is_open=true;evhan_storage_changed();var focusfunc;if(will_save){focusfunc=function(){var el=$(dialog_el_id+"_infield");if(el){el.focus()}}}else{focusfunc=function(){var el=$(dialog_el_id+"_select");if(el){el.focus()}}}focusfunc.defer()}function dialog_close(){var dia=$(dialog_el_id);if(dia){dia.remove()}var frame=$(dialog_el_id+"_frame");if(frame){frame.remove()}var screen=$(dialog_el_id+"_screen");if(screen){screen.remove()}is_open=false;dialog_callback=null;cur_filelist=null}function set_caption(msg,isupper){var elid=(isupper?dialog_el_id+"_cap":dialog_el_id+"_cap2");var el=$(elid);if(!el){return}if(!msg){el.hide()}else{remove_children(el);insert_text(el,msg);el.show()}}function insert_text(el,val){var nod=document.createTextNode(val);el.appendChild(nod)}function remove_children(parent){var obj,ls;ls=parent.childNodes;while(ls.length>0){obj=ls.item(0);parent.removeChild(obj)}}function replace_text(el,val){remove_children(el);insert_text(el,val)}function evhan_select_change(){if(!is_open){return false}if(confirming){return false}var selel=$(dialog_el_id+"_select");if(!selel){return false}var pos=selel.selectedIndex;if(!cur_filelist||pos<0||pos>=cur_filelist.length){return false}var file=cur_filelist[pos];var fel=$(dialog_el_id+"_infield");if(!fel){return false}fel.value=file.dirent.filename;return false}function evhan_accept_load_button(ev){ev.stop();if(!is_open){return false}var selel=$(dialog_el_id+"_select");if(!selel){return false}var pos=selel.selectedIndex;if(!cur_filelist||pos<0||pos>=cur_filelist.length){return false}var file=cur_filelist[pos];if(!file_ref_exists(file.dirent)){return false}var callback=dialog_callback;dialog_close();if(callback){callback(file.dirent)}return false}function evhan_accept_save_button(ev){ev.stop();if(!is_open){return false}var fel=$(dialog_el_id+"_infield");if(!fel){return false}var filename=fel.value;filename=filename.strip();if(!filename){return false}var dirent=file_construct_ref(filename,cur_usage,cur_gameid);if(file_ref_exists(dirent)&&!confirming){confirming=true;set_caption("You already have a "+cur_usage_name+' "'+dirent.filename+'". Do you want to replace it?',false);fel.disabled=true;var butel=$(dialog_el_id+"_accept");replace_text(butel,"Replace");return false}var callback=dialog_callback;dialog_close();if(callback){callback(dirent)}return false}function evhan_cancel_button(ev){ev.stop();if(!is_open){return false}if(confirming){confirming=false;set_caption(null,false);var fel=$(dialog_el_id+"_infield");fel.disabled=false;var butel=$(dialog_el_id+"_accept");butel.disabled=false;replace_text(butel,"Save");return false}var callback=dialog_callback;dialog_close();if(callback){callback(null)}return false}function evhan_storage_changed(ev){if(!is_open){return false}var el,bodyel,ls;var changedkey=null;if(ev){changedkey=ev.key}bodyel=$(dialog_el_id+"_body");if(!bodyel){return false}ls=files_list(cur_usage,cur_gameid);ls.sort(function(f1,f2){return f2.modified.getTime()-f1.modified.getTime()});cur_filelist=ls;if(ls.length==0){remove_children(bodyel)}else{remove_children(bodyel);var selel=new Element("select",{id:dialog_el_id+"_select",name:"files",size:"5"});var ix,file,datestr;for(ix=0;ix<ls.length;ix++){file=ls[ix];el=new Element("option",{name:"f"+ix});if(ix==0){el.selected=true}datestr=format_date(file.modified);insert_text(el,file.dirent.filename+" -- "+datestr);selel.insert(el)}bodyel.insert(selel);if(will_save){selel.onchange=evhan_select_change}}if(will_save){set_caption("Name this "+cur_usage_name+".",true);el=$(dialog_el_id+"_accept");el.disabled=false}else{if(ls.length==0){set_caption("You have no "+cur_usage_name+"s for this game.",true);el=$(dialog_el_id+"_accept");el.disabled=true}else{set_caption("Select a "+cur_usage_name+" to load.",true);el=$(dialog_el_id+"_accept");el.disabled=false}}}function file_construct_ref(filename,usage,gameid){if(!filename){filename=""}if(!usage){useage=""}if(!gameid){gameid=""}var key=usage+":"+gameid+":"+filename;var ref={dirent:"dirent:"+key,content:"content:"+key,filename:filename,usage:usage,gameid:gameid};return ref}function file_decode_ref(dirkey){if(!dirkey.startsWith("dirent:")){return null}var oldpos=7;var pos=dirkey.indexOf(":",oldpos);if(pos<0){return null}var usage=dirkey.slice(oldpos,pos);oldpos=pos+1;pos=dirkey.indexOf(":",oldpos);if(pos<0){return null}var gameid=dirkey.slice(oldpos,pos);oldpos=pos+1;var filename=dirkey.slice(oldpos);var conkey="cont"+dirkey.slice(3);var ref={dirent:dirkey,content:conkey,filename:filename,usage:usage,gameid:gameid};return ref}function file_load_dirent(dirent){if(typeof(dirent)!="object"){dirent=file_decode_ref(dirent);if(!dirent){return null}}var statstring=localStorage.getItem(dirent.dirent);if(!statstring){return null}var file={dirent:dirent};var ix,pos,key,val;var ls=statstring.toString().split(",");for(ix=0;ix<ls.length;ix++){val=ls[ix];pos=val.indexOf(":");if(pos<0){continue}key=val.slice(0,pos);val=val.slice(pos+1);switch(key){case"created":file.created=new Date(Number(val));break;case"modified":file.modified=new Date(Number(val));break}}return file}function file_ref_exists(ref){var statstring=localStorage.getItem(ref.dirent);if(!statstring){return false}else{return true}}function file_remove_ref(ref){localStorage.removeItem(ref.dirent);localStorage.removeItem(ref.content)}function file_write(dirent,content,israw){var val,ls;var file=file_load_dirent(dirent);if(!file){file={dirent:dirent,created:new Date()}}file.modified=new Date();if(!israw){content=encode_array(content)}ls=[];if(file.created){ls.push("created:"+file.created.getTime())}if(file.modified){ls.push("modified:"+file.modified.getTime())}val=ls.join(",");localStorage.setItem(file.dirent.dirent,val);localStorage.setItem(file.dirent.content,content);return true}function file_read(dirent,israw){var file=file_load_dirent(dirent);if(!file){return null}var content=localStorage.getItem(dirent.content);if(content==null){return null}content=content.toString();if(!content){if(israw){return""}else{return[]}}if(israw){return content}else{return decode_array(content)}}function file_ref_matches(ref,usage,gameid){if(usage!=null){if(ref.usage!=usage){return false}}if(gameid!=null){if(ref.gameid!=gameid){return false}}return true}function files_list(usage,gameid){var ix;var ls=[];if(!localStorage){return ls}for(ix=0;ix<localStorage.length;ix++){var key=localStorage.key(ix);if(!key){continue}var dirent=file_decode_ref(key.toString());if(!dirent){continue}if(!file_ref_matches(dirent,usage,gameid)){continue}var file=file_load_dirent(dirent);ls.push(file)}return ls}function format_date(date){if(!date){return"???"}var day=(date.getMonth()+1)+"/"+date.getDate();var time=date.getHours()+":"+(date.getMinutes()<10?"0":"")+date.getMinutes();return day+" "+time}if(window.JSON){function encode_array(arr){var res=JSON.stringify(arr);var len=res.length;if(res[0]=='"'&&res[len-1]=='"'){res=res.slice(1,len-1)}return res}function decode_array(val){return JSON.parse(val)}}else{function encode_array(arr){return"["+arr+"]"}function decode_array(val){return eval(val)}}var localStorage=null;if(window.localStorage!=null){localStorage=window.localStorage}else{if(window.globalStorage!=null){localStorage=window.globalStorage[location.hostname]}}if(localStorage==null){localStorage={data:{},keys:[],length:0,getItem:function(key){return localStorage.data[key]},setItem:function(key,val){if(localStorage.keys.indexOf(key)<0){localStorage.keys.push(key);localStorage.length=localStorage.keys.length}localStorage.data[key]=val},removeItem:function(key){if(localStorage.keys.indexOf(key)>=0){localStorage.keys=localStorage.keys.without(key);localStorage.length=localStorage.keys.length;delete localStorage.data[key]}},key:function(index){return localStorage.keys[index]},clear:function(){localStorage.data={};localStorage.keys=[];localStorage.length=0}}}Event.observe(window,"storage",evhan_storage_changed);return{open:dialog_open,file_construct_ref:file_construct_ref,file_ref_exists:file_ref_exists,file_remove_ref:file_remove_ref,file_write:file_write,file_read:file_read}}();Glk=function(){var bU=null;var bX=false;var L=false;var aT=0;var bY=null;var k=null;function ck(cu){bU=cu.vm;if(window.GiDispa){GiDispa.set_vm(bU)}cu.accept=ak;GlkOte.init(cu)}function ak(cv){var cu;if(L){N("### ui is disabled, ignoring event");return}if(cv.gen!=aT){GlkOte.log("Input event had wrong generation number: got "+cv.gen+", currently at "+aT);return}aT+=1;bY=cv.partial;switch(cv.type){case"init":az=cv.metrics;bU.init();break;case"external":if(cv.value=="timer"){g()}break;case"hyperlink":aS(cv.window,cv.value);break;case"char":P(cv.window,cv.value);break;case"line":a3(cv.window,cv.value,cv.terminator);break;case"arrange":az=cv.metrics;cu={left:az.outspacingx,top:az.outspacingy,right:az.width-az.outspacingx,bottom:az.height-az.outspacingy};if(cl){bH(cl,cu)}x();break}}function x(){if(!b7){return}b7.set_field(0,aN.evtype_Arrange);b7.set_field(1,null);b7.set_field(2,0);b7.set_field(3,0);if(window.GiDispa){GiDispa.prepare_resume(b7)}b7=null;bU.resume()}function g(){if(!b7){return}b7.set_field(0,aN.evtype_Timer);b7.set_field(1,null);b7.set_field(2,0);b7.set_field(3,0);if(window.GiDispa){GiDispa.prepare_resume(b7)}b7=null;bU.resume()}function aS(cu,cw){if(!b7){return}var cv=null;for(cv=au;cv;cv=cv.next){if(cv.disprock==cu){break}}if(!cv||!cv.hyperlink_request){return}b7.set_field(0,aN.evtype_Hyperlink);b7.set_field(1,cv);b7.set_field(2,cw);b7.set_field(3,0);cv.hyperlink_request=false;if(window.GiDispa){GiDispa.prepare_resume(b7)}b7=null;bU.resume()}function P(cv,cu){var cx;if(!b7){return}var cw=null;for(cw=au;cw;cw=cw.next){if(cw.disprock==cv){break}}if(!cw||!cw.char_request){return}if(cu.length==1){cx=cu.charCodeAt(0);if(!cw.char_request_uni){cx=cx&255}}else{cx=Y[cu];if(!cx){cx=aN.keycode_Unknown}}b7.set_field(0,aN.evtype_CharInput);b7.set_field(1,cw);b7.set_field(2,cx);b7.set_field(3,0);cw.char_request=false;cw.char_request_uni=false;cw.input_generation=null;if(window.GiDispa){GiDispa.prepare_resume(b7)}b7=null;bU.resume()}function a3(cw,cv,cx){var cu;if(!b7){return}var cy=null;for(cy=au;cy;cy=cy.next){if(cy.disprock==cw){break}}if(!cy||!cy.line_request){return}if(cv.length>cy.linebuf.length){cv=cv.slice(0,cy.linebuf.length)}if(cy.request_echo_line_input){cu=cy.style;aO(cy.str,aN.style_Input);A(cy,cv);if(cy.echostr){bN(cy.echostr,cv)}aO(cy.str,cu);A(cy,"\n");if(cy.echostr){bN(cy.echostr,"\n")}}for(cu=0;cu<cv.length;cu++){cy.linebuf[cu]=cv.charCodeAt(cu)}var cz=0;if(cx&&Y[cx]){cz=Y[cx]}b7.set_field(0,aN.evtype_LineInput);b7.set_field(1,cy);b7.set_field(2,cv.length);b7.set_field(3,cz);if(window.GiDispa){GiDispa.unretain_array(cy.linebuf)}cy.line_request=false;cy.line_request_uni=false;cy.request_echo_line_input=null;cy.input_generation=null;cy.linebuf=null;if(window.GiDispa){GiDispa.prepare_resume(b7)}b7=null;bU.resume()}function D(){var cL={type:"update",gen:aT};var cK=null;var cI=null;var cz=null;var cE,cD,cH,cJ,cC,cB,cv,cy,cA;var cF,cG,cw,cu;if(aI){aI=false;cK=[];for(cE=au;cE;cE=cE.next){if(cE.type==aN.wintype_Pair){continue}cD={id:cE.disprock,rock:cE.rock};cK.push(cD);switch(cE.type){case aN.wintype_TextBuffer:cD.type="buffer";break;case aN.wintype_TextGrid:cD.type="grid";cD.gridwidth=cE.gridwidth;cD.gridheight=cE.gridheight;break}cD.left=cE.bbox.left;cD.top=cE.bbox.top;cD.width=cE.bbox.right-cE.bbox.left;cD.height=cE.bbox.bottom-cE.bbox.top}}for(cE=au;cE;cE=cE.next){cJ=false;cD={id:cE.disprock};if(cI==null){cI=[]}switch(cE.type){case aN.wintype_TextBuffer:a7(cE);if(cE.content.length){cD.text=cE.content.slice(0);cE.content.length=0;cJ=true}if(cE.clearcontent){cD.clear=true;cE.clearcontent=false;cJ=true;if(!cD.text){cD.text=[]}}break;case aN.wintype_TextGrid:if(cE.gridwidth==0||cE.gridheight==0){break}cD.lines=[];for(cy=0;cy<cE.gridheight;cy++){cC=cE.lines[cy];if(!cC.dirty){continue}cC.dirty=false;cB=[];cG=0;for(cA=0;cA<cE.gridwidth;){cw=cC.styles[cA];cu=cC.hyperlinks[cA];for(;cA<cE.gridwidth&&cC.styles[cA]==cw&&cC.hyperlinks[cA]==cu;cA++){}if(cG<cA){if(!cu){cB.push(aM[cw]);cB.push(cC.chars.slice(cG,cA).join(""))}else{cH={style:aM[cw],text:cC.chars.slice(cG,cA).join(""),hyperlink:cu};cB.push(cH)}cG=cA}}cD.lines.push({line:cy,content:cB})}cJ=cD.lines.length;break}if(cJ){cI.push(cD)}}cz=[];for(cE=au;cE;cE=cE.next){cD=null;if(cE.char_request){cD={id:cE.disprock,type:"char",gen:cE.input_generation};if(cE.type==aN.wintype_TextGrid){bO(cE);cD.xpos=cE.cursorx;cD.ypos=cE.cursory}}if(cE.line_request){cF="";if(k){cv=k[cE.disprock];if(cv){cF=cv}}cD={id:cE.disprock,type:"line",gen:cE.input_generation,maxlen:cE.linebuf.length,initial:cF};if(cE.line_input_terminators.length){cD.terminators=cE.line_input_terminators}if(cE.type==aN.wintype_TextGrid){bO(cE);cD.xpos=cE.cursorx;cD.ypos=cE.cursory}}if(cE.hyperlink_request){if(!cD){cD={id:cE.disprock}}cD.hyperlink=true}if(cD){cz.push(cD)}}cL.windows=cK;cL.content=cI;cL.input=cz;if(L){cL.disable=true}k=null;GlkOte.update(cL)}function aA(cv){bX=true;L=true;GlkOte.error(cv);var cu={type:"update",gen:aT,disable:true};cu.input=[];GlkOte.update(cu)}var aN={gestalt_Version:0,gestalt_CharInput:1,gestalt_LineInput:2,gestalt_CharOutput:3,gestalt_CharOutput_CannotPrint:0,gestalt_CharOutput_ApproxPrint:1,gestalt_CharOutput_ExactPrint:2,gestalt_MouseInput:4,gestalt_Timer:5,gestalt_Graphics:6,gestalt_DrawImage:7,gestalt_Sound:8,gestalt_SoundVolume:9,gestalt_SoundNotify:10,gestalt_Hyperlinks:11,gestalt_HyperlinkInput:12,gestalt_SoundMusic:13,gestalt_GraphicsTransparency:14,gestalt_Unicode:15,gestalt_UnicodeNorm:16,gestalt_LineInputEcho:17,gestalt_LineTerminators:18,gestalt_LineTerminatorKey:19,keycode_Unknown:4294967295,keycode_Left:4294967294,keycode_Right:4294967293,keycode_Up:4294967292,keycode_Down:4294967291,keycode_Return:4294967290,keycode_Delete:4294967289,keycode_Escape:4294967288,keycode_Tab:4294967287,keycode_PageUp:4294967286,keycode_PageDown:4294967285,keycode_Home:4294967284,keycode_End:4294967283,keycode_Func1:4294967279,keycode_Func2:4294967278,keycode_Func3:4294967277,keycode_Func4:4294967276,keycode_Func5:4294967275,keycode_Func6:4294967274,keycode_Func7:4294967273,keycode_Func8:4294967272,keycode_Func9:4294967271,keycode_Func10:4294967270,keycode_Func11:4294967269,keycode_Func12:4294967268,keycode_MAXVAL:28,evtype_None:0,evtype_Timer:1,evtype_CharInput:2,evtype_LineInput:3,evtype_MouseInput:4,evtype_Arrange:5,evtype_Redraw:6,evtype_SoundNotify:7,evtype_Hyperlink:8,style_Normal:0,style_Emphasized:1,style_Preformatted:2,style_Header:3,style_Subheader:4,style_Alert:5,style_Note:6,style_BlockQuote:7,style_Input:8,style_User1:9,style_User2:10,style_NUMSTYLES:11,wintype_AllTypes:0,wintype_Pair:1,wintype_Blank:2,wintype_TextBuffer:3,wintype_TextGrid:4,wintype_Graphics:5,winmethod_Left:0,winmethod_Right:1,winmethod_Above:2,winmethod_Below:3,winmethod_DirMask:15,winmethod_Fixed:16,winmethod_Proportional:32,winmethod_DivisionMask:240,winmethod_Border:0,winmethod_NoBorder:256,winmethod_BorderMask:256,fileusage_Data:0,fileusage_SavedGame:1,fileusage_Transcript:2,fileusage_InputRecord:3,fileusage_TypeMask:15,fileusage_TextMode:256,fileusage_BinaryMode:0,filemode_Write:1,filemode_Read:2,filemode_ReadWrite:3,filemode_WriteAppend:5,seekmode_Start:0,seekmode_Current:1,seekmode_End:2,stylehint_Indentation:0,stylehint_ParaIndentation:1,stylehint_Justification:2,stylehint_Size:3,stylehint_Weight:4,stylehint_Oblique:5,stylehint_Proportional:6,stylehint_TextColor:7,stylehint_BackColor:8,stylehint_ReverseColor:9,stylehint_NUMHINTS:10,stylehint_just_LeftFlush:0,stylehint_just_LeftRight:1,stylehint_just_Centered:2,stylehint_just_RightFlush:3};var Y={left:aN.keycode_Left,right:aN.keycode_Right,up:aN.keycode_Up,down:aN.keycode_Down,"return":aN.keycode_Return,"delete":aN.keycode_Delete,escape:aN.keycode_Escape,tab:aN.keycode_Tab,pageup:aN.keycode_PageUp,pagedown:aN.keycode_PageDown,home:aN.keycode_Home,end:aN.keycode_End,func1:aN.keycode_Func1,func2:aN.keycode_Func2,func3:aN.keycode_Func3,func4:aN.keycode_Func4,func5:aN.keycode_Func5,func6:aN.keycode_Func6,func7:aN.keycode_Func7,func8:aN.keycode_Func8,func9:aN.keycode_Func9,func10:aN.keycode_Func10,func11:aN.keycode_Func11,func12:aN.keycode_Func12};var bs=null;var aM={0:"normal",1:"emphasized",2:"preformatted",3:"header",4:"subheader",5:"alert",6:"note",7:"blockquote",8:"input",9:"user1",10:"user2"};var a1={0:"data",1:"save",2:"transcript",3:"command"};var cg={181:924,223:[83,83],255:376,305:73,329:[700,78],383:83,405:502,414:544,447:503,454:452,457:455,460:458,477:398,496:[74,780],499:497,595:385,596:390,598:393,599:394,601:399,603:400,608:403,611:404,616:407,617:406,623:412,626:413,629:415,640:422,643:425,648:430,650:433,651:434,658:439,837:921,912:[921,776,769],940:902,941:904,942:905,943:906,944:[933,776,769],962:931,972:908,973:910,974:911,976:914,977:920,981:934,982:928,1008:922,1010:1017,1013:917,1415:[1333,1362],7830:[72,817],7831:[84,776],7832:[87,778],7833:[89,778],7834:[65,702],7835:7776,8016:[933,787],8018:[933,787,768],8020:[933,787,769],8022:[933,787,834],8048:8122,8049:8123,8050:8136,8051:8137,8052:8138,8053:8139,8054:8154,8055:8155,8056:8184,8057:8185,8058:8170,8059:8171,8060:8186,8061:8187,8064:[7944,921],8065:[7945,921],8066:[7946,921],8067:[7947,921],8068:[7948,921],8069:[7949,921],8070:[7950,921],8071:[7951,921],8072:[7944,921],8073:[7945,921],8074:[7946,921],8075:[7947,921],8076:[7948,921],8077:[7949,921],8078:[7950,921],8079:[7951,921],8080:[7976,921],8081:[7977,921],8082:[7978,921],8083:[7979,921],8084:[7980,921],8085:[7981,921],8086:[7982,921],8087:[7983,921],8088:[7976,921],8089:[7977,921],8090:[7978,921],8091:[7979,921],8092:[7980,921],8093:[7981,921],8094:[7982,921],8095:[7983,921],8096:[8040,921],8097:[8041,921],8098:[8042,921],8099:[8043,921],8100:[8044,921],8101:[8045,921],8102:[8046,921],8103:[8047,921],8104:[8040,921],8105:[8041,921],8106:[8042,921],8107:[8043,921],8108:[8044,921],8109:[8045,921],8110:[8046,921],8111:[8047,921],8114:[8122,921],8115:[913,921],8116:[902,921],8118:[913,834],8119:[913,834,921],8124:[913,921],8126:921,8130:[8138,921],8131:[919,921],8132:[905,921],8134:[919,834],8135:[919,834,921],8140:[919,921],8146:[921,776,768],8147:[921,776,769],8150:[921,834],8151:[921,776,834],8162:[933,776,768],8163:[933,776,769],8164:[929,787],8165:8172,8166:[933,834],8167:[933,776,834],8178:[8186,921],8179:[937,921],8180:[911,921],8182:[937,834],8183:[937,834,921],8188:[937,921],64256:[70,70],64257:[70,73],64258:[70,76],64259:[70,70,73],64260:[70,70,76],64261:[83,84],64262:[83,84],64275:[1348,1350],64276:[1348,1333],64277:[1348,1339],64278:[1358,1350],64279:[1348,1341]};(function(){var cv,cu,cx;var cw=cg;cv=[7936,7937,7938,7939,7940,7941,7942,7943,7952,7953,7954,7955,7956,7957,7968,7969,7970,7971,7972,7973,7974,7975,7984,7985,7986,7987,7988,7989,7990,7991,8000,8001,8002,8003,8004,8005,8017,8019,8021,8023,8032,8033,8034,8035,8036,8037,8038,8039,8112,8113,8144,8145,8160,8161,];for(cu=0;cu<54;cu++){cx=cv[cu];cw[cx]=cx+8}for(cx=257;cx<=303;cx+=2){cw[cx]=cx-1}for(cx=331;cx<=375;cx+=2){cw[cx]=cx-1}for(cx=505;cx<=543;cx+=2){cw[cx]=cx-1}for(cx=1121;cx<=1153;cx+=2){cw[cx]=cx-1}for(cx=1163;cx<=1215;cx+=2){cw[cx]=cx-1}for(cx=1233;cx<=1269;cx+=2){cw[cx]=cx-1}for(cx=7681;cx<=7829;cx+=2){cw[cx]=cx-1}for(cx=7841;cx<=7929;cx+=2){cw[cx]=cx-1}cv=[307,309,311,314,316,318,320,322,324,326,328,378,380,382,387,389,392,396,402,409,417,419,421,424,429,432,436,438,441,445,453,456,459,462,464,466,468,470,472,474,476,479,481,483,485,487,489,491,493,495,498,501,547,549,551,553,555,557,559,561,563,985,987,989,991,993,995,997,999,1001,1003,1005,1007,1016,1019,1218,1220,1222,1224,1226,1228,1230,1273,1281,1283,1285,1287,1289,1291,1293,1295,];for(cu=0;cu<91;cu++){cx=cv[cu];cw[cx]=cx-1}for(cx=8560;cx<=8575;cx+=1){cw[cx]=cx-16}for(cx=9424;cx<=9449;cx+=1){cw[cx]=cx-26}for(cx=97;cx<=122;cx+=1){cw[cx]=cx-32}for(cx=224;cx<=246;cx+=1){cw[cx]=cx-32}for(cx=945;cx<=961;cx+=1){cw[cx]=cx-32}for(cx=1072;cx<=1103;cx+=1){cw[cx]=cx-32}for(cx=65345;cx<=65370;cx+=1){cw[cx]=cx-32}cv=[248,249,250,251,252,253,254,963,964,965,966,967,968,969,970,971,];for(cu=0;cu<16;cu++){cx=cv[cu];cw[cx]=cx-32}for(cx=66600;cx<=66639;cx+=1){cw[cx]=cx-40}for(cx=1377;cx<=1414;cx+=1){cw[cx]=cx-48}for(cx=1104;cx<=1119;cx+=1){cw[cx]=cx-80}cw[1009]=929})();var ap={304:[105,775],376:255,385:595,390:596,393:598,394:599,398:477,399:601,400:603,403:608,404:611,406:617,407:616,412:623,413:626,415:629,422:640,425:643,430:648,433:650,434:651,439:658,452:454,455:457,458:460,497:499,502:405,503:447,544:414,902:940,904:941,905:942,906:943,908:972,910:973,911:974,1012:952,1017:1010,8122:8048,8123:8049,8124:8115,8136:8050,8137:8051,8138:8052,8139:8053,8140:8131,8154:8054,8155:8055,8170:8058,8171:8059,8172:8165,8184:8056,8185:8057,8186:8060,8187:8061,8188:8179,8486:969,8490:107,8491:229};(function(){var cv,cu,cx;var cw=ap;for(cx=1024;cx<=1039;cx+=1){cw[cx]=cx+80}for(cx=1329;cx<=1366;cx+=1){cw[cx]=cx+48}for(cx=66560;cx<=66599;cx+=1){cw[cx]=cx+40}for(cx=65;cx<=90;cx+=1){cw[cx]=cx+32}for(cx=192;cx<=214;cx+=1){cw[cx]=cx+32}for(cx=913;cx<=929;cx+=1){cw[cx]=cx+32}for(cx=1040;cx<=1071;cx+=1){cw[cx]=cx+32}for(cx=65313;cx<=65338;cx+=1){cw[cx]=cx+32}cv=[216,217,218,219,220,221,222,931,932,933,934,935,936,937,938,939,];for(cu=0;cu<16;cu++){cx=cv[cu];cw[cx]=cx+32}for(cx=9398;cx<=9423;cx+=1){cw[cx]=cx+26}for(cx=8544;cx<=8559;cx+=1){cw[cx]=cx+16}for(cx=256;cx<=302;cx+=2){cw[cx]=cx+1}for(cx=330;cx<=374;cx+=2){cw[cx]=cx+1}for(cx=504;cx<=542;cx+=2){cw[cx]=cx+1}for(cx=1120;cx<=1152;cx+=2){cw[cx]=cx+1}for(cx=1162;cx<=1214;cx+=2){cw[cx]=cx+1}for(cx=1232;cx<=1268;cx+=2){cw[cx]=cx+1}for(cx=7680;cx<=7828;cx+=2){cw[cx]=cx+1}for(cx=7840;cx<=7928;cx+=2){cw[cx]=cx+1}cv=[306,308,310,313,315,317,319,321,323,325,327,377,379,381,386,388,391,395,401,408,416,418,420,423,428,431,435,437,440,444,453,456,459,461,463,465,467,469,471,473,475,478,480,482,484,486,488,490,492,494,498,500,546,548,550,552,554,556,558,560,562,984,986,988,990,992,994,996,998,1000,1002,1004,1006,1015,1018,1217,1219,1221,1223,1225,1227,1229,1272,1280,1282,1284,1286,1288,1290,1292,1294,];for(cu=0;cu<91;cu++){cx=cv[cu];cw[cx]=cx+1}cv=[7944,7945,7946,7947,7948,7949,7950,7951,7960,7961,7962,7963,7964,7965,7976,7977,7978,7979,7980,7981,7982,7983,7992,7993,7994,7995,7996,7997,7998,7999,8008,8009,8010,8011,8012,8013,8025,8027,8029,8031,8040,8041,8042,8043,8044,8045,8046,8047,8072,8073,8074,8075,8076,8077,8078,8079,8088,8089,8090,8091,8092,8093,8094,8095,8104,8105,8106,8107,8108,8109,8110,8111,8120,8121,8152,8153,8168,8169,];for(cu=0;cu<78;cu++){cx=cv[cu];cw[cx]=cx-8}})();var bM={223:[83,115],452:453,453:453,454:453,455:456,456:456,457:456,458:459,459:459,460:459,497:498,498:498,499:498,1415:[1333,1410],8114:[8122,837],8115:8124,8116:[902,837],8119:[913,834,837],8124:8124,8130:[8138,837],8131:8140,8132:[905,837],8135:[919,834,837],8140:8140,8178:[8186,837],8179:8188,8180:[911,837],8183:[937,834,837],8188:8188,64256:[70,102],64257:[70,105],64258:[70,108],64259:[70,102,105],64260:[70,102,108],64261:[83,116],64262:[83,116],64275:[1348,1398],64276:[1348,1381],64277:[1348,1387],64278:[1358,1398],64279:[1348,1389]};(function(){var cv,cu,cx;var cw=bM;cv=[8072,8073,8074,8075,8076,8077,8078,8079,8072,8073,8074,8075,8076,8077,8078,8079,8088,8089,8090,8091,8092,8093,8094,8095,8088,8089,8090,8091,8092,8093,8094,8095,8104,8105,8106,8107,8108,8109,8110,8111,8104,8105,8106,8107,8108,8109,8110,8111,];for(cu=0;cu<48;cu++){cx=cv[cu];cw[cu+8064]=cx}})();var bG={192:[65,768],193:[65,769],194:[65,770],195:[65,771],196:[65,776],197:[65,778],199:[67,807],200:[69,768],201:[69,769],202:[69,770],203:[69,776],204:[73,768],205:[73,769],206:[73,770],207:[73,776],209:[78,771],210:[79,768],211:[79,769],212:[79,770],213:[79,771],214:[79,776],217:[85,768],218:[85,769],219:[85,770],220:[85,776],221:[89,769],224:[97,768],225:[97,769],226:[97,770],227:[97,771],228:[97,776],229:[97,778],231:[99,807],232:[101,768],233:[101,769],234:[101,770],235:[101,776],236:[105,768],237:[105,769],238:[105,770],239:[105,776],241:[110,771],242:[111,768],243:[111,769],244:[111,770],245:[111,771],246:[111,776],249:[117,768],250:[117,769],251:[117,770],252:[117,776],253:[121,769],296:[73,771],297:[105,771],298:[73,772],299:[105,772],300:[73,774],301:[105,774],302:[73,808],303:[105,808],304:[73,775],308:[74,770],309:[106,770],310:[75,807],311:[107,807],313:[76,769],314:[108,769],315:[76,807],316:[108,807],317:[76,780],318:[108,780],323:[78,769],324:[110,769],325:[78,807],326:[110,807],327:[78,780],328:[110,780],332:[79,772],333:[111,772],334:[79,774],335:[111,774],336:[79,779],337:[111,779],416:[79,795],417:[111,795],431:[85,795],432:[117,795],478:[65,776,772],479:[97,776,772],480:[65,775,772],481:[97,775,772],482:[198,772],483:[230,772],486:[71,780],487:[103,780],488:[75,780],489:[107,780],490:[79,808],491:[111,808],492:[79,808,772],493:[111,808,772],494:[439,780],495:[658,780],496:[106,780],500:[71,769],501:[103,769],542:[72,780],543:[104,780],550:[65,775],551:[97,775],552:[69,807],553:[101,807],554:[79,776,772],555:[111,776,772],556:[79,771,772],557:[111,771,772],558:[79,775],559:[111,775],560:[79,775,772],561:[111,775,772],562:[89,772],563:[121,772],832:768,833:769,835:787,836:[776,769],884:697,894:59,901:[168,769],902:[913,769],903:183,904:[917,769],905:[919,769],906:[921,769],908:[927,769],910:[933,769],911:[937,769],912:[953,776,769],938:[921,776],939:[933,776],940:[945,769],941:[949,769],942:[951,769],943:[953,769],944:[965,776,769],970:[953,776],971:[965,776],972:[959,769],973:[965,769],974:[969,769],979:[978,769],980:[978,776],1024:[1045,768],1025:[1045,776],1027:[1043,769],1031:[1030,776],1036:[1050,769],1037:[1048,768],1038:[1059,774],1049:[1048,774],1081:[1080,774],1104:[1077,768],1105:[1077,776],1107:[1075,769],1111:[1110,776],1116:[1082,769],1117:[1080,768],1118:[1091,774],1142:[1140,783],1143:[1141,783],1217:[1046,774],1218:[1078,774],1232:[1040,774],1233:[1072,774],1234:[1040,776],1235:[1072,776],1238:[1045,774],1239:[1077,774],1242:[1240,776],1243:[1241,776],1244:[1046,776],1245:[1078,776],1246:[1047,776],1247:[1079,776],1250:[1048,772],1251:[1080,772],1252:[1048,776],1253:[1080,776],1254:[1054,776],1255:[1086,776],1258:[1256,776],1259:[1257,776],1260:[1069,776],1261:[1101,776],1262:[1059,772],1263:[1091,772],1264:[1059,776],1265:[1091,776],1266:[1059,779],1267:[1091,779],1268:[1063,776],1269:[1095,776],1272:[1067,776],1273:[1099,776],1570:[1575,1619],1571:[1575,1620],1572:[1608,1620],1573:[1575,1621],1574:[1610,1620],1728:[1749,1620],1730:[1729,1620],1747:[1746,1620],2345:[2344,2364],2353:[2352,2364],2356:[2355,2364],2392:[2325,2364],2393:[2326,2364],2394:[2327,2364],2395:[2332,2364],2396:[2337,2364],2397:[2338,2364],2398:[2347,2364],2399:[2351,2364],2507:[2503,2494],2508:[2503,2519],2524:[2465,2492],2525:[2466,2492],2527:[2479,2492],2611:[2610,2620],2614:[2616,2620],2649:[2582,2620],2650:[2583,2620],2651:[2588,2620],2654:[2603,2620],2888:[2887,2902],2891:[2887,2878],2892:[2887,2903],2908:[2849,2876],2909:[2850,2876],2964:[2962,3031],3018:[3014,3006],3019:[3015,3006],3020:[3014,3031],3144:[3142,3158],3264:[3263,3285],3271:[3270,3285],3272:[3270,3286],3274:[3270,3266],3275:[3270,3266,3285],3402:[3398,3390],3403:[3399,3390],3404:[3398,3415],3546:[3545,3530],3548:[3545,3535],3549:[3545,3535,3530],3550:[3545,3551],3907:[3906,4023],3917:[3916,4023],3922:[3921,4023],3927:[3926,4023],3932:[3931,4023],3945:[3904,4021],3955:[3953,3954],3957:[3953,3956],3958:[4018,3968],3960:[4019,3968],3969:[3953,3968],3987:[3986,4023],3997:[3996,4023],4002:[4001,4023],4007:[4006,4023],4012:[4011,4023],4025:[3984,4021],4134:[4133,4142],7835:[383,775],7960:[917,787],7961:[917,788],7962:[917,787,768],7963:[917,788,768],7964:[917,787,769],7965:[917,788,769],8008:[927,787],8009:[927,788],8010:[927,787,768],8011:[927,788,768],8012:[927,787,769],8013:[927,788,769],8016:[965,787],8017:[965,788],8018:[965,787,768],8019:[965,788,768],8020:[965,787,769],8021:[965,788,769],8022:[965,787,834],8023:[965,788,834],8025:[933,788],8027:[933,788,768],8029:[933,788,769],8118:[945,834],8119:[945,834,837],8120:[913,774],8121:[913,772],8122:[913,768],8123:[913,769],8124:[913,837],8126:953,8129:[168,834],8130:[951,768,837],8131:[951,837],8132:[951,769,837],8134:[951,834],8135:[951,834,837],8136:[917,768],8137:[917,769],8138:[919,768],8139:[919,769],8140:[919,837],8141:[8127,768],8142:[8127,769],8143:[8127,834],8144:[953,774],8145:[953,772],8146:[953,776,768],8147:[953,776,769],8150:[953,834],8151:[953,776,834],8152:[921,774],8153:[921,772],8154:[921,768],8155:[921,769],8178:[969,768,837],8179:[969,837],8180:[969,769,837],8182:[969,834],8183:[969,834,837],8184:[927,768],8185:[927,769],8186:[937,768],8187:[937,769],8188:[937,837],8189:180,8192:8194,8193:8195,8486:937,8490:75,8491:[65,778],8602:[8592,824],8603:[8594,824],8622:[8596,824],8653:[8656,824],8654:[8660,824],8655:[8658,824],8708:[8707,824],8713:[8712,824],8716:[8715,824],8740:[8739,824],8742:[8741,824],8769:[8764,824],8772:[8771,824],8775:[8773,824],8777:[8776,824],8800:[61,824],8802:[8801,824],8813:[8781,824],8814:[60,824],8815:[62,824],8816:[8804,824],8817:[8805,824],8820:[8818,824],8821:[8819,824],8824:[8822,824],8825:[8823,824],8832:[8826,824],8833:[8827,824],8836:[8834,824],8837:[8835,824],8840:[8838,824],8841:[8839,824],8876:[8866,824],8877:[8872,824],8878:[8873,824],8879:[8875,824],8928:[8828,824],8929:[8829,824],8930:[8849,824],8931:[8850,824],8938:[8882,824],8939:[8883,824],8940:[8884,824],8941:[8885,824],9001:12296,9002:12297,10972:[10973,824],12364:[12363,12441],12366:[12365,12441],12368:[12367,12441],12370:[12369,12441],12372:[12371,12441],12374:[12373,12441],12376:[12375,12441],12378:[12377,12441],12380:[12379,12441],12382:[12381,12441],12384:[12383,12441],12386:[12385,12441],12389:[12388,12441],12391:[12390,12441],12393:[12392,12441],12400:[12399,12441],12401:[12399,12442],12403:[12402,12441],12404:[12402,12442],12406:[12405,12441],12407:[12405,12442],12409:[12408,12441],12410:[12408,12442],12412:[12411,12441],12413:[12411,12442],12436:[12358,12441],12446:[12445,12441],12460:[12459,12441],12462:[12461,12441],12464:[12463,12441],12466:[12465,12441],12468:[12467,12441],12470:[12469,12441],12472:[12471,12441],12474:[12473,12441],12476:[12475,12441],12478:[12477,12441],12480:[12479,12441],12482:[12481,12441],12485:[12484,12441],12487:[12486,12441],12489:[12488,12441],12496:[12495,12441],12497:[12495,12442],12499:[12498,12441],12500:[12498,12442],12502:[12501,12441],12503:[12501,12442],12505:[12504,12441],12506:[12504,12442],12508:[12507,12441],12509:[12507,12442],12532:[12454,12441],12535:[12527,12441],12536:[12528,12441],12537:[12529,12441],12538:[12530,12441],12542:[12541,12441],64016:22618,64018:26228,64021:20958,64022:29482,64023:30410,64024:31036,64025:31070,64026:31077,64027:31119,64028:38742,64029:31934,64030:32701,64032:34322,64034:35576,64037:36920,64038:37117,64042:39151,64043:39164,64044:39208,64045:40372,64285:[1497,1460],64287:[1522,1463],64298:[1513,1473],64299:[1513,1474],64300:[1513,1468,1473],64301:[1513,1468,1474],64302:[1488,1463],64303:[1488,1464],64304:[1488,1468],64305:[1489,1468],64306:[1490,1468],64307:[1491,1468],64308:[1492,1468],64309:[1493,1468],64310:[1494,1468],64312:[1496,1468],64313:[1497,1468],64314:[1498,1468],64315:[1499,1468],64316:[1500,1468],64318:[1502,1468],64320:[1504,1468],64321:[1505,1468],64323:[1507,1468],64324:[1508,1468],64326:[1510,1468],64327:[1511,1468],64328:[1512,1468],64329:[1513,1468],64330:[1514,1468],64331:[1493,1465],64332:[1489,1471],64333:[1499,1471],64334:[1508,1471],119134:[119127,119141],119135:[119128,119141],119136:[119128,119141,119150],119137:[119128,119141,119151],119138:[119128,119141,119152],119139:[119128,119141,119153],119140:[119128,119141,119154],119227:[119225,119141],119228:[119226,119141],119229:[119225,119141,119150],119230:[119226,119141,119150],119231:[119225,119141,119151],119232:[119226,119141,119151]};(function(){var cv,cu,cx;var cw=bG;cv=[[121,776],[65,772],[97,772],[65,774],[97,774],[65,808],[97,808],[67,769],[99,769],[67,770],[99,770],[67,775],[99,775],[67,780],[99,780],[68,780],[100,780],];for(cu=0;cu<17;cu++){cx=cv[cu];cw[cu+255]=cx}cv=[[69,772],[101,772],[69,774],[101,774],[69,775],[101,775],[69,808],[101,808],[69,780],[101,780],[71,770],[103,770],[71,774],[103,774],[71,775],[103,775],[71,807],[103,807],[72,770],[104,770],];for(cu=0;cu<20;cu++){cx=cv[cu];cw[cu+274]=cx}cv=[[82,769],[114,769],[82,807],[114,807],[82,780],[114,780],[83,769],[115,769],[83,770],[115,770],[83,807],[115,807],[83,780],[115,780],[84,807],[116,807],[84,780],[116,780],];for(cu=0;cu<18;cu++){cx=cv[cu];cw[cu+340]=cx}cv=[[85,771],[117,771],[85,772],[117,772],[85,774],[117,774],[85,778],[117,778],[85,779],[117,779],[85,808],[117,808],[87,770],[119,770],[89,770],[121,770],[89,776],[90,769],[122,769],[90,775],[122,775],[90,780],[122,780],];for(cu=0;cu<23;cu++){cx=cv[cu];cw[cu+360]=cx}cv=[[65,780],[97,780],[73,780],[105,780],[79,780],[111,780],[85,780],[117,780],[85,776,772],[117,776,772],[85,776,769],[117,776,769],[85,776,780],[117,776,780],[85,776,768],[117,776,768],];for(cu=0;cu<16;cu++){cx=cv[cu];cw[cu+461]=cx}cv=[[78,768],[110,768],[65,778,769],[97,778,769],[198,769],[230,769],[216,769],[248,769],[65,783],[97,783],[65,785],[97,785],[69,783],[101,783],[69,785],[101,785],[73,783],[105,783],[73,785],[105,785],[79,783],[111,783],[79,785],[111,785],[82,783],[114,783],[82,785],[114,785],[85,783],[117,783],[85,785],[117,785],[83,806],[115,806],[84,806],[116,806],];for(cu=0;cu<36;cu++){cx=cv[cu];cw[cu+504]=cx}cv=[[65,805],[97,805],[66,775],[98,775],[66,803],[98,803],[66,817],[98,817],[67,807,769],[99,807,769],[68,775],[100,775],[68,803],[100,803],[68,817],[100,817],[68,807],[100,807],[68,813],[100,813],[69,772,768],[101,772,768],[69,772,769],[101,772,769],[69,813],[101,813],[69,816],[101,816],[69,807,774],[101,807,774],[70,775],[102,775],[71,772],[103,772],[72,775],[104,775],[72,803],[104,803],[72,776],[104,776],[72,807],[104,807],[72,814],[104,814],[73,816],[105,816],[73,776,769],[105,776,769],[75,769],[107,769],[75,803],[107,803],[75,817],[107,817],[76,803],[108,803],[76,803,772],[108,803,772],[76,817],[108,817],[76,813],[108,813],[77,769],[109,769],[77,775],[109,775],[77,803],[109,803],[78,775],[110,775],[78,803],[110,803],[78,817],[110,817],[78,813],[110,813],[79,771,769],[111,771,769],[79,771,776],[111,771,776],[79,772,768],[111,772,768],[79,772,769],[111,772,769],[80,769],[112,769],[80,775],[112,775],[82,775],[114,775],[82,803],[114,803],[82,803,772],[114,803,772],[82,817],[114,817],[83,775],[115,775],[83,803],[115,803],[83,769,775],[115,769,775],[83,780,775],[115,780,775],[83,803,775],[115,803,775],[84,775],[116,775],[84,803],[116,803],[84,817],[116,817],[84,813],[116,813],[85,804],[117,804],[85,816],[117,816],[85,813],[117,813],[85,771,769],[117,771,769],[85,772,776],[117,772,776],[86,771],[118,771],[86,803],[118,803],[87,768],[119,768],[87,769],[119,769],[87,776],[119,776],[87,775],[119,775],[87,803],[119,803],[88,775],[120,775],[88,776],[120,776],[89,775],[121,775],[90,770],[122,770],[90,803],[122,803],[90,817],[122,817],[104,817],[116,776],[119,778],[121,778],];for(cu=0;cu<154;cu++){cx=cv[cu];cw[cu+7680]=cx}cv=[[65,803],[97,803],[65,777],[97,777],[65,770,769],[97,770,769],[65,770,768],[97,770,768],[65,770,777],[97,770,777],[65,770,771],[97,770,771],[65,803,770],[97,803,770],[65,774,769],[97,774,769],[65,774,768],[97,774,768],[65,774,777],[97,774,777],[65,774,771],[97,774,771],[65,803,774],[97,803,774],[69,803],[101,803],[69,777],[101,777],[69,771],[101,771],[69,770,769],[101,770,769],[69,770,768],[101,770,768],[69,770,777],[101,770,777],[69,770,771],[101,770,771],[69,803,770],[101,803,770],[73,777],[105,777],[73,803],[105,803],[79,803],[111,803],[79,777],[111,777],[79,770,769],[111,770,769],[79,770,768],[111,770,768],[79,770,777],[111,770,777],[79,770,771],[111,770,771],[79,803,770],[111,803,770],[79,795,769],[111,795,769],[79,795,768],[111,795,768],[79,795,777],[111,795,777],[79,795,771],[111,795,771],[79,795,803],[111,795,803],[85,803],[117,803],[85,777],[117,777],[85,795,769],[117,795,769],[85,795,768],[117,795,768],[85,795,777],[117,795,777],[85,795,771],[117,795,771],[85,795,803],[117,795,803],[89,768],[121,768],[89,803],[121,803],[89,777],[121,777],[89,771],[121,771],];for(cu=0;cu<90;cu++){cx=cv[cu];cw[cu+7840]=cx}cv=[[945,787],[945,788],[945,787,768],[945,788,768],[945,787,769],[945,788,769],[945,787,834],[945,788,834],[913,787],[913,788],[913,787,768],[913,788,768],[913,787,769],[913,788,769],[913,787,834],[913,788,834],[949,787],[949,788],[949,787,768],[949,788,768],[949,787,769],[949,788,769],];for(cu=0;cu<22;cu++){cx=cv[cu];cw[cu+7936]=cx}cv=[[951,787],[951,788],[951,787,768],[951,788,768],[951,787,769],[951,788,769],[951,787,834],[951,788,834],[919,787],[919,788],[919,787,768],[919,788,768],[919,787,769],[919,788,769],[919,787,834],[919,788,834],[953,787],[953,788],[953,787,768],[953,788,768],[953,787,769],[953,788,769],[953,787,834],[953,788,834],[921,787],[921,788],[921,787,768],[921,788,768],[921,787,769],[921,788,769],[921,787,834],[921,788,834],[959,787],[959,788],[959,787,768],[959,788,768],[959,787,769],[959,788,769],];for(cu=0;cu<38;cu++){cx=cv[cu];cw[cu+7968]=cx}cv=[[933,788,834],[969,787],[969,788],[969,787,768],[969,788,768],[969,787,769],[969,788,769],[969,787,834],[969,788,834],[937,787],[937,788],[937,787,768],[937,788,768],[937,787,769],[937,788,769],[937,787,834],[937,788,834],[945,768],[945,769],[949,768],[949,769],[951,768],[951,769],[953,768],[953,769],[959,768],[959,769],[965,768],[965,769],[969,768],[969,769],];for(cu=0;cu<31;cu++){cx=cv[cu];cw[cu+8031]=cx}cv=[[945,787,837],[945,788,837],[945,787,768,837],[945,788,768,837],[945,787,769,837],[945,788,769,837],[945,787,834,837],[945,788,834,837],[913,787,837],[913,788,837],[913,787,768,837],[913,788,768,837],[913,787,769,837],[913,788,769,837],[913,787,834,837],[913,788,834,837],[951,787,837],[951,788,837],[951,787,768,837],[951,788,768,837],[951,787,769,837],[951,788,769,837],[951,787,834,837],[951,788,834,837],[919,787,837],[919,788,837],[919,787,768,837],[919,788,768,837],[919,787,769,837],[919,788,769,837],[919,787,834,837],[919,788,834,837],[969,787,837],[969,788,837],[969,787,768,837],[969,788,768,837],[969,787,769,837],[969,788,769,837],[969,787,834,837],[969,788,834,837],[937,787,837],[937,788,837],[937,787,768,837],[937,788,768,837],[937,787,769,837],[937,788,769,837],[937,787,834,837],[937,788,834,837],[945,774],[945,772],[945,768,837],[945,837],[945,769,837],];for(cu=0;cu<53;cu++){cx=cv[cu];cw[cu+8064]=cx}cv=[[8190,768],[8190,769],[8190,834],[965,774],[965,772],[965,776,768],[965,776,769],[961,787],[961,788],[965,834],[965,776,834],[933,774],[933,772],[933,768],[933,769],[929,788],[168,768],[168,769],96,];for(cu=0;cu<19;cu++){cx=cv[cu];cw[cu+8157]=cx}cv=[35912,26356,36554,36040,28369,20018,21477,40860,40860,22865,37329,21895,22856,25078,30313,32645,34367,34746,35064,37007,27138,27931,28889,29662,33853,37226,39409,20098,21365,27396,29211,34349,40478,23888,28651,34253,35172,25289,33240,34847,24266,26391,28010,29436,37070,20358,20919,21214,25796,27347,29200,30439,32769,34310,34396,36335,38706,39791,40442,30860,31103,32160,33737,37636,40575,35542,22751,24324,31840,32894,29282,30922,36034,38647,22744,23650,27155,28122,28431,32047,32311,38475,21202,32907,20956,20940,31260,32190,33777,38517,35712,25295,27138,35582,20025,23527,24594,29575,30064,21271,30971,20415,24489,19981,27852,25976,32034,21443,22622,30465,33865,35498,27578,36784,27784,25342,33509,25504,30053,20142,20841,20937,26753,31975,33391,35538,37327,21237,21570,22899,24300,26053,28670,31018,38317,39530,40599,40654,21147,26310,27511,36706,24180,24976,25088,25754,28451,29001,29833,31178,32244,32879,36646,34030,36899,37706,21015,21155,21693,28872,35010,35498,24265,24565,25467,27566,31806,29557,20196,22265,23527,23994,24604,29618,29801,32666,32838,37428,38646,38728,38936,20363,31150,37300,38584,24801,20102,20698,23534,23615,26009,27138,29134,30274,34044,36988,40845,26248,38446,21129,26491,26611,27969,28316,29705,30041,30827,32016,39006,20845,25134,38520,20523,23833,28138,36650,24459,24900,26647,29575,38534,21033,21519,23653,26131,26446,26792,27877,29702,30178,32633,35023,35041,37324,38626,21311,28346,21533,29136,29848,34298,38563,40023,40607,26519,28107,33256,31435,31520,31890,29376,28825,35672,20160,33590,21050,20999,24230,25299,31958,23429,27934,26292,36667,34892,38477,35211,24275,20800,21952,];for(cu=0;cu<270;cu++){cx=cv[cu];cw[cu+63744]=cx}cv=[20398,20711,20813,21193,21220,21329,21917,22022,22120,22592,22696,23652,23662,24724,24936,24974,25074,25935,26082,26257,26757,28023,28186,28450,29038,29227,29730,30865,31038,31049,31048,31056,31062,31069,31117,31118,31296,31361,31680,32244,32265,32321,32626,32773,33261,33401,33401,33879,35088,35222,35585,35641,36051,36104,36790,36920,38627,38911,38971,];for(cu=0;cu<59;cu++){cx=cv[cu];cw[cu+64048]=cx}cv=[20029,20024,20033,131362,20320,20398,20411,20482,20602,20633,20711,20687,13470,132666,20813,20820,20836,20855,132380,13497,20839,20877,132427,20887,20900,20172,20908,20917,168415,20981,20995,13535,21051,21062,21106,21111,13589,21191,21193,21220,21242,21253,21254,21271,21321,21329,21338,21363,21373,21375,21375,21375,133676,28784,21450,21471,133987,21483,21489,21510,21662,21560,21576,21608,21666,21750,21776,21843,21859,21892,21892,21913,21931,21939,21954,22294,22022,22295,22097,22132,20999,22766,22478,22516,22541,22411,22578,22577,22700,136420,22770,22775,22790,22810,22818,22882,136872,136938,23020,23067,23079,23000,23142,14062,14076,23304,23358,23358,137672,23491,23512,23527,23539,138008,23551,23558,24403,23586,14209,23648,23662,23744,23693,138724,23875,138726,23918,23915,23932,24033,24034,14383,24061,24104,24125,24169,14434,139651,14460,24240,24243,24246,24266,172946,24318,140081,140081,33281,24354,24354,14535,144056,156122,24418,24427,14563,24474,24525,24535,24569,24705,14650,14620,24724,141012,24775,24904,24908,24910,24908,24954,24974,25010,24996,25007,25054,25074,25078,25104,25115,25181,25265,25300,25424,142092,25405,25340,25448,25475,25572,142321,25634,25541,25513,14894,25705,25726,25757,25719,14956,25935,25964,143370,26083,26360,26185,15129,26257,15112,15076,20882,20885,26368,26268,32941,17369,26391,26395,26401,26462,26451,144323,15177,26618,26501,26706,26757,144493,26766,26655,26900,15261,26946,27043,27114,27304,145059,27355,15384,27425,145575,27476,15438,27506,27551,27578,27579,146061,138507,146170,27726,146620,27839,27853,27751,27926,27966,28023,27969,28009,28024,28037,146718,27956,28207,28270,15667,28363,28359,147153,28153,28526,147294,147342,28614,28729,28702,28699,15766,28746,28797,28791,28845,132389,28997,148067,29084,148395,29224,29237,29264,149000,29312,29333,149301,149524,29562,29579,16044,29605,16056,16056,29767,29788,29809,29829,29898,16155,29988,150582,30014,150674,30064,139679,30224,151457,151480,151620,16380,16392,30452,151795,151794,151833,151859,30494,30495,30495,30538,16441,30603,16454,16534,152605,30798,30860,30924,16611,153126,31062,153242,153285,31119,31211,16687,31296,31306,31311,153980,154279,154279,31470,16898,154539,31686,31689,16935,154752,31954,17056,31976,31971,32000,155526,32099,17153,32199,32258,32325,17204,156200,156231,17241,156377,32634,156478,32661,32762,32773,156890,156963,32864,157096,32880,144223,17365,32946,33027,17419,33086,23221,157607,157621,144275,144284,33281,33284,36766,17515,33425,33419,33437,21171,33457,33459,33469,33510,158524,33509,33565,33635,33709,33571,33725,33767,33879,33619,33738,33740,33756,158774,159083,158933,17707,34033,34035,34070,160714,34148,159532,17757,17761,159665,159954,17771,34384,34396,34407,34409,34473,34440,34574,34530,34681,34600,34667,34694,17879,34785,34817,17913,34912,34915,161383,35031,35038,17973,35066,13499,161966,162150,18110,18119,35488,35565,35722,35925,162984,36011,36033,36123,36215,163631,133124,36299,36284,36336,133342,36564,36664,165330,165357,37012,37105,37137,165678,37147,37432,37591,37592,37500,37881,37909,166906,38283,18837,38327,167287,18918,38595,23986,38691,168261,168474,19054,19062,38880,168970,19122,169110,38923,38923,38953,169398,39138,19251,39209,39335,39362,39422,19406,170800,39698,40000,40189,19662,19693,40295,172238,19704,172293,172558,172689,40635,19798,40697,40702,40709,40719,40726,40763,173568,];for(cu=0;cu<542;cu++){cx=cv[cu];cw[cu+194560]=cx}})();var bL={768:230,769:230,770:230,771:230,772:230,773:230,774:230,775:230,776:230,777:230,778:230,779:230,780:230,781:230,782:230,783:230,784:230,785:230,786:230,787:230,788:230,789:232,790:220,791:220,792:220,793:220,794:232,795:216,796:220,797:220,798:220,799:220,800:220,801:202,802:202,803:220,804:220,805:220,806:220,807:202,808:202,809:220,810:220,811:220,812:220,813:220,814:220,815:220,816:220,817:220,818:220,819:220,820:1,821:1,822:1,823:1,824:1,825:220,826:220,827:220,828:220,829:230,830:230,831:230,832:230,833:230,834:230,835:230,836:230,837:240,838:230,839:220,840:220,841:220,842:230,843:230,844:230,845:220,846:220,848:230,849:230,850:230,851:220,852:220,853:220,854:220,855:230,861:234,862:234,863:233,864:234,865:234,866:233,867:230,868:230,869:230,870:230,871:230,872:230,873:230,874:230,875:230,876:230,877:230,878:230,879:230,1155:230,1156:230,1157:230,1158:230,1425:220,1426:230,1427:230,1428:230,1429:230,1430:220,1431:230,1432:230,1433:230,1434:222,1435:220,1436:230,1437:230,1438:230,1439:230,1440:230,1441:230,1443:220,1444:220,1445:220,1446:220,1447:220,1448:230,1449:230,1450:220,1451:230,1452:230,1453:222,1454:228,1455:230,1456:10,1457:11,1458:12,1459:13,1460:14,1461:15,1462:16,1463:17,1464:18,1465:19,1467:20,1468:21,1469:22,1471:23,1473:24,1474:25,1476:230,1552:230,1553:230,1554:230,1555:230,1556:230,1557:230,1611:27,1612:28,1613:29,1614:30,1615:31,1616:32,1617:33,1618:34,1619:230,1620:230,1621:220,1622:220,1623:230,1624:230,1648:35,1750:230,1751:230,1752:230,1753:230,1754:230,1755:230,1756:230,1759:230,1760:230,1761:230,1762:230,1763:220,1764:230,1767:230,1768:230,1770:220,1771:230,1772:230,1773:220,1809:36,1840:230,1841:220,1842:230,1843:230,1844:220,1845:230,1846:230,1847:220,1848:220,1849:220,1850:230,1851:220,1852:220,1853:230,1854:220,1855:230,1856:230,1857:230,1858:220,1859:230,1860:220,1861:230,1862:220,1863:230,1864:220,1865:230,1866:230,2364:7,2381:9,2385:230,2386:220,2387:230,2388:230,2492:7,2509:9,2620:7,2637:9,2748:7,2765:9,2876:7,2893:9,3021:9,3149:9,3157:84,3158:91,3260:7,3277:9,3405:9,3530:9,3640:103,3641:103,3642:9,3656:107,3657:107,3658:107,3659:107,3768:118,3769:118,3784:122,3785:122,3786:122,3787:122,3864:220,3865:220,3893:220,3895:220,3897:216,3953:129,3954:130,3956:132,3962:130,3963:130,3964:130,3965:130,3968:130,3970:230,3971:230,3972:9,3974:230,3975:230,4038:220,4151:7,4153:9,5908:9,5940:9,6098:9,6109:230,6313:228,6457:222,6458:230,6459:220,8400:230,8401:230,8402:1,8403:1,8404:230,8405:230,8406:230,8407:230,8408:1,8409:1,8410:1,8411:230,8412:230,8417:230,8421:1,8422:1,8423:230,8424:220,8425:230,8426:1,12330:218,12331:228,12332:232,12333:222,12334:224,12335:224,12441:8,12442:8,64286:26,65056:230,65057:230,65058:230,65059:230,119141:216,119142:216,119143:1,119144:1,119145:1,119149:226,119150:216,119151:216,119152:216,119153:216,119154:216,119163:220,119164:220,119165:220,119166:220,119167:220,119168:220,119169:220,119170:220,119173:230,119174:230,119175:230,119176:230,119177:230,119178:220,119179:220,119210:230,119211:230,119212:230,119213:230};var bD={60:{824:8814},61:{824:8800},62:{824:8815},65:{768:192,769:193,770:194,771:195,772:256,774:258,775:550,776:196,777:7842,778:197,780:461,783:512,785:514,803:7840,805:7680,808:260},66:{775:7682,803:7684,817:7686},67:{769:262,770:264,775:266,780:268,807:199},68:{775:7690,780:270,803:7692,807:7696,813:7698,817:7694},69:{768:200,769:201,770:202,771:7868,772:274,774:276,775:278,776:203,777:7866,780:282,783:516,785:518,803:7864,807:552,808:280,813:7704,816:7706},70:{775:7710},71:{769:500,770:284,772:7712,774:286,775:288,780:486,807:290},72:{770:292,775:7714,776:7718,780:542,803:7716,807:7720,814:7722},73:{768:204,769:205,770:206,771:296,772:298,774:300,775:304,776:207,777:7880,780:463,783:520,785:522,803:7882,808:302,816:7724},74:{770:308},75:{769:7728,780:488,803:7730,807:310,817:7732},76:{769:313,780:317,803:7734,807:315,813:7740,817:7738},77:{769:7742,775:7744,803:7746},78:{768:504,769:323,771:209,775:7748,780:327,803:7750,807:325,813:7754,817:7752},79:{768:210,769:211,770:212,771:213,772:332,774:334,775:558,776:214,777:7886,779:336,780:465,783:524,785:526,795:416,803:7884,808:490},80:{769:7764,775:7766},82:{769:340,775:7768,780:344,783:528,785:530,803:7770,807:342,817:7774},83:{769:346,770:348,775:7776,780:352,803:7778,806:536,807:350},84:{775:7786,780:356,803:7788,806:538,807:354,813:7792,817:7790},85:{768:217,769:218,770:219,771:360,772:362,774:364,776:220,777:7910,778:366,779:368,780:467,783:532,785:534,795:431,803:7908,804:7794,808:370,813:7798,816:7796},86:{771:7804,803:7806},87:{768:7808,769:7810,770:372,775:7814,776:7812,803:7816},88:{775:7818,776:7820},89:{768:7922,769:221,770:374,771:7928,772:562,775:7822,776:376,777:7926,803:7924},90:{769:377,770:7824,775:379,780:381,803:7826,817:7828},97:{768:224,769:225,770:226,771:227,772:257,774:259,775:551,776:228,777:7843,778:229,780:462,783:513,785:515,803:7841,805:7681,808:261},98:{775:7683,803:7685,817:7687},99:{769:263,770:265,775:267,780:269,807:231},100:{775:7691,780:271,803:7693,807:7697,813:7699,817:7695},101:{768:232,769:233,770:234,771:7869,772:275,774:277,775:279,776:235,777:7867,780:283,783:517,785:519,803:7865,807:553,808:281,813:7705,816:7707},102:{775:7711},103:{769:501,770:285,772:7713,774:287,775:289,780:487,807:291},104:{770:293,775:7715,776:7719,780:543,803:7717,807:7721,814:7723,817:7830},105:{768:236,769:237,770:238,771:297,772:299,774:301,776:239,777:7881,780:464,783:521,785:523,803:7883,808:303,816:7725},106:{770:309,780:496},107:{769:7729,780:489,803:7731,807:311,817:7733},108:{769:314,780:318,803:7735,807:316,813:7741,817:7739},109:{769:7743,775:7745,803:7747},110:{768:505,769:324,771:241,775:7749,780:328,803:7751,807:326,813:7755,817:7753},111:{768:242,769:243,770:244,771:245,772:333,774:335,775:559,776:246,777:7887,779:337,780:466,783:525,785:527,795:417,803:7885,808:491},112:{769:7765,775:7767},114:{769:341,775:7769,780:345,783:529,785:531,803:7771,807:343,817:7775},115:{769:347,770:349,775:7777,780:353,803:7779,806:537,807:351},116:{775:7787,776:7831,780:357,803:7789,806:539,807:355,813:7793,817:7791},117:{768:249,769:250,770:251,771:361,772:363,774:365,776:252,777:7911,778:367,779:369,780:468,783:533,785:535,795:432,803:7909,804:7795,808:371,813:7799,816:7797},118:{771:7805,803:7807},119:{768:7809,769:7811,770:373,775:7815,776:7813,778:7832,803:7817},120:{775:7819,776:7821},121:{768:7923,769:253,770:375,771:7929,772:563,775:7823,776:255,777:7927,778:7833,803:7925},122:{769:378,770:7825,775:380,780:382,803:7827,817:7829},168:{768:8173,769:901,834:8129},194:{768:7846,769:7844,771:7850,777:7848},196:{772:478},197:{769:506},198:{769:508,772:482},199:{769:7688},202:{768:7872,769:7870,771:7876,777:7874},207:{769:7726},212:{768:7890,769:7888,771:7894,777:7892},213:{769:7756,772:556,776:7758},214:{772:554},216:{769:510},220:{768:475,769:471,772:469,780:473},226:{768:7847,769:7845,771:7851,777:7849},228:{772:479},229:{769:507},230:{769:509,772:483},231:{769:7689},234:{768:7873,769:7871,771:7877,777:7875},239:{769:7727},244:{768:7891,769:7889,771:7895,777:7893},245:{769:7757,772:557,776:7759},246:{772:555},248:{769:511},252:{768:476,769:472,772:470,780:474},258:{768:7856,769:7854,771:7860,777:7858},259:{768:7857,769:7855,771:7861,777:7859},274:{768:7700,769:7702},275:{768:7701,769:7703},332:{768:7760,769:7762},333:{768:7761,769:7763},346:{775:7780},347:{775:7781},352:{775:7782},353:{775:7783},360:{769:7800},361:{769:7801},362:{776:7802},363:{776:7803},383:{775:7835},416:{768:7900,769:7898,771:7904,777:7902,803:7906},417:{768:7901,769:7899,771:7905,777:7903,803:7907},431:{768:7914,769:7912,771:7918,777:7916,803:7920},432:{768:7915,769:7913,771:7919,777:7917,803:7921},439:{780:494},490:{772:492},491:{772:493},550:{772:480},551:{772:481},552:{774:7708},553:{774:7709},558:{772:560},559:{772:561},658:{780:495},776:{769:836},913:{768:8122,769:902,772:8121,774:8120,787:7944,788:7945,837:8124},917:{768:8136,769:904,787:7960,788:7961},919:{768:8138,769:905,787:7976,788:7977,837:8140},921:{768:8154,769:906,772:8153,774:8152,776:938,787:7992,788:7993},927:{768:8184,769:908,787:8008,788:8009},929:{788:8172},933:{768:8170,769:910,772:8169,774:8168,776:939,788:8025},937:{768:8186,769:911,787:8040,788:8041,837:8188},940:{837:8116},942:{837:8132},945:{768:8048,769:940,772:8113,774:8112,787:7936,788:7937,834:8118,837:8115},949:{768:8050,769:941,787:7952,788:7953},951:{768:8052,769:942,787:7968,788:7969,834:8134,837:8131},953:{768:8054,769:943,772:8145,774:8144,776:970,787:7984,788:7985,834:8150},959:{768:8056,769:972,787:8000,788:8001},961:{787:8164,788:8165},965:{768:8058,769:973,772:8161,774:8160,776:971,787:8016,788:8017,834:8166},969:{768:8060,769:974,787:8032,788:8033,834:8182,837:8179},970:{768:8146,769:912,834:8151},971:{768:8162,769:944,834:8167},974:{837:8180},978:{769:979,776:980},1030:{776:1031},1040:{774:1232,776:1234},1043:{769:1027},1045:{768:1024,774:1238,776:1025},1046:{774:1217,776:1244},1047:{776:1246},1048:{768:1037,772:1250,774:1049,776:1252},1050:{769:1036},1054:{776:1254},1059:{772:1262,774:1038,776:1264,779:1266},1063:{776:1268},1067:{776:1272},1069:{776:1260},1072:{774:1233,776:1235},1075:{769:1107},1077:{768:1104,774:1239,776:1105},1078:{774:1218,776:1245},1079:{776:1247},1080:{768:1117,772:1251,774:1081,776:1253},1082:{769:1116},1086:{776:1255},1091:{772:1263,774:1118,776:1265,779:1267},1095:{776:1269},1099:{776:1273},1101:{776:1261},1110:{776:1111},1140:{783:1142},1141:{783:1143},1240:{776:1242},1241:{776:1243},1256:{776:1258},1257:{776:1259},1488:{1463:64302,1464:64303,1468:64304},1489:{1468:64305,1471:64332},1490:{1468:64306},1491:{1468:64307},1492:{1468:64308},1493:{1465:64331,1468:64309},1494:{1468:64310},1496:{1468:64312},1497:{1460:64285,1468:64313},1498:{1468:64314},1499:{1468:64315,1471:64333},1500:{1468:64316},1502:{1468:64318},1504:{1468:64320},1505:{1468:64321},1507:{1468:64323},1508:{1468:64324,1471:64334},1510:{1468:64326},1511:{1468:64327},1512:{1468:64328},1513:{1468:64329,1473:64298,1474:64299},1514:{1468:64330},1522:{1463:64287},1575:{1619:1570,1620:1571,1621:1573},1608:{1620:1572},1610:{1620:1574},1729:{1620:1730},1746:{1620:1747},1749:{1620:1728},2325:{2364:2392},2326:{2364:2393},2327:{2364:2394},2332:{2364:2395},2337:{2364:2396},2338:{2364:2397},2344:{2364:2345},2347:{2364:2398},2351:{2364:2399},2352:{2364:2353},2355:{2364:2356},2465:{2492:2524},2466:{2492:2525},2479:{2492:2527},2503:{2494:2507,2519:2508},2582:{2620:2649},2583:{2620:2650},2588:{2620:2651},2603:{2620:2654},2610:{2620:2611},2616:{2620:2614},2849:{2876:2908},2850:{2876:2909},2887:{2878:2891,2902:2888,2903:2892},2962:{3031:2964},3014:{3006:3018,3031:3020},3015:{3006:3019},3142:{3158:3144},3263:{3285:3264},3270:{3266:3274,3285:3271,3286:3272},3274:{3285:3275},3398:{3390:3402,3415:3404},3399:{3390:3403},3545:{3530:3546,3535:3548,3551:3550},3548:{3530:3549},3904:{4021:3945},3906:{4023:3907},3916:{4023:3917},3921:{4023:3922},3926:{4023:3927},3931:{4023:3932},3953:{3954:3955,3956:3957,3968:3969},3984:{4021:4025},3986:{4023:3987},3996:{4023:3997},4001:{4023:4002},4006:{4023:4007},4011:{4023:4012},4018:{3968:3958},4019:{3968:3960},4133:{4142:4134},7734:{772:7736},7735:{772:7737},7770:{772:7772},7771:{772:7773},7778:{775:7784},7779:{775:7785},7840:{770:7852,774:7862},7841:{770:7853,774:7863},7864:{770:7878},7865:{770:7879},7884:{770:7896},7885:{770:7897},7936:{768:7938,769:7940,834:7942,837:8064},7937:{768:7939,769:7941,834:7943,837:8065},7938:{837:8066},7939:{837:8067},7940:{837:8068},7941:{837:8069},7942:{837:8070},7943:{837:8071},7944:{768:7946,769:7948,834:7950,837:8072},7945:{768:7947,769:7949,834:7951,837:8073},7946:{837:8074},7947:{837:8075},7948:{837:8076},7949:{837:8077},7950:{837:8078},7951:{837:8079},7952:{768:7954,769:7956},7953:{768:7955,769:7957},7960:{768:7962,769:7964},7961:{768:7963,769:7965},7968:{768:7970,769:7972,834:7974,837:8080},7969:{768:7971,769:7973,834:7975,837:8081},7970:{837:8082},7971:{837:8083},7972:{837:8084},7973:{837:8085},7974:{837:8086},7975:{837:8087},7976:{768:7978,769:7980,834:7982,837:8088},7977:{768:7979,769:7981,834:7983,837:8089},7978:{837:8090},7979:{837:8091},7980:{837:8092},7981:{837:8093},7982:{837:8094},7983:{837:8095},7984:{768:7986,769:7988,834:7990},7985:{768:7987,769:7989,834:7991},7992:{768:7994,769:7996,834:7998},7993:{768:7995,769:7997,834:7999},8000:{768:8002,769:8004},8001:{768:8003,769:8005},8008:{768:8010,769:8012},8009:{768:8011,769:8013},8016:{768:8018,769:8020,834:8022},8017:{768:8019,769:8021,834:8023},8025:{768:8027,769:8029,834:8031},8032:{768:8034,769:8036,834:8038,837:8096},8033:{768:8035,769:8037,834:8039,837:8097},8034:{837:8098},8035:{837:8099},8036:{837:8100},8037:{837:8101},8038:{837:8102},8039:{837:8103},8040:{768:8042,769:8044,834:8046,837:8104},8041:{768:8043,769:8045,834:8047,837:8105},8042:{837:8106},8043:{837:8107},8044:{837:8108},8045:{837:8109},8046:{837:8110},8047:{837:8111},8048:{837:8114},8052:{837:8130},8060:{837:8178},8118:{837:8119},8127:{768:8141,769:8142,834:8143},8134:{837:8135},8182:{837:8183},8190:{768:8157,769:8158,834:8159},8592:{824:8602},8594:{824:8603},8596:{824:8622},8656:{824:8653},8658:{824:8655},8660:{824:8654},8707:{824:8708},8712:{824:8713},8715:{824:8716},8739:{824:8740},8741:{824:8742},8764:{824:8769},8771:{824:8772},8773:{824:8775},8776:{824:8777},8781:{824:8813},8801:{824:8802},8804:{824:8816},8805:{824:8817},8818:{824:8820},8819:{824:8821},8822:{824:8824},8823:{824:8825},8826:{824:8832},8827:{824:8833},8828:{824:8928},8829:{824:8929},8834:{824:8836},8835:{824:8837},8838:{824:8840},8839:{824:8841},8849:{824:8930},8850:{824:8931},8866:{824:8876},8872:{824:8877},8873:{824:8878},8875:{824:8879},8882:{824:8938},8883:{824:8939},8884:{824:8940},8885:{824:8941},10973:{824:10972},12358:{12441:12436},12363:{12441:12364},12365:{12441:12366},12367:{12441:12368},12369:{12441:12370},12371:{12441:12372},12373:{12441:12374},12375:{12441:12376},12377:{12441:12378},12379:{12441:12380},12381:{12441:12382},12383:{12441:12384},12385:{12441:12386},12388:{12441:12389},12390:{12441:12391},12392:{12441:12393},12399:{12441:12400,12442:12401},12402:{12441:12403,12442:12404},12405:{12441:12406,12442:12407},12408:{12441:12409,12442:12410},12411:{12441:12412,12442:12413},12445:{12441:12446},12454:{12441:12532},12459:{12441:12460},12461:{12441:12462},12463:{12441:12464},12465:{12441:12466},12467:{12441:12468},12469:{12441:12470},12471:{12441:12472},12473:{12441:12474},12475:{12441:12476},12477:{12441:12478},12479:{12441:12480},12481:{12441:12482},12484:{12441:12485},12486:{12441:12487},12488:{12441:12489},12495:{12441:12496,12442:12497},12498:{12441:12499,12442:12500},12501:{12441:12502,12442:12503},12504:{12441:12505,12442:12506},12507:{12441:12508,12442:12509},12527:{12441:12535},12528:{12441:12536},12529:{12441:12537},12530:{12441:12538},12541:{12441:12542},64329:{1473:64300,1474:64301},119127:{119141:119134},119128:{119141:119135},119135:{119150:119136,119151:119137,119152:119138,119153:119139,119154:119140},119225:{119141:119227},119226:{119141:119228},119227:{119150:119229,119151:119231},119228:{119150:119230,119151:119232}};function cb(cu){if(cu<65536){return String.fromCharCode(cu)}else{cu-=65536;return String.fromCharCode(55296+(cu>>10),56320+(cu&1023))}}function ad(cv){var cw,cx;var cu=cv.length;for(cw=0;cw<cu;cw++){if(cv[cw]<0||cv[cw]>=256){break}}if(cw==cu){return cv}cx=Array(cu);for(cw=0;cw<cu;cw++){cx[cw]=(cv[cw]&255)}return cx}function ca(cv){var cw,cx;var cu=cv.length;if(cu==0){return""}for(cw=0;cw<cu;cw++){if(cv[cw]<0||cv[cw]>=256){break}}if(cw==cu){return String.fromCharCode.apply(this,cv)}cx=Array(cu);for(cw=0;cw<cu;cw++){cx[cw]=String.fromCharCode(cv[cw]&255)}return cx.join("")}function ce(cv){var cw,cy,cx;var cu=cv.length;if(cu==0){return""}for(cw=0;cw<cu;cw++){if(cv[cw]>=65536){break}}if(cw==cu){return String.fromCharCode.apply(this,cv)}cx=Array(cu);for(cw=0;cw<cu;cw++){cy=cv[cw];if(cy<65536){cx[cw]=String.fromCharCode(cy)}else{cy-=65536;cx[cw]=String.fromCharCode(55296+(cy>>10),56320+(cy&1023))}}return cx.join("")}function N(cu){if(window.console&&console.log){console.log(cu)}else{if(window.opera&&opera.postError){opera.postError(cu)}}}function bR(){this.value=undefined;this.set_value=function(cu){this.value=cu};this.get_value=function(){return this.value}}function Z(cu){this.fields=[];this.push_field=function(cv){this.fields.push(cv)};this.set_field=function(cw,cv){this.fields[cw]=cv};this.get_field=function(cv){return this.fields[cv]};this.get_fields=function(){return this.fields}}var ci={dummy:"Glk call has not yet returned"};function bJ(cu){if(cu==1||cu==192||cu==98){return true}else{return false}}var aP=1;var E=2;var be=3;var au=null;var cl=null;var aI=true;var az=null;var cr=null;var bj=null;var K=null;var bx=null;var b7=null;var d=1;var bb=null;var aa=null;var a5=null;function af(cu,cw){var cv={};cv.type=cu;cv.rock=cw;cv.disprock=undefined;cv.parent=null;cv.str=b4(cv);cv.echostr=null;cv.style=aN.style_Normal;cv.hyperlink=0;cv.input_generation=null;cv.linebuf=null;cv.char_request=false;cv.line_request=false;cv.char_request_uni=false;cv.line_request_uni=false;cv.hyperlink_request=false;cv.echo_line_input=true;cv.line_input_terminators=[];cv.request_echo_line_input=null;cv.prev=null;cv.next=au;au=cv;if(cv.next){cv.next.prev=cv}if(window.GiDispa){GiDispa.class_register("window",cv)}else{cv.disprock=d++}aI=true;return cv}function cj(cw){var cv,cu;if(window.GiDispa){GiDispa.class_unregister("window",cw)}aI=true;cw.echostr=null;if(cw.str){ah(cw.str);cw.str=null}cv=cw.prev;cu=cw.next;cw.prev=null;cw.next=null;if(cv){cv.next=cu}else{au=cu}if(cu){cu.prev=cv}cw.parent=null;cw.rock=null;cw.disprock=null}function ax(cv){var cu;for(cu=au;cu;cu=cu.next){if(cu.echostr===cv){cu.echostr=null}}}function A(cw,cx){var cu,cv;switch(cw.type){case aN.wintype_TextBuffer:if(cw.style!=cw.accumstyle||cw.hyperlink!=cw.accumhyperlink){a7(cw)}cw.accum.push(cx);break;case aN.wintype_TextGrid:for(cu=0;cu<cx.length;cu++){cv=cx.charAt(cu);if(cw.cursorx<0){cw.cursorx=0}else{if(cw.cursorx>=cw.gridwidth){cw.cursorx=0;cw.cursory++}}if(cw.cursory<0){cw.cursory=0}else{if(cw.cursory>=cw.gridheight){break}}if(cv=="\n"){cw.cursory++;cw.cursorx=0;continue}lineobj=cw.lines[cw.cursory];lineobj.dirty=true;lineobj.chars[cw.cursorx]=cv;lineobj.styles[cw.cursorx]=cw.style;lineobj.hyperlinks[cw.cursorx]=cw.hyperlink;cw.cursorx++}break}}function bO(cu){if(cu.cursorx<0){cu.cursorx=0}else{if(cu.cursorx>=cu.gridwidth){cu.cursorx=0;cu.cursory++}}if(cu.cursory<0){cu.cursory=0}else{if(cu.cursory>=cu.gridheight){return}}}function a7(cz){var cB=cz.content;var cx=aM[cz.accumstyle];var cA,cw,cv,cy,cu;if(cz.accum.length){cA=cz.accum.join("");cw=cA.split("\n");for(cv=0;cv<cw.length;cv++){cu=undefined;if(cv==0){if(cw[cv]){if(cB.length==0){cu=[];cB.push({content:cu,append:true})}else{cy=cB[cB.length-1];if(!cy.content){cu=[];cy.content=cu}else{cu=cy.content}}}}else{if(cw[cv]){cu=[];cB.push({content:cu})}else{cB.push({})}}if(cu!==undefined){if(!cz.accumhyperlink){cu.push(cx);cu.push(cw[cv])}else{cu.push({style:cx,text:cw[cv],hyperlink:cz.accumhyperlink})}}}}cz.accum.length=0;cz.accumstyle=cz.style;cz.accumhyperlink=cz.hyperlink}function b5(cw,cu){var cv;for(cv=cw.parent;cv;cv=cv.parent){if(cv.type==aN.wintype_Pair){if(cv.pair_key===cw){cv.pair_key=null;cv.pair_keydamage=true}}}if(window.GiDispa&&cw.linebuf){GiDispa.unretain_array(cw.linebuf);cw.linebuf=null}switch(cw.type){case aN.wintype_Pair:if(cu){if(cw.child1){b5(cw.child1,true)}if(cw.child2){b5(cw.child2,true)}}cw.child1=null;cw.child2=null;cw.pair_key=null;break;case aN.wintype_TextBuffer:cw.accum=null;cw.content=null;break;case aN.wintype_TextGrid:cw.lines=null;break}cj(cw)}function bH(cD,cC){var cu,cK,cE,cG;var cA,cI,cJ,cL,cy,cz,cB;var cH,cF,cw,cv;aI=true;cD.bbox=cC;switch(cD.type){case aN.wintype_TextGrid:cu=cC.right-cC.left;cK=cC.bottom-cC.top;cG=cD.gridheight;cD.gridwidth=Math.max(0,Math.floor((cu-az.gridmarginx)/az.gridcharwidth));cD.gridheight=Math.max(0,Math.floor((cK-az.gridmarginy)/az.gridcharheight));if(cG>cD.gridheight){cD.lines.length=cD.gridheight}else{if(cG<cD.gridheight){for(cy=cG;cy<cD.gridheight;cy++){cD.lines[cy]={chars:[],styles:[],hyperlinks:[],dirty:true}}}}for(cy=0;cy<cD.gridheight;cy++){cB=cD.lines[cy];cE=cB.chars.length;if(cE>cD.gridwidth){cB.dirty=true;cB.chars.length=cD.gridwidth;cB.styles.length=cD.gridwidth;cB.hyperlinks.length=cD.gridwidth}else{if(cE<cD.gridwidth){cB.dirty=true;for(cz=cE;cz<cD.gridwidth;cz++){cB.chars[cz]=" ";cB.styles[cz]=aN.style_Normal;cB.hyperlinks[cz]=0}}}}break;case aN.wintype_Pair:if(cD.pair_vertical){cA=cD.bbox.left;cI=cD.bbox.right;cL=az.inspacingx}else{cA=cD.bbox.top;cI=cD.bbox.bottom;cL=az.inspacingy}if(!cD.pair_hasborder){cL=0}cJ=cI-cA;if(cD.pair_division==aN.winmethod_Proportional){split=Math.floor((cJ*cD.pair_size)/100)}else{if(cD.pair_division==aN.winmethod_Fixed){split=0;if(cD.pair_key&&cD.pair_key.type==aN.wintype_TextBuffer){if(!cD.pair_vertical){split=(cD.pair_size*az.buffercharheight+az.buffermarginy)}else{split=(cD.pair_size*az.buffercharwidth+az.buffermarginx)}}if(cD.pair_key&&cD.pair_key.type==aN.wintype_TextGrid){if(!cD.pair_vertical){split=(cD.pair_size*az.gridcharheight+az.gridmarginy)}else{split=(cD.pair_size*az.gridcharwidth+az.gridmarginx)}}split=Math.ceil(split)}else{split=Math.floor(cJ/2)}}if(!cD.pair_backward){split=cI-split-cL}else{split=cA+split}if(cA>=cI){split=cA}else{split=Math.min(Math.max(split,cA),cI-cL)}cD.pair_splitpos=split;cD.pair_splitwidth=cL;if(cD.pair_vertical){cH={left:cD.bbox.left,right:cD.pair_splitpos,top:cD.bbox.top,bottom:cD.bbox.bottom};cF={left:cH.right+cD.pair_splitwidth,right:cD.bbox.right,top:cD.bbox.top,bottom:cD.bbox.bottom}}else{cH={top:cD.bbox.top,bottom:cD.pair_splitpos,left:cD.bbox.left,right:cD.bbox.right};cF={top:cH.bottom+cD.pair_splitwidth,bottom:cD.bbox.bottom,left:cD.bbox.left,right:cD.bbox.right}}if(!cD.pair_backward){cw=cD.child1;cv=cD.child2}else{cw=cD.child2;cv=cD.child1}bH(cw,cH);bH(cv,cF);break}}function bk(cw,cu,cv,cx){var cy={};cy.type=cw;cy.rock=cx;cy.disprock=undefined;cy.unicode=false;cy.ref=null;cy.win=null;cy.file=null;cy.buf=null;cy.bufpos=0;cy.buflen=0;cy.bufeof=0;cy.timer_id=null;cy.flush_func=null;cy.readcount=0;cy.writecount=0;cy.readable=cu;cy.writable=cv;cy.prev=null;cy.next=cr;cr=cy;if(cy.next){cy.next.prev=cy}if(window.GiDispa){GiDispa.class_register("stream",cy)}return cy}function ah(cw){var cv,cu;if(cw===bx){bx=null}ax(cw);if(cw.type==be){if(window.GiDispa){GiDispa.unretain_array(cw.buf)}}if(window.GiDispa){GiDispa.class_unregister("stream",cw)}cv=cw.prev;cu=cw.next;cw.prev=null;cw.next=null;if(cv){cv.next=cu}else{cr=cu}if(cu){cu.prev=cv}cw.buf=null;cw.readable=false;cw.writable=false;cw.ref=null;cw.win=null;cw.file=null;cw.rock=null;cw.disprock=null}function b4(cu){var cv;cv=bk(E,false,true,0);cv.unicode=true;cv.win=cu;return cv}function U(cu){if(cu.timer_id===null){if(cu.flush_func===null){cu.flush_func=function(){b(cu)}}cu.timer_id=setTimeout(cu.flush_func,10000)}}function b(cu){cu.timer_id=null;Dialog.file_write(cu.ref,cu.buf)}function al(cv,cx,cz,cw){var cy={};cy.filename=cv;cy.rock=cz;cy.disprock=undefined;cy.textmode=((cx&aN.fileusage_TextMode)!=0);cy.filetype=(cx&aN.fileusage_TypeMask);cy.filetypename=a1[cy.filetype];if(!cy.filetypename){cy.filetypename="xxx"}if(!cw){var cu="";if(cy.filetype==aN.fileusage_SavedGame){cu=bU.get_signature()}cw=Dialog.file_construct_ref(cy.filename,cy.filetypename,cu)}cy.ref=cw;cy.prev=null;cy.next=bj;bj=cy;if(cy.next){cy.next.prev=cy}if(window.GiDispa){GiDispa.class_register("fileref",cy)}return cy}function a4(cw){var cv,cu;if(window.GiDispa){GiDispa.class_unregister("fileref",cw)}cv=cw.prev;cu=cw.next;cw.prev=null;cw.next=null;if(cv){cv.next=cu}else{bj=cu}if(cu){cu.prev=cv}cw.filename=null;cw.ref=null;cw.rock=null;cw.disprock=null}function h(cv,cu){if(!cv||!cv.writable){throw ("gli_put_char: invalid stream")}if(!cv.unicode){cu=cu&255}cv.writecount+=1;switch(cv.type){case aP:U(cv);case be:if(cv.bufpos<cv.buflen){cv.buf[cv.bufpos]=cu;cv.bufpos+=1;if(cv.bufpos>cv.bufeof){cv.bufeof=cv.bufpos}}break;case E:if(cv.win.line_request){throw ("gli_put_char: window has pending line request")}A(cv.win,cb(cu));if(cv.win.echostr){h(cv.win.echostr,cu)}break}}function aC(cz,cv,cy){var cw,cu,cx;if(!cz||!cz.writable){throw ("gli_put_array: invalid stream")}if(!cz.unicode&&!cy){cv=ad(cv);cy=true}cz.writecount+=cv.length;switch(cz.type){case aP:U(cz);case be:cu=cv.length;if(cu>cz.buflen-cz.bufpos){cu=cz.buflen-cz.bufpos}for(cw=0;cw<cu;cw++){cz.buf[cz.bufpos+cw]=cv[cw]}cz.bufpos+=cu;if(cz.bufpos>cz.bufeof){cz.bufeof=cz.bufpos}break;case E:if(cz.win.line_request){throw ("gli_put_array: window has pending line request")}if(cy){cx=String.fromCharCode.apply(this,cv)}else{cx=ce(cv)}A(cz.win,cx);if(cz.win.echostr){aC(cz.win.echostr,cv,cy)}break}}function bt(cw,cv){var cu;if(!cw||!cw.readable){return -1}switch(cw.type){case aP:case be:if(cw.bufpos<cw.bufeof){cu=cw.buf[cw.bufpos];cw.bufpos++;cw.readcount++;if(!cv&&cu>=256){return 63}return cu}else{return -1}default:return -1}}function t(cy,cw,cx){if(!cy||!cy.readable){return 0}var cu=cw.length;var cv;switch(cy.type){case aP:case be:if(cu==0){return 0}cu-=1;if(cy.bufpos>=cy.bufeof){cu=0}else{if(cy.bufpos+cu>cy.bufeof){cu=cy.bufeof-cy.bufpos}}cv=false;if(!cx){for(lx=0;lx<cu&&!cv;lx++){ch=cy.buf[cy.bufpos++];if(!cx&&ch>=256){ch=63}cw[lx]=ch;cv=(ch==10)}}else{for(lx=0;lx<cu&&!cv;lx++){ch=cy.buf[cy.bufpos++];cw[lx]=ch;cv=(ch==10)}}cy.readcount+=lx;return lx;default:return 0}}function a(cz,cv,cy){if(!cz||!cz.readable){return 0}var cu=cv.length;var cx,cw;switch(cz.type){case aP:case be:if(cz.bufpos>=cz.bufeof){cu=0}else{if(cz.bufpos+cu>cz.bufeof){cu=cz.bufeof-cz.bufpos}}if(!cy){for(cx=0;cx<cu;cx++){cw=cz.buf[cz.bufpos++];if(!cy&&cw>=256){cw=63}cv[cx]=cw}}else{for(cx=0;cx<cu;cx++){cv[cx]=cz.buf[cz.bufpos++]}}cz.readcount+=cu;return cu;default:return 0}}function bu(cv,cu){if(!cu){return}cu.set_field(0,cv.readcount);cu.set_field(1,cv.writecount)}function aY(cv,cu){bN(bx,cv,cu)}function bN(cy,cx,cw){var cv,cu;if(!cy||!cy.writable){throw ("glk_put_jstring: invalid stream")}cy.writecount+=cx.length;switch(cy.type){case aP:U(cy);case be:cu=cx.length;if(cu>cy.buflen-cy.bufpos){cu=cy.buflen-cy.bufpos}if(cy.unicode||cw){for(cv=0;cv<cu;cv++){cy.buf[cy.bufpos+cv]=cx.charCodeAt(cv)}}else{for(cv=0;cv<cu;cv++){cy.buf[cy.bufpos+cv]=cx.charCodeAt(cv)&255}}cy.bufpos+=cu;if(cy.bufpos>cy.bufeof){cy.bufeof=cy.bufpos}break;case E:if(cy.win.line_request){throw ("glk_put_jstring: window has pending line request")}A(cy.win,cx);if(cy.win.echostr){bN(cy.win.echostr,cx,cw)}break}}function aO(cv,cu){if(!cv||!cv.writable){throw ("gli_set_style: invalid stream")}if(cu>=aN.style_NUMSTYLES){cu=0}if(cv.type==E){cv.win.style=cu;if(cv.win.echostr){aO(cv.win.echostr,cu)}}}function H(cv,cu){if(!cv||!cv.writable){throw ("gli_set_hyperlink: invalid stream")}if(cv.type==E){cv.win.hyperlink=cu;if(cv.win.echostr){H(cv.win.echostr,cu)}}}function R(){if(L){if(bX){GlkOte.log("### dropping timer event...");aa=null;return}else{GlkOte.log("### procrastinating timer event...");aa=setTimeout(R,500);return}}aa=setTimeout(R,bb);a5=Date.now();GlkOte.extevent("timer")}function aj(){bX=true;L=true;b7=null;return ci}function br(){}function q(cu,cv){return bE(cu,cv,null)}function bE(cv,cw,cu){switch(cv){case 0:return 1794;case 1:if(cw<=aN.keycode_Left&&cw>=aN.keycode_End){return 1}if(cw>=4294967296-aN.keycode_MAXVAL){return 0}if(cw>1114111){return 0}if((cw>=0&&cw<32)||(cw>=127&&cw<160)){return 0}return 1;case 2:if(cw>1114111){return 0}if((cw>=0&&cw<32)||(cw>=127&&cw<160)){return 0}return 1;case 3:if((cw>1114111)||(cw>=0&&cw<32)||(cw>=127&&cw<160)){if(cu){cu[0]=1}return 0}if(cu){cu[0]=1}return 2;case 4:return 0;case 5:return 1;case 6:return 0;case 7:return 0;case 8:return 0;case 9:return 0;case 10:return 0;case 11:return 1;case 12:if(cw==3||cw==4){return 1}else{return 0}case 13:return 0;case 14:return 0;case 15:return 1;case 16:return 1;case 17:return 1;case 18:return 1;case 19:if(cw==aN.keycode_Escape){return 1}if(cw>=aN.keycode_Func12&&cw<=aN.keycode_Func1){return 1}return 0;case 20:return 1}return 0}function ct(cv,cu){if(!cv){cv=au}else{cv=cv.next}if(cv){if(cu){cu.set_value(cv.rock)}return cv}if(cu){cu.set_value(0)}return null}function bz(cu){if(!cu){throw ("glk_window_get_rock: invalid window")}return cu.rock}function bB(){return cl}function b3(cA,cu,cD,cC,cx){var cB,cz,cw;var cv,cy;if(!cl){if(cA){throw ("glk_window_open: splitwin must be null for first window")}cB=null;cz={left:az.outspacingx,top:az.outspacingy,right:az.width-az.outspacingx,bottom:az.height-az.outspacingy}}else{if(!cA){throw ("glk_window_open: splitwin must not be null")}cw=(cu&aN.winmethod_DivisionMask);if(cw!=aN.winmethod_Fixed&&cw!=aN.winmethod_Proportional){throw ("glk_window_open: invalid method (not fixed or proportional)")}cw=(cu&aN.winmethod_DirMask);if(cw!=aN.winmethod_Above&&cw!=aN.winmethod_Below&&cw!=aN.winmethod_Left&&cw!=aN.winmethod_Right){throw ("glk_window_open: invalid method (bad direction)")}cz=cA.bbox;cB=cA.parent;if(cB&&cB.type!=aN.wintype_Pair){throw ("glk_window_open: parent window is not Pair")}}cy=af(cC,cx);switch(cy.type){case aN.wintype_TextBuffer:cy.accum=[];cy.accumstyle=null;cy.accumhyperlink=0;cy.content=[];cy.clearcontent=false;break;case aN.wintype_TextGrid:cy.gridwidth=0;cy.gridheight=0;cy.lines=[];cy.cursorx=0;cy.cursory=0;break;case aN.wintype_Blank:break;case aN.wintype_Pair:throw ("glk_window_open: cannot open pair window directly");default:cj(cy);return null}if(!cA){cl=cy;bH(cy,cz)}else{cv=af(aN.wintype_Pair,0);cv.pair_dir=cu&aN.winmethod_DirMask;cv.pair_division=cu&aN.winmethod_DivisionMask;cv.pair_key=cy;cv.pair_keydamage=false;cv.pair_size=cD;cv.pair_hasborder=((cu&aN.winmethod_BorderMask)==aN.winmethod_Border);cv.pair_vertical=(cv.pair_dir==aN.winmethod_Left||cv.pair_dir==aN.winmethod_Right);cv.pair_backward=(cv.pair_dir==aN.winmethod_Left||cv.pair_dir==aN.winmethod_Above);cv.child1=cA;cv.child2=cy;cA.parent=cv;cy.parent=cv;cv.parent=cB;if(cB){if(cB.child1==cA){cB.child1=cv}else{cB.child2=cv}}else{cl=cv}bH(cv,cz)}return cy}function bC(cB,cA){if(!cB){throw ("glk_window_close: invalid window")}if(cB===cl||!cB.parent){cl=null;bu(cB.str,cA);b5(cB,true)}else{var cw,cv,cu,cy,cz,cx;cw=cB.parent;if(cB===cw.child1){cu=cw.child2}else{if(cB===cw.child2){cu=cw.child1}else{throw ("glk_window_close: window tree is corrupted")}}cy=cw.bbox;cv=cw.parent;if(!cv){cl=cu;cu.parent=null}else{if(cv.child1===cw){cv.child1=cu}else{cv.child2=cu}cu.parent=cv}bu(cB.str,cA);b5(cB,true);if(cB===cw.child1){cw.child1=null}else{if(cB===cw.child2){cw.child2=null}}b5(cw,false);cx=false;for(cz=cu;cz;cz=cz.parent){if(cz.type==aN.wintype_Pair){if(cz.pair_keydamage){cx=true;cz.pair_keydamage=false}}}if(cx){cy=content_box;bH(cl,cy)}else{bH(cu,cy)}}}function C(cz,cw,cx){if(!cz){throw ("glk_window_get_size: invalid window")}var cy=0;var cv=0;var cu,cA;switch(cz.type){case aN.wintype_TextGrid:cu=cz.bbox.right-cz.bbox.left;cA=cz.bbox.bottom-cz.bbox.top;cy=Math.max(0,Math.floor((cu-az.gridmarginx)/az.gridcharwidth));cv=Math.max(0,Math.floor((cA-az.gridmarginy)/az.gridcharheight));break;case aN.wintype_TextBuffer:cu=cz.bbox.right-cz.bbox.left;cA=cz.bbox.bottom-cz.bbox.top;cy=Math.max(0,Math.floor((cu-az.buffermarginx)/az.buffercharwidth));cv=Math.max(0,Math.floor((cA-az.buffermarginy)/az.buffercharheight));break}if(cw){cw.set_value(cy)}if(cx){cx.set_value(cv)}}function aQ(cA,cB,cx,cw){var cz,cu,cy,cv;if(!cA){throw ("glk_window_set_arrangement: invalid window")}if(cA.type!=aN.wintype_Pair){throw ("glk_window_set_arrangement: not a pair window")}if(cw){if(cw.type==aN.wintype_Pair){throw ("glk_window_set_arrangement: keywin cannot be a pair window")}for(cz=cw;cz;cz=cz.parent){if(cz==cA){break}}if(!cz){throw ("glk_window_set_arrangement: keywin must be a descendant")}}cu=cB&aN.winmethod_DirMask;cy=(cu==aN.winmethod_Left||cu==aN.winmethod_Right);cv=(cu==aN.winmethod_Left||cu==aN.winmethod_Above);if(!cw){cw=cA.pair_key}if(cy&&!cA.pair_vertical){throw ("glk_window_set_arrangement: split must stay horizontal")}if(!cy&&cA.pair_vertical){throw ("glk_window_set_arrangement: split must stay vertical")}if(cw&&cw.type==aN.wintype_Blank&&(cB&aN.winmethod_DivisionMask)==aN.winmethod_Fixed){throw ("glk_window_set_arrangement: a blank window cannot have a fixed size")}if((cv&&!cA.pair_backward)||(!cv&&cA.pair_backward)){cz=cA.child1;cA.child1=cA.child2;cA.child2=cz}cA.pair_dir=cu;cA.pair_division=(cB&aN.winmethod_DivisionMask);cA.pair_key=cw;cA.pair_size=cx;cA.pair_hasborder=((cB&aN.winmethod_BorderMask)==aN.winmethod_Border);cA.pair_vertical=(cA.pair_dir==aN.winmethod_Left||cA.pair_dir==aN.winmethod_Right);cA.pair_backward=(cA.pair_dir==aN.winmethod_Left||cA.pair_dir==aN.winmethod_Above);bH(cA,cA.bbox)}function aE(cx,cu,cw,cv){if(!cx){throw ("glk_window_get_arrangement: invalid window")}if(cx.type!=aN.wintype_Pair){throw ("glk_window_get_arrangement: not a pair window")}if(cw){cw.set_value(cx.pair_size)}if(cv){cv.set_value(cx.pair_key)}if(cu){cu.set_value(cx.pair_dir|cx.pair_division|(cx.pair_hasborder?aN.winmethod_Border:aN.winmethod_NoBorder))}}function j(cu){if(!cu){throw ("glk_window_get_type: invalid window")}return cu.type}function aG(cu){if(!cu){throw ("glk_window_get_parent: invalid window")}return cu.parent}function ac(cy){var cv,cu,cw;if(!cy){throw ("glk_window_clear: invalid window")}if(cy.line_request){throw ("glk_window_clear: window has pending line request")}switch(cy.type){case aN.wintype_TextBuffer:cy.accum.length=0;cy.accumstyle=null;cy.accumhyperlink=0;cy.content.length=0;cy.clearcontent=true;break;case aN.wintype_TextGrid:cy.cursorx=0;cy.cursory=0;for(cv=0;cv<cy.gridheight;cv++){cw=cy.lines[cv];cw.dirty=true;for(cu=0;cu<cy.gridwidth;cu++){cw.chars[cu]=" ";cw.styles[cu]=aN.style_Normal;cw.hyperlinks[cu]=0}}break}}function r(cv,cu,cw){if(!cv){throw ("glk_window_move_cursor: invalid window")}if(cv.type==aN.wintype_TextGrid){cv.cursorx=cu;cv.cursory=cw}else{throw ("glk_window_move_cursor: not a grid window")}}function cp(cu){if(!cu){throw ("glk_window_get_stream: invalid window")}return cu.str}function a8(cu,cv){if(!cu){throw ("glk_window_set_echo_stream: invalid window")}cu.echostr=cv}function ba(cu){if(!cu){throw ("glk_window_get_echo_stream: invalid window")}return cu.echostr}function bp(cu){if(!cu){bx=null}else{bx=cu.str}}function aZ(cw){var cv,cu;if(!cw){throw ("glk_window_get_sibling: invalid window")}cv=cw.parent;if(!cv){return null}if(cw===cv.child1){return cv.child2}else{if(cw===cv.child2){return cv.child1}else{throw ("glk_window_get_sibling: window tree is corrupted")}}}function aW(cv,cu){if(!cv){cv=cr}else{cv=cv.next}if(cv){if(cu){cu.set_value(cv.rock)}return cv}if(cu){cu.set_value(0)}return null}function by(cu){if(!cu){throw ("glk_stream_get_rock: invalid stream")}return cu.rock}function at(cx,cu,cw){if(!cx){throw ("glk_stream_open_file: invalid fileref")}var cy;if(cu!=aN.filemode_Read&&cu!=aN.filemode_Write&&cu!=aN.filemode_ReadWrite&&cu!=aN.filemode_WriteAppend){throw ("glk_stream_open_file: illegal filemode")}if(cu==aN.filemode_Read&&!Dialog.file_ref_exists(cx.ref)){throw ("glk_stream_open_file: file not found for reading: "+cx.ref.filename)}var cv=null;if(cu!=aN.filemode_Write){cv=Dialog.file_read(cx.ref)}if(cv==null){cv=[];if(cu!=aN.filemode_Read){Dialog.file_write(cx.ref,"",true)}}if(cv.length==null){throw ("glk_stream_open_file: data read had no length")}cy=bk(aP,(cu!=aN.filemode_Write),(cu!=aN.filemode_Read),cw);cy.unicode=false;cy.ref=cx.ref;cy.buf=cv;cy.buflen=4294967295;if(cu==aN.filemode_Write){cy.bufeof=0}else{cy.bufeof=cv.length}if(cu==aN.filemode_WriteAppend){cy.bufpos=cy.bufeof}else{cy.bufpos=0}return cy}function bF(cu,cv,cw){var cx;if(cv!=aN.filemode_Read&&cv!=aN.filemode_Write&&cv!=aN.filemode_ReadWrite){throw ("glk_stream_open_memory: illegal filemode")}cx=bk(be,(cv!=aN.filemode_Write),(cv!=aN.filemode_Read),cw);cx.unicode=false;if(cu){cx.buf=cu;cx.buflen=cu.length;cx.bufpos=0;if(cv==aN.filemode_Write){cx.bufeof=0}else{cx.bufeof=cx.buflen}if(window.GiDispa){GiDispa.retain_array(cu)}}return cx}function bA(cv,cu){if(!cv){throw ("glk_stream_close: invalid stream")}if(cv.type==E){throw ("glk_stream_close: cannot close window stream")}if(cv.type==aP&&cv.writable){if(!(cv.timer_id===null)){clearTimeout(cv.timer_id);cv.timer_id=null}Dialog.file_write(cv.ref,cv.buf)}bu(cv,cu);ah(cv)}function aV(cv,cw,cu){if(!cv){throw ("glk_stream_set_position: invalid stream")}switch(cv.type){case aP:case be:if(cu==aN.seekmode_Current){cw=cv.bufpos+cw}else{if(cu==aN.seekmode_End){cw=cv.bufeof+cw}else{}}if(cw<0){cw=0}if(cw>cv.bufeof){cw=cv.bufeof}cv.bufpos=cw}}function bW(cu){if(!cu){throw ("glk_stream_get_position: invalid stream")}switch(cu.type){case aP:case be:return cu.bufpos;default:return 0}}function u(cu){bx=cu}function M(){return bx}function y(cw,cx){var cv=new Date().getTime();var cu="_temp_"+cv+"_"+Math.random();cu=cu.replace(".","");fref=al(cu,cw,cx,null);return fref}function bZ(cv,cu,cw){fref=al(cu,cv,cw,null);return fref}function aX(cz,cx,cu){var cA=(cx!=aN.filemode_Read);var cy=(cz&aN.fileusage_TypeMask);var cv=a1[cy];if(!cv){cv="xxx"}var cC=function(cD){if(b7){return}L=false;aT+=1;var cE=null;if(cD){cE=al(cD.filename,cz,cu,cD)}if(window.GiDispa){GiDispa.prepare_resume(cE)}bU.resume()};try{var cB="";if(cy==aN.fileusage_SavedGame){cB=bU.get_signature()}Dialog.open(cA,cv,cB,cC)}catch(cw){GlkOte.log("Unable to select file: "+cw);return null}L=true;b7=null;return ci}function a2(cu){if(!cu){throw ("glk_fileref_destroy: invalid fileref")}a4(cu)}function J(cv,cu){if(!cv){cv=bj}else{cv=cv.next}if(cv){if(cu){cu.set_value(cv.rock)}return cv}if(cu){cu.set_value(0)}return null}function ab(cu){if(!cu){throw ("glk_fileref_get_rock: invalid fileref")}return cu.rock}function aB(cu){if(!cu){throw ("glk_fileref_delete_file: invalid fileref")}Dialog.file_remove_ref(cu.ref)}function v(cu){if(!cu){throw ("glk_fileref_does_file_exist: invalid fileref")}if(Dialog.file_ref_exists(cu.ref)){return 1}else{return 0}}function ag(cv,cu,cx){if(!cu){throw ("glk_fileref_create_from_fileref: invalid fileref")}var cw=al(cu.filename,cv,cx,null);return cw}function am(cu){h(bx,cu&255)}function B(cv,cu){h(cv,cu&255)}function cf(cu){bN(bx,cu,true)}function b0(cv,cu){bN(cv,cu,true)}function co(cu){cu=ad(cu);aC(bx,cu,true)}function T(cv,cu){cu=ad(cu);aC(cv,cu,true)}function bq(cu){aO(bx,cu)}function ao(cv,cu){aO(cv,cu)}function ai(cu){if(!cu){throw ("glk_get_char_stream: invalid stream")}return bt(cu,false)}function av(cv,cu){if(!cv){throw ("glk_get_line_stream: invalid stream")}return t(cv,cu,false)}function i(cv,cu){if(!cv){throw ("glk_get_buffer_stream: invalid stream")}return a(cv,cu,false)}function aU(cu){if(cu>=65&&cu<=90){return cu+32}if(cu>=192&&cu<=222&&cu!=215){return cu+32}return cu}function bS(cu){if(cu>=97&&cu<=122){return cu-32}if(cu>=224&&cu<=254&&cu!=247){return cu-32}return cu}function o(cw,cu,cx,cv){}function b8(cv,cu,cw){}function bn(cw,cv,cu){return 0}function bg(cw,cv,cx,cu){if(cu){cu.set_value(0)}return 0}function S(cu){b7=cu;return ci}function aq(cv){cv.set_field(0,aN.evtype_None);cv.set_field(1,null);cv.set_field(2,0);cv.set_field(3,0);if(bb&&!(aa===null)){var cu=Date.now();if(cu-a5>bb){clearTimeout(aa);aa=setTimeout(R,bb);a5=Date.now();cv.set_field(0,aN.evtype_Timer)}}}function b2(cx,cv,cw){if(!cx){throw ("glk_request_line_event: invalid window")}if(cx.char_request||cx.line_request){throw ("glk_request_line_event: window already has keyboard request")}if(cx.type==aN.wintype_TextBuffer||cx.type==aN.wintype_TextGrid){if(cw){var cu=cv.slice(0,cw);if(!k){k={}}k[cx.disprock]=ca(cu)}cx.line_request=true;cx.line_request_uni=false;if(cx.type==aN.wintype_TextBuffer){cx.request_echo_line_input=cx.echo_line_input}else{cx.request_echo_line_input=true}cx.input_generation=aT;cx.linebuf=cv;if(window.GiDispa){GiDispa.retain_array(cv)}}else{throw ("glk_request_line_event: window does not support keyboard input")}}function X(cw,cy){if(!cw){throw ("glk_cancel_line_event: invalid window")}if(!cw.line_request){if(cy){cy.set_field(0,aN.evtype_None);cy.set_field(1,null);cy.set_field(2,0);cy.set_field(3,0)}return}var cv="";var cu,cx;if(bY){cx=bY[cw.disprock];if(cx){cv=cx}}if(cv.length>cw.linebuf.length){cv=cv.slice(0,cw.linebuf.length)}if(cw.request_echo_line_input){cu=cw.style;aO(cw.str,aN.style_Input);A(cw,cv);if(cw.echostr){bN(cw.echostr,cv)}aO(cw.str,cu);A(cw,"\n");if(cw.echostr){bN(cw.echostr,"\n")}}for(cu=0;cu<cv.length;cu++){cw.linebuf[cu]=cv.charCodeAt(cu)}if(cy){cy.set_field(0,aN.evtype_LineInput);cy.set_field(1,cw);cy.set_field(2,cv.length);cy.set_field(3,0)}if(window.GiDispa){GiDispa.unretain_array(cw.linebuf)}cw.line_request=false;cw.line_request_uni=false;cw.request_echo_line_input=null;cw.input_generation=null;cw.linebuf=null}function aH(cu){if(!cu){throw ("glk_request_char_event: invalid window")}if(cu.char_request||cu.line_request){throw ("glk_request_char_event: window already has keyboard request")}if(cu.type==aN.wintype_TextBuffer||cu.type==aN.wintype_TextGrid){cu.char_request=true;cu.char_request_uni=false;cu.input_generation=aT}else{throw ("glk_request_char_event: window does not support keyboard input")}}function bK(cu){if(!cu){throw ("glk_cancel_char_event: invalid window")}cu.char_request=false;cu.char_request_uni=false}function W(cu,cv){if(!cu){throw ("glk_set_echo_line_event: invalid window")}cu.echo_line_input=(cv!=0)}function b1(cx,cu){if(!cx){throw ("glk_set_terminators_line_event: invalid window")}if(bs===null){bs={};for(var cy in Y){bs[Y[cy]]=cy}}var cw=[];if(cu){for(var cv=0;cv<cu.length;cv++){var cy=bs[cu[cv]];if(cy){cw.push(cy)}}}cx.line_input_terminators=cw}function aw(cu){if(!cu){throw ("glk_request_mouse_event: invalid window")}}function w(cu){if(!cu){throw ("glk_cancel_mouse_event: invalid window")}}function f(cu){if(!(aa===null)){clearTimeout(aa);aa=null;a5=null}if(!cu){bb=null}else{bb=cu;aa=setTimeout(R,bb);a5=Date.now()}}function p(cu,cv,cw){if(cv){cv.set_value(0)}if(cw){cw.set_value(0)}return 0}function ay(cx,cu,cw,cv){if(!cx){throw ("glk_image_draw: invalid window")}return 0}function bf(cz,cv,cy,cx,cw,cu){if(!cz){throw ("glk_image_draw_scaled: invalid window")}return 0}function n(cu){if(!cu){throw ("glk_window_flow_break: invalid window")}}function cn(cy,cx,cw,cv,cu){if(!cy){throw ("glk_window_erase_rect: invalid window")}}function ar(cz,cv,cy,cx,cw,cu){if(!cz){throw ("glk_window_fill_rect: invalid window")}}function c(cv,cu){if(!cv){throw ("glk_window_set_background_color: invalid window")}}function bl(cu,cv){if(!cu){cu=K}else{cu=cu.next}if(cu){if(cv){cv.set_value(cu.rock)}return cu}if(cv){cv.set_value(0)}return null}function m(cu){if(!cu){throw ("glk_schannel_get_rock: invalid schannel")}return cu.rock}function bi(cu){return null}function F(cu){throw ("glk_schannel_destroy: invalid schannel")}function bw(cv,cu){throw ("glk_schannel_play: invalid schannel")}function bd(cx,cv,cu,cw){throw ("glk_schannel_play_ext: invalid schannel")}function G(cu){throw ("glk_schannel_stop: invalid schannel")}function bh(cv,cu){throw ("glk_schannel_set_volume: invalid schannel")}function aK(cv,cu){}function cc(cu){H(bx,cu)}function I(cv,cu){H(cv,cu)}function bc(cu){if(!cu){throw ("glk_request_hyperlink_event: invalid window")}if(cu.type==aN.wintype_TextBuffer||cu.type==aN.wintype_TextGrid){cu.hyperlink_request=true}}function b9(cu){if(!cu){throw ("glk_cancel_hyperlink_event: invalid window")}if(cu.type==aN.wintype_TextBuffer||cu.type==aN.wintype_TextGrid){cu.hyperlink_request=true}}function bP(cy,cC){var cw,cB,cA,cv,cx;var cz=cy.length;var cu=cy.slice(0,cC);if(cz<cC){throw ("buffer_to_lower_case_uni: numchars exceeds array length")}cA=0;for(cw=0;cw<cC;cw++){cx=cu[cw];cv=ap[cx];if(cv===undefined){cy[cA]=cx;cA++}else{if(!(cv instanceof Array)){cy[cA]=cv;cA++}else{for(cB=0;cB<cv.length;cB++){cy[cA]=cv[cB];cA++}}}}cy.length=cz;return cA}function s(cy,cC){var cw,cB,cA,cv,cx;var cz=cy.length;var cu=cy.slice(0,cC);if(cz<cC){throw ("buffer_to_upper_case_uni: numchars exceeds array length")}cA=0;for(cw=0;cw<cC;cw++){cx=cu[cw];cv=cg[cx];if(cv===undefined){cy[cA]=cx;cA++}else{if(!(cv instanceof Array)){cy[cA]=cv;cA++}else{for(cB=0;cB<cv.length;cB++){cy[cA]=cv[cB];cA++}}}}cy.length=cz;return cA}function aJ(cy,cD,cz){var cw,cC,cB,cv,cx;var cA=cy.length;var cu=cy.slice(0,cD);if(cA<cD){throw ("buffer_to_title_case_uni: numchars exceeds array length")}cB=0;if(cD==0){return 0}cw=0;cx=cu[cw];cv=bM[cx];if(cv===undefined){cv=cg[cx]}if(cv===undefined){cy[cB]=cx;cB++}else{if(!(cv instanceof Array)){cy[cB]=cv;cB++}else{for(cC=0;cC<cv.length;cC++){cy[cB]=cv[cC];cB++}}}if(!cz){for(cw=1;cw<cD;cw++){cx=cu[cw];cy[cB]=cx;cB++}}else{for(cw=1;cw<cD;cw++){cx=cu[cw];cv=ap[cx];if(cv===undefined){cy[cB]=cx;cB++}else{if(!(cv instanceof Array)){cy[cB]=cv;cB++}else{for(cC=0;cC<cv.length;cC++){cy[cB]=cv[cC];cB++}}}}}cy.length=cA;return cB}function bm(cz,cF){var cu=cz.slice(0,cF);var cB,cw,cE,cy,cv;var cD,cC,cA,cx;cB=0;for(cw=0;cw<cF;cw++){cy=cu[cw];cv=bG[cy];if(cv===undefined){cz[cB]=cy;cB++}else{if(!(cv instanceof Array)){cz[cB]=cv;cB++}else{for(cE=0;cE<cv.length;cE++){cz[cB]=cv[cE];cB++}}}}cw=0;while(cw<cB){if(!bL[cz[cw]]){cw++;continue}if(cw>=cB){break}cD=cw;while(cw<cB&&bL[cz[cw]]){cw++}cC=cw;if(cC-cD>=2){for(cE=cC-1;cE>cD;cE--){for(cA=cD;cA<cE;cA++){if(bL[cz[cA]]>bL[cz[cA+1]]){cx=cz[cA];cz[cA]=cz[cA+1];cz[cA+1]=cx}}}}}return cB}function b6(cx,cC){var cw,cB,cy,cD,cu,cA,cv,cz;if(cC==0){return 0}cz=0;cy=cx[0];cu=bL[cy];if(cu){cu=999}cw=1;cB=cw;while(true){if(cB>=cC){cx[cz]=cy;cz=cw;break}cD=cx[cB];cA=bL[cD];cv=bD[cy];if(cv!==undefined&&cv[cD]!==undefined&&(!cu||(cA&&cu<cA))){cy=cv[cD];cx[cz]=cy}else{if(!cA){cz=cw;cy=cD}cu=cA;cx[cw]=cD;cw++}cB++}return cz}function a6(cv,cw){var cx=cv.length;var cu;cu=bm(cv,cw);cv.length=cx;return cu}function aF(cv,cw){var cx=cv.length;var cu;cu=bm(cv,cw);cu=b6(cv,cu);cv.length=cx;return cu}function an(cu){h(bx,cu)}function bT(cu){bN(bx,cu,false)}function aD(cu){aC(bx,cu,false)}function cd(cv,cu){h(cv,cu)}function a9(cv,cu){bN(cv,cu,false)}function cm(cv,cu){aC(cv,cu,false)}function ae(cu){if(!cu){throw ("glk_get_char_stream_uni: invalid stream")}return bt(cu,true)}function aL(cv,cu){if(!cv){throw ("glk_get_buffer_stream_uni: invalid stream")}return a(cv,cu,true)}function a0(cv,cu){if(!cv){throw ("glk_get_line_stream_uni: invalid stream")}return t(cv,cu,true)}function V(cx,cu,cw){if(!cx){throw ("glk_stream_open_file_uni: invalid fileref")}var cy;if(cu!=aN.filemode_Read&&cu!=aN.filemode_Write&&cu!=aN.filemode_ReadWrite&&cu!=aN.filemode_WriteAppend){throw ("glk_stream_open_file_uni: illegal filemode")}if(cu==aN.filemode_Read&&!Dialog.file_ref_exists(cx.ref)){throw ("glk_stream_open_file_uni: file not found for reading: "+cx.ref.filename)}var cv=null;if(cu!=aN.filemode_Write){cv=Dialog.file_read(cx.ref)}if(cv==null){cv=[];if(cu!=aN.filemode_Read){Dialog.file_write(cx.ref,"",true)}}cy=bk(aP,(cu!=aN.filemode_Write),(cu!=aN.filemode_Read),cw);cy.unicode=true;cy.ref=cx.ref;cy.buf=cv;cy.buflen=4294967295;if(cu==aN.filemode_Write){cy.bufeof=0}else{cy.bufeof=cv.length}if(cu==aN.filemode_WriteAppend){cy.bufpos=cy.bufeof}else{cy.bufpos=0}return cy}function bQ(cu,cv,cw){var cx;if(cv!=aN.filemode_Read&&cv!=aN.filemode_Write&&cv!=aN.filemode_ReadWrite){throw ("glk_stream_open_memory: illegal filemode")}cx=bk(be,(cv!=aN.filemode_Write),(cv!=aN.filemode_Read),cw);cx.unicode=true;if(cu){cx.buf=cu;cx.buflen=cu.length;cx.bufpos=0;if(cv==aN.filemode_Write){cx.bufeof=0}else{cx.bufeof=cx.buflen}if(window.GiDispa){GiDispa.retain_array(cu)}}return cx}function bI(cu){if(!cu){throw ("glk_request_char_event: invalid window")}if(cu.char_request||cu.line_request){throw ("glk_request_char_event: window already has keyboard request")}if(cu.type==aN.wintype_TextBuffer||cu.type==aN.wintype_TextGrid){cu.char_request=true;cu.char_request_uni=true;cu.input_generation=aT}else{throw ("glk_request_char_event: window does not support keyboard input")}}function l(cx,cv,cw){if(!cx){throw ("glk_request_line_event: invalid window")}if(cx.char_request||cx.line_request){throw ("glk_request_line_event: window already has keyboard request")}if(cx.type==aN.wintype_TextBuffer||cx.type==aN.wintype_TextGrid){if(cw){var cu=cv.slice(0,cw);if(!k){k={}}k[cx.disprock]=ce(cu)}cx.line_request=true;cx.line_request_uni=true;if(cx.type==aN.wintype_TextBuffer){cx.request_echo_line_input=cx.echo_line_input}else{cx.request_echo_line_input=true}cx.input_generation=aT;cx.linebuf=cv;if(window.GiDispa){GiDispa.retain_array(cv)}}else{throw ("glk_request_line_event: window does not support keyboard input")}}function bv(cw){var cu=new Date().getTime();var cv;cw.set_field(0,Math.floor(cu/4294967296000));cw.set_field(1,Math.floor(cu/1000)>>>0);cv=Math.floor((cu%1000)*1000);if(cv<0){cv=1000000+cv}cw.set_field(2,cv)}function bo(cv){var cu=new Date().getTime();return Math.floor(cu/(cv*1000))}function z(cx,cv){var cu=cx.get_field(0)*4294967296000+cx.get_field(1)*1000+cx.get_field(2)/1000;var cw=new Date(cu);cv.set_field(0,cw.getUTCFullYear());cv.set_field(1,1+cw.getUTCMonth());cv.set_field(2,cw.getUTCDate());cv.set_field(3,cw.getUTCDay());cv.set_field(4,cw.getUTCHours());cv.set_field(5,cw.getUTCMinutes());cv.set_field(6,cw.getUTCSeconds());cv.set_field(7,1000*cw.getUTCMilliseconds())}function bV(cx,cv){var cu=cx.get_field(0)*4294967296000+cx.get_field(1)*1000+cx.get_field(2)/1000;var cw=new Date(cu);cv.set_field(0,cw.getFullYear());cv.set_field(1,1+cw.getMonth());cv.set_field(2,cw.getDate());cv.set_field(3,cw.getDay());cv.set_field(4,cw.getHours());cv.set_field(5,cw.getMinutes());cv.set_field(6,cw.getSeconds());cv.set_field(7,1000*cw.getMilliseconds())}function Q(cy,cw,cv){var cu=cy*(1000*cw);var cx=new Date(cu);cv.set_field(0,cx.getUTCFullYear());cv.set_field(1,1+cx.getUTCMonth());cv.set_field(2,cx.getUTCDate());cv.set_field(3,cx.getUTCDay());cv.set_field(4,cx.getUTCHours());cv.set_field(5,cx.getUTCMinutes());cv.set_field(6,cx.getUTCSeconds());cv.set_field(7,1000*cx.getUTCMilliseconds())}function O(cy,cw,cv){var cu=cy*(1000*cw);var cx=new Date(cu);cv.set_field(0,cx.getFullYear());cv.set_field(1,1+cx.getMonth());cv.set_field(2,cx.getDate());cv.set_field(3,cx.getDay());cv.set_field(4,cx.getHours());cv.set_field(5,cx.getMinutes());cv.set_field(6,cx.getSeconds());cv.set_field(7,1000*cx.getMilliseconds())}function aR(cv,cy){var cx=new Date(0);cx.setUTCFullYear(cv.get_field(0));cx.setUTCMonth(cv.get_field(1)-1);cx.setUTCDate(cv.get_field(2));cx.setUTCHours(cv.get_field(4));cx.setUTCMinutes(cv.get_field(5));cx.setUTCSeconds(cv.get_field(6));cx.setUTCMilliseconds(cv.get_field(7)/1000);var cu=cx.getTime();var cw;cy.set_field(0,Math.floor(cu/4294967296000));cy.set_field(1,Math.floor(cu/1000)>>>0);cw=Math.floor((cu%1000)*1000);if(cw<0){cw=1000000+cw}cy.set_field(2,cw)}function e(cv,cy){var cx=new Date(cv.get_field(0),cv.get_field(1)-1,cv.get_field(2),cv.get_field(4),cv.get_field(5),cv.get_field(6),cv.get_field(7)/1000);var cu=cx.getTime();var cw;cy.set_field(0,Math.floor(cu/4294967296000));cy.set_field(1,Math.floor(cu/1000)>>>0);cw=Math.floor((cu%1000)*1000);if(cw<0){cw=1000000+cw}cy.set_field(2,cw)}function cq(cv,cw){var cx=new Date(0);cx.setUTCFullYear(cv.get_field(0));cx.setUTCMonth(cv.get_field(1)-1);cx.setUTCDate(cv.get_field(2));cx.setUTCHours(cv.get_field(4));cx.setUTCMinutes(cv.get_field(5));cx.setUTCSeconds(cv.get_field(6));cx.setUTCMilliseconds(cv.get_field(7)/1000);var cu=cx.getTime();return Math.floor(cu/(cw*1000))}function cs(cv,cw){var cx=new Date(cv.get_field(0),cv.get_field(1)-1,cv.get_field(2),cv.get_field(4),cv.get_field(5),cv.get_field(6),cv.get_field(7)/1000);var cu=cx.getTime();return Math.floor(cu/(cw*1000))}return{version:"1.2.3",init:ck,update:D,fatal_error:aA,byte_array_to_string:ca,uni_array_to_string:ce,Const:aN,RefBox:bR,RefStruct:Z,DidNotReturn:ci,call_may_not_return:bJ,glk_put_jstring:aY,glk_put_jstring_stream:bN,glk_exit:aj,glk_tick:br,glk_gestalt:q,glk_gestalt_ext:bE,glk_window_iterate:ct,glk_window_get_rock:bz,glk_window_get_root:bB,glk_window_open:b3,glk_window_close:bC,glk_window_get_size:C,glk_window_set_arrangement:aQ,glk_window_get_arrangement:aE,glk_window_get_type:j,glk_window_get_parent:aG,glk_window_clear:ac,glk_window_move_cursor:r,glk_window_get_stream:cp,glk_window_set_echo_stream:a8,glk_window_get_echo_stream:ba,glk_set_window:bp,glk_window_get_sibling:aZ,glk_stream_iterate:aW,glk_stream_get_rock:by,glk_stream_open_file:at,glk_stream_open_memory:bF,glk_stream_close:bA,glk_stream_set_position:aV,glk_stream_get_position:bW,glk_stream_set_current:u,glk_stream_get_current:M,glk_fileref_create_temp:y,glk_fileref_create_by_name:bZ,glk_fileref_create_by_prompt:aX,glk_fileref_destroy:a2,glk_fileref_iterate:J,glk_fileref_get_rock:ab,glk_fileref_delete_file:aB,glk_fileref_does_file_exist:v,glk_fileref_create_from_fileref:ag,glk_put_char:am,glk_put_char_stream:B,glk_put_string:cf,glk_put_string_stream:b0,glk_put_buffer:co,glk_put_buffer_stream:T,glk_set_style:bq,glk_set_style_stream:ao,glk_get_char_stream:ai,glk_get_line_stream:av,glk_get_buffer_stream:i,glk_char_to_lower:aU,glk_char_to_upper:bS,glk_stylehint_set:o,glk_stylehint_clear:b8,glk_style_distinguish:bn,glk_style_measure:bg,glk_select:S,glk_select_poll:aq,glk_request_line_event:b2,glk_cancel_line_event:X,glk_request_char_event:aH,glk_cancel_char_event:bK,glk_request_mouse_event:aw,glk_cancel_mouse_event:w,glk_request_timer_events:f,glk_image_get_info:p,glk_image_draw:ay,glk_image_draw_scaled:bf,glk_window_flow_break:n,glk_window_erase_rect:cn,glk_window_fill_rect:ar,glk_window_set_background_color:c,glk_schannel_iterate:bl,glk_schannel_get_rock:m,glk_schannel_create:bi,glk_schannel_destroy:F,glk_schannel_play:bw,glk_schannel_play_ext:bd,glk_schannel_stop:G,glk_schannel_set_volume:bh,glk_sound_load_hint:aK,glk_set_hyperlink:cc,glk_set_hyperlink_stream:I,glk_request_hyperlink_event:bc,glk_cancel_hyperlink_event:b9,glk_buffer_to_lower_case_uni:bP,glk_buffer_to_upper_case_uni:s,glk_buffer_to_title_case_uni:aJ,glk_buffer_canon_decompose_uni:a6,glk_buffer_canon_normalize_uni:aF,glk_put_char_uni:an,glk_put_string_uni:bT,glk_put_buffer_uni:aD,glk_put_char_stream_uni:cd,glk_put_string_stream_uni:a9,glk_put_buffer_stream_uni:cm,glk_get_char_stream_uni:ae,glk_get_buffer_stream_uni:aL,glk_get_line_stream_uni:a0,glk_stream_open_file_uni:V,glk_stream_open_memory_uni:bQ,glk_request_char_event_uni:bI,glk_request_line_event_uni:l,glk_set_echo_line_event:W,glk_set_terminators_line_event:b1,glk_current_time:bv,glk_current_simple_time:bo,glk_time_to_date_utc:z,glk_time_to_date_local:bV,glk_simple_time_to_date_utc:Q,glk_simple_time_to_date_local:O,glk_date_to_time_utc:aR,glk_date_to_time_local:e,glk_date_to_simple_time_utc:cq,glk_date_to_simple_time_local:cs}}();
