var Prototype={Version:"1.6.1_rc3",Browser:function(){var a=navigator.userAgent,b=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!b,Opera:b,WebKit:a.indexOf("AppleWebKit/")>-1,Gecko:a.indexOf("Gecko")>-1&&a.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(a)}}(),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 a=document.createElement("div"),b=document.createElement("form"),c=false;if(a.__proto__&&a.__proto__!==b.__proto__)c=true;return c}()},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={},Try={these:function(){for(var a,b=0,c=arguments.length;b<c;b++){var e=arguments[b];try{a=e();break}catch(f){}}return a}},Class=function(){function a(){}function b(){function e(){this.initialize.apply(this,arguments)}var f=null,g=$A(arguments);if(Object.isFunction(g[0]))f=g.shift();Object.extend(e,Class.Methods);e.superclass=f;e.subclasses=[];if(f){a.prototype=f.prototype;e.prototype=new a;f.subclasses.push(e)}for(f=0;f<g.length;f++)e.addMethods(g[f]);if(!e.prototype.initialize)e.prototype.initialize=
Prototype.emptyFunction;return e.prototype.constructor=e}function c(e){var f=this.superclass&&this.superclass.prototype,g=Object.keys(e);if(!Object.keys({toString:true}).length){e.toString!=Object.prototype.toString&&g.push("toString");e.valueOf!=Object.prototype.valueOf&&g.push("valueOf")}for(var h=0,j=g.length;h<j;h++){var n=g[h],u=e[n];if(f&&Object.isFunction(u)&&u.argumentNames().first()=="$super"){var E=u;u=function(t){return function(){return f[t].apply(this,arguments)}}(n).wrap(E);u.valueOf=
E.valueOf.bind(E);u.toString=E.toString.bind(E)}this.prototype[n]=u}return this}return{create:b,Methods:{addMethods:c}}}();
(function(){function a(r){return Object.prototype.toString.call(r).match(/^\[object\s(.*)\]$/)[1]}function b(r,A){for(var v in A)r[v]=A[v];return r}function c(r){try{if(R(r))return"undefined";if(r===null)return"null";return r.inspect?r.inspect():String(r)}catch(A){if(A instanceof RangeError)return"...";throw A;}}function e(r){switch(typeof r){case "undefined":case "function":case "unknown":return;case "boolean":return r.toString()}if(r===null)return"null";if(r.toJSON)return r.toJSON();if(!u(r)){var A=
[];for(var v in r){var D=e(r[v]);R(D)||A.push(v.toJSON()+": "+D)}return"{"+A.join(", ")+"}"}}function f(r){return $H(r).toQueryString()}function g(r){return r&&r.toHTML?r.toHTML():String.interpret(r)}function h(r){var A=[];for(var v in r)A.push(v);return A}function j(r){var A=[];for(var v in r)A.push(r[v]);return A}function n(r){return b({},r)}function u(r){return!!(r&&r.nodeType==1)}function E(r){return a(r)==="Array"}function t(r){return r instanceof Hash}function K(r){return typeof r==="function"}
function N(r){return a(r)==="String"}function J(r){return a(r)==="Number"}function R(r){return typeof r==="undefined"}b(Object,{extend:b,inspect:c,toJSON:e,toQueryString:f,toHTML:g,keys:h,values:j,clone:n,isElement:u,isArray:E,isHash:t,isFunction:K,isString:N,isNumber:J,isUndefined:R})})();
Object.extend(Function.prototype,function(){function a(t,K){for(var N=t.length,J=K.length;J--;)t[N+J]=K[J];return t}function b(t,K){t=E.call(t,0);return a(t,K)}function c(){var t=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return t.length==1&&!t[0]?[]:t}function e(t){if(arguments.length<2&&Object.isUndefined(arguments[0]))return this;var K=this,N=E.call(arguments,1);return function(){var J=b(N,arguments);
return K.apply(t,J)}}function f(t){var K=this,N=E.call(arguments,1);return function(J){J=a([J||window.event],N);return K.apply(t,J)}}function g(){if(!arguments.length)return this;var t=this,K=E.call(arguments,0);return function(){var N=b(K,arguments);return t.apply(this,N)}}function h(t){var K=this,N=E.call(arguments,1);t*=1E3;return window.setTimeout(function(){return K.apply(K,N)},t)}function j(){return this.delay.apply(this,a([0.01],arguments))}function n(t){var K=this;return function(){var N=
a([K.bind(this)],arguments);return t.apply(this,N)}}function u(){if(this._methodized)return this._methodized;var t=this;return this._methodized=function(){var K=a([this],arguments);return t.apply(null,K)}}var E=Array.prototype.slice;return{argumentNames:c,bind:e,bindAsEventListener:f,curry:g,delay:h,defer:j,wrap:n,methodize:u}}());
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(a,b){this.callback=a;this.frequency=b;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1E3)},execute:function(){this.callback(this)},stop:function(){if(this.timer){clearInterval(this.timer);this.timer=null}},onTimerEvent:function(){if(!this.currentlyExecuting)try{this.currentlyExecuting=true;this.execute()}catch(a){}finally{this.currentlyExecuting=
false}}});Object.extend(String,{interpret:function(a){return a==null?"":String(a)},specialChar:{"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r","\\":"\\\\"}});
Object.extend(String.prototype,function(){function a(y){if(Object.isFunction(y))return y;var L=new Template(y);return function(O){return L.evaluate(O)}}function b(y,L){var O="",M=this,W;L=a(L);if(Object.isString(y))y=RegExp.escape(y);if(!(y.length||y.source)){L=L("");return L+M.split("").join(L)+L}for(;M.length>0;)if(W=M.match(y)){O+=M.slice(0,W.index);O+=String.interpret(L(W));M=M.slice(W.index+W[0].length)}else{O+=M;M=""}return O}function c(y,L,O){L=a(L);O=Object.isUndefined(O)?1:O;return this.gsub(y,
function(M){if(--O<0)return M[0];return L(M)})}function e(y,L){this.gsub(y,L);return String(this)}function f(y,L){y=y||30;L=Object.isUndefined(L)?"...":L;return this.length>y?this.slice(0,y-L.length)+L:String(this)}function g(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function h(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"")}function j(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function n(){var y=new RegExp(Prototype.ScriptFragment,"img"),
L=new RegExp(Prototype.ScriptFragment,"im");return(this.match(y)||[]).map(function(O){return(O.match(L)||["",""])[1]})}function u(){return this.extractScripts().map(function(y){return eval(y)})}function E(){E.text.data=this;return E.div.innerHTML}function t(){var y=document.createElement("div");y.innerHTML=this.stripTags();return y.childNodes[0]?y.childNodes.length>1?$A(y.childNodes).inject("",function(L,O){return L+O.nodeValue}):y.childNodes[0].nodeValue:""}function K(y){var L=this.strip().match(/([^?#]*)(#.*)?$/);
if(!L)return{};return L[1].split(y||"&").inject({},function(O,M){if((M=M.split("="))[0]){var W=decodeURIComponent(M.shift());M=M.length>1?M.join("="):M[0];if(M!=undefined)M=decodeURIComponent(M);if(W in O){Object.isArray(O[W])||(O[W]=[O[W]]);O[W].push(M)}else O[W]=M}return O})}function N(){return this.split("")}function J(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function R(y){return y<1?"":(new Array(y+1)).join(this)}function r(){var y=this.split("-"),
L=y.length;if(L==1)return y[0];for(var O=this.charAt(0)=="-"?y[0].charAt(0).toUpperCase()+y[0].substring(1):y[0],M=1;M<L;M++)O+=y[M].charAt(0).toUpperCase()+y[M].substring(1);return O}function A(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function v(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase()}function D(){return this.gsub(/_/,"-")}function C(y){var L=this.gsub(/[\x00-\x1f\\]/,function(O){var M=
String.specialChar[O[0]];return M?M:"\\u00"+O[0].charCodeAt().toPaddedString(2,16)});if(y)return'"'+L.replace(/"/g,'\\"')+'"';return"'"+L.replace(/'/g,"\\'")+"'"}function w(){return this.inspect(true)}function q(y){return this.sub(y||Prototype.JSONFilter,"#{1}")}function l(){var y=this;if(y.blank())return false;y=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/.test(y)}function o(y){var L=this.unfilterJSON();try{if(!y||L.isJSON())return eval("("+L+
")")}catch(O){}throw new SyntaxError("Badly formed JSON string: "+this.inspect());}function s(y){return this.indexOf(y)>-1}function F(y){return this.indexOf(y)===0}function B(y){var L=this.length-y.length;return L>=0&&this.lastIndexOf(y)===L}function S(){return this==""}function V(){return/^\s*$/.test(this)}function U(y,L){return(new Template(this,L)).evaluate(y)}return{gsub:b,sub:c,scan:e,truncate:f,strip:String.prototype.trim?String.prototype.trim:g,stripTags:h,stripScripts:j,extractScripts:n,evalScripts:u,
escapeHTML:E,unescapeHTML:t,toQueryParams:K,parseQuery:K,toArray:N,succ:J,times:R,camelize:r,capitalize:A,underscore:v,dasherize:D,inspect:C,toJSON:w,unfilterJSON:q,isJSON:l,evalJSON:o,include:s,startsWith:F,endsWith:B,empty:S,blank:V,interpolate:U}}());Object.extend(String.prototype.escapeHTML,{div:document.createElement("div"),text:document.createTextNode("")});String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);
if("<\n>".escapeHTML()!=="&lt;\n&gt;")String.prototype.escapeHTML=function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")};if("&lt;\n&gt;".unescapeHTML()!=="<\n>")String.prototype.unescapeHTML=function(){return this.stripTags().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")};
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(b){if(a==null)return b[1]+"";var c=b[1]||"";if(c=="\\")return b[2];var e=a,f=b[3],g=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;b=g.exec(f);if(b==null)return c;for(;b!=null;){var h=b[1].startsWith("[")?b[2].gsub("\\\\]","]"):b[1];e=e[h];if(null==
e||""==b[3])break;f=f.substring("["==b[3]?b[1].length:b[0].length);b=g.exec(f)}return c+String.interpret(e)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;
var $break={},Enumerable=function(){function a(q,l){var o=0;try{this._each(function(F){q.call(l,F,o++)})}catch(s){if(s!=$break)throw s;}return this}function b(q,l,o){var s=-q,F=[],B=this.toArray();if(q<1)return B;for(;(s+=q)<B.length;)F.push(B.slice(s,s+q));return F.collect(l,o)}function c(q,l){q=q||Prototype.K;var o=true;this.each(function(s,F){o=o&&!!q.call(l,s,F);if(!o)throw $break;});return o}function e(q,l){q=q||Prototype.K;var o=false;this.each(function(s,F){if(o=!!q.call(l,s,F))throw $break;
});return o}function f(q,l){q=q||Prototype.K;var o=[];this.each(function(s,F){o.push(q.call(l,s,F))});return o}function g(q,l){var o;this.each(function(s,F){if(q.call(l,s,F)){o=s;throw $break;}});return o}function h(q,l){var o=[];this.each(function(s,F){q.call(l,s,F)&&o.push(s)});return o}function j(q,l,o){l=l||Prototype.K;var s=[];if(Object.isString(q))q=new RegExp(RegExp.escape(q));this.each(function(F,B){q.match(F)&&s.push(l.call(o,F,B))});return s}function n(q){if(Object.isFunction(this.indexOf))if(this.indexOf(q)!=
-1)return true;var l=false;this.each(function(o){if(o==q){l=true;throw $break;}});return l}function u(q,l){l=Object.isUndefined(l)?null:l;return this.eachSlice(q,function(o){for(;o.length<q;)o.push(l);return o})}function E(q,l,o){this.each(function(s,F){q=l.call(o,q,s,F)});return q}function t(q){var l=$A(arguments).slice(1);return this.map(function(o){return o[q].apply(o,l)})}function K(q,l){q=q||Prototype.K;var o;this.each(function(s,F){s=q.call(l,s,F);if(o==null||s>=o)o=s});return o}function N(q,
l){q=q||Prototype.K;var o;this.each(function(s,F){s=q.call(l,s,F);if(o==null||s<o)o=s});return o}function J(q,l){q=q||Prototype.K;var o=[],s=[];this.each(function(F,B){(q.call(l,F,B)?o:s).push(F)});return[o,s]}function R(q){var l=[];this.each(function(o){l.push(o[q])});return l}function r(q,l){var o=[];this.each(function(s,F){q.call(l,s,F)||o.push(s)});return o}function A(q,l){return this.map(function(o,s){return{value:o,criteria:q.call(l,o,s)}}).sort(function(o,s){o=o.criteria;s=s.criteria;return o<
s?-1:o>s?1:0}).pluck("value")}function v(){return this.map()}function D(){var q=Prototype.K,l=$A(arguments);if(Object.isFunction(l.last()))q=l.pop();var o=[this].concat(l).map($A);return this.map(function(s,F){return q(o.pluck(F))})}function C(){return this.toArray().length}function w(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:a,eachSlice:b,all:c,every:c,any:e,some:e,collect:f,map:f,detect:g,findAll:h,select:h,filter:h,grep:j,include:n,member:n,inGroupsOf:u,inject:E,invoke:t,
max:K,min:N,partition:J,pluck:R,reject:r,sortBy:A,toArray:v,entries:v,zip:D,size:C,inspect:w,find:g}}();function $A(a){if(!a)return[];if("toArray"in Object(a))return a.toArray();for(var b=a.length||0,c=new Array(b);b--;)c[b]=a[b];return c}function $w(a){if(!Object.isString(a))return[];return(a=a.strip())?a.split(/\s+/):[]}Array.from=$A;
(function(){function a(C){for(var w=0,q=this.length;w<q;w++)C(this[w])}function b(){this.length=0;return this}function c(){return this[0]}function e(){return this[this.length-1]}function f(){return this.select(function(C){return C!=null})}function g(){return this.inject([],function(C,w){if(Object.isArray(w))return C.concat(w.flatten());C.push(w);return C})}function h(){var C=v.call(arguments,0);return this.select(function(w){return!C.include(w)})}function j(C){return(C!==false?this:this.toArray())._reverse()}
function n(C){return this.inject([],function(w,q,l){if(0==l||(C?w.last()!=q:!w.include(q)))w.push(q);return w})}function u(C){return this.uniq().findAll(function(w){return C.detect(function(q){return w===q})})}function E(){return v.call(this,0)}function t(){return this.length}function K(){return"["+this.map(Object.inspect).join(", ")+"]"}function N(){var C=[];this.each(function(w){w=Object.toJSON(w);Object.isUndefined(w)||C.push(w)});return"["+C.join(", ")+"]"}function J(C,w){w||(w=0);var q=this.length;
if(w<0)w=q+w;for(;w<q;w++)if(this[w]===C)return w;return-1}function R(C,w){w=isNaN(w)?this.length:(w<0?this.length+w:w)+1;C=this.slice(0,w).reverse().indexOf(C);return C<0?C:w-C-1}function r(){for(var C=v.call(this,0),w,q=0,l=arguments.length;q<l;q++){w=arguments[q];if(Object.isArray(w)&&!("callee"in w))for(var o=0,s=w.length;o<s;o++)C.push(w[o]);else C.push(w)}return C}var A=Array.prototype,v=A.slice,D=A.forEach;D||(D=a);Object.extend(A,Enumerable);if(!A._reverse)A._reverse=A.reverse;Object.extend(A,
{_each:D,clear:b,first:c,last:e,compact:f,flatten:g,without:h,reverse:j,uniq:n,intersect:u,clone:E,toArray:E,size:t,inspect:K,toJSON:N});if(function(){return[].concat(arguments)[0][0]!==1}(1,2))A.concat=r;if(!A.indexOf)A.indexOf=J;if(!A.lastIndexOf)A.lastIndexOf=R})();function $H(a){return new Hash(a)}
var Hash=Class.create(Enumerable,function(){function a(r){this._object=Object.isHash(r)?r.toObject():Object.clone(r)}function b(r){for(var A in this._object){var v=this._object[A],D=[A,v];D.key=A;D.value=v;r(D)}}function c(r,A){return this._object[r]=A}function e(r){if(this._object[r]!==Object.prototype[r])return this._object[r]}function f(r){var A=this._object[r];delete this._object[r];return A}function g(){return Object.clone(this._object)}function h(){return this.pluck("key")}function j(){return this.pluck("value")}
function n(r){var A=this.detect(function(v){return v.value===r});return A&&A.key}function u(r){return this.clone().update(r)}function E(r){return(new Hash(r)).inject(this,function(A,v){A.set(v.key,v.value);return A})}function t(r,A){if(Object.isUndefined(A))return r;return r+"="+encodeURIComponent(String.interpret(A))}function K(){return this.inject([],function(r,A){var v=encodeURIComponent(A.key);if((A=A.value)&&typeof A=="object"){if(Object.isArray(A))return r.concat(A.map(t.curry(v)))}else r.push(t(v,
A));return r}).join("&")}function N(){return"#<Hash:{"+this.map(function(r){return r.map(Object.inspect).join(": ")}).join(", ")+"}>"}function J(){return Object.toJSON(this.toObject())}function R(){return new Hash(this)}return{initialize:a,_each:b,set:c,get:e,unset:f,toObject:g,toTemplateReplacements:g,keys:h,values:j,index:n,merge:u,update:E,toQueryString:K,inspect:N,toJSON:J,clone:R}}());Hash.from=$H;
Object.extend(Number.prototype,function(){function a(){return this.toPaddedString(2,16)}function b(){return this+1}function c(u,E){$R(0,this,true).each(u,E);return this}function e(u,E){E=this.toString(E||10);return"0".times(u-E.length)+E}function f(){return isFinite(this)?this.toString():"null"}function g(){return Math.abs(this)}function h(){return Math.round(this)}function j(){return Math.ceil(this)}function n(){return Math.floor(this)}return{toColorPart:a,succ:b,times:c,toPaddedString:e,toJSON:f,
abs:g,round:h,ceil:j,floor:n}}());function $R(a,b,c){return new ObjectRange(a,b,c)}
var ObjectRange=Class.create(Enumerable,function(){function a(e,f,g){this.start=e;this.end=f;this.exclusive=g}function b(e){for(var f=this.start;this.include(f);){e(f);f=f.succ()}}function c(e){if(e<this.start)return false;if(this.exclusive)return e<this.end;return e<=this.end}return{initialize:a,_each:b,include:c}}()),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){this.include(a)||this.responders.push(a)},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(a,b,c,e){this.each(function(f){if(Object.isFunction(f[a]))try{f[a].apply(f,[b,c,e])}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,c){$super(c);this.transport=Ajax.getTransport();this.request(b)},request:function(a){this.url=a;this.method=this.options.method;a=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){a._method=this.method;this.method="post"}this.parameters=a;if(a=Object.toQueryString(a))if(this.method=="get")this.url+=(this.url.include("?")?"&":"?")+a;else if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))a+=
"&_=";try{var b=new Ajax.Response(this);this.options.onCreate&&this.options.onCreate(b);Ajax.Responders.dispatch("onCreate",this,b);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);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||a:null;this.transport.send(this.body);!this.options.asynchronous&&this.transport.overrideMimeType&&
this.onStateChange()}catch(c){this.dispatchException(c)}},onStateChange:function(){var a=this.transport.readyState;a>1&&!(a==4&&this._complete)&&this.respondToReadyState(this.transport.readyState)},setRequestHeaders:function(){var a={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){a["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)a.Connection="close"}if(typeof this.options.requestHeaders=="object"){var b=this.options.requestHeaders;if(Object.isFunction(b.push))for(var c=0,e=b.length;c<e;c+=2)a[b[c]]=b[c+1];else $H(b).each(function(g){a[g.key]=g.value})}for(var f in a)this.transport.setRequestHeader(f,a[f])},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){a=Ajax.Request.Events[a];var b=new Ajax.Response(this);if(a=="Complete"){try{this._complete=true;(this.options["on"+b.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(b,b.headerJSON)}catch(c){this.dispatchException(c)}var e=b.getHeader("Content-type");if(this.options.evalJS=="force"||this.options.evalJS&&this.isSameOrigin()&&e&&e.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))this.evalResponse()}try{(this.options["on"+
a]||Prototype.emptyFunction)(b,b.headerJSON);Ajax.Responders.dispatch("on"+a,this,b,b.headerJSON)}catch(f){this.dispatchException(f)}if(a=="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(a){this.dispatchException(a)}},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(a){this.request=a;a=this.transport=a.transport;var b=this.readyState=a.readyState;if(b>2&&!Prototype.Browser.IE||b==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(a.responseText);this.headerJSON=this._getHeaderJSON()}if(b==4){a=a.responseXML;this.responseXML=Object.isUndefined(a)?null:a;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,b,c,e){this.container={success:b.success||b,failure:b.failure||(b.success?null:b)};e=Object.clone(e);var f=e.onComplete;e.onComplete=function(g,h){this.updateContent(g.responseText);Object.isFunction(f)&&f(g,h)}.bind(this);$super(c,e)},updateContent:function(a){var b=this.container[this.success()?"success":"failure"],c=this.options;c.evalScripts||(a=a.stripScripts());if(b=$(b))if(c.insertion)if(Object.isString(c.insertion)){var e=
{};e[c.insertion]=a;b.insert(e)}else c.insertion(b,a);else b.update(a)}});
Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,b,c,e){$super(e);this.onComplete=this.options.onComplete;this.frequency=this.options.frequency||2;this.decay=this.options.decay||1;this.updater={};this.container=b;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 $(a){if(arguments.length>1){for(var b=0,c=[],e=arguments.length;b<e;b++)c.push($(arguments[b]));return c}if(Object.isString(a))a=document.getElementById(a);return Element.extend(a)}if(Prototype.BrowserFeatures.XPath)document._getElementsByXPath=function(a,b){var c=[];a=document.evaluate(a,$(b)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);b=0;for(var e=a.snapshotLength;b<e;b++)c.push(Element.extend(a.snapshotItem(b)));return c};if(!window.Node)var Node={};
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(a){var b=function(){var e=document.createElement("form"),f=document.createElement("input"),g=document.documentElement;f.setAttribute("name","test");e.appendChild(f);g.appendChild(e);f=e.elements?typeof e.elements.test=="undefined":null;g.removeChild(e);return f}(),c=a.Element;a.Element=function(e,f){f=f||{};e=e.toLowerCase();var g=Element.cache;if(b&&f.name){e="<"+e+' name="'+f.name+'">';delete f.name;return Element.writeAttribute(document.createElement(e),f)}g[e]||(g[e]=Element.extend(document.createElement(e)));
return Element.writeAttribute(g[e].cloneNode(false),f)};Object.extend(a.Element,c||{});if(c)a.Element.prototype=c.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(){function a(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 h=f.tagName.toUpperCase();
if(h==="SCRIPT"&&e){f.text=g;return f}if(b||c)if(h in Element._insertionTranslations.tags){for(;f.firstChild;)f.removeChild(f.firstChild);Element._getContentFromAnonymousElement(h,g.stripScripts()).each(function(j){f.appendChild(j)})}else f.innerHTML=g.stripScripts();else f.innerHTML=g.stripScripts();g.evalScripts.bind(g).defer();return f}var b=function(){var f=document.createElement("select"),g=true;f.innerHTML='<option value="test">test</option>';if(f.options&&f.options[0])g=f.options[0].nodeName.toUpperCase()!==
"OPTION";return g}(),c=function(){try{var f=document.createElement("table");if(f&&f.tBodies){f.innerHTML="<tbody><tr><td>test</td></tr></tbody>";return typeof f.tBodies[0]=="undefined"}}catch(g){return true}}(),e=function(){var f=document.createElement("script"),g=false;try{f.appendChild(document.createTextNode(""));g=!f.firstChild||f.firstChild&&f.firstChild.nodeType!==3}catch(h){g=true}return g}();return a}(),replace:function(a,b){a=$(a);if(b&&b.toElement)b=b.toElement();else if(!Object.isElement(b)){b=
Object.toHTML(b);var c=a.ownerDocument.createRange();c.selectNode(a);b.evalScripts.bind(b).defer();b=c.createContextualFragment(b.stripScripts())}a.parentNode.replaceChild(b,a);return a},insert:function(a,b){a=$(a);if(Object.isString(b)||Object.isNumber(b)||Object.isElement(b)||b&&(b.toElement||b.toHTML))b={bottom:b};var c,e,f;for(var g in b){c=b[g];g=g.toLowerCase();e=Element._insertionTranslations[g];if(c&&c.toElement)c=c.toElement();if(Object.isElement(c))e(a,c);else{c=Object.toHTML(c);f=(g=="before"||
g=="after"?a.parentNode:a).tagName.toUpperCase();f=Element._getContentFromAnonymousElement(f,c.stripScripts());if(g=="top"||g=="after")f.reverse();f.each(e.curry(a));c.evalScripts.bind(c).defer()}}return a},wrap:function(a,b,c){a=$(a);if(Object.isElement(b))$(b).writeAttribute(c||{});else b=Object.isString(b)?new Element(b,c):new Element("div",b);a.parentNode&&a.parentNode.replaceChild(b,a);b.appendChild(a);return b},inspect:function(a){a=$(a);var b="<"+a.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(c){var e=
c.first();c=c.last();if(e=(a[e]||"").toString())b+=" "+c+"="+e.inspect(true)});return b+">"},recursivelyCollect:function(a,b){a=$(a);for(var c=[];a=a[b];)a.nodeType==1&&c.push(Element.extend(a));return c},ancestors:function(a){return Element.recursivelyCollect(a,"parentNode")},descendants:function(a){return Element.select(a,"*")},firstDescendant:function(a){for(a=$(a).firstChild;a&&a.nodeType!=1;)a=a.nextSibling;return $(a)},immediateDescendants:function(a){if(!(a=$(a).firstChild))return[];for(;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(a,b){if(Object.isString(b))b=new Selector(b);return b.match($(a))},up:function(a,b,c){a=$(a);if(arguments.length==1)return $(a.parentNode);
var e=Element.ancestors(a);return Object.isNumber(b)?e[b]:Selector.findElement(e,b,c)},down:function(a,b,c){a=$(a);if(arguments.length==1)return Element.firstDescendant(a);return Object.isNumber(b)?Element.descendants(a)[b]:Element.select(a,b)[c||0]},previous:function(a,b,c){a=$(a);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(a));var e=Element.previousSiblings(a);return Object.isNumber(b)?e[b]:Selector.findElement(e,b,c)},next:function(a,b,c){a=$(a);if(arguments.length==
1)return $(Selector.handlers.nextElementSibling(a));var e=Element.nextSiblings(a);return Object.isNumber(b)?e[b]:Selector.findElement(e,b,c)},select:function(a){var b=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(a,b)},adjacent:function(a){var b=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(a.parentNode,b).without(a)},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(){var a=function(){var b=document.createElement("iframe"),c=false;document.documentElement.appendChild(b);try{b.getAttribute("type",2)}catch(e){c=true}document.documentElement.removeChild(b);return c}();return function(b,c){b=$(b);if(a&&c==="type"&&b.tagName.toUpperCase()=="IFRAME")return b.getAttribute("type");if(Prototype.Browser.IE){var e=Element._attributeTranslations.read;if(e.values[c])return e.values[c](b,c);if(e.names[c])c=
e.names[c];if(c.include(":"))return!b.attributes||!b.attributes[c]?null:b.attributes[c].value}return b.getAttribute(c)}}(),writeAttribute:function(a,b,c){a=$(a);var e={},f=Element._attributeTranslations.write;if(typeof b=="object")e=b;else e[b]=Object.isUndefined(c)?true:c;for(var g in e){b=f.names[g]||g;c=e[g];if(f.values[g])b=f.values[g](a,c);if(c===false||c===null)a.removeAttribute(b);else c===true?a.setAttribute(b,b):a.setAttribute(b,c)}return a},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)){a=a.className;return a.length>0&&(a==b||(new RegExp("(^|\\s)"+b+"(\\s|$)")).test(a))}},addClassName:function(a,b){if(a=$(a)){Element.hasClassName(a,b)||(a.className+=(a.className?" ":"")+b);return a}},removeClassName:function(a,b){if(a=$(a)){a.className=a.className.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," ").strip();return a}},toggleClassName:function(a,
b){if(a=$(a))return Element[Element.hasClassName(a,b)?"removeClassName":"addClassName"](a,b)},cleanWhitespace:function(a){a=$(a);for(var b=a.firstChild;b;){var c=b.nextSibling;b.nodeType==3&&!/\S/.test(b.nodeValue)&&a.removeChild(b);b=c}return a},empty:function(a){return $(a).innerHTML.blank()},descendantOf:function(a,b){a=$(a);b=$(b);if(a.compareDocumentPosition)return(a.compareDocumentPosition(b)&8)===8;if(b.contains)return b.contains(a)&&b!==a;for(;a=a.parentNode;)if(a==b)return true;return false},
scrollTo:function(a){a=$(a);var b=Element.cumulativeOffset(a);window.scrollTo(b[0],b[1]);return a},getStyle:function(a,b){a=$(a);b=b=="float"?"cssFloat":b.camelize();var c=a.style[b];if(!c||c=="auto")c=(a=document.defaultView.getComputedStyle(a,null))?a[b]:null;if(b=="opacity")return c?parseFloat(c):1;return c=="auto"?null:c},getOpacity:function(a){return $(a).getStyle("opacity")},setStyle:function(a,b){a=$(a);var c=a.style;if(Object.isString(b)){a.style.cssText+=";"+b;return b.include("opacity")?
a.setOpacity(b.match(/opacity:\s*(\d?\.?\d*)/)[1]):a}for(var e in b)if(e=="opacity")a.setOpacity(b[e]);else c[e=="float"||e=="cssFloat"?Object.isUndefined(c.styleFloat)?"cssFloat":"styleFloat":e]=b[e];return a},setOpacity:function(a,b){a=$(a);a.style.opacity=b==1||b===""?"":b<1.0E-5?0:b;return a},getDimensions:function(a){a=$(a);var b=Element.getStyle(a,"display");if(b!="none"&&b!=null)return{width:a.offsetWidth,height:a.offsetHeight};b=a.style;var c=b.visibility,e=b.position,f=b.display;b.visibility=
"hidden";if(e!="fixed")b.position="absolute";b.display="block";var g=a.clientWidth;a=a.clientHeight;b.display=f;b.position=e;b.visibility=c;return{width:g,height:a}},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(a){var b=0,c=0;do{b+=a.offsetTop||0;c+=a.offsetLeft||0;a=a.offsetParent}while(a);return Element._returnOffset(c,b)},positionedOffset:function(a){var b=
0,c=0;do{b+=a.offsetTop||0;c+=a.offsetLeft||0;if(a=a.offsetParent){if(a.tagName.toUpperCase()=="BODY")break;if(Element.getStyle(a,"position")!=="static")break}}while(a);return Element._returnOffset(c,b)},absolutize:function(a){a=$(a);if(Element.getStyle(a,"position")=="absolute")return a;var b=Element.positionedOffset(a),c=b[1];b=b[0];var e=a.clientWidth,f=a.clientHeight;a._originalLeft=b-parseFloat(a.style.left||0);a._originalTop=c-parseFloat(a.style.top||0);a._originalWidth=a.style.width;a._originalHeight=
a.style.height;a.style.position="absolute";a.style.top=c+"px";a.style.left=b+"px";a.style.width=e+"px";a.style.height=f+"px";return a},relativize:function(a){a=$(a);if(Element.getStyle(a,"position")=="relative")return a;a.style.position="relative";var b=parseFloat(a.style.top||0)-(a._originalTop||0),c=parseFloat(a.style.left||0)-(a._originalLeft||0);a.style.top=b+"px";a.style.left=c+"px";a.style.height=a._originalHeight;a.style.width=a._originalWidth;return a},cumulativeScrollOffset:function(a){var b=
0,c=0;do{b+=a.scrollTop||0;c+=a.scrollLeft||0;a=a.parentNode}while(a);return Element._returnOffset(c,b)},getOffsetParent:function(a){if(a.offsetParent)return $(a.offsetParent);if(a==document.body)return $(a);for(;(a=a.parentNode)&&a!=document.body;)if(Element.getStyle(a,"position")!="static")return $(a);return $(document.body)},viewportOffset:function(a){var b=0,c=0,e=a;do{b+=e.offsetTop||0;c+=e.offsetLeft||0;if(e.offsetParent==document.body&&Element.getStyle(e,"position")=="absolute")break}while(e=
e.offsetParent);e=a;do if(!Prototype.Browser.Opera||e.tagName&&e.tagName.toUpperCase()=="BODY"){b-=e.scrollTop||0;c-=e.scrollLeft||0}while(e=e.parentNode);return Element._returnOffset(c,b)},clonePosition:function(a,b,c){c=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},c||{});b=$(b);var e=Element.viewportOffset(b);a=$(a);var f=[0,0],g=null;if(Element.getStyle(a,"position")=="absolute"){g=Element.getOffsetParent(a);f=Element.viewportOffset(g)}if(g==document.body){f[0]-=
document.body.offsetLeft;f[1]-=document.body.offsetTop}if(c.setLeft)a.style.left=e[0]-f[0]+c.offsetLeft+"px";if(c.setTop)a.style.top=e[1]-f[1]+c.offsetTop+"px";if(c.setWidth)a.style.width=b.offsetWidth+"px";if(c.setHeight)a.style.height=b.offsetHeight+"px";return a}};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(a,b,c){switch(c){case "left":case "top":case "right":case "bottom":if(a(b,"position")==="static")return null;case "height":case "width":if(!Element.visible(b))return null;var e=parseInt(a(b,c),10);if(e!==b["offset"+c.capitalize()])return e+"px";return(c==="height"?["border-top-width","padding-top","padding-bottom","border-bottom-width"]:["border-left-width","padding-left","padding-right","border-right-width"]).inject(e,
function(f,g){g=a(b,g);return g===null?f:f-parseInt(g,10)})+"px";default:return a(b,c)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(a,b,c){if(c==="title")return b.title;return a(b,c)})}else if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(a,b){b=$(b);var c=b.getStyle("position");if(c!=="static")return a(b);b.setStyle({position:"relative"});a=a(b);b.setStyle({position:c});return a});$w("positionedOffset viewportOffset").each(function(a){Element.Methods[a]=
Element.Methods[a].wrap(function(b,c){c=$(c);var e=c.getStyle("position");if(e!=="static")return b(c);var f=c.getOffsetParent();f&&f.getStyle("position")==="fixed"&&f.setStyle({zoom:1});c.setStyle({position:"relative"});b=b(c);c.setStyle({position:e});return b})});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(a,b){return a(b)});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(a,b){function c(g){return g.replace(/alpha\([^\)]*\)/gi,"")}a=$(a);var e=a.currentStyle;if(e&&!e.hasLayout||!e&&a.style.zoom=="normal")a.style.zoom=1;e=a.getStyle("filter");var f=a.style;
if(b==1||b===""){(e=c(e))?(f.filter=e):f.removeAttribute("filter");return a}else if(b<1.0E-5)b=0;f.filter=c(e)+"alpha(opacity="+b*100+")";return a};Element._attributeTranslations=function(){var a="className",b="for",c=document.createElement("div");c.setAttribute(a,"x");if(c.className!=="x"){c.setAttribute("class","x");if(c.className==="x")a="class"}c=null;c=document.createElement("label");c.setAttribute(b,"x");if(c.htmlFor!=="x"){c.setAttribute("htmlFor","x");if(c.htmlFor==="x")b="htmlFor"}c=null;
return{read:{names:{"class":a,className:a,"for":b,htmlFor:b},values:{_getAttr:function(e,f){return e.getAttribute(f,2)},_getAttrNode:function(e,f){return(e=e.getAttributeNode(f))?e.value:""},_getEv:function(){var e=document.createElement("div");e.onclick=Prototype.emptyFunction;e=e.getAttribute("onclick");var f;if(String(e).indexOf("{")>-1)f=function(g,h){h=g.getAttribute(h);if(!h)return null;h=h.toString();h=h.split("{")[1];h=h.split("}")[0];return h.strip()};else if(e==="")f=function(g,h){h=g.getAttribute(h);
if(!h)return null;return h.strip()};e=null;return f}(),_flag:function(e,f){return $(e).hasAttribute(f)?f:null},style:function(e){return e.style.cssText.toLowerCase()},title:function(e){return e.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._getAttr,src:a._getAttr,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);Prototype.BrowserFeatures.ElementExtensions&&function(){function a(b){b=b.getElementsByTagName("*");for(var c=[],e=0,f;f=b[e];e++)f.tagName!=="!"&&c.push(f);return c}Element.Methods.down=function(b,c,e){b=$(b);if(arguments.length==1)return b.firstDescendant();return Object.isNumber(c)?a(b)[c]:Element.select(b,c)[e||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<1.0E-5?0:b;return a};else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=b==1||b===""?"":b<1.0E-5?0:b;if(b==1)if(a.tagName.toUpperCase()=="IMG"&&a.width){a.width++;a.width--}else try{var c=document.createTextNode(" ");a.appendChild(c);a.removeChild(c)}catch(e){}return a};Element.Methods.cumulativeOffset=function(a){var b=0,c=0;do{b+=a.offsetTop||0;c+=a.offsetLeft||0;if(a.offsetParent==document.body)if(Element.getStyle(a,
"position")=="absolute")break;a=a.offsetParent}while(a);return Element._returnOffset(c,b)}}
if("outerHTML"in document.documentElement)Element.Methods.replace=function(a,b){a=$(a);if(b&&b.toElement)b=b.toElement();if(Object.isElement(b)){a.parentNode.replaceChild(b,a);return a}b=Object.toHTML(b);var c=a.parentNode,e=c.tagName.toUpperCase();if(Element._insertionTranslations.tags[e]){var f=a.next();e=Element._getContentFromAnonymousElement(e,b.stripScripts());c.removeChild(a);f?e.each(function(g){c.insertBefore(g,f)}):e.each(function(g){c.appendChild(g)})}else a.outerHTML=b.stripScripts();
b.evalScripts.bind(b).defer();return a};Element._returnOffset=function(a,b){var c=[a,b];c.left=a;c.top=b;return c};Element._getContentFromAnonymousElement=function(a,b){var c=new Element("div");if(a=Element._insertionTranslations.tags[a]){c.innerHTML=a[0]+b+a[1];a[2].times(function(){c=c.firstChild})}else c.innerHTML=b;return $A(c.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,b){b=Element._attributeTranslations.has[b]||b;a=$(a).getAttributeNode(b);return!!(a&&a.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}})(document.createElement("div"));
Element.extend=function(){function a(g){if(typeof window.Element!="undefined"){var h=window.Element.prototype;if(h){var j="_"+(Math.random()+"").slice(2);g=document.createElement(g);h[j]="x";g=g[j]!=="x";delete h[j];return g}}return false}function b(g,h){for(var j in h){var n=h[j];if(Object.isFunction(n)&&!(j in g))g[j]=n.methodize()}}var c=a("object");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(c)return function(g){var h;if(g&&(h=g.tagName))if(/^(?:object|applet|embed)$/i.test(h)){b(g,
Element.Methods);b(g,Element.Methods.ByTag[h.toUpperCase()])}return g};return Prototype.K}var e={},f=Element.Methods.ByTag;c=Object.extend(function(g){if(!g||typeof g._extendedByPrototype!="undefined"||g.nodeType!=1||g==window)return g;var h=Object.clone(e),j=g.tagName.toUpperCase();f[j]&&Object.extend(h,f[j]);b(g,h);g._extendedByPrototype=Prototype.emptyFunction;return g},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(e,Element.Methods);Object.extend(e,Element.Methods.Simulated)}}});
c.refresh();return c}();Element.hasAttribute=function(a,b){if(a.hasAttribute)return a.hasAttribute(b);return Element.Methods.Simulated.hasAttribute(a,b)};
Element.addMethods=function(a){function b(n){n=n.toUpperCase();Element.Methods.ByTag[n]||(Element.Methods.ByTag[n]={});Object.extend(Element.Methods.ByTag[n],a)}function c(n,u,E){E=E||false;for(var t in n){var K=n[t];if(Object.isFunction(K))if(!E||!(t in u))u[t]=K.methodize()}}function e(n){var u,E={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(E[n])u="HTML"+E[n]+"Element";if(window[u])return window[u];u="HTML"+n+"Element";if(window[u])return window[u];u="HTML"+n.capitalize()+"Element";if(window[u])return window[u];n=document.createElement(n);return n.__proto__||n.constructor.prototype}
var f=Prototype.BrowserFeatures,g=Element.Methods.ByTag;if(!a){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 h=a;a=arguments[1]}if(h)Object.isArray(h)?h.each(b):b(h);else Object.extend(Element.Methods,a||{});h=window.HTMLElement?HTMLElement.prototype:
Element.prototype;if(f.ElementExtensions){c(Element.Methods,h);c(Element.Methods.Simulated,h,true)}if(f.SpecificElementExtensions)for(var j in Element.Methods.ByTag){f=e(j);Object.isUndefined(f)||c(g[j],f.prototype)}Object.extend(Element,Element.Methods);delete Element.ByTag;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(a){function b(){if(e.WebKit&&!f.evaluate)return document;if(e.Opera&&window.parseFloat(window.opera.version())<9.5)return document.body;return document.documentElement}function c(j){g||(g=b());h[j]="client"+j;a["get"+j]=function(){return g[h[j]]};return a["get"+j]()}var e=Prototype.Browser,f=document,g,h={};a.getWidth=c.curry("Width");a.getHeight=c.curry("Height")})(document.viewport);Element.Storage={UID:1};
Element.addMethods({getStorage:function(a){if(a=$(a)){if(a===window)a=0;else{if(typeof a._prototypeUID==="undefined")a._prototypeUID=[Element.Storage.UID++];a=a._prototypeUID[0]}Element.Storage[a]||(Element.Storage[a]=$H());return Element.Storage[a]}},store:function(a,b,c){if(a=$(a)){arguments.length===2?Element.getStorage(a).update(b):Element.getStorage(a).set(b,c);return a}},retrieve:function(a,b,c){if(a=$(a)){a=Element.getStorage(a);var e=a.get(b);if(Object.isUndefined(e)){a.set(b,c);e=c}return e}},
clone:function(a,b){if(a=$(a)){a=a.cloneNode(b);a._prototypeUID=void 0;if(b){b=Element.select(a,"*");for(var c=b.length;c--;)b[c]._prototypeUID=void 0}return Element.extend(a)}}});
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 b=false;if(document.evaluate&&window.XPathResult){b=document.createElement("div");b.innerHTML="<ul><li></li></ul><div><ul><li></li></ul></div>";b=document.evaluate(".//*[local-name()='ul' or local-name()='UL']//*[local-name()='li' or local-name()='LI']",
b,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null).snapshotLength!==2}return b}();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 a=this.expression,b=Selector.patterns,c=Selector.criteria,e,f,g=b.length,h;if(Selector._cache[a])this.matcher=Selector._cache[a];else{for(this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];a&&e!=a&&/\S/.test(a);){e=a;for(var j=0;j<g;j++){f=b[j].re;h=b[j].name;if(f=a.match(f)){this.matcher.push(Object.isFunction(c[h])?
c[h](f):(new Template(c[h])).evaluate(f));a=a.replace(f[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher}},compileXPathMatcher:function(){var a=this.expression,b=Selector.patterns,c=Selector.xpath,e,f,g=b.length,h;if(Selector._cache[a])this.xpath=Selector._cache[a];else{for(this.matcher=[".//*"];a&&e!=a&&/\S/.test(a);){e=a;for(var j=0;j<g;j++){h=b[j].name;if(f=a.match(b[j].re)){this.matcher.push(Object.isFunction(c[h])?
c[h](f):(new Template(c[h])).evaluate(f));a=a.replace(f[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath}},findElements:function(a){a=a||document;var b=this.expression;switch(this.mode){case "selectorsAPI":if(a!==document){var c=a.id,e=$(a).identify();e=e.replace(/[\.:]/g,"\\$0");b="#"+e+" "+b}b=$A(a.querySelectorAll(b)).map(Element.extend);a.id=c;return b;case "xpath":return document._getElementsByXPath(this.xpath,a);default:return this.matcher(a)}},match:function(a){this.tokens=
[];for(var b=this.expression,c=Selector.patterns,e=Selector.assertions,f,g,h=c.length,j;b&&f!==b&&/\S/.test(b);){f=b;for(var n=0;n<h;n++){g=c[n].re;j=c[n].name;if(g=b.match(g))if(e[j]){this.tokens.push([j,Object.clone(g)]);b=b.replace(g[0],"")}else return this.findElements(document).include(a)}}b=true;for(n=0;c=this.tokens[n];n++){j=c[0];c=c[1];if(!Selector.assertions[j](a,c)){b=false;break}}return b},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 a=document.createElement("div"),b=document.createElement("span");a.id="prototype_test_id";b.className="Test";a.appendChild(b);return a.querySelector("#prototype_test_id .test")!==null}();
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(a){for(var b=a[6],c=Selector.patterns,e=Selector.xpath,f,g,h=c.length,j=[];b&&f!=b&&/\S/.test(b);){f=b;for(var n=0;n<h;n++){g=c[n].name;if(a=b.match(c[n].re)){g=
Object.isFunction(e[g])?e[g](a):(new Template(e[g])).evaluate(a);j.push("("+g.substring(1,g.length-1)+")");b=b.replace(a[0],"");break}}}return"[not("+j.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(a,b){var c=b[6];if(c=="even")c="2n+0";if(c=="odd")c="2n+1";if(b=c.match(/^(\d+)$/))return"["+a+"= "+b[1]+"]";if(b=c.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(b[1]=="-")b[1]=-1;c=b[1]?Number(b[1]):1;b=b[2]?
Number(b[2]):0;return(new Template("[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]")).evaluate({fragment:a,a:c,b:b})}}}},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(a,b){return(a=Element.readAttribute(a,b[1]))&&Selector.operators[b[2]](a,b[5]||b[6])}},handlers:{concat:function(a,b){for(var c=0,e;e=b[c];c++)a.push(e);return a},mark:function(a){for(var b=Prototype.emptyFunction,c=0,e;e=a[c];c++)e._countedByPrototype=b;return a},unmark:function(){return function(){var a=document.createElement("div"),b=false;a._countedByPrototype="x";return b=a.getAttribute("_countedByPrototype")==="x"}()?function(a){for(var b=0,c;c=a[b];b++)c.removeAttribute("_countedByPrototype");
return a}:function(a){for(var b=0,c;c=a[b];b++)c._countedByPrototype=void 0;return a}}(),index:function(a,b,c){a._countedByPrototype=Prototype.emptyFunction;if(b){a=a.childNodes;b=a.length-1;for(var e=1;b>=0;b--){var f=a[b];if(f.nodeType==1&&(!c||f._countedByPrototype))f.nodeIndex=e++}}else{b=0;e=1;for(a=a.childNodes;f=a[b];b++)if(f.nodeType==1&&(!c||f._countedByPrototype))f.nodeIndex=e++}},unique:function(a){if(a.length==0)return a;for(var b=[],c,e=0,f=a.length;e<f;e++)if(typeof(c=a[e])._countedByPrototype==
"undefined"){c._countedByPrototype=Prototype.emptyFunction;b.push(Element.extend(c))}return Selector.handlers.unmark(b)},descendant:function(a){for(var b=Selector.handlers,c=0,e=[],f;f=a[c];c++)b.concat(e,f.getElementsByTagName("*"));return e},child:function(a){for(var b=0,c=[],e;e=a[b];b++)for(var f=0,g;g=e.childNodes[f];f++)g.nodeType==1&&g.tagName!="!"&&c.push(g);return c},adjacent:function(a){for(var b=0,c=[],e;e=a[b];b++)(e=this.nextElementSibling(e))&&c.push(e);return c},laterSibling:function(a){for(var b=
Selector.handlers,c=0,e=[],f;f=a[c];c++)b.concat(e,Element.nextSiblings(f));return e},nextElementSibling:function(a){for(;a=a.nextSibling;)if(a.nodeType==1)return a;return null},previousElementSibling:function(a){for(;a=a.previousSibling;)if(a.nodeType==1)return a;return null},tagName:function(a,b,c,e){var f=c.toUpperCase(),g=[],h=Selector.handlers;if(a){if(e){if(e=="descendant"){for(b=0;e=a[b];b++)h.concat(g,e.getElementsByTagName(c));return g}else a=this[e](a);if(c=="*")return a}for(b=0;e=a[b];b++)e.tagName.toUpperCase()===
f&&g.push(e);return g}else return b.getElementsByTagName(c)},id:function(a,b,c,e){var f=$(c),g=Selector.handlers;if(b==document){if(!f)return[];if(!a)return[f]}else if(!b.sourceIndex||b.sourceIndex<1){a=b.getElementsByTagName("*");for(var h=0,j;j=a[h];h++)if(j.id===c)return[j]}if(a){if(e)if(e=="child")for(b=0;j=a[b];b++){if(f.parentNode==j)return[f]}else if(e=="descendant")for(b=0;j=a[b];b++){if(Element.descendantOf(f,j))return[f]}else if(e=="adjacent")for(b=0;j=a[b];b++){if(Selector.handlers.previousElementSibling(f)==
j)return[f]}else a=g[e](a);for(b=0;j=a[b];b++)if(j==f)return[f];return[]}return f&&Element.descendantOf(f,b)?[f]:[]},className:function(a,b,c,e){if(a&&e)a=this[e](a);return Selector.handlers.byClassName(a,b,c)},byClassName:function(a,b,c){a||(a=Selector.handlers.descendant([b]));b=" "+c+" ";for(var e=0,f=[],g,h;g=a[e];e++){h=g.className;if(h.length!=0)if(h==c||(" "+h+" ").include(b))f.push(g)}return f},attrPresence:function(a,b,c,e){a||(a=b.getElementsByTagName("*"));if(a&&e)a=this[e](a);b=[];e=0;
for(var f;f=a[e];e++)Element.hasAttribute(f,c)&&b.push(f);return b},attr:function(a,b,c,e,f,g){a||(a=b.getElementsByTagName("*"));if(a&&g)a=this[g](a);b=Selector.operators[f];f=[];g=0;for(var h;h=a[g];g++){var j=Element.readAttribute(h,c);j!==null&&b(j,e)&&f.push(h)}return f},pseudo:function(a,b,c,e,f){if(a&&f)a=this[f](a);a||(a=e.getElementsByTagName("*"));return Selector.pseudos[b](a,c,e)}},pseudos:{"first-child":function(a){for(var b=0,c=[],e;e=a[b];b++)Selector.handlers.previousElementSibling(e)||
c.push(e);return c},"last-child":function(a){for(var b=0,c=[],e;e=a[b];b++)Selector.handlers.nextElementSibling(e)||c.push(e);return c},"only-child":function(a){for(var b=Selector.handlers,c=0,e=[],f;f=a[c];c++)!b.previousElementSibling(f)&&!b.nextElementSibling(f)&&e.push(f);return e},"nth-child":function(a,b,c){return Selector.pseudos.nth(a,b,c)},"nth-last-child":function(a,b,c){return Selector.pseudos.nth(a,b,c,true)},"nth-of-type":function(a,b,c){return Selector.pseudos.nth(a,b,c,false,true)},
"nth-last-of-type":function(a,b,c){return Selector.pseudos.nth(a,b,c,true,true)},"first-of-type":function(a,b,c){return Selector.pseudos.nth(a,"1",c,false,true)},"last-of-type":function(a,b,c){return Selector.pseudos.nth(a,"1",c,true,true)},"only-of-type":function(a,b,c){var e=Selector.pseudos;return e["last-of-type"](e["first-of-type"](a,b,c),b,c)},getIndices:function(a,b,c){if(a==0)return b>0?[b]:[];return $R(1,c).inject([],function(e,f){0==(f-b)%a&&(f-b)/a>=0&&e.push(f);return e})},nth:function(a,
b,c,e,f){if(a.length==0)return[];if(b=="even")b="2n+0";if(b=="odd")b="2n+1";c=Selector.handlers;var g=[],h=[],j;c.mark(a);for(var n=0;j=a[n];n++)if(!j.parentNode._countedByPrototype){c.index(j.parentNode,e,f);h.push(j.parentNode)}if(b.match(/^\d+$/)){b=Number(b);for(n=0;j=a[n];n++)j.nodeIndex==b&&g.push(j)}else if(j=b.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(j[1]=="-")j[1]=-1;n=j[1]?Number(j[1]):1;j=j[2]?Number(j[2]):0;b=Selector.pseudos.getIndices(n,j,a.length);n=0;for(e=b.length;j=a[n];n++)for(f=0;f<
e;f++)j.nodeIndex==b[f]&&g.push(j)}c.unmark(a);c.unmark(h);return g},empty:function(a){for(var b=0,c=[],e;e=a[b];b++)e.tagName=="!"||e.firstChild||c.push(e);return c},not:function(a,b,c){var e=Selector.handlers;b=(new Selector(b)).findElements(c);e.mark(b);c=0;for(var f=[],g;g=a[c];c++)g._countedByPrototype||f.push(g);e.unmark(b);return f},enabled:function(a){for(var b=0,c=[],e;e=a[b];b++)if(!e.disabled&&(!e.type||e.type!=="hidden"))c.push(e);return c},disabled:function(a){for(var b=0,c=[],e;e=a[b];b++)e.disabled&&
c.push(e);return c},checked:function(a){for(var b=0,c=[],e;e=a[b];b++)e.checked&&c.push(e);return c}},operators:{"=":function(a,b){return a==b},"!=":function(a,b){return a!=b},"^=":function(a,b){return a==b||a&&a.startsWith(b)},"$=":function(a,b){return a==b||a&&a.endsWith(b)},"*=":function(a,b){return a==b||a&&a.include(b)},"~=":function(a,b){return(" "+a+" ").include(" "+b+" ")},"|=":function(a,b){return("-"+(a||"").toUpperCase()+"-").include("-"+(b||"").toUpperCase()+"-")}},split:function(a){var b=
[];a.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(c){b.push(c[1].strip())});return b},matchElements:function(a,b){b=$$(b);var c=Selector.handlers;c.mark(b);for(var e=0,f=[],g;g=a[e];e++)g._countedByPrototype&&f.push(g);c.unmark(b);return f},findElement:function(a,b,c){if(Object.isNumber(b)){c=b;b=false}return Selector.matchElements(a,b||"*")[c||0]},findChildElements:function(a,b){b=Selector.split(b.join(","));for(var c=[],e=Selector.handlers,f=0,g=b.length,h;f<g;f++){h=new Selector(b[f].strip());
e.concat(c,h.findElements(a))}return g>1?e.unique(c):c}});Prototype.Browser.IE&&Object.extend(Selector.handlers,{concat:function(a,b){for(var c=0,e;e=b[c];c++)e.tagName!=="!"&&a.push(e);return a}});function $$(){return Selector.findChildElements(document,$A(arguments))}
var Form={reset:function(a){a=$(a);a.reset();return a},serializeElements:function(a,b){if(typeof b!="object")b={hash:!!b};else if(Object.isUndefined(b.hash))b.hash=true;var c,e,f=false,g=b.submit;a=a.inject({},function(h,j){if(!j.disabled&&j.name){c=j.name;e=$(j).getValue();if(e!=null&&j.type!="file"&&(j.type!="submit"||!f&&g!==false&&(!g||c==g)&&(f=true)))if(c in h){Object.isArray(h[c])||(h[c]=[h[c]]);h[c].push(e)}else h[c]=e}return h});return b.hash?a:Object.toQueryString(a)}};
Form.Methods={serialize:function(a,b){return Form.serializeElements(Form.getElements(a),b)},getElements:function(a){a=$(a).getElementsByTagName("*");for(var b,c=[],e=Form.Element.Serializers,f=0;b=a[f];f++)c.push(b);return c.inject([],function(g,h){e[h.tagName.toLowerCase()]&&g.push(Element.extend(h));return g})},getInputs:function(a,b,c){a=$(a);a=a.getElementsByTagName("input");if(!b&&!c)return $A(a).map(Element.extend);for(var e=0,f=[],g=a.length;e<g;e++){var h=a[e];b&&h.type!=b||c&&h.name!=c||
f.push(Element.extend(h))}return f},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(a){a=$(a).getElements().findAll(function(c){return"hidden"!=c.type&&!c.disabled});var b=a.findAll(function(c){return c.hasAttribute("tabIndex")&&c.tabIndex>=0}).sortBy(function(c){return c.tabIndex}).first();return b?b:a.find(function(c){return/^(?:input|select|textarea)$/i.test(c.tagName)})},
focusFirstElement:function(a){a=$(a);a.findFirstElement().activate();return a},request:function(a,b){a=$(a);b=Object.clone(b||{});var c=b.parameters,e=a.readAttribute("action")||"";if(e.blank())e=window.location.href;b.parameters=a.serialize(true);if(c){if(Object.isString(c))c=c.toQueryParams();Object.extend(b.parameters,c)}if(a.hasAttribute("method")&&!b.method)b.method=a.method;return new Ajax.Request(e,b)}};
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,$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(a,b){if(Object.isUndefined(b))return this[a.type=="select-one"?"selectOne":"selectMany"](a);
else for(var c,e,f=!Object.isArray(b),g=0,h=a.length;g<h;g++){c=a.options[g];e=this.optionValue(c);if(f){if(e==b){c.selected=true;return}}else c.selected=b.include(e)}},selectOne:function(a){var b=a.selectedIndex;return b>=0?this.optionValue(a.options[b]):null},selectMany:function(a){var b,c=a.length;if(!c)return null;var e=0;for(b=[];e<c;e++){var f=a.options[e];f.selected&&b.push(this.optionValue(f))}return b},optionValue:function(a){return Element.extend(a).hasAttribute("value")?a.value:a.text}};
Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,b,c,e){$super(e,c);this.element=$(b);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();this.element.tagName.toLowerCase()=="form"?this.registerFormCallbacks():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(){function a(l){return A(l,0)}function b(l){return A(l,1)}function c(l){return A(l,2)}function e(l){l=J.extend(l);var o=l.target,s=l.type;if((l=l.currentTarget)&&l.tagName)if(s==="load"||s==="error"||s==="click"&&l.tagName.toLowerCase()==="input"&&l.type==="radio")o=l;if(o.nodeType==Node.TEXT_NODE)o=o.parentNode;return Element.extend(o)}function f(l,o){l=J.element(l);if(!o)return l;l=[l].concat(l.ancestors());return Selector.findElement(l,o,0)}function g(l){return{x:h(l),y:j(l)}}function h(l){var o=
document.documentElement,s=document.body||{scrollLeft:0};return l.pageX||l.clientX+(o.scrollLeft||s.scrollLeft)-(o.clientLeft||0)}function j(l){var o=document.documentElement,s=document.body||{scrollTop:0};return l.pageY||l.clientY+(o.scrollTop||s.scrollTop)-(o.clientTop||0)}function n(l){J.extend(l);l.preventDefault();l.stopPropagation();l.stopped=true}function u(l,o,s){var F=Element.retrieve(l,"prototype_event_registry");if(Object.isUndefined(F)){w.push(l);F=Element.retrieve(l,"prototype_event_registry",
$H())}var B=F.get(o);if(Object.isUndefined(B)){B=[];F.set(o,B)}if(B.pluck("handler").include(s))return false;var S;if(o.include(":"))S=function(V){if(Object.isUndefined(V.eventName))return false;if(V.eventName!==o)return false;J.extend(V,l);s.call(l,V)};else if(!r&&(o==="mouseenter"||o==="mouseleave")){if(o==="mouseenter"||o==="mouseleave")S=function(V){J.extend(V,l);for(var U=V.relatedTarget;U&&U!==l;)try{U=U.parentNode}catch(y){U=l}U!==l&&s.call(l,V)}}else S=function(V){J.extend(V,l);s.call(l,V)};
S.handler=s;B.push(S);return S}function E(){for(var l=0,o=w.length;l<o;l++){J.stopObserving(w[l]);w[l]=null}}function t(l,o,s){l=$(l);s=u(l,o,s);if(!s)return l;if(o.include(":"))if(l.addEventListener)l.addEventListener("dataavailable",s,false);else{l.attachEvent("ondataavailable",s);l.attachEvent("onfilterchange",s)}else{o=q(o);l.addEventListener?l.addEventListener(o,s,false):l.attachEvent("on"+o,s)}return l}function K(l,o,s){l=$(l);var F=Element.retrieve(l,"prototype_event_registry");if(Object.isUndefined(F))return l;
if(o&&!s){var B=F.get(o);if(Object.isUndefined(B))return l;B.each(function(U){Element.stopObserving(l,o,U.handler)});return l}else if(!o){F.each(function(U){var y=U.key;U.value.each(function(L){Element.stopObserving(l,y,L.handler)})});return l}if(B=F.get(o)){var S=B.find(function(U){return U.handler===s});if(!S)return l;var V=q(o);if(o.include(":"))if(l.removeEventListener)l.removeEventListener("dataavailable",S,false);else{l.detachEvent("ondataavailable",S);l.detachEvent("onfilterchange",S)}else l.removeEventListener?
l.removeEventListener(V,S,false):l.detachEvent("on"+V,S);F.set(o,B.without(S));return l}}function N(l,o,s,F){l=$(l);if(Object.isUndefined(F))F=true;if(l==document&&document.createEvent&&!l.dispatchEvent)l=document.documentElement;var B;if(document.createEvent){B=document.createEvent("HTMLEvents");B.initEvent("dataavailable",true,true)}else{B=document.createEventObject();B.eventType=F?"ondataavailable":"onfilterchange"}B.eventName=o;B.memo=s||{};document.createEvent?l.dispatchEvent(B):l.fireEvent(B.eventType,
B);return J.extend(B)}var J={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:{}},R=document.documentElement,r="onmouseenter"in R&&"onmouseleave"in R,A;if(Prototype.Browser.IE){var v={0:1,1:4,2:2};A=function(l,o){return l.button===v[o]}}else A=Prototype.Browser.WebKit?function(l,o){switch(o){case 0:return l.which==1&&!l.metaKey;case 1:return l.which==1&&l.metaKey;
default:return false}}:function(l,o){return l.which?l.which===o+1:l.button===o};J.Methods={isLeftClick:a,isMiddleClick:b,isRightClick:c,element:e,findElement:f,pointer:g,pointerX:h,pointerY:j,stop:n};var D=Object.keys(J.Methods).inject({},function(l,o){l[o]=J.Methods[o].methodize();return l});if(Prototype.Browser.IE){var C=function(l){switch(l.type){case "mouseover":l=l.fromElement;break;case "mouseout":l=l.toElement;break;default:return null}return Element.extend(l)};Object.extend(D,{stopPropagation:function(){this.cancelBubble=
true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});J.extend=function(l,o){if(!l)return false;if(l._extendedByPrototype)return l;l._extendedByPrototype=Prototype.emptyFunction;var s=J.pointer(l);Object.extend(l,{target:l.srcElement||o,relatedTarget:C(l),pageX:s.x,pageY:s.y});return Object.extend(l,D)}}else{J.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(J.prototype,D);J.extend=Prototype.K}var w=[];Prototype.Browser.IE&&
window.attachEvent("onunload",E);Prototype.Browser.WebKit&&window.addEventListener("unload",Prototype.emptyFunction,false);var q=Prototype.K;r||(q=function(l){var o={mouseenter:"mouseover",mouseleave:"mouseout"};return l in o?o[l]:l});Object.extend(J,J.Methods);Object.extend(J,{fire:N,observe:t,stopObserving:K});Element.addMethods({fire:N,observe:t,stopObserving:K});Object.extend(document,{fire:N.methodize(),observe:t.methodize(),stopObserving:K.methodize(),loaded:false});if(window.Event)Object.extend(window.Event,
J);else window.Event=J})();
(function(){function a(){if(!document.loaded){e&&window.clearTimeout(e);document.loaded=true;document.fire("dom:loaded")}}function b(){if(document.readyState==="complete"){document.stopObserving("readystatechange",b);a()}}function c(){try{document.documentElement.doScroll("left")}catch(f){e=c.defer();return}a()}var e;if(document.addEventListener)document.addEventListener("DOMContentLoaded",a,false);else{document.observe("readystatechange",b);if(window==top)e=c.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})}},$continue=new Error('"throw $continue" is deprecated, use "return" instead'),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(a,b,c){if(this.includeScrollOffsets)return this.withinIncludingScrolloffsets(a,b,c);this.xcomp=b;this.ycomp=c;this.offset=Element.cumulativeOffset(a);return c>=this.offset[1]&&c<this.offset[1]+a.offsetHeight&&b>=this.offset[0]&&b<this.offset[0]+a.offsetWidth},withinIncludingScrolloffsets:function(a,b,c){var e=Element.cumulativeScrollOffset(a);this.xcomp=b+e[0]-this.deltaX;this.ycomp=c+e[1]-this.deltaY;this.offset=Element.cumulativeOffset(a);
return this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+a.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+a.offsetWidth},overlap:function(a,b){if(!a)return 0;if(a=="vertical")return(this.offset[1]+b.offsetHeight-this.ycomp)/b.offsetHeight;if(a=="horizontal")return(this.offset[0]+b.offsetWidth-this.xcomp)/b.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(a,b,c){c=c||{};return Element.clonePosition(b,a,c)}};
if(!document.getElementsByClassName)document.getElementsByClassName=function(a){function b(c){return c.blank()?null:"[contains(concat(' ', @class, ' '), ' "+c+" ')]"}a.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(c,e){e=e.toString().strip();return(e=/\s/.test(e)?$w(e).map(b).join(""):b(e))?document._getElementsByXPath(".//*"+e,c):[]}:function(c,e){e=e.toString().strip();var f=[],g=/\s/.test(e)?$w(e):null;if(!g&&!e)return f;c=$(c).getElementsByTagName("*");e=" "+e+" ";for(var h=
0,j,n;j=c[h];h++)if(j.className&&(n=" "+j.className+" ")&&(n.include(e)||g&&g.all(function(u){return!u.toString().blank()&&n.include(" "+u+" ")})))f.push(Element.extend(j));return f};return function(c,e){return $(e||document.body).getElementsByClassName(c)}}(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){this.include(a)||this.set($A(this).concat(a).join(" "))},remove:function(a){this.include(a)&&this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);function ActiveUser(a){this.initialize(a)}ActiveUser.UPDATE_FREQUENCY=1200;ActiveUser.COOKIE_NAME="kong_user_data";ActiveUser.SILENCED_TEMPLATE=new Template('You have been silenced for #{until}. Click <a href="/pages/silenced">here</a> to read about silences.');ActiveUser.ADMIN_LOAD_TOOLS_PATH="/admin/load_toolbar";
ActiveUser.prototype={initialize:function(a){this._holodeck=null;this._attributes=$H();this._game_attributes=$H();this._attribute_observers=[];this._on_authenticated_observers=[];this._captured_inline_selectors=[];this._domain=a.domain;this.getAttributesFromCookie();this.isAuthenticated()&&this.createUpdater();this.addRunWhenAuthenticatedObserver(function(b){b.loadAdminToolbar()})},setHolodeck:function(a){this._holodeck=a},createUpdater:function(){var a=this;new PeriodicalExecuter(function(){a.pullUserData()},
ActiveUser.UPDATE_FREQUENCY)},pullUserData:function(){var a=this,b="/accounts/"+this.username()+"/info.json";new Ajax.Request(b,{method:"get",onSuccess:function(c){a.updateAttributes(c.responseJSON)}})},addAttributesObserver:function(a){this._attribute_observers.push(a)},addOnAuthenticatedObserver:function(a){this._on_authenticated_observers.push(a)},addRunWhenAuthenticatedObserver:function(a){this.isAuthenticated()?a(this):this.addOnAuthenticatedObserver(a)},updateAttributes:function(a){var b=a.username&&
a.username!=this._attributes.get("username"),c=this;this._attributes.update(a);this._attribute_observers.each(function(e){e(c)});b&&this.usernameUpdated()},updateGameAttributes:function(a){this._game_attributes.update(a)},getAttributesFromCookie:function(){var a=Cookie.get(ActiveUser.COOKIE_NAME);a&&this.updateAttributes(a.evalJSON())},gameCookieName:function(){if(this._game_id)return"kong_game_"+this._game_id},getGameAttributesFromCookie:function(){var a=Cookie.get(this.gameCookieName());a&&this.updateGameAttributes(a.evalJSON())},
updateUserDataCookie:function(){var a=this.getAttributes();Cookie.set(ActiveUser.COOKIE_NAME,Object.toJSON(a),undefined,"/")},updateGameAttributesCookie:function(){var a=this.getGameAttributes();a&&Cookie.set(this.gameCookieName(),Object.toJSON(a),undefined,this.gameCookiePath())},getAttributes:function(){return this._attributes.toObject()},getGameAttributes:function(){return this._game_attributes.toObject()},username:function(){return this._attributes.get("username")},avatarPath:function(){var a=
this._attributes.get("avatar_url");if(!a)return"";if((a=a.match(/http:\/\/[a-z\.:0-9]*(.*)$/))&&a.length==2)return a[1]},id:function(){return this._attributes.get("id")},solvedCaptcha:function(){return this._attributes.get("solved_captcha")},chatUsername:function(){return this._attributes.get("chat_username")||this._attributes.get("username")},chatPassword:function(){return this._attributes.get("chat_password")},gameAuthToken:function(){return this._game_attributes.get("game_auth_token")},userVars:function(){return this._game_attributes.get("user_vars")},
userVarsSig:function(){return this._game_attributes.get("user_vars_sig")},age:function(){return this._attributes.get("age")},senderNameOrEmail:function(){return this._attributes.get("sender_name_or_email")},boshEnabled:function(){return this._game_attributes.get("bosh_enabled")},compressionEnabled:function(){return this._game_attributes.get("compression_enabled")},usernameUpdated:function(){var a=this;if(this.isAuthenticated()){this.populateUserSpecificLinks.bind(this).runWhenDomLoaded();this.createUpdater();
this._on_authenticated_observers.each(function(b){b(a)})}},isAuthenticated:function(){return!!(this.username()&&!/^Guest/.match(this.username()))},isAdmin:function(){return this.isAuthenticated()&&this._attributes.get("admin")},isModerator:function(){return this.isAuthenticated()&&this._attributes.get("moderator")},isCurator:function(){return this.isAuthenticated()&&this._attributes.get("curator")},isForumModerator:function(){return this.isAuthenticated()&&this._attributes.get("forum_moderator")},
getsAdminBar:function(){return this.isModerator()||this.isCurator()||this.isForumModerator()},silencedUntil:function(){var a=this._attributes.get("silenced_until");return a?new Date(a):undefined},isSilenced:function(){var a=this.silencedUntil();return Boolean(a&&a>new Date)},silencedMessage:function(){return ActiveUser.SILENCED_TEMPLATE.evaluate({until:TimeInWordsHelper.distanceInWords(new Date,this.silencedUntil())})},populateUserSpecificLinks:function(a){a||(a=$(document.body));var b=this.username();
(a.select?a.select("a.user_specific").concat($$("#full-nav-wrap a")):[]).each(function(c){c.href=c.href.replace("Guest",b).replace("KongregateHolodeckTemplateUsername",b)})},addCapturedSelector:function(a){this._captured_inline_selectors.push(a);var b=this;$$(a).each(function(c){c.getElementsBySelector("a").each(function(e){var f=e.onclick;if(f)e.onclick=b.capturedSelectorWrapper.bindAsEventListener(b,f.bind(e))});c.addClassName("lbOn")})},capturedSelectorWrapper:function(a,b){if(this.isAuthenticated()){if("function"==
typeof b)return b(a)}else{this.activateInlineLogin();"function"==typeof b&&this.saveCapturedFunction(b.curry(a));Event.stop(a);return false}},activateInlineLogin:function(a){a||(a={});a=$H(a);var b="/accounts/new/behind_login";if(this._holodeck){this._holodeck.recordAnalyticsEvent("Lightbox","Signin");a.set("game_id",this._game_id)}if(a.size()>0)b=b+"?"+a.toQueryString();lightbox.prototype.initializeKongregateLightboxFromAjax(b,{done_class_name:"lightbox_login"})},activatePasswordRecovery:function(){if(this.isGamePage())this.activateInlineLogin({recover:true});
else document.location="/sessions/new?recover=true"},debugLevel:function(){if(!this._debug_level)this._debug_level=this.documentLocationSearchQuery().debug_level;return this._debug_level},documentLocationSearchQuery:function(){if(!this._document_location_search_query)this._document_location_search_query=document.location.search.parseQuery();return this._document_location_search_query},seenSharedContentWelcome:function(){return!!this._game_attributes.get("seen_shared_content_welcome")},setSeenSharedContentWelcome:function(a){this._game_attributes.set("seen_shared_content_welcome",
a);this.updateGameAttributesCookie()},saveCapturedFunction:function(a){this._capturedFunction=a},runCapturedFunction:function(){"function"==typeof this._capturedFunction&&this._capturedFunction.defer();this._capturedFunction=null},gameId:function(){return this._game_id},setGame:function(a,b){this._game_id=a;this._game_resource_path=b;this.getGameAttributesFromCookie()},gamePath:function(){if(!this._game_path){var a=document.location.pathname.match(/(.*)\/$/);this._game_path=a?a[1]:document.location.pathname}return this._game_path},
gameResourcePath:function(){return this._game_resource_path},gameCookiePath:function(){if(!this._game_cookie_path)this._game_cookie_path=this.gamePath().match(/(.*)\/.*/)[1];return this._game_cookie_path},referrerUrl:function(a){if(!this.isAuthenticated())return a;var b=a.match(/\?/)?"&":"?";return a+b+"referrer="+encodeURIComponent(this.username())},formAuthenticityToken:function(){return this._attributes.get("form_authenticity_token")},accountUrl:function(){return"/accounts/"+this.username()},isGamePage:function(){return!!this._holodeck},
domain:function(){return this._domain},isMobileUserAgent:function(){return this._attributes.get("mobile_user_agent")},loadAdminToolbar:function(){this.getsAdminBar()&&new Ajax.Updater("admin_links_placeholder",ActiveUser.ADMIN_LOAD_TOOLS_PATH,{method:"get"})}};String.prototype.parseColor=function(a){var b="#";if(this.slice(0,4)=="rgb("){var c=this.slice(4,this.length-1).split(","),e=0;do b+=parseInt(c[e]).toColorPart();while(++e<3)}else if(this.slice(0,1)=="#"){if(this.length==4)for(e=1;e<4;e++)b+=(this.charAt(e)+this.charAt(e)).toLowerCase();if(this.length==7)b=this.toLowerCase()}return b.length==7?b:a||this};
Element.collectTextNodes=function(a){return $A($(a).childNodes).collect(function(b){return b.nodeType==3?b.nodeValue:b.hasChildNodes()?Element.collectTextNodes(b):""}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(a,b){return $A($(a).childNodes).collect(function(c){return c.nodeType==3?c.nodeValue:c.hasChildNodes()&&!Element.hasClassName(c,b)?Element.collectTextNodesIgnoreClass(c,b):""}).flatten().join("")};
Element.setContentZoom=function(a,b){a=$(a);a.setStyle({fontSize:b/100+"em"});Prototype.Browser.WebKit&&window.scrollBy(0,0);return a};Element.getInlineOpacity=function(a){return $(a).style.opacity||""};Element.forceRerendering=function(a){try{a=$(a);var b=document.createTextNode(" ");a.appendChild(b);a.removeChild(b)}catch(c){}};
var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},Transitions:{linear:Prototype.K,sinoidal:function(a){return-Math.cos(a*Math.PI)/2+0.5},reverse:function(a){return 1-a},flicker:function(a){a=-Math.cos(a*Math.PI)/4+0.75+Math.random()/4;return a>1?1:a},wobble:function(a){return-Math.cos(a*Math.PI*9*a)/2+0.5},pulse:function(a,b){return-Math.cos(a*((b||5)-0.5)*2*Math.PI)/2+0.5},spring:function(a){return 1-
Math.cos(a*4.5*Math.PI)*Math.exp(-a*6)},none:function(){return 0},full:function(){return 1}},DefaultOptions:{duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(a){var b="position:relative";if(Prototype.Browser.IE)b+=";zoom:1";a=$(a);$A(a.childNodes).each(function(c){if(c.nodeType==3){c.nodeValue.toArray().each(function(e){a.insertBefore((new Element("span",{style:b})).update(e==" "?String.fromCharCode(160):e),c)});Element.remove(c)}})},multiple:function(a,b,c){a=
(typeof a=="object"||Object.isFunction(a))&&a.length?a:$(a).childNodes;var e=Object.extend({speed:0.1,delay:0},c||{}),f=e.delay;$A(a).each(function(g,h){new b(g,Object.extend(e,{delay:h*e.speed+f}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(a,b,c){a=$(a);b=(b||"appear").toLowerCase();c=Object.extend({queue:{position:"end",scope:a.id||"global",limit:1}},c||{});Effect[a.visible()?Effect.PAIRS[b][1]:Effect.PAIRS[b][0]](a,c)}};
Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;
Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null},_each:function(a){this.effects._each(a)},add:function(a){var b=(new Date).getTime();switch(Object.isString(a.options.queue)?a.options.queue:a.options.queue.position){case "front":this.effects.findAll(function(c){return c.state=="idle"}).each(function(c){c.startOn+=a.finishOn;c.finishOn+=a.finishOn});break;case "with-last":b=this.effects.pluck("startOn").max()||b;break;case "end":b=this.effects.pluck("finishOn").max()||
b;break}a.startOn+=b;a.finishOn+=b;if(!a.options.queue.limit||this.effects.length<a.options.queue.limit)this.effects.push(a);if(!this.interval)this.interval=setInterval(this.loop.bind(this),15)},remove:function(a){this.effects=this.effects.reject(function(b){return b==a});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){for(var a=(new Date).getTime(),b=0,c=this.effects.length;b<c;b++)this.effects[b]&&this.effects[b].loop(a)}});
Effect.Queues={instances:$H(),get:function(a){if(!Object.isString(a))return a;return this.instances.get(a)||this.instances.set(a,new Effect.ScopedQueue)}};Effect.Queue=Effect.Queues.get("global");
Effect.Base=Class.create({position:null,start:function(a){if(a&&a.transition===false)a.transition=Effect.Transitions.linear;this.options=Object.extend(Object.extend({},Effect.DefaultOptions),a||{});this.currentFrame=0;this.state="idle";this.startOn=this.options.delay*1E3;this.finishOn=this.startOn+this.options.duration*1E3;this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;this.render=function(){function b(c,
e){c.options[e+"Internal"]&&c.options[e+"Internal"](c);c.options[e]&&c.options[e](c)}return function(c){if(this.state==="idle"){this.state="running";b(this,"beforeSetup");this.setup&&this.setup();b(this,"afterSetup")}if(this.state==="running"){this.position=c=this.options.transition(c)*this.fromToDelta+this.options.from;b(this,"beforeUpdate");this.update&&this.update(c);b(this,"afterUpdate")}}}();this.event("beforeStart");this.options.sync||Effect.Queues.get(Object.isString(this.options.queue)?"global":
this.options.queue.scope).add(this)},loop:function(a){if(a>=this.startOn)if(a>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");this.finish&&this.finish();this.event("afterFinish")}else{a=(a-this.startOn)/this.totalTime;var b=(a*this.totalFrames).round();if(b>this.currentFrame){this.render(a);this.currentFrame=b}}},cancel:function(){this.options.sync||Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this);this.state="finished"},
event:function(a){this.options[a+"Internal"]&&this.options[a+"Internal"](this);this.options[a]&&this.options[a](this)},inspect:function(){var a=$H();for(property in this)Object.isFunction(this[property])||a.set(property,this[property]);return"#<Effect:"+a.inspect()+",options:"+$H(this.options).inspect()+">"}});
Effect.Parallel=Class.create(Effect.Base,{initialize:function(a,b){this.effects=a||[];this.start(b)},update:function(a){this.effects.invoke("render",a)},finish:function(a){this.effects.each(function(b){b.render(1);b.cancel();b.event("beforeFinish");b.finish&&b.finish(a);b.event("afterFinish")})}});
Effect.Tween=Class.create(Effect.Base,{initialize:function(a,b,c){a=Object.isString(a)?$(a):a;var e=$A(arguments),f=e.last();e=e.length==5?e[3]:null;this.method=Object.isFunction(f)?f.bind(a):Object.isFunction(a[f])?a[f].bind(a):function(g){a[f]=g};this.start(Object.extend({from:b,to:c},e||{}))},update:function(a){this.method(a)}});Effect.Event=Class.create(Effect.Base,{initialize:function(a){this.start(Object.extend({duration:0},a||{}))},update:Prototype.emptyFunction});
Effect.Opacity=Class.create(Effect.Base,{initialize:function(a,b){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;Prototype.Browser.IE&&!this.element.currentStyle.hasLayout&&this.element.setStyle({zoom:1});this.start(Object.extend({from:this.element.getOpacity()||0,to:1},b||{}))},update:function(a){this.element.setOpacity(a)}});
Effect.Move=Class.create(Effect.Base,{initialize:function(a,b){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;this.start(Object.extend({x:0,y:0,mode:"relative"},b||{}))},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle("left")||"0");this.originalTop=parseFloat(this.element.getStyle("top")||"0");if(this.options.mode=="absolute"){this.options.x-=this.originalLeft;this.options.y-=this.originalTop}},update:function(a){this.element.setStyle({left:(this.options.x*
a+this.originalLeft).round()+"px",top:(this.options.y*a+this.originalTop).round()+"px"})}});Effect.MoveBy=function(a,b,c,e){return new Effect.Move(a,Object.extend({x:c,y:b},e||{}))};
Effect.Scale=Class.create(Effect.Base,{initialize:function(a,b,c){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;this.start(Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:b},c||{}))},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(b){this.originalStyle[b]=
this.element.style[b]}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var a=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(b){if(a.indexOf(b)>0){this.fontSize=parseFloat(a);this.fontSizeType=b}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=="box")this.dims=[this.element.offsetHeight,this.element.offsetWidth];if(/^content/.test(this.options.scaleMode))this.dims=
[this.element.scrollHeight,this.element.scrollWidth];if(!this.dims)this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]},update:function(a){a=this.options.scaleFrom/100+this.factor*a;this.options.scaleContent&&this.fontSize&&this.element.setStyle({fontSize:this.fontSize*a+this.fontSizeType});this.setDimensions(this.dims[0]*a,this.dims[1]*a)},finish:function(){this.restoreAfterFinish&&this.element.setStyle(this.originalStyle)},setDimensions:function(a,b){var c={};
if(this.options.scaleX)c.width=b.round()+"px";if(this.options.scaleY)c.height=a.round()+"px";if(this.options.scaleFromCenter){a=(a-this.dims[0])/2;b=(b-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY)c.top=this.originalTop-a+"px";if(this.options.scaleX)c.left=this.originalLeft-b+"px"}else{if(this.options.scaleY)c.top=-a+"px";if(this.options.scaleX)c.left=-b+"px"}}this.element.setStyle(c)}});
Effect.Highlight=Class.create(Effect.Base,{initialize:function(a,b){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;this.start(Object.extend({startcolor:"#ffff99"},b||{}))},setup:function(){if(this.element.getStyle("display")=="none")this.cancel();else{this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle("background-image");this.element.setStyle({backgroundImage:"none"})}if(!this.options.endcolor)this.options.endcolor=
this.element.getStyle("background-color").parseColor("#ffffff");if(!this.options.restorecolor)this.options.restorecolor=this.element.getStyle("background-color");this._base=$R(0,2).map(function(a){return parseInt(this.options.startcolor.slice(a*2+1,a*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(a){return parseInt(this.options.endcolor.slice(a*2+1,a*2+3),16)-this._base[a]}.bind(this))}},update:function(a){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(b,c,e){return b+
(this._base[e]+this._delta[e]*a).round().toColorPart()}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(a,b){b=b||{};var c=document.viewport.getScrollOffsets();a=$(a).cumulativeOffset();if(b.offset)a[1]+=b.offset;return new Effect.Tween(null,c.top,a[1],b,function(e){scrollTo(c.left,e.round())})};
Effect.Fade=function(a,b){a=$(a);var c=a.getInlineOpacity();b=Object.extend({from:a.getOpacity()||1,to:0,afterFinishInternal:function(e){e.options.to==0&&e.element.hide().setStyle({opacity:c})}},b||{});return new Effect.Opacity(a,b)};
Effect.Appear=function(a,b){a=$(a);b=Object.extend({from:a.getStyle("display")=="none"?0:a.getOpacity()||0,to:1,afterFinishInternal:function(c){c.element.forceRerendering()},beforeSetup:function(c){c.element.setOpacity(c.options.from).show()}},b||{});return new Effect.Opacity(a,b)};
Effect.Puff=function(a,b){a=$(a);var c={opacity:a.getInlineOpacity(),position:a.getStyle("position"),top:a.style.top,left:a.style.left,width:a.style.width,height:a.style.height};return new Effect.Parallel([new Effect.Scale(a,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(a,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(e){Position.absolutize(e.effects[0].element)},afterFinishInternal:function(e){e.effects[0].element.hide().setStyle(c)}},
b||{}))};Effect.BlindUp=function(a,b){a=$(a);a.makeClipping();return new Effect.Scale(a,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(c){c.element.hide().undoClipping()}},b||{}))};
Effect.BlindDown=function(a,b){a=$(a);var c=a.getDimensions();return new Effect.Scale(a,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:c.height,originalWidth:c.width},restoreAfterFinish:true,afterSetup:function(e){e.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(e){e.element.undoClipping()}},b||{}))};
Effect.SwitchOff=function(a,b){a=$(a);var c=a.getInlineOpacity();return new Effect.Appear(a,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(e){new Effect.Scale(e.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(f){f.element.makePositioned().makeClipping()},afterFinishInternal:function(f){f.element.hide().undoClipping().undoPositioned().setStyle({opacity:c})}})}},b||{}))};
Effect.DropOut=function(a,b){a=$(a);var c={top:a.getStyle("top"),left:a.getStyle("left"),opacity:a.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(a,{x:0,y:100,sync:true}),new Effect.Opacity(a,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(e){e.effects[0].element.makePositioned()},afterFinishInternal:function(e){e.effects[0].element.hide().undoPositioned().setStyle(c)}},b||{}))};
Effect.Shake=function(a,b){a=$(a);b=Object.extend({distance:20,duration:0.5},b||{});var c=parseFloat(b.distance),e=parseFloat(b.duration)/10,f={top:a.getStyle("top"),left:a.getStyle("left")};return new Effect.Move(a,{x:c,y:0,duration:e,afterFinishInternal:function(g){new Effect.Move(g.element,{x:-c*2,y:0,duration:e*2,afterFinishInternal:function(h){new Effect.Move(h.element,{x:c*2,y:0,duration:e*2,afterFinishInternal:function(j){new Effect.Move(j.element,{x:-c*2,y:0,duration:e*2,afterFinishInternal:function(n){new Effect.Move(n.element,
{x:c*2,y:0,duration:e*2,afterFinishInternal:function(u){new Effect.Move(u.element,{x:-c,y:0,duration:e,afterFinishInternal:function(E){E.element.undoPositioned().setStyle(f)}})}})}})}})}})}})};
Effect.SlideDown=function(a,b){a=$(a).cleanWhitespace();var c=a.down().getStyle("bottom"),e=a.getDimensions();return new Effect.Scale(a,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:e.height,originalWidth:e.width},restoreAfterFinish:true,afterSetup:function(f){f.element.makePositioned();f.element.down().makePositioned();window.opera&&f.element.setStyle({top:""});f.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(f){f.element.down().setStyle({bottom:f.dims[0]-
f.element.clientHeight+"px"})},afterFinishInternal:function(f){f.element.undoClipping().undoPositioned();f.element.down().undoPositioned().setStyle({bottom:c})}},b||{}))};
Effect.SlideUp=function(a,b){a=$(a).cleanWhitespace();var c=a.down().getStyle("bottom"),e=a.getDimensions();return new Effect.Scale(a,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:e.height,originalWidth:e.width},restoreAfterFinish:true,afterSetup:function(f){f.element.makePositioned();f.element.down().makePositioned();window.opera&&f.element.setStyle({top:""});f.element.makeClipping().show()},afterUpdateInternal:function(f){f.element.down().setStyle({bottom:f.dims[0]-
f.element.clientHeight+"px"})},afterFinishInternal:function(f){f.element.hide().undoClipping().undoPositioned();f.element.down().undoPositioned().setStyle({bottom:c})}},b||{}))};Effect.Squish=function(a){return new Effect.Scale(a,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(b){b.element.makeClipping()},afterFinishInternal:function(b){b.element.hide().undoClipping()}})};
Effect.Grow=function(a,b){a=$(a);var c=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},b||{}),e={top:a.style.top,left:a.style.left,height:a.style.height,width:a.style.width,opacity:a.getInlineOpacity()},f=a.getDimensions(),g,h,j,n;switch(c.direction){case "top-left":g=h=j=n=0;break;case "top-right":g=f.width;h=n=0;j=-f.width;break;case "bottom-left":g=j=0;h=f.height;n=-f.height;break;
case "bottom-right":g=f.width;h=f.height;j=-f.width;n=-f.height;break;case "center":g=f.width/2;h=f.height/2;j=-f.width/2;n=-f.height/2;break}return new Effect.Move(a,{x:g,y:h,duration:0.01,beforeSetup:function(u){u.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(u){new Effect.Parallel([new Effect.Opacity(u.element,{sync:true,to:1,from:0,transition:c.opacityTransition}),new Effect.Move(u.element,{x:j,y:n,sync:true,transition:c.moveTransition}),new Effect.Scale(u.element,
100,{scaleMode:{originalHeight:f.height,originalWidth:f.width},sync:true,scaleFrom:window.opera?1:0,transition:c.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(E){E.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(E){E.effects[0].element.undoClipping().undoPositioned().setStyle(e)}},c))}})};
Effect.Shrink=function(a,b){a=$(a);b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},b||{});var c={top:a.style.top,left:a.style.left,height:a.style.height,width:a.style.width,opacity:a.getInlineOpacity()},e=a.getDimensions(),f,g;switch(b.direction){case "top-left":f=g=0;break;case "top-right":f=e.width;g=0;break;case "bottom-left":f=0;g=e.height;break;case "bottom-right":f=e.width;g=
e.height;break;case "center":f=e.width/2;g=e.height/2;break}return new Effect.Parallel([new Effect.Opacity(a,{sync:true,to:0,from:1,transition:b.opacityTransition}),new Effect.Scale(a,window.opera?1:0,{sync:true,transition:b.scaleTransition,restoreAfterFinish:true}),new Effect.Move(a,{x:f,y:g,sync:true,transition:b.moveTransition})],Object.extend({beforeStartInternal:function(h){h.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(h){h.effects[0].element.hide().undoClipping().undoPositioned().setStyle(c)}},
b))};Effect.Pulsate=function(a,b){a=$(a);var c=b||{},e=a.getInlineOpacity(),f=c.transition||Effect.Transitions.linear;return new Effect.Opacity(a,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(g){g.element.setStyle({opacity:e})}},c),{transition:function(g){return 1-f(-Math.cos(g*(c.pulses||5)*2*Math.PI)/2+0.5)}}))};
Effect.Fold=function(a,b){a=$(a);var c={top:a.style.top,left:a.style.left,width:a.style.width,height:a.style.height};a.makeClipping();return new Effect.Scale(a,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(){new Effect.Scale(a,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(e){e.element.hide().undoClipping().setStyle(c)}})}},b||{}))};
Effect.Morph=Class.create(Effect.Base,{initialize:function(a,b){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;a=Object.extend({style:{}},b||{});if(Object.isString(a.style))if(a.style.include(":"))this.style=a.style.parseStyle();else{this.element.addClassName(a.style);this.style=$H(this.element.getStyles());this.element.removeClassName(a.style);var c=this.element.getStyles();this.style=this.style.reject(function(e){return e.value==c[e.key]});a.afterFinishInternal=function(e){e.element.addClassName(e.options.style);
e.transforms.each(function(f){e.element.style[f.style]=""})}}else this.style=$H(a.style);this.start(a)},setup:function(){function a(b){if(!b||["rgba(0, 0, 0, 0)","transparent"].include(b))b="#ffffff";b=b.parseColor();return $R(0,2).map(function(c){return parseInt(b.slice(c*2+1,c*2+3),16)})}this.transforms=this.style.map(function(b){var c=b[0];b=b[1];var e=null;if(b.parseColor("#zzzzzz")!="#zzzzzz"){b=b.parseColor();e="color"}else if(c=="opacity"){b=parseFloat(b);Prototype.Browser.IE&&!this.element.currentStyle.hasLayout&&
this.element.setStyle({zoom:1})}else if(Element.CSS_LENGTH.test(b)){e=b.match(/^([\+\-]?[0-9\.]+)(.*)$/);b=parseFloat(e[1]);e=e.length==3?e[2]:null}var f=this.element.getStyle(c);return{style:c.camelize(),originalValue:e=="color"?a(f):parseFloat(f||0),targetValue:e=="color"?a(b):b,unit:e}}.bind(this)).reject(function(b){return b.originalValue==b.targetValue||b.unit!="color"&&(isNaN(b.originalValue)||isNaN(b.targetValue))})},update:function(a){for(var b={},c,e=this.transforms.length;e--;)b[(c=this.transforms[e]).style]=
c.unit=="color"?"#"+Math.round(c.originalValue[0]+(c.targetValue[0]-c.originalValue[0])*a).toColorPart()+Math.round(c.originalValue[1]+(c.targetValue[1]-c.originalValue[1])*a).toColorPart()+Math.round(c.originalValue[2]+(c.targetValue[2]-c.originalValue[2])*a).toColorPart():(c.originalValue+(c.targetValue-c.originalValue)*a).toFixed(3)+(c.unit===null?"":c.unit);this.element.setStyle(b,true)}});
Effect.Transform=Class.create({initialize:function(a,b){this.tracks=[];this.options=b||{};this.addTracks(a)},addTracks:function(a){a.each(function(b){b=$H(b);var c=b.values().first();this.tracks.push($H({ids:b.keys().first(),effect:Effect.Morph,options:{style:c}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(a){var b=a.get("ids"),c=a.get("effect"),e=a.get("options");return[$(b)||$$(b)].flatten().map(function(f){return new c(f,Object.extend({sync:true},
e))})}).flatten(),this.options)}});Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex");
Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement("div");
String.prototype.parseStyle=function(){var a,b=$H();if(Prototype.Browser.WebKit)a=(new Element("div",{style:this})).style;else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';a=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(c){a[c]&&b.set(c,a[c])});Prototype.Browser.IE&&this.include("opacity")&&b.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);return b};
Element.getStyles=document.defaultView&&document.defaultView.getComputedStyle?function(a){var b=document.defaultView.getComputedStyle($(a),null);return Element.CSS_PROPERTIES.inject({},function(c,e){c[e]=b[e];return c})}:function(a){a=$(a);var b=a.currentStyle,c;c=Element.CSS_PROPERTIES.inject({},function(e,f){e[f]=b[f];return e});if(!c.opacity)c.opacity=a.getOpacity();return c};
Effect.Methods={morph:function(a,b,c){a=$(a);new Effect.Morph(a,Object.extend({style:b},c||{}));return a},visualEffect:function(a,b,c){a=$(a);b=b.dasherize().camelize();b=b.charAt(0).toUpperCase()+b.substring(1);new Effect[b](a,c);return a},highlight:function(a,b){a=$(a);new Effect.Highlight(a,b);return a}};
$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(a){Effect.Methods[a]=function(b,c){b=$(b);Effect[a.charAt(0).toUpperCase()+a.substring(1)](b,c);return b}});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(a){Effect.Methods[a]=Element[a]});Element.addMethods(Effect.Methods);if(typeof Effect=="undefined")throw"controls.js requires including script.aculo.us' effects.js library";var Autocompleter={};
Autocompleter.Base=Class.create({baseInitialize:function(a,b,c){this.element=a=$(a);this.update=$(b);this.active=this.changed=this.hasFocus=false;this.entryCount=this.index=0;this.oldElementValue=this.element.value;if(this.setOptions)this.setOptions(c);else this.options=c||{};this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=
this.options.onShow||function(e,f){if(!f.style.position||f.style.position=="absolute"){f.style.position="absolute";Position.clone(e,f,{setHeight:false,offsetTop:e.offsetHeight})}Effect.Appear(f,{duration:0.15})};this.options.onHide=this.options.onHide||function(e,f){new Effect.Fade(f,{duration:0.15})};if(typeof this.options.tokens=="string")this.options.tokens=new Array(this.options.tokens);this.options.tokens.include("\n")||this.options.tokens.push("\n");this.observer=null;this.element.setAttribute("autocomplete",
"off");Element.hide(this.update);Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));Event.observe(this.element,"keydown",this.onKeyPress.bindAsEventListener(this))},show:function(){Element.getStyle(this.update,"display")=="none"&&this.options.onShow(this.element,this.update);if(!this.iefix&&Prototype.Browser.IE&&Element.getStyle(this.update,"position")=="absolute"){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" src="javascript:false;" frameborder="0" scrolling="no"></iframe>');
this.iefix=$(this.update.id+"_iefix")}this.iefix&&setTimeout(this.fixIEOverlapping.bind(this),50)},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:!this.update.style.height});this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix)},hide:function(){this.stopIndicator();Element.getStyle(this.update,"display")!="none"&&this.options.onHide(this.element,this.update);this.iefix&&Element.hide(this.iefix)},startIndicator:function(){this.options.indicator&&Element.show(this.options.indicator)},
stopIndicator:function(){this.options.indicator&&Element.hide(this.options.indicator)},onKeyPress:function(a){if(this.active)switch(a.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(a);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(a);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();Event.stop(a);return;case Event.KEY_DOWN:this.markNext();this.render();Event.stop(a);return}else if(a.keyCode==Event.KEY_TAB||
a.keyCode==Event.KEY_RETURN||Prototype.Browser.WebKit>0&&a.keyCode==0)return;this.hasFocus=this.changed=true;this.observer&&clearTimeout(this.observer);this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1E3)},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices()},onHover:function(a){var b=Event.findElement(a,"LI");if(this.index!=b.autocompleteIndex){this.index=b.autocompleteIndex;this.render()}Event.stop(a)},onClick:function(a){this.index=
Event.findElement(a,"LI").autocompleteIndex;this.selectEntry();this.hide()},onBlur:function(){setTimeout(this.hide.bind(this),250);this.active=this.hasFocus=false},render:function(){if(this.entryCount>0){for(var a=0;a<this.entryCount;a++)this.index==a?Element.addClassName(this.getEntry(a),"selected"):Element.removeClassName(this.getEntry(a),"selected");if(this.hasFocus){this.show();this.active=true}}else{this.active=false;this.hide()}},markPrevious:function(){if(this.index>0)this.index--;else this.index=
this.entryCount-1;this.getEntry(this.index).scrollIntoView(true)},markNext:function(){if(this.index<this.entryCount-1)this.index++;else this.index=0;this.getEntry(this.index).scrollIntoView(false)},getEntry:function(a){return this.update.firstChild.childNodes[a]},getCurrentEntry:function(){return this.getEntry(this.index)},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry())},updateElement:function(a){if(this.options.updateElement)this.options.updateElement(a);else{var b=
"";if(this.options.select){var c=$(a).select("."+this.options.select)||[];if(c.length>0)b=Element.collectTextNodes(c[0],this.options.select)}else b=Element.collectTextNodesIgnoreClass(a,"informal");c=this.getTokenBounds();if(c[0]!=-1){var e=this.element.value.substr(0,c[0]),f=this.element.value.substr(c[0]).match(/^\s+/);if(f)e+=f[0];this.element.value=e+b+this.element.value.substr(c[1])}else this.element.value=b;this.oldElementValue=this.element.value;this.element.focus();this.options.afterUpdateElement&&
this.options.afterUpdateElement(this.element,a)}},updateChoices:function(a){if(!this.changed&&this.hasFocus){this.update.innerHTML=a;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(a=0;a<this.entryCount;a++){var b=this.getEntry(a);b.autocompleteIndex=a;this.addObservers(b)}}else this.entryCount=0;this.stopIndicator();this.index=0;if(this.entryCount==1&&
this.options.autoSelect){this.selectEntry();this.hide()}else this.render()}},addObservers:function(a){Event.observe(a,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(a,"click",this.onClick.bindAsEventListener(this))},onObserverEvent:function(){this.changed=false;this.tokenBounds=null;if(this.getToken().length>=this.options.minChars)this.getUpdatedChoices();else{this.active=false;this.hide()}this.oldElementValue=this.element.value},getToken:function(){var a=this.getTokenBounds();
return this.element.value.substring(a[0],a[1]).strip()},getTokenBounds:function(){if(null!=this.tokenBounds)return this.tokenBounds;var a=this.element.value;if(a.strip().empty())return[-1,0];for(var b=arguments.callee.getFirstDifferencePos(a,this.oldElementValue),c=b==this.oldElementValue.length?1:0,e=-1,f=a.length,g,h=0,j=this.options.tokens.length;h<j;++h){g=a.lastIndexOf(this.options.tokens[h],b+c-1);if(g>e)e=g;g=a.indexOf(this.options.tokens[h],b+c);if(-1!=g&&g<f)f=g}return this.tokenBounds=[e+
1,f]}});Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(a,b){for(var c=Math.min(a.length,b.length),e=0;e<c;++e)if(a[e]!=b[e])return e;return c};
Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(a,b,c,e){this.baseInitialize(a,b,e);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=c},getUpdatedChoices:function(){this.startIndicator();var a=encodeURIComponent(this.options.paramName)+"="+encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,a):a;if(this.options.defaultParams)this.options.parameters+=
"&"+this.options.defaultParams;new Ajax.Request(this.url,this.options)},onComplete:function(a){this.updateChoices(a.responseText)}});
Autocompleter.Local=Class.create(Autocompleter.Base,{initialize:function(a,b,c,e){this.baseInitialize(a,b,e);this.options.array=c},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this))},setOptions:function(a){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(b){for(var c=[],e=[],f=b.getToken(),g=0;g<b.options.array.length&&c.length<b.options.choices;g++)for(var h=b.options.array[g],j=b.options.ignoreCase?
h.toLowerCase().indexOf(f.toLowerCase()):h.indexOf(f);j!=-1;){if(j==0&&h.length!=f.length){c.push("<li><strong>"+h.substr(0,f.length)+"</strong>"+h.substr(f.length)+"</li>");break}else if(f.length>=b.options.partialChars&&b.options.partialSearch&&j!=-1)if(b.options.fullSearch||/\s/.test(h.substr(j-1,1))){e.push("<li>"+h.substr(0,j)+"<strong>"+h.substr(j,f.length)+"</strong>"+h.substr(j+f.length)+"</li>");break}j=b.options.ignoreCase?h.toLowerCase().indexOf(f.toLowerCase(),j+1):h.indexOf(f,j+1)}if(e.length)c=
c.concat(e.slice(0,b.options.choices-c.length));return"<ul>"+c.join("")+"</ul>"}},a||{})}});Field.scrollFreeActivate=function(a){setTimeout(function(){Field.activate(a)},1)};
Ajax.InPlaceEditor=Class.create({initialize:function(a,b,c){this.url=b;this.element=a=$(a);this.prepareOptions();this._controls={};arguments.callee.dealWithDeprecatedOptions(c);Object.extend(this.options,c||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+"-inplaceeditor";if($(this.options.formId))this.options.formId=""}if(this.options.externalControl)this.options.externalControl=$(this.options.externalControl);if(!this.options.externalControl)this.options.externalControlOnly=
false;this._originalBackground=this.element.getStyle("background-color")||"transparent";this.element.title=this.options.clickToEditText;this._boundCancelHandler=this.handleFormCancellation.bind(this);this._boundComplete=(this.options.onComplete||Prototype.emptyFunction).bind(this);this._boundFailureHandler=this.handleAJAXFailure.bind(this);this._boundSubmitHandler=this.handleFormSubmission.bind(this);this._boundWrapperHandler=this.wrapUp.bind(this);this.registerListeners()},checkForEscapeOrReturn:function(a){if(!(!this._editing||
a.ctrlKey||a.altKey||a.shiftKey))if(Event.KEY_ESC==a.keyCode)this.handleFormCancellation(a);else Event.KEY_RETURN==a.keyCode&&this.handleFormSubmission(a)},createControl:function(a,b,c){var e=this.options[a+"Control"];b=this.options[a+"Text"];if("button"==e){c=document.createElement("input");c.type="submit";c.value=b;c.className="editor_"+a+"_button";if("cancel"==a)c.onclick=this._boundCancelHandler;this._form.appendChild(c);this._controls[a]=c}else if("link"==e){e=document.createElement("a");e.href=
"#";e.appendChild(document.createTextNode(b));e.onclick="cancel"==a?this._boundCancelHandler:this._boundSubmitHandler;e.className="editor_"+a+"_link";if(c)e.className+=" "+c;this._form.appendChild(e);this._controls[a]=e}},createEditField:function(){var a=this.options.loadTextURL?this.options.loadingText:this.getText(),b;if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){b=document.createElement("input");b.type="text";var c=this.options.size||this.options.cols||0;if(0<c)b.size=c}else{b=document.createElement("textarea");
b.rows=1>=this.options.rows?this.options.autoRows:this.options.rows;b.cols=this.options.cols||40}b.name=this.options.paramName;b.value=a;b.className="editor_field";if(this.options.submitOnBlur)b.onblur=this._boundSubmitHandler;this._controls.editor=b;this.options.loadTextURL&&this.loadExternalText();this._form.appendChild(this._controls.editor)},createForm:function(){function a(c,e){c=b.options["text"+c+"Controls"];!c||e===false||b._form.appendChild(document.createTextNode(c))}var b=this;this._form=
$(document.createElement("form"));this._form.id=this.options.formId;this._form.addClassName(this.options.formClassName);this._form.onsubmit=this._boundSubmitHandler;this.createEditField();"textarea"==this._controls.editor.tagName.toLowerCase()&&this._form.appendChild(document.createElement("br"));this.options.onFormCustomization&&this.options.onFormCustomization(this,this._form);a("Before",this.options.okControl||this.options.cancelControl);this.createControl("ok",this._boundSubmitHandler);a("Between",
this.options.okControl&&this.options.cancelControl);this.createControl("cancel",this._boundCancelHandler,"editor_cancel");a("After",this.options.okControl||this.options.cancelControl)},destroy:function(){if(this._oldInnerHTML)this.element.innerHTML=this._oldInnerHTML;this.leaveEditMode();this.unregisterListeners()},enterEditMode:function(a){if(!(this._saving||this._editing)){this._editing=true;this.triggerCallback("onEnterEditMode");this.options.externalControl&&this.options.externalControl.hide();
this.element.hide();this.createForm();this.element.parentNode.insertBefore(this._form,this.element);this.options.loadTextURL||this.postProcessEditField();a&&Event.stop(a)}},enterHover:function(){this.options.hoverClassName&&this.element.addClassName(this.options.hoverClassName);this._saving||this.triggerCallback("onEnterHover")},getText:function(){return this.element.innerHTML.unescapeHTML()},handleAJAXFailure:function(a){this.triggerCallback("onFailure",a);if(this._oldInnerHTML){this.element.innerHTML=
this._oldInnerHTML;this._oldInnerHTML=null}},handleFormCancellation:function(a){this.wrapUp();a&&Event.stop(a)},handleFormSubmission:function(a){var b=this._form,c=$F(this._controls.editor);this.prepareSubmission();b=this.options.callback(b,c)||"";if(Object.isString(b))b=b.toQueryParams();b.editorId=this.element.id;if(this.options.htmlResponse){c=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(c,{parameters:b,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});
new Ajax.Updater({success:this.element},this.url,c)}else{c=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(c,{parameters:b,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,c)}a&&Event.stop(a)},leaveEditMode:function(){this.element.removeClassName(this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this._originalBackground;this.element.show();this.options.externalControl&&this.options.externalControl.show();
this._editing=this._saving=false;this._oldInnerHTML=null;this.triggerCallback("onLeaveEditMode")},leaveHover:function(){this.options.hoverClassName&&this.element.removeClassName(this.options.hoverClassName);this._saving||this.triggerCallback("onLeaveHover")},loadExternalText:function(){this._form.addClassName(this.options.loadingClassName);this._controls.editor.disabled=true;var a=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(a,{parameters:"editorId="+encodeURIComponent(this.element.id),
onComplete:Prototype.emptyFunction,onSuccess:function(b){this._form.removeClassName(this.options.loadingClassName);b=b.responseText;if(this.options.stripLoadedTextTags)b=b.stripTags();this._controls.editor.value=b;this._controls.editor.disabled=false;this.postProcessEditField()}.bind(this),onFailure:this._boundFailureHandler});new Ajax.Request(this.options.loadTextURL,a)},postProcessEditField:function(){var a=this.options.fieldPostCreation;if(a)$(this._controls.editor)["focus"==a?"focus":"activate"]()},
prepareOptions:function(){this.options=Object.clone(Ajax.InPlaceEditor.DefaultOptions);Object.extend(this.options,Ajax.InPlaceEditor.DefaultCallbacks);[this._extraDefaultOptions].flatten().compact().each(function(a){Object.extend(this.options,a)}.bind(this))},prepareSubmission:function(){this._saving=true;this.removeForm();this.leaveHover();this.showSaving()},registerListeners:function(){this._listeners={};var a;$H(Ajax.InPlaceEditor.Listeners).each(function(b){a=this[b.value].bind(this);this._listeners[b.key]=
a;this.options.externalControlOnly||this.element.observe(b.key,a);this.options.externalControl&&this.options.externalControl.observe(b.key,a)}.bind(this))},removeForm:function(){if(this._form){this._form.remove();this._form=null;this._controls={}}},showSaving:function(){this._oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;this.element.addClassName(this.options.savingClassName);this.element.style.backgroundColor=this._originalBackground;this.element.show()},triggerCallback:function(a,
b){"function"==typeof this.options[a]&&this.options[a](this,b)},unregisterListeners:function(){$H(this._listeners).each(function(a){this.options.externalControlOnly||this.element.stopObserving(a.key,a.value);this.options.externalControl&&this.options.externalControl.stopObserving(a.key,a.value)}.bind(this))},wrapUp:function(a){this.leaveEditMode();this._boundComplete(a,this.element)}});Object.extend(Ajax.InPlaceEditor.prototype,{dispose:Ajax.InPlaceEditor.prototype.destroy});
Ajax.InPlaceCollectionEditor=Class.create(Ajax.InPlaceEditor,{initialize:function($super,b,c,e){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;$super(b,c,e)},createEditField:function(){var a=document.createElement("select");a.name=this.options.paramName;a.size=1;this._controls.editor=a;this._collection=this.options.collection||[];this.options.loadCollectionURL?this.loadCollection():this.checkForExternalText();this._form.appendChild(this._controls.editor)},loadCollection:function(){this._form.addClassName(this.options.loadingClassName);
this.showLoadingText(this.options.loadingCollectionText);var a=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(a,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(b){b=b.responseText.strip();if(!/^\[.*\]$/.test(b))throw"Server returned an invalid collection representation.";this._collection=eval(b);this.checkForExternalText()}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadCollectionURL,a)},
showLoadingText:function(a){this._controls.editor.disabled=true;var b=this._controls.editor.firstChild;if(!b){b=document.createElement("option");b.value="";this._controls.editor.appendChild(b);b.selected=true}b.update((a||"").stripScripts().stripTags())},checkForExternalText:function(){this._text=this.getText();this.options.loadTextURL?this.loadExternalText():this.buildOptionList()},loadExternalText:function(){this.showLoadingText(this.options.loadingText);var a=Object.extend({method:"get"},this.options.ajaxOptions);
Object.extend(a,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(b){this._text=b.responseText.strip();this.buildOptionList()}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadTextURL,a)},buildOptionList:function(){this._form.removeClassName(this.options.loadingClassName);this._collection=this._collection.map(function(e){return 2===e.length?e:[e,e].flatten()});var a="value"in this.options?this.options.value:this._text,
b=this._collection.any(function(e){return e[0]==a}.bind(this));this._controls.editor.update("");var c;this._collection.each(function(e,f){c=document.createElement("option");c.value=e[0];c.selected=b?e[0]==a:0==f;c.appendChild(document.createTextNode(e[1]));this._controls.editor.appendChild(c)}.bind(this));this._controls.editor.disabled=false;Field.scrollFreeActivate(this._controls.editor)}});
Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions=function(a){function b(c,e){c in a||e===undefined||(a[c]=e)}if(a){b("cancelControl",a.cancelLink?"link":a.cancelButton?"button":a.cancelLink==a.cancelButton==false?false:undefined);b("okControl",a.okLink?"link":a.okButton?"button":a.okLink==a.okButton==false?false:undefined);b("highlightColor",a.highlightcolor);b("highlightEndColor",a.highlightendcolor)}};
Object.extend(Ajax.InPlaceEditor,{DefaultOptions:{ajaxOptions:{},autoRows:3,cancelControl:"link",cancelText:"cancel",clickToEditText:"Click to edit",externalControl:null,externalControlOnly:false,fieldPostCreation:"activate",formClassName:"inplaceeditor-form",formId:null,highlightColor:"#ffff99",highlightEndColor:"#ffffff",hoverClassName:"",htmlResponse:true,loadingClassName:"inplaceeditor-loading",loadingText:"Loading...",okControl:"button",okText:"ok",paramName:"value",rows:1,savingClassName:"inplaceeditor-saving",
savingText:"Saving...",size:0,stripLoadedTextTags:false,submitOnBlur:false,textAfterControls:"",textBeforeControls:"",textBetweenControls:""},DefaultCallbacks:{callback:function(a){return Form.serialize(a)},onComplete:function(a,b){new Effect.Highlight(b,{startcolor:this.options.highlightColor,keepBackgroundImage:true})},onEnterEditMode:null,onEnterHover:function(a){a.element.style.backgroundColor=a.options.highlightColor;a._effect&&a._effect.cancel()},onFailure:function(a){alert("Error communication with the server: "+
a.responseText.stripTags())},onFormCustomization:null,onLeaveEditMode:null,onLeaveHover:function(a){a._effect=new Effect.Highlight(a.element,{startcolor:a.options.highlightColor,endcolor:a.options.highlightEndColor,restorecolor:a._originalBackground,keepBackgroundImage:true})}},Listeners:{click:"enterEditMode",keydown:"checkForEscapeOrReturn",mouseover:"enterHover",mouseout:"leaveHover"}});Ajax.InPlaceCollectionEditor.DefaultOptions={loadingCollectionText:"Loading options..."};
Form.Element.DelayedObserver=Class.create({initialize:function(a,b,c){this.delay=b||0.5;this.element=$(a);this.callback=c;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,"keyup",this.delayedListener.bindAsEventListener(this))},delayedListener:function(){if(this.lastValue!=$F(this.element)){this.timer&&clearTimeout(this.timer);this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1E3);this.lastValue=$F(this.element)}},onTimerEvent:function(){this.timer=null;this.callback(this.element,
$F(this.element))}});if(!document.onunload)document.onunload=function(){};function write_to_document(a){document.write(a)}function toggleTabs(a,b){Element.show(a);Element.show(a+"_title");Element.show(b+"_link");Element.hide(b);Element.hide(b+"_title");Element.hide(a+"_link");$(a+"_tab").className="tab current";$(b+"_tab").className="tab"}
var TopicForm={editNewTitle:function(a){$("new_topic").innerHTML=a.value.length>5?a.value:"New Topic"}},EditForm={init:function(a){$("edit-post-"+a+"_spinner").show();this.clearReplyId()},setReplyId:function(a){$("edit").setAttribute("post_id",a.toString());$("posts-"+a+"-row").addClassName("editing");$("reply")&&$("reply").hide()},clearReplyId:function(){var a=this.currentReplyId();if(!(!a||a=="")){(a=$("posts-"+a+"-row"))&&a.removeClassName("editing");$("edit").setAttribute("post_id","")}},currentReplyId:function(){return $("edit").getAttribute("post_id")},
isEditing:function(a){if(this.currentReplyId()==a.toString()){$("edit").show();$("edit_post_body").focus();return true}return false},cancel:function(){this.clearReplyId();$("edit").hide()}},ReplyForm={init:function(){EditForm.cancel();$("reply").toggle();$("post_body").focus()}};function showChatSelector(a,b){new lightbox("/rooms/change?game_rooms="+a+"&game_id="+b)}function limitText(a,b){if(a.value.length>b)a.value=a.value.substring(0,b)}
Prototype.Platform={Windows:!!navigator.platform.match(/Win/),Macintosh:!!navigator.platform.match(/Mac/),Linux:!!navigator.platform.match(/Linux/)};Hash.prototype.getWithDefault=function(a,b){var c=this.get(a);return undefined==c?this.set(a,b()):c};Hash.prototype.getOrSet=function(a,b){var c=this.get(a);return undefined==c?this.set(a,b):c};Prototype.Browser.IE6=navigator.userAgent.indexOf("MSIE 6.")>-1;Prototype.Browser.IE7=navigator.userAgent.indexOf("MSIE 7.")>-1;
Prototype.Browser.IE8=navigator.userAgent.indexOf("MSIE 8.")>-1;if(Prototype.Browser.IE8)Element._attributeTranslations.write.names["class"]=undefined;Element.addMethods("textarea",{positionCaretAtEnd:function(a){a=$(a);if(a.createTextRange){var b=a.createTextRange();b.move("character",a.value.length);b.select()}else if(a.selectionStart!=null){b=a.value.length;a.focus();a.setSelectionRange(b,b)}else{a.focus();a.value+=""}return a}});
Element.addMethods({ieHappyHide:function(a){a=$(a);a.style.display="none";a.style.visibility="hidden";return a},ieHappyShow:function(a){a=$(a);a.style.display="";a.style.visibility="visible";return a}});String.prototype.evalScripts=function(){return this.extractScripts?this.extractScripts().map(function(a){return eval(a)}):this};Function.prototype.runWhenDomLoaded=function(){if(document.loaded)this.defer();else{var a=this;document.observe("dom:loaded",function(){a()})}};
function insertTrackingPixelWithTimestamp(a){stamp=(new Date).getTime();document.write('<img src="'+a+stamp+'?"/>')};Function.prototype.bufferingFunction=function(a,b){var c=Function.preconditionBufferingGroup(a,b),e=this,f=function(){c.push(e,arguments,this,f,b);a(this)&&c.unwind()};return f};
Function.preconditionBufferingGroup=function(a,b){if(!this._buffering_function_groups)this._buffering_function_groups=[];if(undefined===a._buffering_group_id)a._buffering_group_id=this._buffering_function_groups.length;a=a._buffering_group_id;this._buffering_function_groups[a]||(this._buffering_function_groups[a]=function(){var c=[];return{push:function(e,f,g,h,j){c.push({fn:e,outerFunction:h,args:f,bind_to:g,timestamp:new Date,tag:j})},unwind:function(){if(c.length){var e;e=function(f,g){var h=function(j,
n){if(j.localeCompare&&n.localeCompare)return j.localeCompare(n);if(j>n)return-1;if(j<n)return 1;return 0};return h(f.tag,g.tag)||h(f.timestamp,g.timestamp)};if(b instanceof Function)c.sort(b);else b&&c.sort(e);for(;e=c.shift();)e.fn.apply(e.bind_to,e.args)}}}}());return this._buffering_function_groups[a]};Function.unbufferBufferingGroup=function(a){a._buffering_group_id&&Function.preconditionBufferingGroup(a).unwind()};function CommentsController(a){this.initialize(a)}
CommentsController.prototype={initialize:function(a){this._comments_path=a.comments_path;this._hidden_threshold=a.hidden_threshold;this._active_user=a.active_user;this._comment_ids=a.comment_ids},showNewCommentForm:function(){if(this._active_user.isAuthenticated()){try{holodeck.recordAnalyticsEvent("Comments","Add")}catch(a){}Element.hide("commentutility");Element.show("comment_new")}},resetNewCommentForm:function(){$("comment_content").value="";$("comment_errors").hide();Element.hide("comment_new");
this.reenableNewCommentForm();$("commentutility").show()},reenableNewCommentForm:function(){Element.hide("comment_indicator");$("post_comment_submit").disabled=false},submitNewCommentForm:function(a){var b=this;Element.show("comment_indicator");$("post_comment_submit").disabled=true;$(a).request({method:"post",onSuccess:function(c){var e=$$(".comments_list").last();e&&e.insert(c.responseText);$("no_comments").hide();b.resetNewCommentForm();urchinTracker("/new_comment")},on400:function(c){b.showNewCommentErrors(c.responseText)},
on500:function(){b.showNewCommentErrors("A server error occured.")}})},showNewCommentErrors:function(a){var b=$("comment_errors");b.show();b.update(a);this.reenableNewCommentForm()},userSilenced:function(){var a=$("comment_user_silenced");$("comment_add_a_comment").hide();a.update(this._active_user.silencedMessage());a.show()},checkUserSilenced:function(){this._active_user.isSilenced()&&this.userSilenced()},lightUpSingleComment:function(a,b){a=$("comment_"+a);a.removeClassName("rated_negative");a.removeClassName("rated_positive");
a.addClassName(b?"rated_positive":"rated_negative")},currentRating:function(a){return parseInt($("comment_current_rating_"+a).innerHTML,10)},opinionForComment:function(a){a=$("comment_"+a);return a.hasClassName("rated_negative")?false:a.hasClassName("rated_positive")?true:null},rateComment:function(a,b){var c=this.opinionForComment(a);if(c!==b){var e=this.currentRating(a);if(c===true)e-=1;else if(c===false)e+=1;if(b===true)e+=1;else if(b===false)e-=1;c=$("comment_"+a);$("comment_rating_area_"+a);
var f=this;this.hideRatingLinks(a);$("comment_current_rating_"+a).update(e);c.removeClassName("below_threshold");c.removeClassName("above_threshold");c.addClassName(e>this._hidden_threshold?"above_threshold":"below_threshold");this.lightUpSingleComment(a,b);new Ajax.Request(this._comments_path+"/"+a+"/ratings.js",{parameters:{opinion:b},onComplete:function(){f.showRatingLinks(a)}})}},flagComment:function(a){var b=this;this.hideRatingLinks(a);new Ajax.Request(this._comments_path+"/"+a+"/flaggings.js",
{onComplete:function(){b.showRatingLinks(a);$("comment_flagged_"+a).show();$("comment_flagged_"+a).update("<span>This comment has been flagged for review.</span>")}})},hideRatingLinks:function(a){var b=$("comment_rating_links_"+a),c=$("flag_indicator_"+a);a=$("comment_status_"+a);c.show();a.hide();b.hide()},showRatingLinks:function(a){var b=$("comment_rating_links_"+a),c=$("flag_indicator_"+a);a=$("comment_status_"+a);c.hide();b.show();a.show()},showCommentContent:function(a){Element.hide("show_comment_content_"+
a);Element.show("hide_comment_content_"+a);Element.show("comment_content_"+a)},hideCommentContent:function(a){Element.show("show_comment_content_"+a);Element.hide("hide_comment_content_"+a);Element.hide("comment_content_"+a)},removeComment:function(a){var b=this._comments_path+"/"+a+".js",c=$("flag_indicator_"+a),e=$("remove_comment_"+a),f=$("comment_"+a);c.show();e.hide();new Ajax.Request(b,{method:"delete",onSuccess:function(){f.remove()}})},checkUserRatingStatus:function(){var a=this;new Ajax.Request(this._active_user.accountUrl()+
"/comment_ratings.json",{method:"get",parameters:{comment_ids:Object.toJSON(this._comment_ids),game_id:this._active_user.gameId()},onSuccess:function(b){a.lightUpComments(b.responseJSON)}})},lightUpComments:function(a){var b=this;$H(a).each(function(c){b.lightUpSingleComment(c.key,c.value)})},showAdminControls:function(){active_user.isAdmin()&&$$(".admin_controls").each(Element.show)}};var CreditCardForm=Class.create({initialize:function(a,b,c,e,f){this._tableElement=a;this._rows=[];this._togglePayNow=f;this._ccImages={};$H({visa:"/images/ccmark_visa.gif",master_card:"/images/ccmark_mastercard.png",american_express:"/images/ccmark_amex.png",discover:"/images/ccmark_discover.gif"}).each(function(g){this._ccImages[g.key]=new Element("img");this._ccImages[g.key].src=g.value}.bind(this));this._ccNumberRow=new FormCreditCardNumberRow("","Credit card number","cc_number",e.cc_number,this._checkAllRowsForValidity.bind(this),
this._propagateCreditCardType.bind(this));this._rows.push(this._ccNumberRow);this._rows.push(new FormExpirationDateRow("","Expiration Date","",b,c,e.cc_month,e.cc_year,this._checkAllRowsForValidity.bind(this)));this._cvvRow=new FormCvvRow("","Card security code","cc_verification_value",e.cc_verification_value,this._checkAllRowsForValidity.bind(this));this._rows.push(this._cvvRow);this._rows.push(new FormNonEmptyRow("","First name","cc_first_name","Please enter your first name exactly as it appears on your credit card",
e.cc_first_name,this._checkAllRowsForValidity.bind(this),false));this._rows.push(new FormNonEmptyRow("","Last name","cc_last_name","Please enter your last name exactly as it appears on your credit card",e.cc_last_name,this._checkAllRowsForValidity.bind(this),false));this._rows.push(new FormNonEmptyRow("","Billing address","cc_address_1","Enter the street address where your statements are mailed to. (eg, 12 Maple Drive)",e.cc_address_1,this._checkAllRowsForValidity.bind(this),false));this._rows.push(new FormCanBeEmptyRow("",
"Billing address (cont)","cc_address_2","Apartment number, suite number or department",e.cc_address_2,this._checkAllRowsForValidity.bind(this),false));this._rows.push(new FormNonEmptyRow("","City","cc_city","",e.cc_city,this._checkAllRowsForValidity.bind(this),false));this._rows.push(new FormNonEmptyRow("","State/Province/Region","cc_state","",e.cc_state,this._checkAllRowsForValidity.bind(this),false));this._rows.push(new FormNonEmptyRow("","Postal Code","cc_postal_code","",e.cc_postal_code,this._checkAllRowsForValidity.bind(this),
true));this._attachRowsToTableElement()},rowCount:function(){return this._rows.length},_checkAllRowsForValidity:function(){},_enablePayNow:function(){var a=$$(".checkout_button")[0];a.disabled=false;a.removeClassName("disabled")},_disablePayNow:function(){var a=$$(".checkout_button")[0];if(this._togglePayNow){a.disabled=true;a.addClassName("disabled")}},_attachRowsToTableElement:function(){this._rows.each(function(a){Element.insert(this._tableElement,{before:a.getElement()})}.bind(this))},_propagateCreditCardType:function(){var a=
this._ccNumberRow.getCreditCardType();this._ccNumberRow._helpCreditCardFocusHandler._setImage(this._ccImages[a]);this._cvvRow.setCreditCardType(a)}}),updatePaypalFormValues=function(a){var b=new RegExp(/kpid=(\d*)/);custom_input=$("custom");custom_input.value=custom_input.value.replace(b,"kpid="+a);$("kred_package_id").value=a},paypalInformationPath=function(a){a.kred_amount=$("kred_amount").innerHTML;a.kred_package_id=$("kred_package_id").value;return"/paypal_informations?"+Object.toQueryString(a)},
updatePurchaseSummary=function(a,b){$("kred_amount").innerHTML=a;$("dollar_price").innerHTML=b;$("item_name").value=a+" Kreds";$("amount").value=b};FeedbackFormBuilder=Class.create();FeedbackFormType=Class.create();FeedbackFormType.prototype={initialize:function(a,b,c,e,f){this.type=a;this.property_class=b;this.desc_text_area=c;this.sidebar_id=e;this.login_required=f}};
FeedbackFormBuilder.selectAccomplishment=function(a){if(a=="")$("missing_accomplishment_options").innerHTML="Please select a game";else{$("missing_accomplishment_options").innerHTML='<img src="/images/spinner.gif" style="float:right;"/>';new Ajax.Request("/feedbacks/missing_accomplishments_for.js?game_id="+a,{method:"get"})}};
FeedbackFormBuilder.prototype={initialize:function(a){var b=$("select_topic").options[$("select_topic").selectedIndex].value;this.currentTextArea=null;this._element=$(a);this._classes=new Array("abuse","general","game_missing_accomplishment","game_bug");this.types=[new FeedbackFormType("Feedback","general","feedback_general_content","general_feedback_instructions"),new FeedbackFormType("BugReport","general","feedback_general_content","general_bug_feedback_instructions"),new FeedbackFormType("FeatureRequest",
"general","feedback_general_content","general_feedback_instructions"),new FeedbackFormType("AdvertisingInquiryFeedback","general","feedback_general_content","advertiser_feedback_instructions"),new FeedbackFormType("OtherInquiryFeedback","general","feedback_general_content","general_feedback_instructions"),new FeedbackFormType("DevelopmentSupportFeedback","general","feedback_general_content","developer_support_feedback_instructions"),new FeedbackFormType("AbusiveUser","abuse","feedback_abuse_content",
"abusive_user_feedback_instructions"),new FeedbackFormType("MissingAccomplishmentFeedback","game_missing_accomplishment","feedback_missing_accomplishment_content","missing_accomplishment_feedback_instructions",true),new FeedbackFormType("GameBugReport","game_bug","feedback_game_bug_content","game_bug_feedback_instructions")];this._clearContentExcept(b);this._hideAll();this.subjectChanged();this._setSubmitState()},_findTypeByTypeStr:function(a){return this.types.find(function(b){return b.type==a})},
_findAllTextAreas:function(a){var b=new Hash;a.each(function(c){b.set(c.desc_text_area,true)});return b.keys()},_findAllSidebars:function(){var a=new Hash;this.types.each(function(b){a.set(b.sidebar_id,true)});return a.keys()},_findAllClasses:function(){},_clearContentExcept:function(a){var b=this._findAllTextAreas(this.types),c=this._findTypeByTypeStr(a);b.each(function(e){if(e!=c.desc_text_area)$(e).value=""})},_hideAll:function(){this._classes.each(function(a){this._getElementsForClass(a).each(function(b){b.hide()})}.bind(this));
this._hideSidebars()},_hideSidebars:function(){this._findAllSidebars().each(function(a){$(a).hide()})},_showType:function(a){this.type=a=this._findTypeByTypeStr(a);this.showElementsOfClass(a.property_class);this._showSidebarForType(a);this.copyContent(a.desc_text_area)},_showSidebarForType:function(a){$(a.sidebar_id).show()},copyContent:function(a){a=$(a);if(this.currentTextArea&&this.currentTextArea!=a){a.value=this.currentTextArea.value;this.currentTextArea.value=""}this.currentTextArea=a},_setSubmitState:function(){if($F("select_topic")==
"Feedback"){$("feedback_submit_button").disable();$("feedback_submission_warning").show()}else{$("feedback_submit_button").enable();$("feedback_submission_warning").hide()}},_getElementsForClass:function(a){return this._element.select("."+a)},showElementsOfClass:function(a){this._getElementsForClass(a).each(function(b){b.show()})},select:function(a){this._hideAll();this._showType(a)},_loginRequired:function(){return typeof this.type!="undefined"&&this.type.login_required},_enableForm:function(){$("login_message").hide();
$("feedback_form_form").enable();$("feedback_submit_button").show()},_disableForm:function(){$("login_message").show();$("feedback_form_form").disable();$("select_topic").enable();$("feedback_submit_button").hide()},subjectChanged:function(){var a=$F("select_topic");this.select(a);this._loginRequired()&&!active_user.isAuthenticated()?this._disableForm():this._enableForm();var b=$("chooser"),c=$("feedback_game_id");c.onchange=function(){};a=="GameBugReport"&&$("game_bug_input_cell").appendChild(b);
if(a=="MissingAccomplishmentFeedback"){$("game_missing_accomplishment_input_cell").appendChild(b);c.onchange=function(){FeedbackFormBuilder.selectAccomplishment(c.value)};c.value!=""&&c.onchange()}this._setSubmitState()},_spin:function(){$("feedback_form_content").style.display="none";$("feedback_spinner").style.display="block"},_unspin:function(){$("feedback_spinner").style.display="none";$("feedback_form_content").style.display="block"}};var FocusHandler=Class.create({initialize:function(a,b,c){this._row=a;this._text=b;this._callback=c;this._elementsToInspect=a.getInputElements();this._elementToAffect=a.getHelpElement()},setText:function(a){this._text=a},_inputIsValid:undefined,onFocus:function(){FocusHandler._last_row=this._row},onBlur:function(){if(this._inputIsValid()){this._elementsToInspect.each(function(a){Element.removeClassName(a,"error_field")});Element.removeClassName(this._elementToAffect,"error_msg");this._elementToAffect.innerHTML=
"";return false}else{this._elementsToInspect.each(function(a){Element.addClassName(a,"error_field")});Element.addClassName(this._elementToAffect,"error_msg");this._elementToAffect.innerHTML=this._text;this._callback();return true}},_rowChanged:function(){return this._row!=FocusHandler._last_row}}),HelpFocusHandler=Class.create(FocusHandler,{initialize:function($super,b,c){$super(b,c,function(){})},onBlur:function(){var a=this._elementToAffect.childNodes[0];a&&a.remove();return false},_createHelpDiv:function(){this._removeHelpDiv();
var a=new Element("div");a.id="help_wrapper";var b=new Element("div");b.id="help_text";a.appendChild(b);this._elementToAffect.appendChild(a);return b},_removeHelpDiv:function(){var a=this._elementToAffect.childNodes[0];a&&a.remove()},_errorsArePresent:function(){return this._elementToAffect.hasClassName("error_msg")}}),HelpTextFocusHandler=Class.create(HelpFocusHandler,{initialize:function($super,b,c){$super(b,c)},onFocus:function($super){$super();if(this._errorsArePresent())return false;if(this._text)this._createHelpDiv().innerHTML=
this._text;return true}}),HelpImageFocusHandler=Class.create(HelpFocusHandler,{initialize:function($super,b,c){$super(b,null);this._imageElement=c},onFocus:function($super){$super();if(this._errorsArePresent())return false;this._setImage(this._imageElement);return true},_setImage:function(a){this._createHelpDiv().appendChild(a)}}),HelpCreditCardFocusHandler=Class.create(HelpImageFocusHandler,{initialize:function($super,b,c){$super(b,c);this._setImage(this._imageElement)},onBlur:function(){}}),NonEmptyInputFocusHandler=
Class.create(FocusHandler,{initialize:function($super,b,c,e){$super(b,c,e)},_inputIsValid:function(){return this._row.getInputValue()!=""}}),CreditCardValidationFocusHandler=Class.create(FocusHandler,{initialize:function($super,b,c,e){$super(b,c,e)},_inputIsValid:function(){for(var a=[/^4\d{12}(\d{3})?$/,/^(5[1-5]\d{4}|677189)\d{10}$/,/^(6011|65\d{2})\d{12}$/,/^3[47]\d{13}$/],b=["visa","master_card","discover","american_express"],c=0,e=a.length;c<e;c++)if(this._row.getInputValue().match(a[c])){this._creditCardType=
b[c];return true}return false},getCreditCardType:function(){return this._creditCardType}}),DateValidationFocusHandler=Class.create(FocusHandler,{initialize:function($super,b,c,e){$super(b,c,e)},_deferValidation:function(){return!this._rowChanged()&&this._isIncomplete()},_isIncomplete:function(){return!this._month()||!this._year()},_month:function(){return this._row.getInputElements()[0].value},_year:function(){return this._row.getInputElements()[1].value}}),CompleteDateValidationFocusHandler=Class.create(DateValidationFocusHandler,
{initialize:function($super,b,c,e){$super(b,c,e)},_inputIsValid:function(){if(this._deferValidation())return true;return this._row.getInputValue().length>=6}}),FutureDateValidationFocusHandler=Class.create(DateValidationFocusHandler,{initialize:function($super,b,c,e){$super(b,c,e)},_getCurrentDate:function(){return new Date},_inputIsValid:function(){if(this._deferValidation())return true;var a=this._row.getInputValue().split("/"),b=this._getCurrentDate();return!(a[1]==b.getFullYear()&&a[0]<b.getMonth()+
1)}}),CvvValidationFocusHandler=Class.create(FocusHandler,{initialize:function($super,b,c){this._requiredCvvLength=0;$super(b,"credit card number must be valid",c)},setCreditCardType:function(a){this._requiredCvvLength=this._getRequiredCvvLengthFor(a);this.setText("code must be "+this._requiredCvvLength+" digits")},_getRequiredCvvLengthFor:function(a){if(a=="american_express")return 4;else if(a=="test")return 1;return 3},_inputIsValid:function(){return this._row.getInputValue().length==this._requiredCvvLength}}),
ValidInputCallbackFocusHandler=Class.create(FocusHandler,{initialize:function($super,b,c){$super(b,"",c)},onBlur:function(){this._callback();return false}});var hookup_hintables=function(){$$(".hintable").each(function(a){var b=a.title,c=a.form,e=c.restoreHints,f=function(){if(b==a.value||""==a.value){a.value="";a.removeClassName("hinted_value")}},g=function(){if(""==a.value){a.value=b;a.addClassName("hinted_value")}},h=a.form.onsubmit;g();a.observe("click",f);a.observe("focus",f);a.observe("blur",g);a.restoreHint=g;c.onsubmit=function(){var j=true;f();if(h)try{j=h.apply(this,arguments)}catch(n){}g();return j};c.restoreHints=function(){g();e&&e.apply(this,
arguments)}})};document.observe("dom:loaded",function(){hookup_hintables()});function SiteNavigation(a,b){this.initialize(a,b)}
SiteNavigation.prototype={initialize:function(a,b){this._rollover_delay=b.rollover_delay||0.2;this._waiting=false;this._active_nav_element=null;this._active_user=b.active_user;var c=this;$(document.body).observe("mouseover",function(e){(e=$(e.target))&&e.descendantOf&&!e.descendantOf($("full-nav-wrap"))&&c.onMouseLeave()});$$(".hovertarget").each(function(e){e.subnav=$(e.id.slice(4,e.id.length)+"_subnav");e.observe("mouseover",function(f){var g=f.target;if("A"==f.target.tagName)g=f.target.parentNode;
c.onMouseOverNavigationCategory(g)})});$$(".subnav").each(function(e){e.observe("mouseover",function(){c.clearResetTimer()})});if(this._active_user){b=function(){$$("#full-nav-wrap a").each(function(e){e.href=e.getAttribute("authUrl")})};this._active_user.isAuthenticated()?b():this._active_user.addOnAuthenticatedObserver(b)}this.activateNav(a)},activateNav:function(a){if(this._active_nav_element){this._active_nav_element.removeClassName("hover");this._active_nav_element.down("a").removeClassName("active")}this._active_nav_element=
a;$$(".subnav").invoke("hide");a.subnav.show();a.addClassName("hover");a.down("a").addClassName("active")},clearResetTimer:function(){this._reset_timer&&clearTimeout(this._reset_timer);this._reset_timer=null},resetCurrentNav:function(){this.activateNav($$(".active-nav-category-item")[0])},onMouseLeave:function(){this.clearResetTimer();this._waiting=false;this._reset_timer=this.resetCurrentNav.bind(this).delay(this._rollover_delay)},onMouseOverNavigationCategory:function(a){this.clearResetTimer();
if(this._waiting)this._reset_timer=this.activateNav.bind(this).delay(this._rollover_delay,a);else{this._waiting=true;this._reset_timer=this.activateNav.bind(this).delay(0,a)}}};function WelcomeBox(a){this.initialize(a)}
WelcomeBox.prototype={initialize:function(a){this._user=a;this._template=new Template($("logged_in_user_welcome_template").innerHTML);this.updateValues();var b=this;a.addAttributesObserver(function(){b.updateValues()})},updateValues:function(){if(this._user.isAuthenticated()){var a=this._user.getAttributes(),b=a.unread_shouts_count+a.unread_whispers_count;a.friends_online_string=this.friendsOnlineString(a.friends_online_count);a.unread_messages_count_string=this.messagesCountString(b);a.kreds_balance_or_my_profile_link=
this.kredsBalanceOrMyProfileString(a.kreds_balance);a.kreds_balance_or_my_profile_link_url=this.kredAccountUrlOrMyProfileUrl(a.kreds_balance);var c=this._template.evaluate(a);b=$("welcome");b.update(c);b.down("#friends_online_welcome_box_link").writeAttribute({title:a.friends_online_names});c=(new Element("img")).writeAttribute({id:"welcome_box_user_avatar","class":"user_avatar",src:a.avatar_url,title:a.username,name:"user_avatar",alt:"avatar for"+a.username,height:40,width:40});b.down("span#welcome_box_avatar_placeholder").update(c);
c=(new Element("img")).writeAttribute({id:"welcome_levelbug","class":"levelbug_image",src:a.levelbug_url,title:"Level "+a.level,name:"welcome_levelbug",alt:"Levelbug"+a.level});b.down("span#welcome_box_levelbug_img_placeholder").update(c);b.down("#levelbug").observe("click",this.seeLevelStatusFunction());this._user.populateUserSpecificLinks(b);this.updateMessagesLink(a.unread_shouts_count,a.unread_whispers_count);b.show()}},friendsOnlineString:function(a){return 1==a?"<strong>1 friend online</strong>":
a>1?"<strong>"+a+" friends online</strong>":"No friends online"},messagesCountString:function(a){return a>0?"<strong>Messages ("+(a>99?"99+":a)+")</strong>":"Messages"},updateMessagesLink:function(a,b){var c=$("unread_messages_welcome_box_link");if(c)c.href=a==0&&b>0?"/accounts/"+this._user.username()+"/private_messages":"/accounts/"+this._user.username()+"/messages"},kredsBalanceOrMyProfileString:function(a){return 0==a?"My Profile":1==a?"1 Kred":a.withDelimiters()+" Kreds"},kredAccountUrlOrMyProfileUrl:function(a){return 0==
a?"/accounts/"+encodeURIComponent(this._user.username()):"/accounts/"+encodeURIComponent(this._user.username())+"/kred_account"},seeLevelStatusFunction:function(){var a=this;return function(b){var c="/accounts/"+a._user.username()+"/points";new Ajax.Updater("points",c,{method:"GET",onComplete:function(){Element.toggle("mystuff");Element.toggle("points")}});b.stop();return false}}};Ajax.CachedAutocompleter=Class.create();
Object.extend(Object.extend(Ajax.CachedAutocompleter.prototype,Autocompleter.Base.prototype),{initialize:function(a,b,c,e){this.baseInitialize(a,b,e);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=c;this.cache={}},getUpdatedChoices:function(){var a=this.getToken().toLowerCase();if(this.cache[a])this.updateChoices(this.cache[a]);else{this.startIndicator();entry=encodeURIComponent(this.options.paramName)+
"="+encodeURIComponent(a);this.options.parameters=this.options.callback?this.options.callback(this.element,entry):entry;if(this.options.defaultParams)this.options.parameters+="&"+this.options.defaultParams;new Ajax.Request(this.url,this.options)}},onComplete:function(a){this.updateChoices(this.cache[a.request.parameters.search]=a.responseText)},markPrevious:function(){if(this.index>0)this.index--;else{this.index=this.entryCount-1;this.update.scrollTop=this.update.scrollHeight}selection=this.getEntry(this.index);
selection_top=selection.offsetTop;if(selection_top<this.update.scrollTop)this.update.scrollTop-=selection.offsetHeight},markNext:function(){if(this.index<this.entryCount-1)this.index++;else{this.index=0;this.update.scrollTop=0}selection=this.getEntry(this.index);selection_bottom=selection.offsetTop+selection.offsetHeight;if(selection_bottom>this.update.scrollTop+this.update.offsetHeight)this.update.scrollTop+=selection.offsetHeight},selectEntry:function(){if(this.index>=0){this.active=false;this.updateElement(this.getCurrentEntry())}else{try{this.element.form.onsubmit()}catch(a){}this.element.form.submit()}},
updateChoices:function(a){if(!this.changed&&this.hasFocus){this.update.innerHTML=a;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(a=0;a<this.entryCount;a++){var b=this.getEntry(a);b.autocompleteIndex=a;this.addObservers(b)}}else this.entryCount=0;this.stopIndicator();this.update.scrollTop=0;this.index=this.options.noAutoDefault?-1:0;if(this.entryCount==
1&&this.options.autoSelect){this.selectEntry();this.hide()}else this.render()}}});Number.prototype.withDelimiters=function(a,b){a||(a=",");b||(b=1E3);for(var c=[],e=Math.floor(this);e;){c.unshift(e%b);e=Math.floor(e/b)}return[c.shift()].concat(c.map(function(f){return f.toPaddedString((b-1+"").length)})).join(a)};Ajax.Poller=function(a,b,c,e){this.initialize(a,b,c,e)};Ajax.Poller.prototype={initialize:function(a,b,c,e){c=c||5E3;e=e||3E4;var f=this,g=Object.extend({method:"get",on202:function(){setTimeout(f._poll,c)},onFailure:function(){setTimeout(f._poll,e)}},b);this._poll=function(){new Ajax.Request(a,g)}},start:function(a){setTimeout(this._poll.bind(this),a||0)}};Form.serializeElements=function(a,b){if(typeof b!="object")b={hash:!!b};else if(Object.isUndefined(b.hash))b.hash=true;var c,e,f=false,g=b.submit,h;if(b.hash){b={};h=function(j,n,u){if(n in j){Object.isArray(j[n])||(j[n]=[j[n]]);j[n].push(u)}else j[n]=u;return j}}else{b="";h=function(j,n,u){return j+(j?"&":"")+encodeURIComponent(n)+"="+encodeURIComponent(u)}}return a.inject(b,function(j,n){if(!n.disabled&&n.name){c=n.name;e=$(n).getValue();if(e!=null&&n.type!="file"&&(n.type!="submit"||!f&&g!==false&&
(!g||c==g)&&(f=true)))j=h(j,c,e)}return j})};window.bezen=window.bezen||function(){return{$:function(a){return document.getElementById(a)},nix:function(){},_:{}}}();bezen.error=function(){var a=window.setTimeout,b=window.setInterval,c=function(j,n,u){if(bezen.log)typeof j==="object"?c(j.message,j.fileName,j.lineNumber):bezen.log.error(j+" at "+n+"["+u+"]",true)},e=function(j,n,u){c("window.onerror: "+j,n,u);return true},f=function(j,n){n=n||"error.catchError";if(typeof j!=="function"){c(n+": A function is expected, found "+typeof j);return bezen.nix}return function(){try{return j.apply(this,arguments)}catch(u){window.onerror&&window.onerror(n+": "+u.message+
" in "+j,u.fileName,u.lineNumber,true)}}},g=function(j,n){if(typeof j==="string"){bezen.log&&bezen.log.warn('window.setTimeout: eval is evil: "'+j+'"');j=new Function(j)}return a(f(j,"window.setTimeout"),n)},h=function(j,n){if(typeof j==="string"){bezen.log&&bezen.log.warn('window.setInterval: eval is evil: "'+j+'"');j=new Function(j)}return b(f(j,"window.setInterval"),n)};return{reportError:c,onerror:e,safeSetTimeout:g,safeSetInterval:h,catchError:f,catchAll:function(){window.onerror=e;window.setTimeout=
g;window.setInterval=h},_:{}}}();bezen.array=function(){var a=[];return{empty:function(b){b.length=0},last:function(b){if(!b||b.length===0)return null;return b[b.length-1]},push:function(b,c){return Array.push?Array.push(b,c):a.push.call(b,c)},pop:function(b){return Array.pop?Array.pop(b):a.pop.call(b)},shift:function(b){return Array.shift?Array.shift(b):a.shift.call(b)},unshift:function(b,c){return Array.unshift?Array.unshift(b,c):a.unshift.call(b,c)},copy:function(b){if(!b)return null;for(var c=[],e=0;e<b.length;e++)c.push(b[e]);
return c},hash:function(b){if(!b)return null;for(var c={},e=0;e<b.length;e++)c[b[e]]=true;return c},_:{}}}();bezen.string=function(){return{trim:function(a){a=a.replace(/^\s\s*/,"");return a.replace(/\s\s*$/,"")},startsWith:function(a,b){b=String(b);return a.slice(0,b.length)===b},endsWith:function(a,b){b=String(b);return a.slice(a.length-b.length)===b},_:{}}}();bezen.dom=function(){var a=bezen.error.catchError;return{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,element:function(b,c){var e=document.createElement(b);if(!c)return e;for(var f in c)c.hasOwnProperty(f)&&e.setAttribute(f,c[f]);if(e.canHaveChildren===false)return e;for(f=2;f<arguments.length;f++){var g=arguments[f];if(typeof g==="string")g=document.createTextNode(g);e.appendChild(g)}return e},clear:function(b){if(b.canHaveChildren!==false)b.innerHTML=""},insertBefore:function(b,c){b.parentNode.insertBefore(c,
b)},insertAfter:function(b,c){b.parentNode.insertBefore(c,b.nextSibling)},remove:function(b){b.parentNode&&b.parentNode.innerHTML&&b.parentNode.removeChild(b)},hasAttribute:function(b,c){if(b.hasAttribute)return b.hasAttribute(c);b=b.getAttributeNode(c);if(b===null)return false;return b.specified},appendScript:function(b,c,e){var f=a(e,"script.onload");if(c.readyState&&c.onload!==null)c.onreadystatechange=function(){if(c.readyState==="loaded"||c.readyState==="complete"){c.onreadystatechange=null;
c.onerror=null;f()}};else c.onload=f;b.appendChild(c)},_:{}}}();bezen.domwrite=function(){var a=bezen.nix,b=bezen.string.trim,c=bezen.array.empty,e=bezen.dom.hasAttribute,f=bezen.dom.appendScript,g=document.write,h=document.writeln,j=[],n=function(v){j.push(v)},u=function(v){n(v+"\n")},E=function(){if(j.length===0)return null;var v=j.join("");c(j);return v},t=function(v){var D=document.createElement("div");D.innerHTML="<br/>"+v;D.removeChild(D.firstChild);return D.firstChild},K=function(v){if(v.nodeName!=="SCRIPT")return false;if(v.language&&v.language.toLowerCase()!==
"javascript")return false;if(v.type&&b(v.type).toLowerCase()!=="text/javascript")return false;return true},N=false;(function(){var v=document.documentElement,D=document.createElement("script"),C="script"+(new Date).valueOf();D.type="text/javascript";try{D.appendChild(document.createTextNode("window."+C+"=1"))}catch(w){}v.insertBefore(D,v.firstChild);if(window[C]){N=true;delete window[C]}})();var J=function(v){if(v){var D=document.getElementsByTagName("head")[0]||document.documentElement,C=document.createElement("script");
C.type="text/javascript";if(N)C.appendChild(document.createTextNode(v));else C.text=v;D.insertBefore(C,D.firstChild);D.removeChild(C)}},R=function(v,D,C){if(e(D,"src")){for(var w=document.createElement("script"),q=0;q<D.attributes.length;q++){var l=D.attributes[q];e(D,l.name)&&w.setAttribute(l.name,l.value)}w.text=D.text;f(v,w,C)}else{w=D.cloneNode(false);w.text=D.text;w.type="any";v.appendChild(w);e(D,"type")?w.setAttribute("type",D.type):w.removeAttribute("type");J(w.text);C()}},r,A=function(v,
D,C){if(D===null)C();else{var w=null,q=v,l=function(){A(q,w,C)};if(K(D))setTimeout(function(){R(v,D,function(){r(v,l)})},0);else{var o=D.cloneNode(false);v.appendChild(o);setTimeout(l,0);if(D.firstChild)if(D.getElementsByTagName("script").length===0)o.innerHTML=D.innerHTML;else{w=D.firstChild;q=o}}if(w===null)w=D.nextSibling;for(o=D.parentNode;w===null&&o!==null;){w=o.nextSibling;q=q.parentNode;o=o.parentNode}}};r=function(v,D){if(v instanceof Function){D=v;v=document.body}else{v=v||document.body;
D=D||a}var C=E();C===null?D():A(v,t(C),D)};return{capture:function(){var v=document;if(v.write===g)v.write=n;if(v.writeln===h)v.writeln=u},parseMarkup:t,render:r,restore:function(){document.write=g;document.writeln=h},_:{markupArray:j,domWrite:n,domWriteln:u,collectMarkup:E,isJavascriptScript:K,appendScriptClone:R,loadPiecemeal:A}}}();var SocialHistory=function(a){function b(t,K,N){if(t.currentStyle)var J=t.currentStyle[N];else if(window.getComputedStyle)J=K.defaultView.getComputedStyle(t,null).getPropertyValue(N);return J}function c(t){t.parentNode.removeChild(t)}function e(){var t=document.createElement("iframe");t.style.position="absolute";t.style.visibility="hidden";document.body.appendChild(t);if(t.contentDocument)t.doc=t.contentDocument;else if(t.contentWindow)t.doc=t.contentWindow.document;t.doc.open();t.doc.write("<style>");
t.doc.write("a{color: #000000; display:none;}");t.doc.write("a:visited {color: #FF0000; display:inline;}");t.doc.write("</style>");t.doc.close();return t}function f(t){var K=n.doc.createElement("a");K.href=t;K.innerHTML=h;n.doc.body.appendChild(K)}var g={Digg:["http://digg.com","http://digg.com/login"],Reddit:["http://reddit.com","http://reddit.com/new/","http://reddit.com/controversial/","http://reddit.com/top/","http://reddit.com/r/reddit.com/","http://reddit.com/r/programming/"],StumbleUpon:["http://stumbleupon.com"],
"Yahoo Buzz":["http://buzz.yahoo.com"],Facebook:["http://facebook.com/home.php","http://facebook.com","https://login.facebook.com/login.php"],"Del.icio.us":["https://secure.del.icio.us/login","http://del.icio.us/"],MySpace:["http://www.myspace.com/"],Technorati:["http://www.technorati.com"],Newsvine:["https://www.newsvine.com","https://www.newsvine.com/_tools/user/login"],Songza:["http://songza.com"],Slashdot:["http://slashdot.org/"],"Ma.gnolia":["http://ma.gnolia.com/"],Blinklist:["http://www.blinklist.com"],
Furl:["http://furl.net","http://furl.net/members/login"],"Mister Wong":["http://www.mister-wong.com"],Current:["http://current.com","http://current.com/login.html"],Menaeme:["http://meneame.net","http://meneame.net/login.php"],Oknotizie:["http://oknotizie.alice.it","http://oknotizie.alice.it/login.html.php"],Diigo:["http://www.diigo.com/","https://secure.diigo.com/sign-in"],Funp:["http://funp.com","http://funp.com/account/loginpage.php"],Blogmarks:["http://blogmarks.net"],"Yahoo Bookmarks":["http://bookmarks.yahoo.com"],
Xanga:["http://xanga.com"],Blogger:["http://blogger.com"],"Last.fm":["http://www.last.fm/","https://www.last.fm/login/"],N4G:["http://www.n4g.com"],Faves:["http://faves.com","http://faves.com/home","https://secure.faves.com/signIn"],Simpy:["http://www.simpy.com","http://www.simpy.com/login"],Yigg:["http://www.yigg.de"],Kirtsy:["http://www.kirtsy.com","http://www.kirtsy.com/login.php"],Fark:["http://www.fark.com","http://cgi.fark.com/cgi/fark/users.pl?self=1"],Mixx:["https://www.mixx.com/login/dual",
"http://www.mixx.com"],"Google Bookmarks":["http://www.google.com/bookmarks","http://www.google.com/ig/add?moduleurl=bookmarks.xml&hl=en"],Subbmitt:["http://subbmitt.com/"],Twitter:["http://twitter.com","http://twitter.com/login"]};for(var h in a){if(typeof g[h]=="undefined")g[h]=[];if(typeof a[h]=="string")g[h].push(a[h]);else g[h]=g[h].concat(a[h])}var j={},n=e();for(h in g){var u=g[h];for(a=0;a<u.length;a++){f(u[a],h);if(u[a].match(/www\./)){var E=u[a].replace(/www\./,"");f(E,h)}else{E=u[a].indexOf("//")+
2;E=u[a].substring(0,E)+"www."+u[a].substring(E);f(E,h)}}}u=n.doc.body.childNodes;for(a=0;a<u.length;a++)if(b(u[a],n.doc,"display")!="none")j[u[a].innerHTML]=true;c(n);return new (function(){var t=[];for(var K in j)t.push(K);this.visitedSites=function(){return t};this.doesVisit=function(J){if(typeof g[J]=="undefined")return-1;return typeof j[J]!="undefined"};var N=[];for(K in g)N.push(K);this.checkedSites=function(){return N}})};function subjectChanged(a){if($("select_type")){var b=$F("select_type");b&&b!=""&&$("abuse_form_submit").enable();if(b=="OtherAbuseReport"||b=="InappropriateChatReport"||b=="UnderageUserReport"||b=="PermabanRequest"){$("description_field").show();updateDescriptionPrompt(true,a)}if(b=="InappropriateUsernameReport"||b=="InappropriateAvatarReport"||b=="InappropriateProfileReport"){$("description_field").show();updateDescriptionPrompt(false,a)}}}
function updateDescriptionPrompt(a,b){b="Please describe your reason for reporting "+b+" using as much detail as possible";var c=$("abuse_report_description_label_block").innerHTML;a=a?c.gsub("Please add any other information that would be helpful",b):c.gsub(b,"Please add any other information that would be helpful");$("abuse_report_description_label_block").update(a)};function upd(a,b,c){if(a.checked||c=="always"){if(c){index=a.id.substring(a.id.indexOf("[")+1,a.id.indexOf("]"));radio_id="handle["+index+"]";$(radio_id).checked="handle"}b&&b.show()}else b&&b.hide()};function AgeGate(a,b){a&&b?this.initialize(a,b):this.initialize(null,a)}AgeGate.MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];
AgeGate.prototype={initialize:function(a,b){var c=this;this._cookie_name=b.cookie_name||"age_gate";this._active_user=b.active_user||active_user;this._required_age=b.required_age;this._age_met=false;if(this._use_form=b.use_form===undefined?true:b.use_form){this._element=$(a);this._button_text=b.button_text||"Go"}this._onSuccess=(b.onSuccess||function(){}).wrap(function(e){c._age_met=true;Cookie.set(c._cookie_name,"YES");return e()});this._onFailure=(b.onFailure||function(){}).wrap(function(e){Cookie.set(c._cookie_name,
"NO");return e()});this._onError=b.onError||function(){};this.preflight()||this._age_met||(this._use_form?this.writeForm():this._onFailure())},preflight:function(){var a=this._active_user.age();if(a){a>=this._required_age?this._onSuccess():this._onFailure();return true}a=Cookie.get(this._cookie_name);if(a=="YES"){this._onSuccess();return true}else if(a=="NO"){this._onFailure();return true}return false},writeForm:function(){var a=this,b="",c=0;b='<form action="#">';b+="<dl>";b+="<dt><label>Date of Birth</label></dt>";
b+='<dd id="date">';b+='<select id="user_month" name="user_month">';b+='<option value=""></option>';for(c=0;c<AgeGate.MONTHS.length;c++)b+='<option value="'+c+'">'+AgeGate.MONTHS[c]+"</option>";b+="</select>";b+='<select id="user_day" name="user_day">';b+='<option value=""></option>';for(c=1;c<=31;c++)b+='<option value="'+c+'">'+c+"</option>";b+="</select>";b+='<select id="user_year" name="user_year">';b+='<option value=""></option>';for(c=2005;c>=1908;c--)b+='<option value="'+c+'">'+c+"</option>";
b+="</select>";b+="</dd>";b+="</dl>";b+='<input type="submit" value="'+this._button_text+'" />';b+="</form>";this._element.innerHTML+=b;(function(){a._element.immediateDescendants()[0].onsubmit=function(){a.checkAge(this);return false}}).defer()},checkAge:function(a){var b=Number(a.user_month.getValue()),c=Number(a.user_day.getValue());a=Number(a.user_year.getValue());if(isNaN(b)||c===0||a===0)this._onError();else{b=new Date(a+this._required_age,b,c);(new Date).getTime()-b.getTime()<0?this._onFailure():
this._onSuccess()}}};function hideAllButOne(a,b){$$(a).each(function(c){Element.hide(c)});Element.show(b)};Array.prototype.binarySearch=function(a,b,c){b||(b=function(j,n){return j==n?0:j<n?-1:1});for(var e=0,f=this.length-1,g,h;e<=f;){g=parseInt((e+f)/2,10);h=b(this[g],a);if(h<0)e=g+1;else if(h>0)f=g-1;else return g}if(c)return e;return-1};Array.prototype.orderedInsert=function(a,b){b=this.binarySearch(a,b,true);this.splice(b,0,a);return b};Array.prototype.orderedDelete=function(a,b){a=this.binarySearch(a,b);a>=0&&this.splice(a,1);return a};var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS"},searchString:function(a){for(var b=0;b<a.length;b++){var c=a[b].string,e=a[b].prop;this.versionSearchString=a[b].versionSearch||a[b].identity;if(c){if(c.indexOf(a[b].subString)!=-1)return a[b].identity}else if(e)return a[b].identity}},
searchVersion:function(a){var b=a.indexOf(this.versionSearchString);if(b!=-1)return parseFloat(a.substring(b+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,
subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},
{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};function Bumper(a){this.initialize(a)}Bumper.HTML_TEMPLATE=new Template('<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><title>Kongregate</title><style type="text/css">img{border-style:none;}html,body,div{padding:0;margin:0;border:none;overflow:hidden;background-color:#000}</style></head><body>#{body}</body></html>');Bumper.JAVASCRIPT_TEMPLATE=new Template('<script type="text/javascript" src="#{src}"><\/script>');Bumper.IFRAME_TEMPLATE=new Template("<iframe id='ad_iframe' name='ad_iframe' style='overflow:hidden;position:relative;top:0px;left:0px;padding:0;margin:0;border:none;width:#{width}px;;height:#{height}px;background-color:#000' scrolling='no' border='0' frameborder='0' #{extra}></iframe>");
Bumper.prototype={initialize:function(a){this._closed=this._content_rendered=this._response_received=this._timed_out=false;this._options={};this._interval=null;this._shown=false;this._response=null;this._ready=false;this._startTime=(new Date).getTime();this._content_div_names=a.content_divs;this._content_divs={};this._ansense_swf_path=a.adsense_swf_path;this._category=a.category;this._enabled=GA_available&&a.enabled;this._game_title=a.title||"unknown";this._track_events=!!a.track_events;this._events=
[];this._events_interval=null;this.trackTimedEvent("BumperInitialized")},isReady:function(){return this._ready},isEnabled:function(){return this._enabled},getContentDiv:function(a){var b=this._content_divs[a];if(!b)if(b=$(this._content_div_names[a]))this._content_divs[a]=b;else return null;return b},setReady:function(){if(!this.isReady()){this.trackTimedEvent("BumperReady");this._ready=true;if(this.isEnabled()){this.initAdTimeouts();this._response&&embedAd(this._response)}else this.showContent()}},
setResponse:function(a){this._response||this.trackTimedEvent("BumperResponse");this._response=a},requestAd:function(){if(GA_available){this.trackTimedEvent("BumperRequested");GA_googleFillSlot("kong_bumper_preroll_600x400")}},getOption:function(a){return this._options[a]},isTimedOut:function(){return this._timed_out},wasShown:function(){return this._shown},initAdTimeouts:function(){setTimeout(this.adResponseTimeout.bind(this),3E3)},embedAd:function(a){this.setResponse(a);if(this.isReady())if(!this.isTimedOut())try{if(this.validateAdResponse(a)){this.processAdResponse(a);
this.showAd()}else this.showContent()}catch(b){this.closeAd()}},processAdResponse:function(a){var b=a.type,c=this.getContentDiv(b),e=c.getDimensions(),f=e.width;e=e.height;a.countdown=!!a.countdown;a.preload=!!a.preload;navigator.userAgent.toLowerCase();if(a.content_type=="adsense_video")a.preload=false;this._options=a;this._parent=c;this._type=b;this._response_received=true;this.hideContent();a.preload&&this.renderContent();if(a.content_type=="adsense_video"){this._width=f;this._height=e;this._y=
this._x=0}else{this._width=a.width;this._height=a.height;this._x=(f-this._width)/2;this._y=(e-(this._height+20))/2}},validateAdResponse:function(a){if(a.type||a.url){a.type=a.type?a.type:"bumper";if(a.type=="bumper"||a.type=="superbumper"){a.content_type=a.content_type?a.content_type:"image";if(a.content_type=="image"||a.content_type=="adsense_video"||a.content_type=="swf"||a.content_type=="javascript"||a.content_type=="iframe"||a.content_type=="html")return true}}return false},showAd:function(){var a=
this._parent.getDimensions();this.insertAdDivs(a.width,a.height);this.showUncoveredContent();switch(this.getOption("content_type")){case "javascript":this.showJavascriptAd();break;case "image":this.showBumperImageAd();break;case "swf":this.showBumperFlashAd();break;case "adsense_video":this.showAdsenseVideoAd();break;case "iframe":this.showIframeAd();break;case "html":this.showHtmlAd();break}},showBumperImageAd:function(){var a=this._options;$("ad_content").insert("<img id='ad_image' alt='' src='"+
a.url+"'/>");$("ad_image").observe("click",function(){window.open(a.click_url)});this.insertCountdownText()},showAdsenseVideoAd:function(){var a=this._ansense_swf_path,b=this.getOption("duration");b={category:this._category,permalink:this._permalink,fullscreen_enabled:this.getOption("allow_text_ads"),duration:b};swfobject.embedSWF(a,"ad_holder",this._width,this._height,"6",false,b,{allownetworking:"all",allowscriptaccess:"always",wmode:"opaque"},{})},showBumperFlashAd:function(){var a=this.getOption("url"),
b=a.match(/TelemetryAdPlayer\.swf/)?"always":"never";swfobject.embedSWF(a,"ad_content",this._width,this._height,"6",false,{},{allownetworking:"all",allowscriptaccess:b,wmode:"opaque"},{});this.insertCountdownText()},showIframeAd:function(){$("ad_content").innerHTML=Bumper.IFRAME_TEMPLATE.evaluate({width:this._width,height:this._height,extra:"src='"+this.getOption("url")+"'"});this.insertCountdownText()},showJavascriptAd:function(){this._options.html=escape(Bumper.JAVASCRIPT_TEMPLATE.evaluate({src:this.getOption("url")}));
this.showHtmlAd()},showHtmlAd:function(){$("ad_content").update(Bumper.IFRAME_TEMPLATE.evaluate({width:this._width,height:this._height,extra:""}));var a=Bumper.HTML_TEMPLATE.evaluate({body:unescape(this.getOption("html"))});this.insertCountdownText();setTimeout(function(){var b=$("ad_iframe"),c=window.frames.ad_iframe.document;if(c==null)if(b.contentDocument)c=b.contentDocument;else if(b.contentWindow)c=b.contentWindow.document;c.open();c.write(a);window.opera&&c.close()}.bind(this),0)},insertCountdownText:function(){var a=
this._options;if(!this._closed){if(a.countdown){$("ad_label").innerHTML='<div id="ad_label_countdown" style="display: inline"></div><a href="javascript:bumper.closeAd();" style="color: #900; margin-left: 2px">&#40;close&#41;</a>';this.updateAdDurationText(a.duration)}else{var b=a.preload?"Your game is loading, and this ad will close automatically":"This ad will close automatically";$("ad_label").innerHTML=b+" <a style='color: #900' href='javascript:bumper.closeAd();'>&#40;close&#41;</a>"}setTimeout(function(){this._end_time=
(new Date).getTime()+a.duration;this._interval=setInterval(this.checkAdDuration.bind(this),250);this.updateAdDurationText(a.duration)}.bind(this),500);setTimeout(function(){$("ad_label")&&$("ad_label").appear({duration:1})},1500)}},closeAd:function(){if(!this._closed){setTimeout(this.removeAd.bind(this),0);this._closed=true;this.showContent();clearInterval(this._interval)}},removeAd:function(){$("ad_content")&&$("ad_content").remove();if($("ad_holder")){$("ad_holder").remove();if(navigator.userAgent.toLowerCase().match(/safari/)){window.scrollBy(0,
1);window.scrollBy(0,-1)}}},checkAdDuration:function(){var a=this._end_time-(new Date).getTime();a>0?this.updateAdDurationText(a):this.closeAd()},updateAdDurationText:function(a){if(this.getOption("countdown")&&!this._closed){a=Math.round(a/1E3);$("ad_label_countdown").innerHTML=(this.getOption("preload")?"Your game is loading ":"This ad will close automatically ")+a}},showContent:function(){this.renderContent();for(var a in this._content_div_names){var b=this.getContentDiv(a);if(b)if(lightbox.prototype._activated)lightbox.prototype._dom_elements_actually_hidden.push(b);
else if(!b.hiddenByLightbox)b.style.visibility="visible"}},hideContent:function(){for(var a in this._content_div_names)if(a==this._type||this._type=="superbumper"){var b=this.getContentDiv(a);if(b)b.style.visibility="hidden"}},adResponseTimeout:function(){if(!this._response_received){this.timed_out=true;this.closeAd()}},showUncoveredContent:function(){if(this._type!="superbumper")for(var a in this._content_div_names){var b=this.getContentDiv(a);if(b)if(a!=this._type&&b.hiddenByLightbox)b.style.visibility=
"visible"}},renderContent:function(){if(!this._content_rendered){this._content_rendered=true;activateGame()}},insertAdDivs:function(a,b){this._parent.insert("<div id='ad_holder' name='ad_holder' style='position:absolute; width:"+a+"px; height:"+b+"px; visibility:hidden; z-index: 9999998; background-color:#000; overflow:hidden'></div>");$("ad_holder").insert("<div id='ad' name='ad' style='position:relative;'>");$("ad").insert("<div id='ad_content'></div><div id='ad_label' style='display:none; font: 11px Verdana, Arial, sans-serif; color: #fff;text-align: center'></div>");
$("ad").setStyle({top:this._y+"px",left:"0px"});$("ad_holder").setStyle({visibility:"visible",top:"0px",left:"0px"})},showAllContent:function(){this.renderContent();var a=$("game");$("flashframecontent").style.visibility="visible";if(!a.hiddenByLightbox)a.style.visibility="visible"},attemptBumperEmbed:function(){try{GA_available?this.setReady():this.showAllContent()}catch(a){this.showAllContent()}},trackTimedEvent:function(a){if(this._track_events)try{var b=typeof ls=="undefined"?this._startTime:
ls,c=(new Date).getTime()-b;if(typeof pageTracker!="undefined")pageTracker._trackEvent("LoadTime",a,this._game_title,c);else if(GA_available){this._events.push([a,c]);if(!this._events_interval)this._events_interval=setInterval(this.submitEvents.bind(this),1E3)}}catch(e){}},submitEvents:function(){if(typeof pageTracker!="undefined"){clearInterval(this._events_interval);try{for(var a=0;a<this._events.length;a++){var b=this._events[a];pageTracker._trackEvent("LoadTime",b[0],this._game_title,b[1])}}catch(c){}this._events=
[]}}};function embedAd(a){bumper.embedAd(a)};var Cookie={set:function(a,b,c,e){a=escape(a)+"="+escape(b||"");if(c!==undefined){b=new Date;b.setTime(b.getTime()+864E5*parseFloat(c));a+="; expires="+b.toGMTString()}if(e)a+="; path="+e;return document.cookie=a},get:function(a){return(a=document.cookie.match(new RegExp("(^|;)\\s*"+escape(a)+"=([^;\\s]*)")))?unescape(a[2].gsub(/\+/,"%20")):null},erase:function(a,b){var c=Cookie.get(a)||true;Cookie.set(a,"",-1,b);return c},accept:function(){if(typeof navigator.cookieEnabled=="boolean")return navigator.cookieEnabled;
Cookie.set("_test","1");return Cookie.erase("_test")==="1"}};if(Object.isUndefined(Effect))throw"dragdrop.js requires including script.aculo.us' effects.js library";
var Droppables={drops:[],remove:function(a){this.drops=this.drops.reject(function(b){return b.element==$(a)})},add:function(a,b){a=$(a);var c=Object.extend({greedy:true,hoverclass:null,tree:false},b||{});if(c.containment){c._containers=[];b=c.containment;Object.isArray(b)?b.each(function(e){c._containers.push($(e))}):c._containers.push($(b))}if(c.accept)c.accept=[c.accept].flatten();Element.makePositioned(a);c.element=a;this.drops.push(c)},findDeepestChild:function(a){deepest=a[0];for(i=1;i<a.length;++i)if(Element.isParent(a[i].element,
deepest.element))deepest=a[i];return deepest},isContained:function(a,b){var c;c=b.tree?a.treeNode:a.parentNode;return b._containers.detect(function(e){return c==e})},isAffected:function(a,b,c){return c.element!=b&&(!c._containers||this.isContained(b,c))&&(!c.accept||Element.classNames(b).detect(function(e){return c.accept.include(e)}))&&Position.within(c.element,a[0],a[1])},deactivate:function(a){a.hoverclass&&Element.removeClassName(a.element,a.hoverclass);this.last_active=null},activate:function(a){a.hoverclass&&
Element.addClassName(a.element,a.hoverclass);this.last_active=a},show:function(a,b){if(this.drops.length){var c,e=[];this.drops.each(function(f){Droppables.isAffected(a,b,f)&&e.push(f)});if(e.length>0)c=Droppables.findDeepestChild(e);this.last_active&&this.last_active!=c&&this.deactivate(this.last_active);if(c){Position.within(c.element,a[0],a[1]);c.onHover&&c.onHover(b,c.element,Position.overlap(c.overlap,c.element));c!=this.last_active&&Droppables.activate(c)}}},fire:function(a,b){if(this.last_active){Position.prepare();
if(this.isAffected([Event.pointerX(a),Event.pointerY(a)],b,this.last_active))if(this.last_active.onDrop){this.last_active.onDrop(b,this.last_active.element,a);return true}}},reset:function(){this.last_active&&this.deactivate(this.last_active)}},Draggables={drags:[],observers:[],register:function(a){if(this.drags.length==0){this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.updateDrag.bindAsEventListener(this);this.eventKeypress=this.keyPress.bindAsEventListener(this);
Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);Event.observe(document,"keypress",this.eventKeypress)}this.drags.push(a)},unregister:function(a){this.drags=this.drags.reject(function(b){return b==a});if(this.drags.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);Event.stopObserving(document,"keypress",this.eventKeypress)}},activate:function(a){if(a.options.delay)this._timeout=
setTimeout(function(){Draggables._timeout=null;window.focus();Draggables.activeDraggable=a}.bind(this),a.options.delay);else{window.focus();this.activeDraggable=a}},deactivate:function(){this.activeDraggable=null},updateDrag:function(a){if(this.activeDraggable){var b=[Event.pointerX(a),Event.pointerY(a)];if(!(this._lastPointer&&this._lastPointer.inspect()==b.inspect())){this._lastPointer=b;this.activeDraggable.updateDrag(a,b)}}},endDrag:function(a){if(this._timeout){clearTimeout(this._timeout);this._timeout=
null}if(this.activeDraggable){this._lastPointer=null;this.activeDraggable.endDrag(a);this.activeDraggable=null}},keyPress:function(a){this.activeDraggable&&this.activeDraggable.keyPress(a)},addObserver:function(a){this.observers.push(a);this._cacheObserverCallbacks()},removeObserver:function(a){this.observers=this.observers.reject(function(b){return b.element==a});this._cacheObserverCallbacks()},notify:function(a,b,c){this[a+"Count"]>0&&this.observers.each(function(e){e[a]&&e[a](a,b,c)});b.options[a]&&
b.options[a](b,c)},_cacheObserverCallbacks:function(){["onStart","onEnd","onDrag"].each(function(a){Draggables[a+"Count"]=Draggables.observers.select(function(b){return b[a]}).length})}},Draggable=Class.create({initialize:function(a,b){var c={handle:false,reverteffect:function(e,f,g){var h=Math.sqrt(Math.abs(f^2)+Math.abs(g^2))*0.02;new Effect.Move(e,{x:-g,y:-f,duration:h,queue:{scope:"_draggable",position:"end"}})},endeffect:function(e){var f=Object.isNumber(e._opacity)?e._opacity:1;new Effect.Opacity(e,
{duration:0.2,from:0.7,to:f,queue:{scope:"_draggable",position:"end"},afterFinish:function(){Draggable._dragging[e]=false}})},zindex:1E3,revert:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};if(!b||Object.isUndefined(b.endeffect))Object.extend(c,{starteffect:function(e){e._opacity=Element.getOpacity(e);Draggable._dragging[e]=true;new Effect.Opacity(e,{duration:0.2,from:e._opacity,to:0.7})}});b=Object.extend(c,b||{});this.element=$(a);if(b.handle&&Object.isString(b.handle))this.handle=
this.element.down("."+b.handle,0);if(!this.handle)this.handle=$(b.handle);if(!this.handle)this.handle=this.element;if(b.scroll&&!b.scroll.scrollTo&&!b.scroll.outerHTML){b.scroll=$(b.scroll);this._isScrollChild=Element.childOf(this.element,b.scroll)}Element.makePositioned(this.element);this.options=b;this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this)},destroy:function(){Event.stopObserving(this.handle,
"mousedown",this.eventMouseDown);Draggables.unregister(this)},currentDelta:function(){return[parseInt(Element.getStyle(this.element,"left")||"0"),parseInt(Element.getStyle(this.element,"top")||"0")]},initDrag:function(a){if(!(!Object.isUndefined(Draggable._dragging[this.element])&&Draggable._dragging[this.element]))if(Event.isLeftClick(a))if(!((tag_name=Event.element(a).tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA"))){var b=
[Event.pointerX(a),Event.pointerY(a)],c=Position.cumulativeOffset(this.element);this.offset=[0,1].map(function(e){return b[e]-c[e]});Draggables.activate(this);Event.stop(a)}},startDrag:function(a){this.dragging=true;if(!this.delta)this.delta=this.currentDelta();if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,"z-index")||0);this.element.style.zIndex=this.options.zindex}if(this.options.ghosting){this._clone=this.element.cloneNode(true);(this._originallyAbsolute=this.element.getStyle("position")==
"absolute")||Position.absolutize(this.element);this.element.parentNode.insertBefore(this._clone,this.element)}if(this.options.scroll)if(this.options.scroll==window){var b=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=b.left;this.originalScrollTop=b.top}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop}Draggables.notify("onStart",this,a);this.options.starteffect&&this.options.starteffect(this.element)},updateDrag:function(a,
b){this.dragging||this.startDrag(a);if(!this.options.quiet){Position.prepare();Droppables.show(b,this.element)}Draggables.notify("onDrag",this,a);this.draw(b);this.options.change&&this.options.change(this);if(this.options.scroll){this.stopScrolling();var c;if(this.options.scroll==window)with(this._getWindowScroll(this.options.scroll))c=[left,top,left+width,top+height];else{c=Position.page(this.options.scroll);c[0]+=this.options.scroll.scrollLeft+Position.deltaX;c[1]+=this.options.scroll.scrollTop+
Position.deltaY;c.push(c[0]+this.options.scroll.offsetWidth);c.push(c[1]+this.options.scroll.offsetHeight)}var e=[0,0];if(b[0]<c[0]+this.options.scrollSensitivity)e[0]=b[0]-(c[0]+this.options.scrollSensitivity);if(b[1]<c[1]+this.options.scrollSensitivity)e[1]=b[1]-(c[1]+this.options.scrollSensitivity);if(b[0]>c[2]-this.options.scrollSensitivity)e[0]=b[0]-(c[2]-this.options.scrollSensitivity);if(b[1]>c[3]-this.options.scrollSensitivity)e[1]=b[1]-(c[3]-this.options.scrollSensitivity);this.startScrolling(e)}Prototype.Browser.WebKit&&
window.scrollBy(0,0);Event.stop(a)},finishDrag:function(a,b){this.dragging=false;if(this.options.quiet){Position.prepare();var c=[Event.pointerX(a),Event.pointerY(a)];Droppables.show(c,this.element)}if(this.options.ghosting){this._originallyAbsolute||Position.relativize(this.element);delete this._originallyAbsolute;Element.remove(this._clone);this._clone=null}c=false;if(b)(c=Droppables.fire(a,this.element))||(c=false);c&&this.options.onDropped&&this.options.onDropped(this.element);Draggables.notify("onEnd",
this,a);if((a=this.options.revert)&&Object.isFunction(a))a=a(this.element);b=this.currentDelta();if(a&&this.options.reverteffect){if(c==0||a!="failure")this.options.reverteffect(this.element,b[1]-this.delta[1],b[0]-this.delta[0])}else this.delta=b;if(this.options.zindex)this.element.style.zIndex=this.originalZ;this.options.endeffect&&this.options.endeffect(this.element);Draggables.deactivate(this);Droppables.reset()},keyPress:function(a){if(a.keyCode==Event.KEY_ESC){this.finishDrag(a,false);Event.stop(a)}},
endDrag:function(a){if(this.dragging){this.stopScrolling();this.finishDrag(a,true);Event.stop(a)}},draw:function(a){var b=Position.cumulativeOffset(this.element);if(this.options.ghosting){var c=Position.realOffset(this.element);b[0]+=c[0]-Position.deltaX;b[1]+=c[1]-Position.deltaY}c=this.currentDelta();b[0]-=c[0];b[1]-=c[1];if(this.options.scroll&&this.options.scroll!=window&&this._isScrollChild){b[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;b[1]-=this.options.scroll.scrollTop-this.originalScrollTop}c=
[0,1].map(function(f){return a[f]-b[f]-this.offset[f]}.bind(this));if(this.options.snap)c=Object.isFunction(this.options.snap)?this.options.snap(c[0],c[1],this):Object.isArray(this.options.snap)?c.map(function(f,g){return(f/this.options.snap[g]).round()*this.options.snap[g]}.bind(this)):c.map(function(f){return(f/this.options.snap).round()*this.options.snap}.bind(this));var e=this.element.style;if(!this.options.constraint||this.options.constraint=="horizontal")e.left=c[0]+"px";if(!this.options.constraint||
this.options.constraint=="vertical")e.top=c[1]+"px";if(e.visibility=="hidden")e.visibility=""},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;Draggables._lastScrollPointer=null}},startScrolling:function(a){if(a[0]||a[1]){this.scrollSpeed=[a[0]*this.options.scrollSpeed,a[1]*this.options.scrollSpeed];this.lastScrolled=new Date;this.scrollInterval=setInterval(this.scroll.bind(this),10)}},scroll:function(){var a=new Date,b=a-this.lastScrolled;
this.lastScrolled=a;if(this.options.scroll==window)with(this._getWindowScroll(this.options.scroll)){if(this.scrollSpeed[0]||this.scrollSpeed[1]){a=b/1E3;this.options.scroll.scrollTo(left+a*this.scrollSpeed[0],top+a*this.scrollSpeed[1])}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*b/1E3;this.options.scroll.scrollTop+=this.scrollSpeed[1]*b/1E3}Position.prepare();Droppables.show(Draggables._lastPointer,this.element);Draggables.notify("onDrag",this);if(this._isScrollChild){Draggables._lastScrollPointer=
Draggables._lastScrollPointer||$A(Draggables._lastPointer);Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*b/1E3;Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*b/1E3;if(Draggables._lastScrollPointer[0]<0)Draggables._lastScrollPointer[0]=0;if(Draggables._lastScrollPointer[1]<0)Draggables._lastScrollPointer[1]=0;this.draw(Draggables._lastScrollPointer)}this.options.change&&this.options.change(this)},_getWindowScroll:function(a){var b,c,e;with(a.document){if(a.document.documentElement&&
documentElement.scrollTop){b=documentElement.scrollTop;c=documentElement.scrollLeft}else if(a.document.body){b=body.scrollTop;c=body.scrollLeft}if(a.innerWidth){e=a.innerWidth;a=a.innerHeight}else if(a.document.documentElement&&documentElement.clientWidth){e=documentElement.clientWidth;a=documentElement.clientHeight}else{e=body.offsetWidth;a=body.offsetHeight}}return{top:b,left:c,width:e,height:a}}});Draggable._dragging={};
var SortableObserver=Class.create({initialize:function(a,b){this.element=$(a);this.observer=b;this.lastValue=Sortable.serialize(this.element)},onStart:function(){this.lastValue=Sortable.serialize(this.element)},onEnd:function(){Sortable.unmark();this.lastValue!=Sortable.serialize(this.element)&&this.observer(this.element)}}),Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(a){for(;a.tagName.toUpperCase()!="BODY";){if(a.id&&Sortable.sortables[a.id])return a;
a=a.parentNode}},options:function(a){if(a=Sortable._findRootElement($(a)))return Sortable.sortables[a.id]},destroy:function(a){a=$(a);if(a=Sortable.sortables[a.id]){Draggables.removeObserver(a.element);a.droppables.each(function(b){Droppables.remove(b)});a.draggables.invoke("destroy");delete Sortable.sortables[a.element.id]}},create:function(a,b){a=$(a);var c=Object.extend({element:a,tag:"li",dropOnEmpty:false,tree:false,treeTag:"ul",overlap:"vertical",constraint:"vertical",containment:a,handle:false,
only:false,delay:0,hoverclass:null,ghosting:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:this.SERIALIZE_RULE,elements:false,handles:false,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},b||{});this.destroy(a);var e={revert:true,quiet:c.quiet,scroll:c.scroll,scrollSpeed:c.scrollSpeed,scrollSensitivity:c.scrollSensitivity,delay:c.delay,ghosting:c.ghosting,constraint:c.constraint,handle:c.handle};if(c.starteffect)e.starteffect=c.starteffect;if(c.reverteffect)e.reverteffect=
c.reverteffect;else if(c.ghosting)e.reverteffect=function(h){h.style.top=0;h.style.left=0};if(c.endeffect)e.endeffect=c.endeffect;if(c.zindex)e.zindex=c.zindex;var f={overlap:c.overlap,containment:c.containment,tree:c.tree,hoverclass:c.hoverclass,onHover:Sortable.onHover},g={onHover:Sortable.onEmptyHover,overlap:c.overlap,containment:c.containment,hoverclass:c.hoverclass};Element.cleanWhitespace(a);c.draggables=[];c.droppables=[];if(c.dropOnEmpty||c.tree){Droppables.add(a,g);c.droppables.push(a)}(c.elements||
this.findElements(a,c)||[]).each(function(h,j){j=c.handles?$(c.handles[j]):c.handle?$(h).select("."+c.handle)[0]:h;c.draggables.push(new Draggable(h,Object.extend(e,{handle:j})));Droppables.add(h,f);if(c.tree)h.treeNode=a;c.droppables.push(h)});if(c.tree)(Sortable.findTreeElements(a,c)||[]).each(function(h){Droppables.add(h,g);h.treeNode=a;c.droppables.push(h)});this.sortables[a.id]=c;Draggables.addObserver(new SortableObserver(a,c.onUpdate))},findElements:function(a,b){return Element.findChildren(a,
b.only,b.tree?true:false,b.tag)},findTreeElements:function(a,b){return Element.findChildren(a,b.only,b.tree?true:false,b.treeTag)},onHover:function(a,b,c){if(!Element.isParent(b,a))if(!(c>0.33&&c<0.66&&Sortable.options(b).tree))if(c>0.5){Sortable.mark(b,"before");if(b.previousSibling!=a){c=a.parentNode;a.style.visibility="hidden";b.parentNode.insertBefore(a,b);b.parentNode!=c&&Sortable.options(c).onChange(a);Sortable.options(b.parentNode).onChange(a)}}else{Sortable.mark(b,"after");var e=b.nextSibling||
null;if(e!=a){c=a.parentNode;a.style.visibility="hidden";b.parentNode.insertBefore(a,e);b.parentNode!=c&&Sortable.options(c).onChange(a);Sortable.options(b.parentNode).onChange(a)}}},onEmptyHover:function(a,b,c){var e=a.parentNode,f=Sortable.options(b);if(!Element.isParent(b,a)){var g=Sortable.findElements(b,{tag:f.tag,only:f.only}),h=null;if(g){var j=Element.offsetSize(b,f.overlap)*(1-c);for(c=0;c<g.length;c+=1)if(j-Element.offsetSize(g[c],f.overlap)>=0)j-=Element.offsetSize(g[c],f.overlap);else{h=
j-Element.offsetSize(g[c],f.overlap)/2>=0?c+1<g.length?g[c+1]:null:g[c];break}}b.insertBefore(a,h);Sortable.options(e).onChange(a);f.onChange(a)}},unmark:function(){Sortable._marker&&Sortable._marker.hide()},mark:function(a,b){var c=Sortable.options(a.parentNode);if(!(c&&!c.ghosting)){if(!Sortable._marker){Sortable._marker=($("dropmarker")||Element.extend(document.createElement("DIV"))).hide().addClassName("dropmarker").setStyle({position:"absolute"});document.getElementsByTagName("body").item(0).appendChild(Sortable._marker)}var e=
Position.cumulativeOffset(a);Sortable._marker.setStyle({left:e[0]+"px",top:e[1]+"px"});if(b=="after")c.overlap=="horizontal"?Sortable._marker.setStyle({left:e[0]+a.clientWidth+"px"}):Sortable._marker.setStyle({top:e[1]+a.clientHeight+"px"});Sortable._marker.show()}},_tree:function(a,b,c){for(var e=Sortable.findElements(a,b)||[],f=0;f<e.length;++f){var g=e[f].id.match(b.format);if(g){g={id:encodeURIComponent(g?g[1]:null),element:a,parent:c,children:[],position:c.children.length,container:$(e[f]).down(b.treeTag)};
g.container&&this._tree(g.container,b,g);c.children.push(g)}}return c},tree:function(a,b){a=$(a);var c=this.options(a);b=Object.extend({tag:c.tag,treeTag:c.treeTag,only:c.only,name:a.id,format:c.format},b||{});return Sortable._tree(a,b,{id:null,parent:null,children:[],container:a,position:0})},_constructIndex:function(a){var b="";do if(a.id)b="["+a.position+"]"+b;while((a=a.parent)!=null);return b},sequence:function(a,b){a=$(a);var c=Object.extend(this.options(a),b||{});return $(this.findElements(a,
c)||[]).map(function(e){return e.id.match(c.format)?e.id.match(c.format)[1]:""})},setSequence:function(a,b,c){a=$(a);var e=Object.extend(this.options(a),c||{}),f={};this.findElements(a,e).each(function(g){if(g.id.match(e.format))f[g.id.match(e.format)[1]]=[g,g.parentNode];g.parentNode.removeChild(g)});b.each(function(g){var h=f[g];if(h){h[1].appendChild(h[0]);delete f[g]}})},serialize:function(a,b){a=$(a);var c=Object.extend(Sortable.options(a),b||{}),e=encodeURIComponent(b&&b.name?b.name:a.id);return c.tree?
Sortable.tree(a,b).children.map(function(f){return[e+Sortable._constructIndex(f)+"[id]="+encodeURIComponent(f.id)].concat(f.children.map(arguments.callee))}).flatten().join("&"):Sortable.sequence(a,b).map(function(f){return e+"[]="+encodeURIComponent(f)}).join("&")}};Element.isParent=function(a,b){if(!a.parentNode||a==b)return false;if(a.parentNode==b)return true;return Element.isParent(a.parentNode,b)};
Element.findChildren=function(a,b,c,e){if(!a.hasChildNodes())return null;e=e.toUpperCase();if(b)b=[b].flatten();var f=[];$A(a.childNodes).each(function(g){if(g.tagName&&g.tagName.toUpperCase()==e&&(!b||Element.classNames(g).detect(function(h){return b.include(h)})))f.push(g);if(c)(g=Element.findChildren(g,b,c,e))&&f.push(g)});return f.length>0?f.flatten():[]};Element.offsetSize=function(a,b){return a["offset"+(b=="vertical"||b=="height"?"Height":"Width")]};var FacebookWidgetLoader={load:function(){var a=new Template('<iframe src="http://www.facebook.com/plugins/#{widget_type}.php?site=kongregate.com&amp;width=297&amp;height=350&amp;header=true&amp;colorscheme=light scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:297px; height:350px"></iframe>'),b=Cookie.get("kong_fbwn"),c=location.search.parseQuery();if(c.fb_widget&&("recommendations"==c.fb_widget||"activity"==c.fb_widget))b=c.fb_widget;if(b&&"news_section"!=
b){$("facebook_content_holder").update(a.evaluate({widget_type:b}));$("facebook_content_holder").show()}else $("kongregate_announcements").show()}};function FlashMessages(a){this.initialize(a)}FlashMessages.DISPLAY_TEMPLATE=new Template('<div class="sitemessage"><h2>#{message}</h2></div>');FlashMessages.TRACKING_CODE_EVENT_CATEGORIES={games:"GameSubmission",accounts:"Registration",sessions:"Sessions"};
FlashMessages.prototype={initialize:function(a){this._messages_node=$("global");this._insertMessages();this._pageTracker=a.pageTracker;this._reported_tracking_codes={};this.reportTrackingCode()},data:function(){this._getDataFromCookie();return this._data},reportTrackingCode:function(){this._reportTrackingCodeWithPageView();this._reportTrackingCodeWithoutPageView()},_getDataFromCookie:function(){var a=Cookie.get("kong_flash_messages");if(a){a=a.evalJSON();if(this._data)Object.extend(this._data,a);
else this._data=a}this._clearCookie()},_insertMessages:function(){if(this._messages_node)this._messages_node.innerHTML=this.data().messages.map(function(a){return FlashMessages.DISPLAY_TEMPLATE.evaluate({message:a})}).join()},_clearCookie:function(){Cookie.erase("kong_flash_messages")},_reportTrackingCodeWithPageView:function(){this._reportTrackingCodeWithReporter(this.data().tracking_code,function(a){this._pageTracker._trackPageview(a);(a=this._eventDataForTrackingCode(a))&&this._pageTracker._trackEvent(a[0],
a[1])});this._data.tracking_code=undefined},_reportTrackingCodeWithoutPageView:function(){this._reportTrackingCodeWithReporter(this.data().minor_tracking_code,function(a){(a=this._eventDataForTrackingCode(a))&&this._pageTracker._trackEvent(a[0],a[1])});this._data.minor_tracking_code=undefined},_reportTrackingCodeWithReporter:function(a,b){if(a&&this._pageTracker){var c=(new Date).getTime(),e=this._reported_tracking_codes[a];if(!e||c-e>15E3){this._reported_tracking_codes[a]=c;b.bind(this)(a)}}},_eventDataForTrackingCode:function(a){if(!a)return null;
if((a=a.match(/^\/([^\/]*)\/(.*)$/))&&3==a.length)return[FlashMessages.TRACKING_CODE_EVENT_CATEGORIES[a[1]],a[2]]}};var FormRow=Class.create({initialize:function(a,b,c,e,f){this._formCallback=f;this._tr=new Element("tr");this._tr.appendChild(this._createFieldNameColumn(b,c));this._tr.appendChild(this._createInputColumn(c,e));this._helpColumn=this._createHelpColumn(c);this._tr.appendChild(this._helpColumn);this._focusHandlers=[];this.getInputElements().each(function(g){g.onfocus=this._callAllOnFocusHandlers.bind(this);g.onblur=this._callAllOnBlurHandlers.bind(this)}.bind(this));this._hasValidInput=false;this._setInputValidityTrue=
function(){this.setInputValidity(true)}.bind(this);this._setInputValidityFalse=function(){this.setInputValidity(false)}.bind(this)},hasValidInput:function(){return this._hasValidInput},setInputValidity:function(a){this._hasValidInput=a;this._formCallback()},_callAllOnFocusHandlers:function(){for(var a=0;a<this._focusHandlers.length;a++)if(this._focusHandlers[a].onFocus())break},_callAllOnBlurHandlers:function(){for(var a=0;a<this._focusHandlers.length;a++)if(this._focusHandlers[a].onBlur())break},
getElement:function(){return this._tr},getInputElements:function(){return[this.getColumn(1).childNodes[0]]},getInputValue:function(){return this.getColumn(1).childNodes[0].value},getHelpElement:function(){return this.getColumn(2)},getColumn:function(a){return this._tr.childNodes[a]},addFocusHandler:function(a){this._focusHandlers.push(a)},focusHandlerCount:function(){return this._focusHandlers.length},_createFieldNameColumn:function(a,b){var c=new Element("td");c.innerHTML='<label for="kred_package_credit_card_purchase_'+
b+'">'+a+"</label>";c.className="purchase_label";return c},_createInputColumn:function(a,b){var c=new Element("td");c.className="purchase_input";this._inputElement=new Element("input");this._inputElement.id="kred_package_credit_card_purchase_"+a;this._inputElement.name="kred_package_credit_card_purchase["+a+"]";this._inputElement.size=30;this._inputElement.value=b?b:"";c.appendChild(this._inputElement);return c},_createHelpColumn:function(a){var b=new Element("td");b.id=a+"_help";return b}}),FormNonEmptyRow=
Class.create(FormRow,{initialize:function($super,b,c,e,f,g,h,j){$super(b,c,e,g,h);j&&this.getInputElements().each(function(n){n.onkeyup=function(){this.getInputValue()!=""&&this._callAllOnBlurHandlers()}.bind(this)}.bind(this));this.addFocusHandler(new NonEmptyInputFocusHandler(this,"can't be blank",this._setInputValidityFalse));this._validInputCallbackFocusHandler=new ValidInputCallbackFocusHandler(this,this._setInputValidityTrue);this.addFocusHandler(this._validInputCallbackFocusHandler);this.addFocusHandler(new HelpTextFocusHandler(this,
f))}}),FormCanBeEmptyRow=Class.create(FormRow,{initialize:function($super,b,c,e,f,g,h){$super(b,c,e,g,h);this._hasValidInput=true;this.addFocusHandler(new HelpTextFocusHandler(this,f))}}),FormCreditCardNumberRow=Class.create(FormRow,{initialize:function($super,b,c,e,f,g,h){$super(b,c,e,f,g);this.addFocusHandler(new NonEmptyInputFocusHandler(this,"can't be blank",this._setInputValidityFalse));this._ccNumberFocusHandler=new CreditCardValidationFocusHandler(this,"invalid account number",this._setInputValidityFalse);
this.addFocusHandler(this._ccNumberFocusHandler);this._validInputCallbackFocusHandler=new ValidInputCallbackFocusHandler(this,h,this._setInputValidityFalse);this.addFocusHandler(this._validInputCallbackFocusHandler);this._validInputCallbackFocusHandler=new ValidInputCallbackFocusHandler(this,this._setInputValidityTrue);this.addFocusHandler(this._validInputCallbackFocusHandler);b=new Element("img");b.src="/images/creditcard_marks.png";this._helpCreditCardFocusHandler=new HelpCreditCardFocusHandler(this,
b);this.addFocusHandler(this._helpCreditCardFocusHandler)},getCreditCardType:function(){return this._ccNumberFocusHandler.getCreditCardType()},getInputValue:function(){return this.getColumn(1).childNodes[0].value.replace(/\s+/g,"")}}),FormCvvRow=Class.create(FormRow,{initialize:function($super,b,c,e,f,g){$super(b,c,e,f,g);this.addFocusHandler(new NonEmptyInputFocusHandler(this,"can't be blank",this._setInputValidityFalse));this._cvvValidationFocusHandler=new CvvValidationFocusHandler(this,this._setInputValidityFalse);
this.addFocusHandler(this._cvvValidationFocusHandler);this._validInputCallbackFocusHandler=new ValidInputCallbackFocusHandler(this,this._setInputValidityTrue);this.addFocusHandler(this._validInputCallbackFocusHandler);this._helpTextFocusHandler=new HelpTextFocusHandler(this,"");this.addFocusHandler(this._helpTextFocusHandler)},setCreditCardType:function(a){this._cvvValidationFocusHandler.setCreditCardType(a);var b="";b=a=="american_express"?"Please enter the four digit code that's printed on the front of your card, just to the right of the account number.":
"Please enter the last three digits printed on the signature line on the back side of your card.";this._helpTextFocusHandler.setText(b)}}),FormExpirationDateRow=Class.create(FormRow,{initialize:function($super,b,c,e,f,g,h,j,n){this._formCallback=n;this._monthHTML=f;this._yearHTML=g;this._defaultMonth=h;this._defaultYear=j;$super(b,c,e+"cc_month","",n);this.addFocusHandler(new CompleteDateValidationFocusHandler(this,"month &amp; year are required",this._setInputValidityFalse));this.addFocusHandler(new FutureDateValidationFocusHandler(this,
"date must be in the future",this._setInputValidityFalse));this._validInputCallbackFocusHandler=new ValidInputCallbackFocusHandler(this,this._setInputValidityTrue);this.addFocusHandler(this._validInputCallbackFocusHandler);this.addFocusHandler(new HelpTextFocusHandler(this,""))},_createInputColumn:function(){var a=new Element("td");a.addClassName("purchase_input");Element.insert(a,this._monthHTML);a.childNodes[0].value=this._defaultMonth;Element.insert(a,this._yearHTML);a.childNodes[1].value=this._defaultYear;
return a},_createSelect:function(a){var b=new Element("select");b.id="kred_package_credit_card_purchase_"+a;b.name="kred_package_credit_card_purchase["+a+"]";b.size=30;return b},getInputElements:function(){return[this.getColumn(1).childNodes[0],this.getColumn(1).childNodes[1]]},getInputValue:function(){return this.getColumn(1).childNodes[0].value+"/"+this.getColumn(1).childNodes[1].value},setMonthInput:function(a){this.getColumn(1).childNodes[0].selectedIndex=a},setYearInput:function(a){this.getColumn(1).childNodes[1].selectedIndex=
a}});function evalJS(a){eval(a)}function updateTaskProgress(a,b){try{$(a+"-progress-amount").update(b)}catch(c){console.warn("error during updateTaskProgress on %s to %s",a,b)}}function markTaskComplete(a){try{Element.addClassName(a,"complete");Element.removeClassName(a,"incomplete");$(a+"-progress")&&Element.hide(a+"-progress");new Effect.Highlight(a,{})}catch(b){console.warn("error during markTaskComplete on %s",a)}}
function markAccomplishmentComplete(a){try{Element.addClassName(a,"complete");Element.removeClassName(a,"incomplete");new Effect.Highlight(a,{})}catch(b){console.warn("error during markAccomplishmentComplete on %s",a)}};var GameBrowser={highlightCurrentSidebarItem:function(a){(a=$("browser-sidebar-"+a))&&a.addClassName("active")}};var GameMetricsUpdater=function(){return{update:function(){new Ajax.Request(active_user.gameResourcePath()+"/metrics.json",{method:"get",onSuccess:function(a){a=a.responseJSON;[[".favorites_count",a.favorites_count_with_delimiter],[".gameplays_count",a.gameplays_count_with_delimiter],[".average_rating",a.average_rating_text],["#rating_message",a.rating_message],["#below_game_rating_message",a.below_game_rating_message],["#star_ratings_block",a.user_rating],["#below_game_star_ratings_block",a.below_game_user_rating],
[".flag_game",a.flagged],["#favorite_game",a.favorite_message],["#below_game_favorite_game",a.below_game_favorite_message],["#quicklinks_favorite_block",a.quicklinks_favorite_message],["#user_donation_holder",a.last_tip_message]].each(function(b){var c=b[0],e=b[1];e&&$$(c).each(function(f){f.update(e)})})},onFailure:function(a){console.error("Error loading game metrics: %o",a.responseText)}})}}}();function ImageSwitcher(a){this.initialize(a)}
ImageSwitcher.prototype={initialize:function(a){var b=this;this._image_ids=a.image_ids;this._current_image=this._image_ids.first();this._current_text=this.makeTextId(this._current_image);document.observe("dom:loaded",function(){b._image_ids.each(function(c){$(b.makeTextId(c)).observe("mouseover",b.switchFunction(c))})})},switchFunction:function(a){var b=this;return function(){$(b._current_image).hide();$(b._current_text).removeClassName("selected");b._current_image=a;b._current_text=b.makeTextId(a);
$(b._current_image).show();$(b._current_text).addClassName("selected")}},makeTextId:function(a){return a+"Text"}};function showTrailerPopup(a){window.open(a,"","width=520,height=400,status=no,resizable=no,scrollbars=no")};function KredPackagePicker(a){this.initialize(a)}
KredPackagePicker.prototype={initialize:function(a){this._kred_packages=a.kred_packages;this._active_user=a.active_user;this._purchase_methods={};this._package_purchase_selected_callbacks={};this._payment_options_selected_callbacks={};this._kav_required=a.kav_required;this._package_choices_node=null;this._zong_packages={};this._required_kreds=a.required_kreds;this._current_balance=a.current_balance;this._thank_you_button_iframe_url=a.thank_you_url;this._has_stored_cc=a.has_stored_cc;this._blocked_for_cc=
a.blocked_for_cc;a=this._required_kreds-this._current_balance;this._kred_deficit=a>0?a:0;this._payment_option_selected=false},customPackageVariables:function(){return Object.toQueryString({uid:this._active_user.id(),kpid:this._selected_kred_package.id})},returnToSelectPackage:function(){this.selectPaymentOption(this._selected_payment_option)},returnToSelectPaymentMethod:function(){$$(".zong_package").each(Element.remove);$$(".kred_flow_step").each(Element.hide);$$("#stored_cc_direct_form").each(Element.hide);
$("payment_method_selection").show();$("common_choose_other_payment_link").show();$("blocked_for_cc_message").hide();this.recordAnalyticsPageview("/kred_lightbox/payment_selection")},checkIfVerificationRequired:function(){if(this._kav_required){window.location="/accounts/"+active_user.username()+"/kred_account_verification/edit";return true}},hideKredFlow:function(){$$(".kred_flow_step").each(Element.hide)},addPurchaseMethod:function(a){this._purchase_methods[a.preselect_param]=a},showPreselectedPaymentOption:function(a){if(a=
this._purchase_methods[a])this.selectPaymentOption(a);else this._payment_option_selected||$("payment_method_selection").show()},selectPaymentOption:function(a){this._payment_option_selected=true;if(!this.checkIfVerificationRequired()){this.hideKredFlow();this._selected_payment_option=a;this.recordSelectedPaymentOptionAnalytics(a);$$(".kred_purchase_method_name").each(function(c){c.update(a.name)});if("UgcTransaction"==a.purchase_record_class||"OfferpalTransaction"==a.purchase_record_class)this.showPurchaseForm();
else if("ZongTransaction"==a.purchase_record_class){0===$$(".zong_package_input").length?this.loadZongPackages():$("zong_country_code_form").show();this.showPurchaseForm()}else"KredPackageCreditCardPurchase"==a.purchase_record_class&&this._blocked_for_cc?$("blocked_for_cc_message").show():this.showPackageSelection(a);a.purchase_record_class.match(/Paypal|CreditCard|Paysafe/)?$("kred_packages_choices_div").addClassName("kred_sale_purchase_method"):$("kred_packages_choices_div").removeClassName("kred_sale_purchase_method");
var b=this._payment_options_selected_callbacks[a.purchase_record_class];b&&b.each(function(c){c(a)})}},recordSelectedPaymentOptionAnalytics:function(a){a=a.preselect_param;if("mobile"==a)a="zong";if("game_card"==a)this.recordAnalyticsPageview("/kred_lightbox/ugc/code_entry");else"offers"==a?this.recordAnalyticsPageview("/kred_lightbox/offerpal/iframe"):this.recordAnalyticsPageview("/kred_lightbox/"+a+"/package_selection")},loadZongPackages:function(){$("zong_transaction_country_code").form.onsubmit()},
showZongPackageSelection:function(a){this.hidePackageSelection();$("common_choose_other_payment_link").hide();this._zong_packages={};a.each(function(c){this._zong_packages[c.id]=c;c.additional_classes="zong_package";c.additional_input_classes="zong_package_input";this.addPackage(c)}.bind(this));var b=$F("zong_transaction_country_code");$("selected_country").update($("zong_transaction_country_code").down("[value="+b+"]").innerHTML);this.showPackageSelection({kred_package_ids:a.pluck("id"),purchase_record_class:"ZongTransaction"})},
addPackage:function(a){if(this._package_choices_node===null)this._package_choices_node=$("kred_package_choices_ul");var b=null;b="kred_package_template";if(a.package_template_id)b=a.package_template_id;b=new Template($(b).innerHTML);this._package_choices_node.insert(b.evaluate(a),{position:"bottom"});a.special_info&&$("kred_package_special_info_"+a.id).update(a.special_info);a.kred_bonus&&$("kred_bonus_info_"+a.id).show()},showPackageSelection:function(a){var b=this.recommendPackage(a),c=$("kred_package_selection");
this.hidePackageSelection();a.kred_package_ids.each(function(f){$("kred_package_"+f).show();$("kred_package_radio_"+f).checked=f==b});c.show();var e=c.down(".purchase-method-specific");a=c.down(".purchase-method-specific."+a.purchase_record_class);e&&e.hide();a&&a.show()},kredDeficit:function(){return this._kred_deficit},kredPackageById:function(a){return this._kred_packages.find(function(b){return b.id==a})||this._zong_packages[a]},recommendPackage:function(a){if(!this.kredDeficit())return this.defaultRecommendation(a);
return a.kred_package_ids.find(function(b){return(b=this.kredPackageById(b))&&b.kred_amount>=this.kredDeficit()}.bind(this))||this.defaultRecommendation(a)},defaultRecommendation:function(a){return a.preferred_kred_package_id||a.kred_package_ids.last()},hidePackageSelection:function(){$$(".kred_package").each(Element.hide)},selectPackage:function(){$$(".kred_flow_step").each(Element.hide);var a=this._selected_payment_option;this.recordSelectedPackageAnalytics(a);var b=a.kred_package_ids.find(function(f){return $("kred_package_radio_"+
f).checked}),c=this._kred_packages.find(function(f){return f.id==b}),e=this._package_purchase_selected_callbacks[this._selected_payment_option.purchase_record_class];if("ZongTransaction"==a.purchase_record_class){e&&e.each(function(f){f(c)});this.selectZongPackage()}else{this._selected_kred_package=c;this.populateFormValuesAndSummaries(c);e&&e.each(function(f){f(c)});this.showPurchaseForm()}},recordSelectedPackageAnalytics:function(a){var b;if("KredPackageCreditCardPurchase"==a.purchase_record_class)b=
this._has_stored_cc?"/kred_lightbox/credit_card/old_stored_card":"/kred_lightbox/credit_card/form";else if("KredPackagePaypalPurchase"==a.purchase_record_class)b="/kred_lightbox/paypal/waiting_screen";else if("ZongTransaction"==a.purchase_record_class)b="/kred_lightbox/zong/iframe";else if("PaysafeTransaction"==a.purchase_record_class)b="/kred_lightbox/paysafe/iframe";b&&this.recordAnalyticsPageview(b)},populateFormValuesAndSummaries:function(a){var b=this;$$(".kred_purchase_form_kred_package_id").each(function(c){c.value=
a.id});$$(".kred_purchase_form_kred_package_dollar_price").each(function(c){c.value=a.dollar_price});$$(".kred_purchase_form_kred_package_kred_amount").each(function(c){c.value=a.kred_amount});$$(".kred_purchase_form_kred_package_item_name").each(function(c){c.value=a.kred_amount+" Kreds"});$$(".kred_purchase_form_kred_package_custom_package_variables").each(function(c){c.value=b.customPackageVariables()});$$(".kred_purchase_summary_dollar_price").each(function(c){c.update(a.dollar_price)});$$(".kred_purchase_summary_kred_amount").each(function(c){c.update(a.kred_amount)})},
selectZongPackage:function(){var a=this._zong_packages[$$(".zong_package_input").find(function(b){return b.checked}).value];$("zong_iframe").contentWindow.location.replace(a.iframe_url);$("zong_iframe_wrapper").show();$("purchase_method_form_ZongTransaction").show()},showPurchaseForm:function(){$("purchase_method_form_"+this._selected_payment_option.purchase_record_class).show()},ugcTryAgain:function(){$("ugc_postback_failure").hide();$("ugc_form").show();$("ugc_form_spinner").restore();$("ugc_transaction_ugc_pin").value=
"";this.returnToSelectPaymentMethod()},addSelectedPaymentOptionCallback:function(a,b){this._payment_options_selected_callbacks[a]||(this._payment_options_selected_callbacks[a]=[]);this._payment_options_selected_callbacks[a].push(b)},addSelectedPackageCallback:function(a,b){this._package_purchase_selected_callbacks[a]||(this._package_purchase_selected_callbacks[a]=[]);this._package_purchase_selected_callbacks[a].push(b)},displayCurrency:function(a,b){output="";if(["USD","CAD"].include(a))output+="$";
output+=b.toFixed(2);if("USD"!=a)output+=" "+a;return output},hookupStoredPackageSelectorsFor:function(a){var b=this;$$("."+a+"_kred_package_radio").each(function(c){c.checked&&b.selectStoredPaymentTypePackage(c);c.observe("change",function(e){b.selectStoredPaymentTypePackage(e.target)});c.observe("click",function(e){b.selectStoredPaymentTypePackage(e.target)})})},selectStoredPaymentTypePackage:function(a){var b=parseInt(a.value,10);this._selected_kred_package=a=package_picker._kred_packages.find(function(c){return c.id==
b});this.populateFormValuesAndSummaries(a)},setCreditCardAsSelectedPaymentMethod:function(){this._selected_payment_option=this._purchase_methods.credit_card},setPaypalAsSelectedPaymentMethod:function(){this._selected_payment_option=this._purchase_methods.paypal},reportKredPurchase:function(a){this.recordAnalyticsPageview("/purchase/kreds?"+Object.toQueryString(a))},recordAnalyticsPageview:function(a){pageTracker&&pageTracker._trackPageview(a)}};var detect=navigator.userAgent.toLowerCase(),total,thestring,lightbox=Class.create();
lightbox.prototype={yPos:0,xPos:0,initialize:function(a,b){this.wait_for_shutdown=this._activated=false;this.done_class_name="done";if(typeof a=="string"){this.content=a;this.activate()}else{this.content=a.href;a.observer_function=this.activate.bindAsEventListener(this);Event.observe(a,"click",a.observer_function,true);a.onclick=function(){return false}}this._on_close_callbacks=[];b&&this._on_close_callbacks.push(b)},shutdown:function(){if(!this.wait_for_shutdown){this.stopListening();this.deactivate.apply(this,
arguments)}},shutdownWithoutCallbacks:function(){this._on_close_callbacks=[];this.shutdown.apply(this,arguments)},addOnCloseCallback:function(a){if(!this._on_close_callbacks)this._on_close_callbacks=[];this._on_close_callbacks.push(a)},initializeKredTipPurchaseFrame:function(a,b){b&&this.addOnCloseCallback(b);this.addOnCloseCallback(function(){new Ajax.Request(active_user.gamePath()+"/game_tips",{method:"get"})});this.initializeKredPurchaseFrame(a)},initializeKredItemPurchaseFrame:function(a){top.kredPurchaseSuccess=
false;this.addOnCloseCallback(function(b){b=b||{success:false};b.success=!!b.success;try{holodeck.konduit().dispatchEvent({type:"purchase_result",data:b})}catch(c){}});this.initializeKredPurchaseFrame(a)},initializeKredCardCartPurchaseFrame:function(a){this.addOnCloseCallback(function(b){if(b&&b.success)top.location=top.location.href});this.initializeKredPurchaseFrame(a)},initializeKredPurchaseFrame:function(a){if(!this._kongregate_lightbox_wrapper_template)this._kongregate_lightbox_wrapper_template=
new Template($("kongregate_lightbox_wrapper_template").innerHTML);this.staticContent=this._kongregate_lightbox_wrapper_template.evaluate({iframe_src:a});this.done_class_name="kred_purchase";this.activate()},initializeKongregateLightboxFromAjax:function(a,b){b||(b={});if(!this._kongregate_lightbox_wrapper_template_noframe)this._kongregate_lightbox_wrapper_template_noframe=new Template($("kongregate_lightbox_wrapper_template_noframe").innerHTML);this.staticContent=this._kongregate_lightbox_wrapper_template_noframe.evaluate({});
this.staticContentDivUrl=a;this.afterStaticContentLoad=b.afterStaticContentLoad;this.done_class_name=["kred_purchase"].concat(b.done_class_name||[]).join(" ");this.activate()},initializeKredPurchase:function(a){if(active_user.isAuthenticated()){var b=window.location.host,c="https://";if(b.match(/local/)||b.match(/dev/))c="http://";b=c+b+"/kred_package_purchases/new";if(a)b+="?purchase_method="+a;this.initializeKredPurchaseFrame(b)}else this.initializeKongregateLightboxFromAjax("/accounts/new/behind_login",
{done_class_name:"lightbox_login"})},activate:function(a){if($("lightbox"))if(!this._activated){this._activated=true;if(!this.done_class_name)this.done_class_name="done";if(Prototype.Browser.IE){this.getScroll();this.prepareIE("100%","hidden");this.setScroll(0,0);this.hideSelects("hidden")}this.hideHiddenElements();setTimeout(function(){$("lightbox").className="loading";this.displayLightbox("block")}.bind(this),10);a&&typeof a=="object"&&a.stopPropagation&&a.stopPropagation()}},deactivate:function(){if(this._activated){this._activated=
false;this.staticContent=undefined;var a=$("lbContent");a&&a.remove();if(Prototype.Browser.IE){this.setScroll(0,this.yPos);this.prepareIE("auto","auto");this.hideSelects("visible")}this.displayLightbox("none");this.done_class_name="done";this.onClose.apply(this,arguments);this.showHiddenElements();try{holodeck.saveSharedContentFailed()}catch(b){}}},prepareIE:function(a,b){Prototype.Browser.IE6&&$$("html, body").each(function(c){c.setStyle({height:a,overflow:b})})},hideSelects:function(a){selects=
document.getElementsByTagName("select");for(i=0;i<selects.length;i++)selects[i].style.visibility=a},domElementsToHide:function(){return[$("game"),$("gamediv")].concat($$("object")).concat($$(".ad")).select(function(a){return a&&"konduit"!=a.id})},hideHiddenElements:function(){var a=this._dom_elements_actually_hidden=[];this.domElementsToHide().each(function(b){if("visible"==b.getStyle("visibility")){a.push(b);b.setStyle({visibility:"hidden"});b.hiddenByLightbox=true}});this.hideGameInIFrame()},showHiddenElements:function(){if(this._dom_elements_actually_hidden){this._dom_elements_actually_hidden.each(function(a){a.setStyle({visibility:"visible"});
a.hiddenByLightbox=false});this.showGameInIFrame()}},hideGameInIFrame:function(){},showGameInIFrame:function(){},getScroll:function(){if(self.pageYOffset)this.yPos=self.pageYOffset;else if(document.documentElement&&document.documentElement.scrollTop)this.yPos=document.documentElement.scrollTop;else if(document.body)this.yPos=document.body.scrollTop},setScroll:function(a,b){window.scrollTo(a,b)},displayLightbox:function(a){$("overlay").style.display=a;$("lightbox").style.display=a;a!="none"&&this.loadInfo()},
reloadInfo:function(){var a=$("lbContent");if(a){var b=$("lightbox");b.removeClassName("done");b.removeClassName("wide");a.remove();this.loadInfo()}else this.activate()},loadInfo:function(){if(this.staticContent){this.renderContents(this.staticContent);this.staticContent=undefined;if(this.staticContentDivUrl){new Ajax.Request(this.staticContentDivUrl,{method:"get",onComplete:function(a){Element.hide("kongregate_lightbox_spinner");$("lightbox_form").update(a.responseText);this.afterStaticContentLoad&&
this.afterStaticContentLoad();this.afterStaticContentLoad=undefined}.bind(this)});this.staticContentDivUrl=undefined}else{this.afterStaticContentLoad&&this.afterStaticContentLoad();this.afterStaticContentLoad=undefined}}else new Ajax.Request(this.content,{method:"get",parameters:"",onComplete:this.processInfo.bindAsEventListener(this)})},processInfo:function(a){this.renderContents(a.responseText)},renderContents:function(a){a="<div id='lbContent'>"+a+"</div>";var b=$("lbLoadMessage");new Insertion.Before(b,
a);b.hide();$("lightbox").className=this.done_class_name;this.actions()},actions:function(){lbActions=document.getElementsByClassName("lbAction");var a=document.getElementById("username");a&&Prototype.Browser.Gecko&&Prototype.Platform.Macintosh&&a.focus();for(i=0;i<lbActions.length;i++){Event.observe(lbActions[i],"click",this[lbActions[i].rel].bindAsEventListener(this),false);lbActions[i].onclick=function(){return false}}},insert:function(a){link=Event.element(a).parentNode;Element.remove($("lbContent"));
new Ajax.Request(link.href,{method:"post",parameters:"",onComplete:this.processInfo.bindAsEventListener(this)})},toggleRegistration:function(){var a=$("lightbox"),b=$("lightboxlogin"),c=$("lightboxregister"),e,f,g;if(c.style.display=="block"){e="none";f="block";g="kred_purchase lightbox_login"}else{e="block";f="none";g="kred_purchase"}if(b)b.style.display=f;c.style.display=e;a.className=g;if(pageTracker){pageTracker._trackEvent("Registration","begin_create");pageTracker._trackPageview("/accounts/begin_create")}},
onClose:function(){if(this._on_close_callbacks){var a=arguments;this._on_close_callbacks.each(function(b){b.apply(this,a)})}this._on_close_callbacks=[]},stopListening:function(){$$(".lbOn").each(function(a){a.stopObserving("click",a.observer_function,true);a.getElementsBySelector("a").each(function(b){if(b.original_onclick){b.onclick=b.original_onclick;b.original_onclick=null}})})}};
function initialize(){addLightboxMarkup();lbox=document.getElementsByClassName("lbOn");for(i=0;i<lbox.length;i++)valid=new lightbox(lbox[i])}
function addLightboxMarkup(){bod=document.getElementsByTagName("body")[0];overlay=document.createElement("div");overlay.id="overlay";lb=document.createElement("div");lb.id="lightbox";lb.className="loading";lb.innerHTML='<div id="lbLoadMessage"><p><img src="/images/presentation/indicator.gif" class="indicator" style="width: 16px; height: 16px;" /> Loading</p></div>';bod.appendChild(overlay);bod.appendChild(lb)};var NoteWatcher={watch:function(){var a=$("note"),b=$("submit");if(a.value!="")b.enable();else{b.disable();a.focus()}},setFocus:function(){$("note")&&$("note").focus()}};d=document;ndc=[];coc=[];kg=true;function zelph_onDOMload(a,b){es=zelph_getElementsBySelector(a);if(ndc[a]==null){ndc[a]=0;coc[coc.length]="zelph_onDOMload('"+a+"', '"+b+"')"}if(es.length>ndc[a]){nes=es.length;for(var c=ndc[a];c<nes;c++){theTarget=es[c];eval(b)}ndc[a]=nes}kg==true&&setTimeout("zelph_onDOMload('"+a+"', '"+b+"')",100);return true}
function zelph_getElementsBySelector(a){var b=[];var c=b="",e=a,f=[];if(a.indexOf(" ")>0){b=a.split(" ");c=b[0].split("#");if(c.length==1)return f;if(d.getElementById(c[1]))return d.getElementById(c[1]).getElementsByTagName(b[1]);return false}if(a.indexOf("#")>0){b=a.split("#");e=b[0];b=b[1]}if(b!=""){if(d.getElementById(b)){f.push(d.getElementById(b));return f}return false}if(a.indexOf(".")>0){b=a.split(".");e=b[0];c=b[1]}b=d.getElementsByTagName(e);if(c=="")return b;for(a=0;a<b.length;a++){curClass=
" "+b[a].className+" ";curClass.indexOf(" "+c+" ")!="-1"&&f.push(b[a])}return f}function zelph_stopIt(){kg="";for(x=0;x<coc.length;x++)eval(coc[x])}function zelph_addLoadEvent(a){var b=window.onload;window.onload=typeof window.onload!="function"?a:function(){b();a()}}zelph_addLoadEvent(zelph_stopIt);var PaymentHelpText={showHelpText:function(a,b){var c=$("help_wrapper");b=$(b);if(!(a==""||a==null))if(b.className!="error_msg"){b.appendChild(c);$("help_text").innerHTML=a;c.show()}},hideHelpText:function(){$("help_wrapper").hide()}};function QuickPick(a){this.initialize(a)}
QuickPick.prototype={initialize:function(a){this._destination=a.destination;this._template=a.template;this._destination.down()},setQuickPicks:function(a){this._quick_picks=a.map(function(b){b.plays=b.plays.withDelimiters()+" plays";return b});this._last_pick=parseInt(Math.random()*a.length,10)},pickOne:function(){this._last_pick=(this._last_pick+1)%this._quick_picks.length;this._destination.update(this._template.evaluate(this._quick_picks[this._last_pick]))},spin:function(a,b,c){if(0==arguments.length)this.spin(10,
1.4,300);else{this.pickOne();a<c&&setTimeout(this.spin.bind(this,a*b,b,c),a)}if(!this._ever_spun){this._ever_spun=true;this.prefetchIcons()}},prefetchIcons:function(){var a=$(document.body);this._quick_picks.each(function(b){a.insert(new Element("img",{src:b.icon,style:"display:none"}))})}};var SiteStatsUpdater=function(){var a=new Template("<strong>#{users_online_count_with_delimiter}</strong> online playing <strong>#{games_count_with_delimiter}</strong> free games!"),b=new Template('<a onclick="holodeck.showChatTab(); return false;" href="#">Join #{people_online_text} in chat right now!</a>');return{update:function(){new Ajax.Request("/site_stats.json",{method:"get",onSuccess:function(c){c=c.responseJSON;$("playing").update(a.evaluate(c));$("holodeck_chat_promotion")&&$("holodeck_chat_promotion").update(b.evaluate(c))}})}}}();Element.addMethods({textNodes:function(a){return $A(a.childNodes).map(function(b){return b.nodeType==3?[b]:b.nodeType==1?$(b).textNodes():[]}).flatten()},splitLongWords:function(a){var b=/\S{30,}/,c=function(){return Prototype.Browser.IE?document.createElement("wbr"):document.createTextNode(String.fromCharCode(8203))};a.textNodes().each(function(e){var f=e.parentNode;e=e;for(var g;(g=e.nodeValue.search(b))>=0;)if(/http:/.test(e.nodeValue.substr(0,g+30)))if(/^\s/.test(e.nodeValue)){g=e.nodeValue.search(/\S/);
e=e.splitText(g)}else if((g=e.nodeValue.search(/\s+/))>=0)e=e.splitText(g);else return;else{e=e.splitText(g+30);f.insertBefore(c(),e)}})}});document.observe("dom:loaded",function(){$$(".splittext").invoke("splitLongWords")});var swfobject=function(){function a(){if(!ba){try{var m=B.getElementsByTagName("body")[0].appendChild(r("span"));m.parentNode.removeChild(m)}catch(p){return}ba=true;m=U.length;for(var z=0;z<m;z++)U[z]()}}function b(m){if(ba)m();else U[U.length]=m}function c(m){if(typeof F.addEventListener!=q)F.addEventListener("load",m,false);else if(typeof B.addEventListener!=q)B.addEventListener("load",m,false);else if(typeof F.attachEvent!=q)A(F,"onload",m);else if(typeof F.onload=="function"){var p=F.onload;F.onload=
function(){p();m()}}else F.onload=m}function e(){V?f():g()}function f(){var m=B.getElementsByTagName("body")[0],p=r(l);p.setAttribute("type",o);var z=m.appendChild(p);if(z){var G=0;(function(){if(typeof z.GetVariable!=q){var H=z.GetVariable("$version");if(H){H=H.split(" ")[1].split(",");I.pv=[parseInt(H[0],10),parseInt(H[1],10),parseInt(H[2],10)]}}else if(G<10){G++;setTimeout(arguments.callee,10);return}m.removeChild(p);z=null;g()})()}else g()}function g(){var m=y.length;if(m>0)for(var p=0;p<m;p++){var z=
y[p].id,G=y[p].callbackFn,H={success:false,id:z};if(I.pv[0]>0){var P=R(z);if(P)if(v(y[p].swfVersion)&&!(I.wk&&I.wk<312)){C(z,true);if(G){H.success=true;H.ref=h(z);G(H)}}else if(y[p].expressInstall&&j()){H={};H.data=y[p].expressInstall;H.width=P.getAttribute("width")||"0";H.height=P.getAttribute("height")||"0";if(P.getAttribute("class"))H.styleclass=P.getAttribute("class");if(P.getAttribute("align"))H.align=P.getAttribute("align");var Q={};P=P.getElementsByTagName("param");for(var T=P.length,X=0;X<
T;X++)if(P[X].getAttribute("name").toLowerCase()!="movie")Q[P[X].getAttribute("name")]=P[X].getAttribute("value");n(H,Q,z,G)}else{u(P);G&&G(H)}}else{C(z,true);if(G){if((z=h(z))&&typeof z.SetVariable!=q){H.success=true;H.ref=z}G(H)}}}}function h(m){var p=null;if((m=R(m))&&m.nodeName=="OBJECT")if(typeof m.SetVariable!=q)p=m;else if(m=m.getElementsByTagName(l)[0])p=m;return p}function j(){return!da&&v("6.0.65")&&(I.win||I.mac)&&!(I.wk&&I.wk<312)}function n(m,p,z,G){da=true;ha=G||null;ja={success:false,
id:z};var H=R(z);if(H){if(H.nodeName=="OBJECT"){M=E(H);W=null}else{M=H;W=z}m.id=s;if(typeof m.width==q||!/%$/.test(m.width)&&parseInt(m.width,10)<310)m.width="310";if(typeof m.height==q||!/%$/.test(m.height)&&parseInt(m.height,10)<137)m.height="137";B.title=B.title.slice(0,47)+" - Flash Player Installation";G=I.ie&&I.win?"ActiveX":"PlugIn";G="MMredirectURL="+F.location.toString().replace(/&/g,"%26")+"&MMplayerType="+G+"&MMdoctitle="+B.title;if(typeof p.flashvars!=q)p.flashvars+="&"+G;else p.flashvars=
G;if(I.ie&&I.win&&H.readyState!=4){G=r("div");z+="SWFObjectNew";G.setAttribute("id",z);H.parentNode.insertBefore(G,H);H.style.display="none";(function(){H.readyState==4?H.parentNode.removeChild(H):setTimeout(arguments.callee,10)})()}t(m,p,z)}}function u(m){if(I.ie&&I.win&&m.readyState!=4){var p=r("div");m.parentNode.insertBefore(p,m);p.parentNode.replaceChild(E(m),p);m.style.display="none";(function(){m.readyState==4?m.parentNode.removeChild(m):setTimeout(arguments.callee,10)})()}else m.parentNode.replaceChild(E(m),
m)}function E(m){var p=r("div");if(I.win&&I.ie)p.innerHTML=m.innerHTML;else if(m=m.getElementsByTagName(l)[0])if(m=m.childNodes)for(var z=m.length,G=0;G<z;G++)!(m[G].nodeType==1&&m[G].nodeName=="PARAM")&&m[G].nodeType!=8&&p.appendChild(m[G].cloneNode(true));return p}function t(m,p,z){var G,H=R(z);if(I.wk&&I.wk<312)return G;if(H){if(typeof m.id==q)m.id=z;if(I.ie&&I.win){var P="";for(var Q in m)if(m[Q]!=Object.prototype[Q])if(Q.toLowerCase()=="data")p.movie=m[Q];else if(Q.toLowerCase()=="styleclass")P+=
' class="'+m[Q]+'"';else if(Q.toLowerCase()!="classid")P+=" "+Q+'="'+m[Q]+'"';Q="";for(var T in p)if(p[T]!=Object.prototype[T])Q+='<param name="'+T+'" value="'+p[T]+'" />';H.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+P+">"+Q+"</object>";L[L.length]=m.id;G=R(m.id)}else{T=r(l);T.setAttribute("type",o);for(P in m)if(m[P]!=Object.prototype[P])if(P.toLowerCase()=="styleclass")T.setAttribute("class",m[P]);else P.toLowerCase()!="classid"&&T.setAttribute(P,m[P]);for(var X in p)p[X]!=
Object.prototype[X]&&X.toLowerCase()!="movie"&&K(T,X,p[X]);H.parentNode.replaceChild(T,H);G=T}}return G}function K(m,p,z){var G=r("param");G.setAttribute("name",p);G.setAttribute("value",z);m.appendChild(G)}function N(m){var p=R(m);if(p&&p.nodeName=="OBJECT")if(I.ie&&I.win){p.style.display="none";(function(){p.readyState==4?J(m):setTimeout(arguments.callee,10)})()}else p.parentNode.removeChild(p)}function J(m){if(m=R(m)){for(var p in m)if(typeof m[p]=="function")m[p]=null;m.parentNode.removeChild(m)}}
function R(m){var p=null;try{p=B.getElementById(m)}catch(z){}return p}function r(m){return B.createElement(m)}function A(m,p,z){m.attachEvent(p,z);O[O.length]=[m,p,z]}function v(m){var p=I.pv;m=m.split(".");m[0]=parseInt(m[0],10);m[1]=parseInt(m[1],10)||0;m[2]=parseInt(m[2],10)||0;return p[0]>m[0]||p[0]==m[0]&&p[1]>m[1]||p[0]==m[0]&&p[1]==m[1]&&p[2]>=m[2]?true:false}function D(m,p,z,G){if(!(I.ie&&I.mac)){var H=B.getElementsByTagName("head")[0];if(H){z=z&&typeof z=="string"?z:"screen";if(G)ia=Y=null;
if(!Y||ia!=z){G=r("style");G.setAttribute("type","text/css");G.setAttribute("media",z);Y=H.appendChild(G);if(I.ie&&I.win&&typeof B.styleSheets!=q&&B.styleSheets.length>0)Y=B.styleSheets[B.styleSheets.length-1];ia=z}if(I.ie&&I.win)Y&&typeof Y.addRule==l&&Y.addRule(m,p);else Y&&typeof B.createTextNode!=q&&Y.appendChild(B.createTextNode(m+" {"+p+"}"))}}}function C(m,p){if(ka){p=p?"visible":"hidden";if(ba&&R(m))R(m).style.visibility=p;else D("#"+m,"visibility:"+p)}}function w(m){return/[\\\"<>\.;]/.exec(m)!=
null&&typeof encodeURIComponent!=q?encodeURIComponent(m):m}var q="undefined",l="object",o="application/x-shockwave-flash",s="SWFObjectExprInst",F=window,B=document,S=navigator,V=false,U=[e],y=[],L=[],O=[],M,W,ha,ja,ba=false,da=false,Y,ia,ka=true,I=function(){var m=typeof B.getElementById!=q&&typeof B.getElementsByTagName!=q&&typeof B.createElement!=q,p=S.userAgent.toLowerCase(),z=S.platform.toLowerCase(),G=z?/win/.test(z):/win/.test(p);z=z?/mac/.test(z):/mac/.test(p);p=/webkit/.test(p)?parseFloat(p.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,
"$1")):false;var H=!+"\u000b1",P=[0,0,0],Q=null;if(typeof S.plugins!=q&&typeof S.plugins["Shockwave Flash"]==l){if((Q=S.plugins["Shockwave Flash"].description)&&!(typeof S.mimeTypes!=q&&S.mimeTypes[o]&&!S.mimeTypes[o].enabledPlugin)){V=true;H=false;Q=Q.replace(/^.*\s+(\S+\s+\S+$)/,"$1");P[0]=parseInt(Q.replace(/^(.*)\..*$/,"$1"),10);P[1]=parseInt(Q.replace(/^.*\.(.*)\s.*$/,"$1"),10);P[2]=/[a-zA-Z]/.test(Q)?parseInt(Q.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else if(typeof F.ActiveXObject!=q)try{var T=
new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if(T)if(Q=T.GetVariable("$version")){H=true;Q=Q.split(" ")[1].split(",");P=[parseInt(Q[0],10),parseInt(Q[1],10),parseInt(Q[2],10)]}}catch(X){}return{w3:m,pv:P,wk:p,ie:H,win:G,mac:z}}();(function(){if(I.w3){if(typeof B.readyState!=q&&B.readyState=="complete"||typeof B.readyState==q&&(B.getElementsByTagName("body")[0]||B.body))a();if(!ba){typeof B.addEventListener!=q&&B.addEventListener("DOMContentLoaded",a,false);if(I.ie&&I.win){B.attachEvent("onreadystatechange",
function(){if(B.readyState=="complete"){B.detachEvent("onreadystatechange",arguments.callee);a()}});F==top&&function(){if(!ba){try{B.documentElement.doScroll("left")}catch(m){setTimeout(arguments.callee,0);return}a()}}()}I.wk&&function(){ba||(/loaded|complete/.test(B.readyState)?a():setTimeout(arguments.callee,0))}();c(a)}}})();(function(){I.ie&&I.win&&window.attachEvent("onunload",function(){for(var m=O.length,p=0;p<m;p++)O[p][0].detachEvent(O[p][1],O[p][2]);m=L.length;for(p=0;p<m;p++)N(L[p]);for(var z in I)I[z]=
null;I=null;for(var G in swfobject)swfobject[G]=null;swfobject=null})})();return{registerObject:function(m,p,z,G){if(I.w3&&m&&p){var H={};H.id=m;H.swfVersion=p;H.expressInstall=z;H.callbackFn=G;y[y.length]=H;C(m,false)}else G&&G({success:false,id:m})},getObjectById:function(m){if(I.w3)return h(m)},embedSWF:function(m,p,z,G,H,P,Q,T,X,ca){var ea={success:false,id:p};if(I.w3&&!(I.wk&&I.wk<312)&&m&&p&&z&&G&&H){C(p,false);b(function(){z+="";G+="";var aa={};if(X&&typeof X===l)for(var Z in X)aa[Z]=X[Z];
aa.data=m;aa.width=z;aa.height=G;Z={};if(T&&typeof T===l)for(var fa in T)Z[fa]=T[fa];if(Q&&typeof Q===l)for(var ga in Q)if(typeof Z.flashvars!=q)Z.flashvars+="&"+ga+"="+Q[ga];else Z.flashvars=ga+"="+Q[ga];if(v(H)){fa=t(aa,Z,p);aa.id==p&&C(p,true);ea.success=true;ea.ref=fa}else if(P&&j()){aa.data=P;n(aa,Z,p,ca);return}else C(p,true);ca&&ca(ea)})}else ca&&ca(ea)},switchOffAutoHideShow:function(){ka=false},ua:I,getFlashPlayerVersion:function(){return{major:I.pv[0],minor:I.pv[1],release:I.pv[2]}},hasFlashPlayerVersion:v,
createSWF:function(m,p,z){if(I.w3)return t(m,p,z)},showExpressInstall:function(m,p,z,G){I.w3&&j()&&n(m,p,z,G)},removeSWF:function(m){I.w3&&N(m)},createCSS:function(m,p,z,G){I.w3&&D(m,p,z,G)},addDomLoadEvent:b,addLoadEvent:c,getQueryParamValue:function(m){var p=B.location.search||B.location.hash;if(p){if(/\?/.test(p))p=p.split("?")[1];if(m==null)return w(p);p=p.split("&");for(var z=0;z<p.length;z++)if(p[z].substring(0,p[z].indexOf("="))==m)return w(p[z].substring(p[z].indexOf("=")+1))}return""},expressInstallCallback:function(){if(da){var m=
R(s);if(m&&M){m.parentNode.replaceChild(M,m);if(W){C(W,true);if(I.ie&&I.win)M.style.display="block"}ha&&ha(ja)}da=false}}}}();function addDOMLoadEvent(a){if(!window.__load_events){var b=function(){if(!arguments.callee.done){arguments.callee.done=true;if(window.__load_timer){clearInterval(window.__load_timer);window.__load_timer=null}for(var c=0;c<window.__load_events.length;c++)window.__load_events[c]();window.__load_events=null}};document.addEventListener&&document.addEventListener("DOMContentLoaded",b,false);if(/WebKit/i.test(navigator.userAgent))window.__load_timer=setInterval(function(){/loaded|complete/.test(document.readyState)&&
b()},10);window.onload=b;window.__load_events=[]}window.__load_events.push(a)}
function tabset(){if(!document.getElementById)return false;var a=document.getElementsByTagName("dl");for(k=0;k<a.length;k++){var b=a[k];if(b.className.indexOf("tabset")!=-1){var c=0,e=b.getElementsByTagName("dd");for(i=0;i<e.length;i++)if(e[i].parentNode==b){if(i==0)var f=e.item(0);else e[i].style.display="none";e[i].count=c++}c=[];e=b.getElementsByTagName("dt");for(i=0;i<e.length;i++)if(e[i].parentNode==b)c[c.length]=e[i];b=[];for(i=0;i<c.length;i++){if(!c[i].transformed_to_tab){c[i].transformed_to_tab=
true;c[i].count=i;c[i].onclick=toggleDt;c[i].innerHTML="<a href='#' title='"+c[i].innerHTML+"'>"+c[i].innerHTML+"</a>";c[i].parentNode.removeChild(c[i]);f.parentNode.insertBefore(c[i],f)}if(c[i].className.indexOf("active")>=0)b[b.length]=c[i]}for(i=0;i<b.length;i++)b[i].onclick()}}}
function toggleDt(){var a=this.parentNode.getElementsByTagName("dt");for(i=0;i<a.length;i++)if(this==a[i]&&this.className.indexOf("dormant")>=0&&this.className.indexOf("active")==-1&&a[i].parentNode==this.parentNode){this.className+=" active";this.className=this.className.replace(/(?:^\s*|\s*$)/,"")}else if(this!=a[i]&&a[i].parentNode==this.parentNode)a[i].className=a[i].className.replace("active","dormant");a=this.parentNode.getElementsByTagName("dd");for(i=0;i<a.length;i++)if(a[i].parentNode==this.parentNode)a[i].style.display=
this.count==a[i].count?"block":"none";return false}addDOMLoadEvent(tabset);function autoInit_trees(){for(var a=document.getElementsByTagName("ul"),b=0;b<a.length;b++)if(a[b].className&&a[b].className.indexOf("tree")!=-1){initTree(a[b]);a[b].className=a[b].className.replace(/ ?unformatted ?/," ")}}
function initTree(a){var b,c,e,f,g,h,j;for(b=0;b<a.childNodes.length;b++)if(a.childNodes[b].tagName&&a.childNodes[b].tagName.toLowerCase()=="li"){var n=a.childNodes[b];e=document.createElement("span");c=document.createElement("span");f=document.createElement("span");e.appendChild(c);c.appendChild(f);e.className="a "+n.className.replace("closed","spanClosed");e.onMouseOver=function(){};c.className="b";c.onclick=treeToggle;f.className="c";h=n.childNodes.length;g=0;j=null;for(c=0;c<n.childNodes.length;c++)if(n.childNodes[c].tagName&&
n.childNodes[c].tagName.toLowerCase()=="div")g=c+1;else if(n.childNodes[c].tagName&&n.childNodes[c].tagName.toLowerCase()=="ul"){j=n.childNodes[c];h=c;break}for(c=g;c<h;c++)f.appendChild(n.childNodes[g]);n.childNodes.length>g?n.insertBefore(e,n.childNodes[g]):n.appendChild(e);if(j!=null)if(initTree(j)){addClass(n,"children","closed");addClass(e,"children","spanClosed")}}if(n){addClass(n,"last","closed");addClass(e,"last","spanClosed");return true}else return false}
function treeToggle(a,b){for(a=this;a!=null&&(!a.tagName||a.tagName.toLowerCase()!="li");)a=a.parentNode;var c=findChildWithTag(a,"ul"),e=findChildWithTag(a,"span");if(b!=null)if(b=="open")treeOpen(e,a);else b=="close"&&treeClose(e,a);else if(c!=null)a.className.match(/(^| )closed($| )/)?treeOpen(e,a):treeClose(e,a)}function treeOpen(a,b){removeClass(a,"spanClosed");removeClass(b,"closed")}function treeClose(a,b){addClass(a,"spanClosed");addClass(b,"closed")}
function findChildWithTag(a,b){for(var c=0;c<a.childNodes.length;c++)if(a.childNodes[c].tagName!=null&&a.childNodes[c].tagName.toLowerCase()==b)return a.childNodes[c];return null}function addClass(a,b,c){if(c!=null&&a.className.match(new RegExp("(^| )"+c)))a.className=a.className.replace(new RegExp("( |^)"+c),"$1"+b+" "+c);else if(!a.className.match(new RegExp("(^| )"+b+"($| )"))){a.className+=" "+b;a.className=a.className.replace(/(^ +)|( +$)/g,"")}}
function removeClass(a,b){var c=" "+a.className+" ";c=c.replace(new RegExp(" ("+b+" +)+","g")," ");a.className=c.replace(/(^ +)|( +$)/g,"")}_LOADERS=Array();function callAllLoaders(){var a,b;for(a=0;a<_LOADERS.length;a++){b=_LOADERS[a];b!=callAllLoaders&&b()}}function appendLoader(a){if(window.onload&&window.onload!=callAllLoaders)_LOADERS[_LOADERS.length]=window.onload;window.onload=callAllLoaders;_LOADERS[_LOADERS.length]=a}appendLoader(autoInit_trees);function whenAvailable(a,b,c){if("object"!=typeof availabilityCheckers)availabilityCheckers={};var e=setInterval(function(){if("undefined"!=typeof a[b]){checker=availabilityCheckers[e];clearInterval(checker.interval);checker.onAvailable(b,a[b])}},500);availabilityCheckers[e]={interval:e,onAvailable:c}};
