var Prototype={Version:"1.6.1_rc2",Browser:{IE:!!(window.attachEvent&&navigator.userAgent.indexOf("Opera")===-1),Opera:navigator.userAgent.indexOf("Opera")>-1,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")===-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){if(window.HTMLElement&&window.HTMLElement.prototype){return true}if(window.Element&&window.Element.prototype){return true}})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var A=document.createElement("div");if(A["__proto__"]&&A["__proto__"]!==document.createElement("form")["__proto__"]){return true}return false})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(A){return A}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Abstract={};var Try={these:function(){var C;for(var B=0,D=arguments.length;B<D;B++){var A=arguments[B];try{C=A();break}catch(E){}}return C}};var Class=(function(){function A(){var G=null,F=$A(arguments);if(Object.isFunction(F[0])){G=F.shift()}function C(){this.initialize.apply(this,arguments)}Object.extend(C,Class.Methods);C.superclass=G;C.subclasses=[];if(G){var D=function(){};D.prototype=G.prototype;C.prototype=new D;G.subclasses.push(C)}for(var E=0;E<F.length;E++){C.addMethods(F[E])}if(!C.prototype.initialize){C.prototype.initialize=Prototype.emptyFunction}C.prototype.constructor=C;return C}function B(I){var E=this.superclass&&this.superclass.prototype;var D=Object.keys(I);if(!Object.keys({toString:true}).length){if(I.toString!=Object.prototype.toString){D.push("toString")}if(I.valueOf!=Object.prototype.valueOf){D.push("valueOf")}}for(var C=0,F=D.length;C<F;C++){var H=D[C],G=I[H];if(E&&Object.isFunction(G)&&G.argumentNames().first()=="$super"){var J=G;G=(function(K){return function(){return E[K].apply(this,arguments)}})(H).wrap(J);G.valueOf=J.valueOf.bind(J);G.toString=J.toString.bind(J)}this.prototype[H]=G}return this}return{create:A,Methods:{addMethods:B}}})();(function(){function L(Q){return Object.prototype.toString.call(Q).match(/^\[object\s(.*)\]$/)[1]}function H(Q,S){for(var R in S){Q[R]=S[R]}return Q}function K(Q){try{if(D(Q)){return"undefined"}if(Q===null){return"null"}return Q.inspect?Q.inspect():String(Q)}catch(R){if(R instanceof RangeError){return"..."}throw R}}function J(Q){var S=typeof Q;switch(S){case"undefined":case"function":case"unknown":return ;case"boolean":return Q.toString()}if(Q===null){return"null"}if(Q.toJSON){return Q.toJSON()}if(G(Q)){return }var R=[];for(var U in Q){var T=J(Q[U]);if(!D(T)){R.push(U.toJSON()+": "+T)}}return"{"+R.join(", ")+"}"}function C(Q){return $H(Q).toQueryString()}function E(Q){return Q&&Q.toHTML?Q.toHTML():String.interpret(Q)}function O(Q){var R=[];for(var S in Q){R.push(S)}return R}function M(Q){var R=[];for(var S in Q){R.push(Q[S])}return R}function I(Q){return H({},Q)}function G(Q){return !!(Q&&Q.nodeType==1)}function F(Q){return L(Q)==="Array"}function P(Q){return Q instanceof Hash}function B(Q){return typeof Q==="function"}function A(Q){return L(Q)==="String"}function N(Q){return L(Q)==="Number"}function D(Q){return typeof Q==="undefined"}H(Object,{extend:H,inspect:K,toJSON:J,toQueryString:C,toHTML:E,keys:O,values:M,clone:I,isElement:G,isArray:F,isHash:P,isFunction:B,isString:A,isNumber:N,isUndefined:D})})();Object.extend(Function.prototype,(function(){var K=Array.prototype.slice;function D(O,L){var N=O.length,M=L.length;while(M--){O[N+M]=L[M]}return O}function I(M,L){M=K.call(M,0);return D(M,L)}function G(){var L=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return L.length==1&&!L[0]?[]:L}function H(N){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var L=this,M=K.call(arguments,1);return function(){var O=I(M,arguments);return L.apply(N,O)}}function F(N){var L=this,M=K.call(arguments,1);return function(P){var O=D([P||window.event],M);return L.apply(N,O)}}function J(){if(!arguments.length){return this}var L=this,M=K.call(arguments,0);return function(){var N=I(M,arguments);return L.apply(this,N)}}function E(N){var L=this,M=K.call(arguments,1);N=N*1000;return window.setTimeout(function(){return L.apply(L,M)},N)}function A(){var L=D([0.01],arguments);return this.delay.apply(this,L)}function C(M){var L=this;return function(){var N=D([L.bind(this)],arguments);return M.apply(this,N)}}function B(){if(this._methodized){return this._methodized}var L=this;return this._methodized=function(){var M=D([this],arguments);return L.apply(null,M)}}return{argumentNames:G,bind:H,bindAsEventListener:F,curry:J,delay:E,defer:A,wrap:C,methodize:B}})());Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+'Z"'};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(A){return String(A).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(B,A){this.callback=B;this.frequency=A;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer){return }clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute()}catch(A){}finally{this.currentlyExecuting=false}}}});Object.extend(String,{interpret:function(A){return A==null?"":String(A)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,(function(){function prepareReplacement(replacement){if(Object.isFunction(replacement)){return replacement}var template=new Template(replacement);return function(match){return template.evaluate(match)}}function gsub(pattern,replacement){var result="",source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern)){pattern=RegExp.escape(pattern)}if(!(pattern.length||pattern.source)){replacement=replacement("");return replacement+source.split("").join(replacement)+replacement}while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length)}else{result+=source,source=""}}return result}function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0){return match[0]}return replacement(match)})}function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this)}function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?"...":truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this)}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function stripTags(){return this.replace(/<\/?[^>]+>/gi,"")}function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,"img");var matchOne=new RegExp(Prototype.ScriptFragment,"im");return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||["",""])[1]})}function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}function escapeHTML(){escapeHTML.text.data=this;return escapeHTML.div.innerHTML}function unescapeHTML(){var div=document.createElement("div");div.innerHTML=this.stripTags();return div.childNodes[0]?(div.childNodes.length>1?$A(div.childNodes).inject("",function(memo,node){return memo+node.nodeValue}):div.childNodes[0].nodeValue):""}function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match){return{}}return match[1].split(separator||"&").inject({},function(hash,pair){if((pair=pair.split("="))[0]){var key=decodeURIComponent(pair.shift());var value=pair.length>1?pair.join("="):pair[0];if(value!=undefined){value=decodeURIComponent(value)}if(key in hash){if(!Object.isArray(hash[key])){hash[key]=[hash[key]]}hash[key].push(value)}else{hash[key]=value}}return hash})}function toArray(){return this.split("")}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function times(count){return count<1?"":new Array(count+1).join(this)}function camelize(){var parts=this.split("-"),len=parts.length;if(len==1){return parts[0]}var camelized=this.charAt(0)=="-"?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++){camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1)}return camelized}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function underscore(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase()}function dasherize(){return this.gsub(/_/,"-")}function inspect(useDoubleQuotes){var escapedString=this.gsub(/[\x00-\x1f\\]/,function(match){var character=String.specialChar[match[0]];return character?character:"\\u00"+match[0].charCodeAt().toPaddedString(2,16)});if(useDoubleQuotes){return'"'+escapedString.replace(/"/g,'\\"')+'"'}return"'"+escapedString.replace(/'/g,"\\'")+"'"}function toJSON(){return this.inspect(true)}function unfilterJSON(filter){return this.sub(filter||Prototype.JSONFilter,"#{1}")}function isJSON(){var str=this;if(str.blank()){return false}str=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern){return this.indexOf(pattern)===0}function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===d}function empty(){return this==""}function blank(){return/^\s*$/.test(this)}function interpolate(object,pattern){return new Template(this,pattern).evaluate(object)}return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,toJSON:toJSON,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate}})());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(Object.isFunction(A.toTemplateReplacements)){A=A.toTemplateReplacements()}return this.template.gsub(this.pattern,function(D){if(A==null){return""}var F=D[1]||"";if(F=="\\"){return D[2]}var B=A,G=D[3];var E=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;D=E.exec(G);if(D==null){return F}while(D!=null){var C=D[1].startsWith("[")?D[2].gsub("\\\\]","]"):D[1];B=B[C];if(null==B||""==D[3]){break}G=G.substring("["==D[3]?D[1].length:D[0].length);D=E.exec(G)}return F+String.interpret(B)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function C(Y,X){var W=0;try{this._each(function(a){Y.call(X,a,W++)})}catch(Z){if(Z!=$break){throw Z}}return this}function R(Z,Y,X){var W=-Z,a=[],b=this.toArray();if(Z<1){return b}while((W+=Z)<b.length){a.push(b.slice(W,W+Z))}return a.collect(Y,X)}function B(Y,X){Y=Y||Prototype.K;var W=true;this.each(function(a,Z){W=W&&!!Y.call(X,a,Z);if(!W){throw $break}});return W}function I(Y,X){Y=Y||Prototype.K;var W=false;this.each(function(a,Z){if(W=!!Y.call(X,a,Z)){throw $break}});return W}function J(Y,X){Y=Y||Prototype.K;var W=[];this.each(function(a,Z){W.push(Y.call(X,a,Z))});return W}function T(Y,X){var W;this.each(function(a,Z){if(Y.call(X,a,Z)){W=a;throw $break}});return W}function H(Y,X){var W=[];this.each(function(a,Z){if(Y.call(X,a,Z)){W.push(a)}});return W}function G(Z,Y,X){Y=Y||Prototype.K;var W=[];if(Object.isString(Z)){Z=new RegExp(RegExp.escape(Z))}this.each(function(b,a){if(Z.match(b)){W.push(Y.call(X,b,a))}});return W}function A(W){if(Object.isFunction(this.indexOf)){if(this.indexOf(W)!=-1){return true}}var X=false;this.each(function(Y){if(Y==W){X=true;throw $break}});return X}function Q(X,W){W=Object.isUndefined(W)?null:W;return this.eachSlice(X,function(Y){while(Y.length<X){Y.push(W)}return Y})}function L(W,Y,X){this.each(function(a,Z){W=Y.call(X,W,a,Z)});return W}function V(X){var W=$A(arguments).slice(1);return this.map(function(Y){return Y[X].apply(Y,W)})}function P(Y,X){Y=Y||Prototype.K;var W;this.each(function(a,Z){a=Y.call(X,a,Z);if(W==null||a>=W){W=a}});return W}function N(Y,X){Y=Y||Prototype.K;var W;this.each(function(a,Z){a=Y.call(X,a,Z);if(W==null||a<W){W=a}});return W}function E(Z,X){Z=Z||Prototype.K;var Y=[],W=[];this.each(function(b,a){(Z.call(X,b,a)?Y:W).push(b)});return[Y,W]}function F(X){var W=[];this.each(function(Y){W.push(Y[X])});return W}function D(Y,X){var W=[];this.each(function(a,Z){if(!Y.call(X,a,Z)){W.push(a)}});return W}function M(X,W){return this.map(function(Z,Y){return{value:Z,criteria:X.call(W,Z,Y)}}).sort(function(d,c){var Z=d.criteria,Y=c.criteria;return Z<Y?-1:Z>Y?1:0}).pluck("value")}function O(){return this.map()}function S(){var X=Prototype.K,W=$A(arguments);if(Object.isFunction(W.last())){X=W.pop()}var Y=[this].concat(W).map($A);return this.map(function(a,Z){return X(Y.pluck(Z))})}function K(){return this.toArray().length}function U(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:C,eachSlice:R,all:B,every:B,any:I,some:I,collect:J,map:J,detect:T,findAll:H,select:H,filter:H,grep:G,include:A,member:A,inGroupsOf:Q,inject:L,invoke:V,max:P,min:N,partition:E,pluck:F,reject:D,sortBy:M,toArray:O,entries:O,zip:S,size:K,inspect:U,find:T}})();function $A(C){if(!C){return[]}if("toArray" in C){return C.toArray()}var B=C.length||0,A=new Array(B);while(B--){A[B]=C[B]}return A}function $w(A){if(!Object.isString(A)){return[]}A=A.strip();return A?A.split(/\s+/):[]}Array.from=$A;(function(){var S=Array.prototype,M=S.slice,O=S.forEach;function B(W){for(var V=0,X=this.length;V<X;V++){W(this[V])}}if(!O){O=B}function L(){this.length=0;return this}function D(){return this[0]}function G(){return this[this.length-1]}function I(){return this.select(function(V){return V!=null})}function U(){return this.inject([],function(W,V){if(Object.isArray(V)){return W.concat(V.flatten())}W.push(V);return W})}function H(){var V=M.call(arguments,0);return this.select(function(W){return !V.include(W)})}function F(V){return(V!==false?this:this.toArray())._reverse()}function K(V){return this.inject([],function(Y,X,W){if(0==W||(V?Y.last()!=X:!Y.include(X))){Y.push(X)}return Y})}function P(V){return this.uniq().findAll(function(W){return V.detect(function(X){return W===X})})}function Q(){return M.call(this,0)}function J(){return this.length}function T(){return"["+this.map(Object.inspect).join(", ")+"]"}function R(){var V=[];this.each(function(W){var X=Object.toJSON(W);if(!Object.isUndefined(X)){V.push(X)}});return"["+V.join(", ")+"]"}function A(X,V){V||(V=0);var W=this.length;if(V<0){V=W+V}for(;V<W;V++){if(this[V]===X){return V}}return -1}function N(W,V){V=isNaN(V)?this.length:(V<0?this.length+V:V)+1;var X=this.slice(0,V).reverse().indexOf(W);return(X<0)?X:V-X-1}function C(){var a=M.call(this,0),Y;for(var W=0,X=arguments.length;W<X;W++){Y=arguments[W];if(Object.isArray(Y)&&!("callee" in Y)){for(var V=0,Z=Y.length;V<Z;V++){a.push(Y[V])}}else{a.push(Y)}}return a}Object.extend(S,Enumerable);if(!S._reverse){S._reverse=S.reverse}Object.extend(S,{_each:O,clear:L,first:D,last:G,compact:I,flatten:U,without:H,reverse:F,uniq:K,intersect:P,clone:Q,toArray:Q,size:J,inspect:T,toJSON:R});var E=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(E){S.concat=C}if(!S.indexOf){S.indexOf=A}if(!S.lastIndexOf){S.lastIndexOf=N}})();function $H(A){return new Hash(A)}var Hash=Class.create(Enumerable,(function(){function E(Q){this._object=Object.isHash(Q)?Q.toObject():Object.clone(Q)}function F(R){for(var Q in this._object){var S=this._object[Q],T=[Q,S];T.key=Q;T.value=S;R(T)}}function K(Q,R){return this._object[Q]=R}function C(Q){if(this._object[Q]!==Object.prototype[Q]){return this._object[Q]}}function N(Q){var R=this._object[Q];delete this._object[Q];return R}function P(){return Object.clone(this._object)}function O(){return this.pluck("key")}function M(){return this.pluck("value")}function G(R){var Q=this.detect(function(S){return S.value===R});return Q&&Q.key}function I(Q){return this.clone().update(Q)}function D(Q){return new Hash(Q).inject(this,function(R,S){R.set(S.key,S.value);return R})}function B(Q,R){if(Object.isUndefined(R)){return Q}return Q+"="+encodeURIComponent(String.interpret(R))}function A(){return this.inject([],function(S,T){var R=encodeURIComponent(T.key),Q=T.value;if(Q&&typeof Q=="object"){if(Object.isArray(Q)){return S.concat(Q.map(B.curry(R)))}}else{S.push(B(R,Q))}return S}).join("&")}function L(){return"#<Hash:{"+this.map(function(Q){return Q.map(Object.inspect).join(": ")}).join(", ")+"}>"}function J(){return Object.toJSON(this.toObject())}function H(){return new Hash(this)}return{initialize:E,_each:F,set:K,get:C,unset:N,toObject:P,toTemplateReplacements:P,keys:O,values:M,index:G,merge:I,update:D,toQueryString:A,inspect:L,toJSON:J,clone:H}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function D(){return this.toPaddedString(2,16)}function E(){return this+1}function A(K,J){$R(0,this,true).each(K,J);return this}function B(L,K){var J=this.toString(K||10);return"0".times(L-J.length)+J}function F(){return isFinite(this)?this.toString():"null"}function I(){return Math.abs(this)}function H(){return Math.round(this)}function G(){return Math.ceil(this)}function C(){return Math.floor(this)}return{toColorPart:D,succ:E,times:A,toPaddedString:B,toJSON:F,abs:I,round:H,ceil:G,floor:C}})());function $R(C,A,B){return new ObjectRange(C,A,B)}var ObjectRange=Class.create(Enumerable,(function(){function B(F,D,E){this.start=F;this.end=D;this.exclusive=E}function C(D){var E=this.start;while(this.include(E)){D(E);E=E.succ()}}function A(D){if(D<this.start){return false}if(this.exclusive){return D<this.end}return D<=this.end}return{initialize:B,_each:C,include:A}})());var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(A){this.responders._each(A)},register:function(A){if(!this.include(A)){this.responders.push(A)}},unregister:function(A){this.responders=this.responders.without(A)},dispatch:function(D,B,C,A){this.each(function(E){if(Object.isFunction(E[D])){try{E[D].apply(E,[B,C,A])}catch(F){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(A){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,A||{});this.options.method=this.options.method.toLowerCase();if(Object.isString(this.options.parameters)){this.options.parameters=this.options.parameters.toQueryParams()}else{if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()}}}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,B,A){$super(A);this.transport=Ajax.getTransport();this.request(B)},request:function(B){this.url=B;this.method=this.options.method;var D=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){D["_method"]=this.method;this.method="post"}this.parameters=D;if(D=Object.toQueryString(D)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+D}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){D+="&_="}}}try{var A=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(A)}Ajax.Responders.dispatch("onCreate",this,A);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||D):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(C){this.dispatchException(C)}},onStateChange:function(){var A=this.transport.readyState;if(A>1&&!((A==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var E={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,"Accept":"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){E["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){E["Connection"]="close"}}if(typeof this.options.requestHeaders=="object"){var C=this.options.requestHeaders;if(Object.isFunction(C.push)){for(var B=0,D=C.length;B<D;B+=2){E[C[B]]=C[B+1]}}else{$H(C).each(function(F){E[F.key]=F.value})}}for(var A in E){this.transport.setRequestHeader(A,E[A])}},success:function(){var A=this.getStatus();return !A||(A>=200&&A<300)},getStatus:function(){try{return this.transport.status||0}catch(A){return 0}},respondToReadyState:function(A){var C=Ajax.Request.Events[A],B=new Ajax.Response(this);if(C=="Complete"){try{this._complete=true;(this.options["on"+B.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(B,B.headerJSON)}catch(D){this.dispatchException(D)}var 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"+C]||Prototype.emptyFunction)(B,B.headerJSON);Ajax.Responders.dispatch("on"+C,this,B,B.headerJSON)}catch(D){this.dispatchException(D)}if(C=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var A=this.url.match(/^\s*https?:\/\/[^\/]*/);return !A||(A[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))},getHeader:function(A){try{return this.transport.getResponseHeader(A)||null}catch(B){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(A){(this.options.onException||Prototype.emptyFunction)(this,A);Ajax.Responders.dispatch("onException",this,A)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(C){this.request=C;var D=this.transport=C.transport,A=this.readyState=D.readyState;if((A>2&&!Prototype.Browser.IE)||A==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(D.responseText);this.headerJSON=this._getHeaderJSON()}if(A==4){var B=D.responseXML;this.responseXML=Object.isUndefined(B)?null:B;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(A){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(A){return null}},getResponseHeader:function(A){return this.transport.getResponseHeader(A)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var A=this.getHeader("X-JSON");if(!A){return null}A=decodeURIComponent(escape(A));try{return A.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(B){this.request.dispatchException(B)}},_getResponseJSON:function(){var A=this.request.options;if(!A.evalJSON||(A.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(A.sanitizeJSON||!this.request.isSameOrigin())}catch(B){this.request.dispatchException(B)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,A,C,B){this.container={success:(A.success||A),failure:(A.failure||(A.success?null:A))};B=Object.clone(B);var D=B.onComplete;B.onComplete=(function(E,F){this.updateContent(E.responseText);if(Object.isFunction(D)){D(E,F)}}).bind(this);$super(C,B)},updateContent:function(D){var C=this.container[this.success()?"success":"failure"],A=this.options;if(!A.evalScripts){D=D.stripScripts()}if(C=$(C)){if(A.insertion){if(Object.isString(A.insertion)){var B={};B[A.insertion]=D;C.insert(B)}else{A.insertion(C,D)}}else{C.update(D)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,A,C,B){$super(B);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=A;this.url=C;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},updateComplete:function(A){if(this.options.decay){this.decay=(A.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=A.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(B){if(arguments.length>1){for(var A=0,D=[],C=arguments.length;A<C;A++){D.push($(arguments[A]))}return D}if(Object.isString(B)){B=document.getElementById(B)}return Element.extend(B)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(F,A){var C=[];var E=document.evaluate(F,$(A)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var B=0,D=E.snapshotLength;B<D;B++){C.push(Element.extend(E.snapshotItem(B)))}return C}}if(!window.Node){var Node={}}if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}(function(C){var B=(function(){var F=document.createElement("form");var E=document.createElement("input");var D=document.documentElement;E.setAttribute("name","test");F.appendChild(E);D.appendChild(F);var G=F.elements?(typeof F.elements.test=="undefined"):null;D.removeChild(F);F=E=null;return G})();var A=C.Element;C.Element=function(F,E){E=E||{};F=F.toLowerCase();var D=Element.cache;if(B&&E.name){F="<"+F+' name="'+E.name+'">';delete E.name;return Element.writeAttribute(document.createElement(F),E)}if(!D[F]){D[F]=Element.extend(document.createElement(F))}return Element.writeAttribute(D[F].cloneNode(false),E)};Object.extend(C.Element,A||{});if(A){C.Element.prototype=A.prototype}})(this);Element.cache={};Element.idCounter=1;Element.Methods={visible:function(A){return $(A).style.display!="none"},toggle:function(A){A=$(A);Element[Element.visible(A)?"hide":"show"](A);return A},hide:function(A){A=$(A);A.style.display="none";return A},show:function(A){A=$(A);A.style.display="";return A},remove:function(A){A=$(A);A.parentNode.removeChild(A);return A},update:(function(){var B=(function(){var E=document.createElement("select"),F=true;E.innerHTML='<option value="test">test</option>';if(E.options&&E.options[0]){F=E.options[0].nodeName.toUpperCase()!=="OPTION"}E=null;return F})();var A=(function(){try{var E=document.createElement("table");if(E&&E.tBodies){E.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var G=typeof E.tBodies[0]=="undefined";E=null;return G}}catch(F){return true}})();var D=(function(){var E=document.createElement("script"),G=false;try{E.appendChild(document.createTextNode(""));G=!E.firstChild||E.firstChild&&E.firstChild.nodeType!==3}catch(F){G=true}E=null;return G})();function C(F,G){F=$(F);if(G&&G.toElement){G=G.toElement()}if(Object.isElement(G)){return F.update().insert(G)}G=Object.toHTML(G);var E=F.tagName.toUpperCase();if(E==="SCRIPT"&&D){F.text=G;return F}if(B||A){if(E in Element._insertionTranslations.tags){$A(F.childNodes).each(function(H){F.removeChild(H)});Element._getContentFromAnonymousElement(E,G.stripScripts()).each(function(H){F.appendChild(H)})}else{F.innerHTML=G.stripScripts()}}else{F.innerHTML=G.stripScripts()}G.evalScripts.bind(G).defer();return F}return C})(),replace:function(B,C){B=$(B);if(C&&C.toElement){C=C.toElement()}else{if(!Object.isElement(C)){C=Object.toHTML(C);var A=B.ownerDocument.createRange();A.selectNode(B);C.evalScripts.bind(C).defer();C=A.createContextualFragment(C.stripScripts())}}B.parentNode.replaceChild(C,B);return B},insert:function(C,E){C=$(C);if(Object.isString(E)||Object.isNumber(E)||Object.isElement(E)||(E&&(E.toElement||E.toHTML))){E={bottom:E}}var D,F,B,G;for(var A in E){D=E[A];A=A.toLowerCase();F=Element._insertionTranslations[A];if(D&&D.toElement){D=D.toElement()}if(Object.isElement(D)){F(C,D);continue}D=Object.toHTML(D);B=((A=="before"||A=="after")?C.parentNode:C).tagName.toUpperCase();G=Element._getContentFromAnonymousElement(B,D.stripScripts());if(A=="top"||A=="after"){G.reverse()}G.each(F.curry(C));D.evalScripts.bind(D).defer()}return C},wrap:function(B,C,A){B=$(B);if(Object.isElement(C)){$(C).writeAttribute(A||{})}else{if(Object.isString(C)){C=new Element(C,A)}else{C=new Element("div",C)}}if(B.parentNode){B.parentNode.replaceChild(C,B)}C.appendChild(B);return C},inspect:function(B){B=$(B);var A="<"+B.tagName.toLowerCase();$H({"id":"id","className":"class"}).each(function(F){var E=F.first(),C=F.last();var D=(B[E]||"").toString();if(D){A+=" "+C+"="+D.inspect(true)}});return A+">"},recursivelyCollect:function(A,C){A=$(A);var B=[];while(A=A[C]){if(A.nodeType==1){B.push(Element.extend(A))}}return B},ancestors:function(A){return $(A).recursivelyCollect("parentNode")},descendants:function(A){return Element.select(A,"*")},firstDescendant:function(A){A=$(A).firstChild;while(A&&A.nodeType!=1){A=A.nextSibling}return $(A)},immediateDescendants:function(A){if(!(A=$(A).firstChild)){return[]}while(A&&A.nodeType!=1){A=A.nextSibling}if(A){return[A].concat($(A).nextSiblings())}return[]},previousSiblings:function(A){return $(A).recursivelyCollect("previousSibling")},nextSiblings:function(A){return $(A).recursivelyCollect("nextSibling")},siblings:function(A){A=$(A);return A.previousSiblings().reverse().concat(A.nextSiblings())},match:function(B,A){if(Object.isString(A)){A=new Selector(A)}return A.match($(B))},up:function(B,D,A){B=$(B);if(arguments.length==1){return $(B.parentNode)}var C=B.ancestors();return Object.isNumber(D)?C[D]:Selector.findElement(C,D,A)},down:function(B,C,A){B=$(B);if(arguments.length==1){return B.firstDescendant()}return Object.isNumber(C)?B.descendants()[C]:Element.select(B,C)[A||0]},previous:function(B,D,A){B=$(B);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(B))}var C=B.previousSiblings();return Object.isNumber(D)?C[D]:Selector.findElement(C,D,A)},next:function(C,D,B){C=$(C);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(C))}var A=C.nextSiblings();return Object.isNumber(D)?A[D]:Selector.findElement(A,D,B)},select:function(){var A=$A(arguments),B=$(A.shift());return Selector.findChildElements(B,A)},adjacent:function(){var A=$A(arguments),B=$(A.shift());return Selector.findChildElements(B.parentNode,A).without(B)},identify:function(A){A=$(A);var B=A.readAttribute("id");if(B){return B}do{B="anonymous_element_"+Element.idCounter++}while($(B));A.writeAttribute("id",B);return B},readAttribute:(function(){var A=(function(){var B=document.createElement("iframe"),D=false;document.documentElement.appendChild(B);try{B.getAttribute("type",2)}catch(C){D=true}document.documentElement.removeChild(B);B=null;return D})();return function(D,B){D=$(D);if(A&&B==="type"&&D.tagName.toUpperCase()=="IFRAME"){return D.getAttribute("type")}if(Prototype.Browser.IE){var C=Element._attributeTranslations.read;if(C.values[B]){return C.values[B](D,B)}if(C.names[B]){B=C.names[B]}if(B.include(":")){return(!D.attributes||!D.attributes[B])?null:D.attributes[B].value}}return D.getAttribute(B)}})(),writeAttribute:function(E,C,F){E=$(E);var B={},D=Element._attributeTranslations.write;if(typeof C=="object"){B=C}else{B[C]=Object.isUndefined(F)?true:F}for(var A in B){C=D.names[A]||A;F=B[A];if(D.values[A]){C=D.values[A](E,F)}if(F===false||F===null){E.removeAttribute(C)}else{if(F===true){E.setAttribute(C,C)}else{E.setAttribute(C,F)}}}return E},getHeight:function(A){return $(A).getDimensions().height},getWidth:function(A){return $(A).getDimensions().width},classNames:function(A){return new Element.ClassNames(A)},hasClassName:function(A,B){if(!(A=$(A))){return }var C=A.className;return(C.length>0&&(C==B||new RegExp("(^|\\s)"+B+"(\\s|$)").test(C)))},addClassName:function(A,B){if(!(A=$(A))){return }if(!A.hasClassName(B)){A.className+=(A.className?" ":"")+B}return A},removeClassName:function(A,B){if(!(A=$(A))){return }A.className=A.className.replace(new RegExp("(^|\\s+)"+B+"(\\s+|$)")," ").strip();return A},toggleClassName:function(A,B){if(!(A=$(A))){return }return A[A.hasClassName(B)?"removeClassName":"addClassName"](B)},cleanWhitespace:function(B){B=$(B);var C=B.firstChild;while(C){var A=C.nextSibling;if(C.nodeType==3&&!/\S/.test(C.nodeValue)){B.removeChild(C)}C=A}return B},empty:function(A){return $(A).innerHTML.blank()},descendantOf:function(B,A){B=$(B),A=$(A);if(B.compareDocumentPosition){return(B.compareDocumentPosition(A)&8)===8}if(A.contains){return A.contains(B)&&A!==B}while(B=B.parentNode){if(B==A){return true}}return false},scrollTo:function(A){A=$(A);var B=A.cumulativeOffset();window.scrollTo(B[0],B[1]);return A},getStyle:function(B,C){B=$(B);C=C=="float"?"cssFloat":C.camelize();var D=B.style[C];if(!D||D=="auto"){var A=document.defaultView.getComputedStyle(B,null);D=A?A[C]:null}if(C=="opacity"){return D?parseFloat(D):1}return D=="auto"?null:D},getOpacity:function(A){return $(A).getStyle("opacity")},setStyle:function(B,C){B=$(B);var E=B.style,A;if(Object.isString(C)){B.style.cssText+=";"+C;return C.include("opacity")?B.setOpacity(C.match(/opacity:\s*(\d?\.?\d*)/)[1]):B}for(var D in C){if(D=="opacity"){B.setOpacity(C[D])}else{E[(D=="float"||D=="cssFloat")?(Object.isUndefined(E.styleFloat)?"cssFloat":"styleFloat"):D]=C[D]}}return B},setOpacity:function(A,B){A=$(A);A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;return A},getDimensions:function(C){C=$(C);var G=C.getStyle("display");if(G!="none"&&G!=null){return{width:C.offsetWidth,height:C.offsetHeight}}var B=C.style;var F=B.visibility;var D=B.position;var A=B.display;B.visibility="hidden";if(D!="fixed"){B.position="absolute"}B.display="block";var H=C.clientWidth;var E=C.clientHeight;B.display=A;B.position=D;B.visibility=F;return{width:H,height:E}},makePositioned:function(A){A=$(A);var B=Element.getStyle(A,"position");if(B=="static"||!B){A._madePositioned=true;A.style.position="relative";if(Prototype.Browser.Opera){A.style.top=0;A.style.left=0}}return A},undoPositioned:function(A){A=$(A);if(A._madePositioned){A._madePositioned=undefined;A.style.position=A.style.top=A.style.left=A.style.bottom=A.style.right=""}return A},makeClipping:function(A){A=$(A);if(A._overflow){return A}A._overflow=Element.getStyle(A,"overflow")||"auto";if(A._overflow!=="hidden"){A.style.overflow="hidden"}return A},undoClipping:function(A){A=$(A);if(!A._overflow){return A}A.style.overflow=A._overflow=="auto"?"":A._overflow;A._overflow=null;return A},cumulativeOffset:function(B){var A=0,C=0;do{A+=B.offsetTop||0;C+=B.offsetLeft||0;B=B.offsetParent}while(B);return Element._returnOffset(C,A)},positionedOffset:function(B){var A=0,D=0;do{A+=B.offsetTop||0;D+=B.offsetLeft||0;B=B.offsetParent;if(B){if(B.tagName.toUpperCase()=="BODY"){break}var C=Element.getStyle(B,"position");if(C!=="static"){break}}}while(B);return Element._returnOffset(D,A)},absolutize:function(B){B=$(B);if(B.getStyle("position")=="absolute"){return B}var D=B.positionedOffset();var F=D[1];var E=D[0];var C=B.clientWidth;var A=B.clientHeight;B._originalLeft=E-parseFloat(B.style.left||0);B._originalTop=F-parseFloat(B.style.top||0);B._originalWidth=B.style.width;B._originalHeight=B.style.height;B.style.position="absolute";B.style.top=F+"px";B.style.left=E+"px";B.style.width=C+"px";B.style.height=A+"px";return B},relativize:function(A){A=$(A);if(A.getStyle("position")=="relative"){return A}A.style.position="relative";var C=parseFloat(A.style.top||0)-(A._originalTop||0);var B=parseFloat(A.style.left||0)-(A._originalLeft||0);A.style.top=C+"px";A.style.left=B+"px";A.style.height=A._originalHeight;A.style.width=A._originalWidth;return A},cumulativeScrollOffset:function(B){var A=0,C=0;do{A+=B.scrollTop||0;C+=B.scrollLeft||0;B=B.parentNode}while(B);return Element._returnOffset(C,A)},getOffsetParent:function(A){if(A.offsetParent){return $(A.offsetParent)}if(A==document.body){return $(A)}while((A=A.parentNode)&&A!=document.body){if(Element.getStyle(A,"position")!="static"){return $(A)}}return $(document.body)},viewportOffset:function(D){var A=0,C=0;var B=D;do{A+=B.offsetTop||0;C+=B.offsetLeft||0;if(B.offsetParent==document.body&&Element.getStyle(B,"position")=="absolute"){break}}while(B=B.offsetParent);B=D;do{if(!Prototype.Browser.Opera||(B.tagName&&(B.tagName.toUpperCase()=="BODY"))){A-=B.scrollTop||0;C-=B.scrollLeft||0}}while(B=B.parentNode);return Element._returnOffset(C,A)},clonePosition:function(B,D){var A=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});D=$(D);var E=D.viewportOffset();B=$(B);var F=[0,0];var C=null;if(Element.getStyle(B,"position")=="absolute"){C=B.getOffsetParent();F=C.viewportOffset()}if(C==document.body){F[0]-=document.body.offsetLeft;F[1]-=document.body.offsetTop}if(A.setLeft){B.style.left=(E[0]-F[0]+A.offsetLeft)+"px"}if(A.setTop){B.style.top=(E[1]-F[1]+A.offsetTop)+"px"}if(A.setWidth){B.style.width=D.offsetWidth+"px"}if(A.setHeight){B.style.height=D.offsetHeight+"px"}return B}};Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(D,B,C){switch(C){case"left":case"top":case"right":case"bottom":if(D(B,"position")==="static"){return null}case"height":case"width":if(!Element.visible(B)){return null}var E=parseInt(D(B,C),10);if(E!==B["offset"+C.capitalize()]){return E+"px"}var A;if(C==="height"){A=["border-top-width","padding-top","padding-bottom","border-bottom-width"]}else{A=["border-left-width","padding-left","padding-right","border-right-width"]}return A.inject(E,function(F,G){var H=D(B,G);return H===null?F:F-parseInt(H,10)})+"px";default:return D(B,C)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(C,A,B){if(B==="title"){return A.title}return C(A,B)})}else{if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(C,B){B=$(B);try{B.offsetParent}catch(E){return $(document.body)}var A=B.getStyle("position");if(A!=="static"){return C(B)}B.setStyle({position:"relative"});var D=C(B);B.setStyle({position:A});return D});$w("positionedOffset viewportOffset").each(function(A){Element.Methods[A]=Element.Methods[A].wrap(function(E,C){C=$(C);try{C.offsetParent}catch(G){return Element._returnOffset(0,0)}var B=C.getStyle("position");if(B!=="static"){return E(C)}var D=C.getOffsetParent();if(D&&D.getStyle("position")==="fixed"){D.setStyle({zoom:1})}C.setStyle({position:"relative"});var F=E(C);C.setStyle({position:B});return F})});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(B,A){try{A.offsetParent}catch(C){return Element._returnOffset(0,0)}return B(A)});Element.Methods.getStyle=function(A,B){A=$(A);B=(B=="float"||B=="cssFloat")?"styleFloat":B.camelize();var C=A.style[B];if(!C&&A.currentStyle){C=A.currentStyle[B]}if(B=="opacity"){if(C=(A.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(C[1]){return parseFloat(C[1])/100}}return 1}if(C=="auto"){if((B=="width"||B=="height")&&(A.getStyle("display")!="none")){return A["offset"+B.capitalize()]+"px"}return null}return C};Element.Methods.setOpacity=function(B,E){function F(G){return G.replace(/alpha\([^\)]*\)/gi,"")}B=$(B);var A=B.currentStyle;if((A&&!A.hasLayout)||(!A&&B.style.zoom=="normal")){B.style.zoom=1}var D=B.getStyle("filter"),C=B.style;if(E==1||E===""){(D=F(D))?C.filter=D:C.removeAttribute("filter");return B}else{if(E<0.00001){E=0}}C.filter=F(D)+"alpha(opacity="+(E*100)+")";return B};Element._attributeTranslations=(function(){var B="className";var A="for";var C=document.createElement("div");C.setAttribute(B,"x");if(C.className!=="x"){C.setAttribute("class","x");if(C.className==="x"){B="class"}}C=null;C=document.createElement("label");C.setAttribute(A,"x");if(C.htmlFor!=="x"){C.setAttribute("htmlFor","x");if(C.htmlFor==="x"){A="htmlFor"}}C=null;return{read:{names:{"class":B,"className":B,"for":A,"htmlFor":A},values:{_getAttr:function(D,E){return D.getAttribute(E,2)},_getAttrNode:function(D,F){var E=D.getAttributeNode(F);return E?E.value:""},_getEv:(function(){var D=document.createElement("div");D.onclick=Prototype.emptyFunction;var F=D.getAttribute("onclick");var E;if(String(F).indexOf("{")>-1){E=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(F===""){E=function(G,H){H=G.getAttribute(H);if(!H){return null}return H.strip()}}}D=null;return E})(),_flag:function(D,E){return $(D).hasAttribute(E)?E:null},style:function(D){return D.style.cssText.toLowerCase()},title:function(D){return D.title}}}}})();Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(A,B){A.checked=!!B},style:function(A,B){A.style.cssText=B?B:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(A){Element._attributeTranslations.write.names[A.toLowerCase()]=A;Element._attributeTranslations.has[A.toLowerCase()]=A});(function(A){Object.extend(A,{href:A._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);if(Prototype.BrowserFeatures.ElementExtensions){(function(){function A(E){var B=E.getElementsByTagName("*"),D=[];for(var C=0,F;F=B[C];C++){if(F.tagName!=="!"){D.push(F)}}return D}Element.Methods.down=function(C,D,B){C=$(C);if(arguments.length==1){return C.firstDescendant()}return Object.isNumber(D)?A(C)[D]:Element.select(C,D)[B||0]}})()}}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(A,B){A=$(A);A.style.opacity=(B==1)?0.999999:(B==="")?"":(B<0.00001)?0:B;return A}}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(A,B){A=$(A);A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;if(B==1){if(A.tagName.toUpperCase()=="IMG"&&A.width){A.width++;A.width--}else{try{var D=document.createTextNode(" ");A.appendChild(D);A.removeChild(D)}catch(C){}}}return A};Element.Methods.cumulativeOffset=function(B){var A=0,C=0;do{A+=B.offsetTop||0;C+=B.offsetLeft||0;if(B.offsetParent==document.body){if(Element.getStyle(B,"position")=="absolute"){break}}B=B.offsetParent}while(B);return Element._returnOffset(C,A)}}}}}if("outerHTML" in document.documentElement){Element.Methods.replace=function(C,E){C=$(C);if(E&&E.toElement){E=E.toElement()}if(Object.isElement(E)){C.parentNode.replaceChild(E,C);return C}E=Object.toHTML(E);var D=C.parentNode,B=D.tagName.toUpperCase();if(Element._insertionTranslations.tags[B]){var F=C.next();var A=Element._getContentFromAnonymousElement(B,E.stripScripts());D.removeChild(C);if(F){A.each(function(G){D.insertBefore(G,F)})}else{A.each(function(G){D.appendChild(G)})}}else{C.outerHTML=E.stripScripts()}E.evalScripts.bind(E).defer();return C}}Element._returnOffset=function(B,C){var A=[B,C];A.left=B;A.top=C;return A};Element._getContentFromAnonymousElement=function(C,B){var D=new Element("div"),A=Element._insertionTranslations.tags[C];if(A){D.innerHTML=A[0]+B+A[1];A[2].times(function(){D=D.firstChild})}else{D.innerHTML=B}return $A(D.childNodes)};Element._insertionTranslations={before:function(A,B){A.parentNode.insertBefore(B,A)},top:function(A,B){A.insertBefore(B,A.firstChild)},bottom:function(A,B){A.appendChild(B)},after:function(A,B){A.parentNode.insertBefore(B,A.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};(function(){Object.extend(this.tags,{THEAD:this.tags.TBODY,TFOOT:this.tags.TBODY,TH:this.tags.TD})}).call(Element._insertionTranslations);Element.Methods.Simulated={hasAttribute:function(A,C){C=Element._attributeTranslations.has[C]||C;var B=$(A).getAttributeNode(C);return !!(B&&B.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(A){if(!Prototype.BrowserFeatures.ElementExtensions&&A["__proto__"]){window.HTMLElement={};window.HTMLElement.prototype=A["__proto__"];Prototype.BrowserFeatures.ElementExtensions=true}A=null})(document.createElement("div"));Element.extend=(function(){function C(H){if(typeof window.Element!="undefined"){var J=window.Element.prototype;if(J){var L="_"+(Math.random()+"").slice(2);var I=document.createElement(H);J[L]="x";var K=(I[L]!=="x");delete J[L];I=null;return K}}return false}function B(I,H){for(var K in H){var J=H[K];if(Object.isFunction(J)&&!(K in I)){I[K]=J.methodize()}}}var D=C("object");var F=C("applet");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(D&&F){return function(I){if(I&&I.tagName){var H=I.tagName.toUpperCase();if(H==="OBJECT"||H==="APPLET"){B(I,Element.Methods);if(H==="OBJECT"){B(I,Element.Methods.ByTag.OBJECT)}else{if(H==="APPLET"){B(I,Element.Methods.ByTag.APPLET)}}}}return I}}return Prototype.K}var A={},E=Element.Methods.ByTag;var G=Object.extend(function(J){if(!J||typeof J._extendedByPrototype!="undefined"||J.nodeType!=1||J==window){return J}var H=Object.clone(A),I=J.tagName.toUpperCase();if(E[I]){Object.extend(H,E[I])}B(J,H);J._extendedByPrototype=Prototype.emptyFunction;return J},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(A,Element.Methods);Object.extend(A,Element.Methods.Simulated)}}});G.refresh();return G})();Element.hasAttribute=function(A,B){if(A.hasAttribute){return A.hasAttribute(B)}return Element.Methods.Simulated.hasAttribute(A,B)};Element.addMethods=function(C){var J=Prototype.BrowserFeatures,D=Element.Methods.ByTag;if(!C){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{"FORM":Object.clone(Form.Methods),"INPUT":Object.clone(Form.Element.Methods),"SELECT":Object.clone(Form.Element.Methods),"TEXTAREA":Object.clone(Form.Element.Methods)})}if(arguments.length==2){var B=C;C=arguments[1]}if(!B){Object.extend(Element.Methods,C||{})}else{if(Object.isArray(B)){B.each(H)}else{H(B)}}function H(F){F=F.toUpperCase();if(!Element.Methods.ByTag[F]){Element.Methods.ByTag[F]={}}Object.extend(Element.Methods.ByTag[F],C)}function A(M,L,F){F=F||false;for(var O in M){var N=M[O];if(!Object.isFunction(N)){continue}if(!F||!(O in L)){L[O]=N.methodize()}}}function E(N){var F;var M={"OPTGROUP":"OptGroup","TEXTAREA":"TextArea","P":"Paragraph","FIELDSET":"FieldSet","UL":"UList","OL":"OList","DL":"DList","DIR":"Directory","H1":"Heading","H2":"Heading","H3":"Heading","H4":"Heading","H5":"Heading","H6":"Heading","Q":"Quote","INS":"Mod","DEL":"Mod","A":"Anchor","IMG":"Image","CAPTION":"TableCaption","COL":"TableCol","COLGROUP":"TableCol","THEAD":"TableSection","TFOOT":"TableSection","TBODY":"TableSection","TR":"TableRow","TH":"TableCell","TD":"TableCell","FRAMESET":"FrameSet","IFRAME":"IFrame"};if(M[N]){F="HTML"+M[N]+"Element"}if(window[F]){return window[F]}F="HTML"+N+"Element";if(window[F]){return window[F]}F="HTML"+N.capitalize()+"Element";if(window[F]){return window[F]}var L=document.createElement(N);var O=L["__proto__"]||L.constructor.prototype;L=null;return O}var I=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(J.ElementExtensions){A(Element.Methods,I);A(Element.Methods.Simulated,I,true)}if(J.SpecificElementExtensions){for(var K in Element.Methods.ByTag){var G=E(K);if(Object.isUndefined(G)){continue}A(D[K],G.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){return{width:this.getWidth(),height:this.getHeight()}},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};(function(C){var H=Prototype.Browser,F=document,D,E={};function A(){if(H.WebKit&&!F.evaluate){return document}if(H.Opera&&window.parseFloat(window.opera.version())<9.5){return document.body}return document.documentElement}function G(B){if(!D){D=A()}E[B]="client"+B;C["get"+B]=function(){return D[E[B]]};return C["get"+B]()}C.getWidth=G.curry("Width");C.getHeight=G.curry("Height")})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:function(B){if(!(B=$(B))){return }var A;if(B===window){A=0}else{if(typeof B._prototypeUID==="undefined"){B._prototypeUID=[Element.Storage.UID++]}A=B._prototypeUID[0]}if(!Element.Storage[A]){Element.Storage[A]=$H()}return Element.Storage[A]},store:function(B,A,C){if(!(B=$(B))){return }if(arguments.length===2){B.getStorage().update(A)}else{B.getStorage().set(A,C)}return B},retrieve:function(C,B,A){if(!(C=$(C))){return }var E=Element.getStorage(C),D=E.get(B);if(Object.isUndefined(D)){E.set(B,A);D=A}return D},clone:function(C,A){if(!(C=$(C))){return }var E=C.cloneNode(A);E._prototypeUID=void 0;if(A){var D=Element.select(E,"*"),B=D.length;while(B--){D[B]._prototypeUID=void 0}}return Element.extend(E)}});var Selector=Class.create({initialize:function(A){this.expression=A.strip();if(this.shouldUseSelectorsAPI()){this.mode="selectorsAPI"}else{if(this.shouldUseXPath()){this.mode="xpath";this.compileXPathMatcher()}else{this.mode="normal";this.compileMatcher()}}},shouldUseXPath:(function(){var A=(function(){var E=false;if(document.evaluate&&window.XPathResult){var D=document.createElement("div");D.innerHTML="<ul><li></li></ul><div><ul><li></li></ul></div>";var C=".//*[local-name()='ul' or local-name()='UL']//*[local-name()='li' or local-name()='LI']";var B=document.evaluate(C,D,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);E=(B.snapshotLength!==2);D=null}return E})();return function(){if(!Prototype.BrowserFeatures.XPath){return false}var B=this.expression;if(Prototype.Browser.WebKit&&(B.include("-of-type")||B.include(":empty"))){return false}if((/(\[[\w-]*?:|:checked)/).test(B)){return false}if(A){return false}return true}})(),shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI){return false}if(Selector.CASE_INSENSITIVE_CLASS_NAMES){return false}if(!Selector._div){Selector._div=new Element("div")}try{Selector._div.querySelector(this.expression)}catch(A){return false}return true},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m,len=ps.length,name;if(Selector._cache[e]){this.matcher=Selector._cache[e];return }this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i=0;i<len;i++){p=ps[i].re;name=ps[i].name;if(m=e.match(p)){this.matcher.push(Object.isFunction(c[name])?c[name](m):new Template(c[name]).evaluate(m));e=e.replace(m[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher},compileXPathMatcher:function(){var G=this.expression,H=Selector.patterns,C=Selector.xpath,F,B,A=H.length,D;if(Selector._cache[G]){this.xpath=Selector._cache[G];return }this.matcher=[".//*"];while(G&&F!=G&&(/\S/).test(G)){F=G;for(var E=0;E<A;E++){D=H[E].name;if(B=G.match(H[E].re)){this.matcher.push(Object.isFunction(C[D])?C[D](B):new Template(C[D]).evaluate(B));G=G.replace(B[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(A){A=A||document;var C=this.expression,B;switch(this.mode){case"selectorsAPI":if(A!==document){var D=A.id,E=$(A).identify();E=E.replace(/[\.:]/g,"\\$0");C="#"+E+" "+C}B=$A(A.querySelectorAll(C)).map(Element.extend);A.id=D;return B;case"xpath":return document._getElementsByXPath(this.xpath,A);default:return this.matcher(A)}},match:function(I){this.tokens=[];var M=this.expression,A=Selector.patterns,E=Selector.assertions;var B,D,F,L=A.length,C;while(M&&B!==M&&(/\S/).test(M)){B=M;for(var H=0;H<L;H++){D=A[H].re;C=A[H].name;if(F=M.match(D)){if(E[C]){this.tokens.push([C,Object.clone(F)]);M=M.replace(F[0],"")}else{return this.findElements(document).include(I)}}}}var K=true,C,J;for(var H=0,G;G=this.tokens[H];H++){C=G[0],J=G[1];if(!Selector.assertions[C](I,J)){K=false;break}}return K},toString:function(){return this.expression},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"}});if(Prototype.BrowserFeatures.SelectorsAPI&&document.compatMode==="BackCompat"){Selector.CASE_INSENSITIVE_CLASS_NAMES=(function(){var C=document.createElement("div"),A=document.createElement("span");C.id="prototype_test_id";A.className="Test";C.appendChild(A);var B=(C.querySelector("#prototype_test_id .test")!==null);C=A=null;return B})()}Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(A){if(A[1]=="*"){return""}return"[local-name()='"+A[1].toLowerCase()+"' or local-name()='"+A[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(A){A[1]=A[1].toLowerCase();return new Template("[@#{1}]").evaluate(A)},attr:function(A){A[1]=A[1].toLowerCase();A[3]=A[5]||A[6];return new Template(Selector.xpath.operators[A[2]]).evaluate(A)},pseudo:function(A){var B=Selector.xpath.pseudos[A[1]];if(!B){return""}if(Object.isFunction(B)){return B(A)}return new Template(Selector.xpath.pseudos[A[1]]).evaluate(A)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]","empty":"[count(*) = 0 and (count(text()) = 0)]","checked":"[@checked]","disabled":"[(@disabled) and (@type!='hidden')]","enabled":"[not(@disabled) and (@type!='hidden')]","not":function(E){var H=E[6],C=Selector.patterns,I=Selector.xpath,A,J,G=C.length,B;var D=[];while(H&&A!=H&&(/\S/).test(H)){A=H;for(var F=0;F<G;F++){B=C[F].name;if(E=H.match(C[F].re)){J=Object.isFunction(I[B])?I[B](E):new Template(I[B]).evaluate(E);D.push("("+J.substring(1,J.length-1)+")");H=H.replace(E[0],"");break}}}return"[not("+D.join(" and ")+")]"},"nth-child":function(A){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",A)},"nth-last-child":function(A){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",A)},"nth-of-type":function(A){return Selector.xpath.pseudos.nth("position() ",A)},"nth-last-of-type":function(A){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",A)},"first-of-type":function(A){A[6]="1";return Selector.xpath.pseudos["nth-of-type"](A)},"last-of-type":function(A){A[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](A)},"only-of-type":function(A){var B=Selector.xpath.pseudos;return B["first-of-type"](A)+B["last-of-type"](A)},nth:function(E,C){var F,G=C[6],B;if(G=="even"){G="2n+0"}if(G=="odd"){G="2n+1"}if(F=G.match(/^(\d+)$/)){return"["+E+"= "+F[1]+"]"}if(F=G.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(F[1]=="-"){F[1]=-1}var D=F[1]?Number(F[1]):1;var A=F[2]?Number(F[2]):0;B="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(B).evaluate({fragment:E,a:D,b:A})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(A){A[3]=(A[5]||A[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(A)},pseudo:function(A){if(A[6]){A[6]=A[6].replace(/"/g,'\\"')}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(A)},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:[{name:"laterSibling",re:/^\s*~\s*/},{name:"child",re:/^\s*>\s*/},{name:"adjacent",re:/^\s*\+\s*/},{name:"descendant",re:/^\s/},{name:"tagName",re:/^\s*(\*|[\w\-]+)(\b|$)?/},{name:"id",re:/^#([\w\-\*]+)(\b|$)/},{name:"className",re:/^\.([\w\-\*]+)(\b|$)/},{name:"pseudo",re:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/},{name:"attrPresence",re:/^\[((?:[\w-]+:)?[\w-]+)\]/},{name:"attr",re:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/}],assertions:{tagName:function(A,B){return B[1].toUpperCase()==A.tagName.toUpperCase()},className:function(A,B){return Element.hasClassName(A,B[1])},id:function(A,B){return A.id===B[1]},attrPresence:function(A,B){return Element.hasAttribute(A,B[1])},attr:function(B,C){var A=Element.readAttribute(B,C[1]);return A&&Selector.operators[C[2]](A,C[5]||C[6])}},handlers:{concat:function(B,A){for(var C=0,D;D=A[C];C++){B.push(D)}return B},mark:function(A){var D=Prototype.emptyFunction;for(var B=0,C;C=A[B];B++){C._countedByPrototype=D}return A},unmark:function(A){for(var B=0,C;C=A[B];B++){C._countedByPrototype=undefined}return A},index:function(A,D,G){A._countedByPrototype=Prototype.emptyFunction;if(D){for(var B=A.childNodes,E=B.length-1,C=1;E>=0;E--){var F=B[E];if(F.nodeType==1&&(!G||F._countedByPrototype)){F.nodeIndex=C++}}}else{for(var E=0,C=1,B=A.childNodes;F=B[E];E++){if(F.nodeType==1&&(!G||F._countedByPrototype)){F.nodeIndex=C++}}}},unique:function(B){if(B.length==0){return B}var D=[],E;for(var C=0,A=B.length;C<A;C++){if(typeof (E=B[C])._countedByPrototype=="undefined"){E._countedByPrototype=Prototype.emptyFunction;D.push(Element.extend(E))}}return Selector.handlers.unmark(D)},descendant:function(A){var D=Selector.handlers;for(var C=0,B=[],E;E=A[C];C++){D.concat(B,E.getElementsByTagName("*"))}return B},child:function(A){var E=Selector.handlers;for(var D=0,C=[],F;F=A[D];D++){for(var B=0,G;G=F.childNodes[B];B++){if(G.nodeType==1&&G.tagName!="!"){C.push(G)}}}return C},adjacent:function(A){for(var C=0,B=[],E;E=A[C];C++){var D=this.nextElementSibling(E);if(D){B.push(D)}}return B},laterSibling:function(A){var D=Selector.handlers;for(var C=0,B=[],E;E=A[C];C++){D.concat(B,Element.nextSiblings(E))}return B},nextElementSibling:function(A){while(A=A.nextSibling){if(A.nodeType==1){return A}}return null},previousElementSibling:function(A){while(A=A.previousSibling){if(A.nodeType==1){return A}}return null},tagName:function(A,H,C,B){var I=C.toUpperCase();var E=[],G=Selector.handlers;if(A){if(B){if(B=="descendant"){for(var F=0,D;D=A[F];F++){G.concat(E,D.getElementsByTagName(C))}return E}else{A=this[B](A)}if(C=="*"){return A}}for(var F=0,D;D=A[F];F++){if(D.tagName.toUpperCase()===I){E.push(D)}}return E}else{return H.getElementsByTagName(C)}},id:function(A,I,B,C){var H=$(B),G=Selector.handlers;if(I==document){if(!H){return[]}if(!A){return[H]}}else{if(!I.sourceIndex||I.sourceIndex<1){var A=I.getElementsByTagName("*");for(var E=0,D;D=A[E];E++){if(D.id===B){return[D]}}}}if(A){if(C){if(C=="child"){for(var F=0,D;D=A[F];F++){if(H.parentNode==D){return[H]}}}else{if(C=="descendant"){for(var F=0,D;D=A[F];F++){if(Element.descendantOf(H,D)){return[H]}}}else{if(C=="adjacent"){for(var F=0,D;D=A[F];F++){if(Selector.handlers.previousElementSibling(H)==D){return[H]}}}else{A=G[C](A)}}}}for(var F=0,D;D=A[F];F++){if(D==H){return[H]}}return[]}return(H&&Element.descendantOf(H,I))?[H]:[]},className:function(B,A,C,D){if(B&&D){B=this[D](B)}return Selector.handlers.byClassName(B,A,C)},byClassName:function(C,B,F){if(!C){C=Selector.handlers.descendant([B])}var H=" "+F+" ";for(var E=0,D=[],G,A;G=C[E];E++){A=G.className;if(A.length==0){continue}if(A==F||(" "+A+" ").include(H)){D.push(G)}}return D},attrPresence:function(C,B,A,G){if(!C){C=B.getElementsByTagName("*")}if(C&&G){C=this[G](C)}var E=[];for(var D=0,F;F=C[D];D++){if(Element.hasAttribute(F,A)){E.push(F)}}return E},attr:function(A,I,H,J,C,B){if(!A){A=I.getElementsByTagName("*")}if(A&&B){A=this[B](A)}var K=Selector.operators[C],F=[];for(var E=0,D;D=A[E];E++){var G=Element.readAttribute(D,H);if(G===null){continue}if(K(G,J)){F.push(D)}}return F},pseudo:function(B,C,E,A,D){if(B&&D){B=this[D](B)}if(!B){B=A.getElementsByTagName("*")}return Selector.pseudos[C](B,E,A)}},pseudos:{"first-child":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(Selector.handlers.previousElementSibling(E)){continue}C.push(E)}return C},"last-child":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(Selector.handlers.nextElementSibling(E)){continue}C.push(E)}return C},"only-child":function(B,G,A){var E=Selector.handlers;for(var D=0,C=[],F;F=B[D];D++){if(!E.previousElementSibling(F)&&!E.nextElementSibling(F)){C.push(F)}}return C},"nth-child":function(B,C,A){return Selector.pseudos.nth(B,C,A)},"nth-last-child":function(B,C,A){return Selector.pseudos.nth(B,C,A,true)},"nth-of-type":function(B,C,A){return Selector.pseudos.nth(B,C,A,false,true)},"nth-last-of-type":function(B,C,A){return Selector.pseudos.nth(B,C,A,true,true)},"first-of-type":function(B,C,A){return Selector.pseudos.nth(B,"1",A,false,true)},"last-of-type":function(B,C,A){return Selector.pseudos.nth(B,"1",A,true,true)},"only-of-type":function(B,D,A){var C=Selector.pseudos;return C["last-of-type"](C["first-of-type"](B,D,A),D,A)},getIndices:function(B,A,C){if(B==0){return A>0?[A]:[]}return $R(1,C).inject([],function(D,E){if(0==(E-A)%B&&(E-A)/B>=0){D.push(E)}return D})},nth:function(A,L,N,K,C){if(A.length==0){return[]}if(L=="even"){L="2n+0"}if(L=="odd"){L="2n+1"}var J=Selector.handlers,I=[],B=[],E;J.mark(A);for(var H=0,D;D=A[H];H++){if(!D.parentNode._countedByPrototype){J.index(D.parentNode,K,C);B.push(D.parentNode)}}if(L.match(/^\d+$/)){L=Number(L);for(var H=0,D;D=A[H];H++){if(D.nodeIndex==L){I.push(D)}}}else{if(E=L.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(E[1]=="-"){E[1]=-1}var O=E[1]?Number(E[1]):1;var M=E[2]?Number(E[2]):0;var P=Selector.pseudos.getIndices(O,M,A.length);for(var H=0,D,F=P.length;D=A[H];H++){for(var G=0;G<F;G++){if(D.nodeIndex==P[G]){I.push(D)}}}}}J.unmark(A);J.unmark(B);return I},"empty":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(E.tagName=="!"||E.firstChild){continue}C.push(E)}return C},"not":function(A,D,I){var G=Selector.handlers,J,C;var H=new Selector(D).findElements(I);G.mark(H);for(var F=0,E=[],B;B=A[F];F++){if(!B._countedByPrototype){E.push(B)}}G.unmark(H);return E},"enabled":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(!E.disabled&&(!E.type||E.type!=="hidden")){C.push(E)}}return C},"disabled":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(E.disabled){C.push(E)}}return C},"checked":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(E.checked){C.push(E)}}return C}},operators:{"=":function(B,A){return B==A},"!=":function(B,A){return B!=A},"^=":function(B,A){return B==A||B&&B.startsWith(A)},"$=":function(B,A){return B==A||B&&B.endsWith(A)},"*=":function(B,A){return B==A||B&&B.include(A)},"~=":function(B,A){return(" "+B+" ").include(" "+A+" ")},"|=":function(B,A){return("-"+(B||"").toUpperCase()+"-").include("-"+(A||"").toUpperCase()+"-")}},split:function(B){var A=[];B.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(C){A.push(C[1].strip())});return A},matchElements:function(F,G){var E=$$(G),D=Selector.handlers;D.mark(E);for(var C=0,B=[],A;A=F[C];C++){if(A._countedByPrototype){B.push(A)}}D.unmark(E);return B},findElement:function(B,C,A){if(Object.isNumber(C)){A=C;C=false}return Selector.matchElements(B,C||"*")[A||0]},findChildElements:function(E,G){G=Selector.split(G.join(","));var D=[],F=Selector.handlers;for(var C=0,B=G.length,A;C<B;C++){A=new Selector(G[C].strip());F.concat(D,A.findElements(E))}return(B>1)?F.unique(D):D}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(B,A){for(var C=0,D;D=A[C];C++){if(D.tagName!=="!"){B.push(D)}}return B},unmark:function(A){for(var B=0,C;C=A[B];B++){C.removeAttribute("_countedByPrototype")}return A}})}function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(A){A=$(A);A.reset();return A},serializeElements:function(G,B){if(typeof B!="object"){B={hash:!!B}}else{if(Object.isUndefined(B.hash)){B.hash=true}}var C,F,A=false,E=B.submit;var D=G.inject({},function(H,I){if(!I.disabled&&I.name){C=I.name;F=$(I).getValue();if(F!=null&&I.type!="file"&&(I.type!="submit"||(!A&&E!==false&&(!E||C==E)&&(A=true)))){if(C in H){if(!Object.isArray(H[C])){H[C]=[H[C]]}H[C].push(F)}else{H[C]=F}}}return H});return B.hash?D:Object.toQueryString(D)}};Form.Methods={serialize:function(B,A){return Form.serializeElements(Form.getElements(B),A)},getElements:function(E){var F=$(E).getElementsByTagName("*"),D,A=[],C=Form.Element.Serializers;for(var B=0;D=F[B];B++){A.push(D)}return A.inject([],function(G,H){if(C[H.tagName.toLowerCase()]){G.push(Element.extend(H))}return G})},getInputs:function(G,C,D){G=$(G);var A=G.getElementsByTagName("input");if(!C&&!D){return $A(A).map(Element.extend)}for(var E=0,H=[],F=A.length;E<F;E++){var B=A[E];if((C&&B.type!=C)||(D&&B.name!=D)){continue}H.push(Element.extend(B))}return H},disable:function(A){A=$(A);Form.getElements(A).invoke("disable");return A},enable:function(A){A=$(A);Form.getElements(A).invoke("enable");return A},findFirstElement:function(B){var C=$(B).getElements().findAll(function(D){return"hidden"!=D.type&&!D.disabled});var A=C.findAll(function(D){return D.hasAttribute("tabIndex")&&D.tabIndex>=0}).sortBy(function(D){return D.tabIndex}).first();return A?A:C.find(function(D){return["input","select","textarea"].include(D.tagName.toLowerCase())})},focusFirstElement:function(A){A=$(A);A.findFirstElement().activate();return A},request:function(B,A){B=$(B),A=Object.clone(A||{});var D=A.parameters,C=B.readAttribute("action")||"";if(C.blank()){C=window.location.href}A.parameters=B.serialize(true);if(D){if(Object.isString(D)){D=D.toQueryParams()}Object.extend(A.parameters,D)}if(B.hasAttribute("method")&&!A.method){A.method=B.method}return new Ajax.Request(C,A)}};Form.Element={focus:function(A){$(A).focus();return A},select:function(A){$(A).select();return A}};Form.Element.Methods={serialize:function(A){A=$(A);if(!A.disabled&&A.name){var B=A.getValue();if(B!=undefined){var C={};C[A.name]=B;return Object.toQueryString(C)}}return""},getValue:function(A){A=$(A);var B=A.tagName.toLowerCase();return Form.Element.Serializers[B](A)},setValue:function(A,B){A=$(A);var C=A.tagName.toLowerCase();Form.Element.Serializers[C](A,B);return A},clear:function(A){$(A).value="";return A},present:function(A){return $(A).value!=""},activate:function(A){A=$(A);try{A.focus();if(A.select&&(A.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(A.type))){A.select()}}catch(B){}return A},disable:function(A){A=$(A);A.disabled=true;return A},enable:function(A){A=$(A);A.disabled=false;return A}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(A,B){switch(A.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(A,B);default:return Form.Element.Serializers.textarea(A,B)}},inputSelector:function(A,B){if(Object.isUndefined(B)){return A.checked?A.value:null}else{A.checked=!!B}},textarea:function(A,B){if(Object.isUndefined(B)){return A.value}else{A.value=B}},select:function(C,F){if(Object.isUndefined(F)){return this[C.type=="select-one"?"selectOne":"selectMany"](C)}else{var B,D,G=!Object.isArray(F);for(var A=0,E=C.length;A<E;A++){B=C.options[A];D=this.optionValue(B);if(G){if(D==F){B.selected=true;return }}else{B.selected=F.include(D)}}}},selectOne:function(B){var A=B.selectedIndex;return A>=0?this.optionValue(B.options[A]):null},selectMany:function(D){var A,E=D.length;if(!E){return null}for(var C=0,A=[];C<E;C++){var B=D.options[C];if(B.selected){A.push(this.optionValue(B))}}return A},optionValue:function(A){return Element.extend(A).hasAttribute("value")?A.value:A.text}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,A,B,C){$super(C,B);this.element=$(A);this.lastValue=this.getValue()},execute:function(){var A=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(A)?this.lastValue!=A:String(this.lastValue)!=String(A)){this.callback(this.element,A);this.lastValue=A}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({initialize:function(A,B){this.element=$(A);this.callback=B;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var A=this.getValue();if(this.lastValue!=A){this.callback(this.element,A);this.lastValue=A}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(A){if(A.type){switch(A.type.toLowerCase()){case"checkbox":case"radio":Event.observe(A,"click",this.onElementEvent.bind(this));break;default:Event.observe(A,"change",this.onElementEvent.bind(this));break}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});(function(){var U={KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{}};var N;if(Prototype.Browser.IE){var G={0:1,1:4,2:2};N=function(W,V){return W.button===G[V]}}else{if(Prototype.Browser.WebKit){N=function(W,V){switch(V){case 0:return W.which==1&&!W.metaKey;case 1:return W.which==1&&W.metaKey;default:return false}}}else{N=function(W,V){return W.which?(W.which===V+1):(W.button===V)}}}function Q(V){return N(V,0)}function P(V){return N(V,1)}function J(V){return N(V,2)}function C(X){X=U.extend(X);var W=X.target,V=X.type,Y=X.currentTarget;if(Y&&Y.tagName){if(V==="load"||V==="error"||(V==="click"&&Y.tagName.toLowerCase()==="input"&&Y.type==="radio")){W=Y}}if(W.nodeType==Node.TEXT_NODE){W=W.parentNode}return Element.extend(W)}function L(W,Y){var V=U.element(W);if(!Y){return V}var X=[V].concat(V.ancestors());return Selector.findElement(X,Y,0)}function O(V){return{x:B(V),y:A(V)}}function B(X){var W=document.documentElement,V=document.body||{scrollLeft:0};return X.pageX||(X.clientX+(W.scrollLeft||V.scrollLeft)-(W.clientLeft||0))}function A(X){var W=document.documentElement,V=document.body||{scrollTop:0};return X.pageY||(X.clientY+(W.scrollTop||V.scrollTop)-(W.clientTop||0))}function M(V){U.extend(V);V.preventDefault();V.stopPropagation();V.stopped=true}U.Methods={isLeftClick:Q,isMiddleClick:P,isRightClick:J,element:C,findElement:L,pointer:O,pointerX:B,pointerY:A,stop:M};var S=Object.keys(U.Methods).inject({},function(V,W){V[W]=U.Methods[W].methodize();return V});if(Prototype.Browser.IE){function F(W){var V;switch(W.type){case"mouseover":V=W.fromElement;break;case"mouseout":V=W.toElement;break;default:return null}return Element.extend(V)}Object.extend(S,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});U.extend=function(W,V){if(!W){return false}if(W._extendedByPrototype){return W}W._extendedByPrototype=Prototype.emptyFunction;var X=U.pointer(W);Object.extend(W,{target:W.srcElement||V,relatedTarget:F(W),pageX:X.x,pageY:X.y});return Object.extend(W,S)}}else{U.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(U.prototype,S);U.extend=Prototype.K}function K(Z,Y,a){var X=Element.retrieve(Z,"prototype_event_registry");if(Object.isUndefined(X)){D.push(Z);X=Element.retrieve(Z,"prototype_event_registry",$H())}var V=X.get(Y);if(Object.isUndefined()){V=[];X.set(Y,V)}if(V.pluck("handler").include(a)){return false}var W;if(Y.include(":")){W=function(b){if(Object.isUndefined(b.eventName)){return false}if(b.eventName!==Y){return false}U.extend(b,Z);a.call(Z,b)}}else{if(!Prototype.Browser.IE&&(Y==="mouseenter"||Y==="mouseleave")){if(Y==="mouseenter"||Y==="mouseleave"){W=function(c){U.extend(c,Z);var b=c.relatedTarget;while(b&&b!==Z){try{b=b.parentNode}catch(d){b=Z}}if(b===Z){return }a.call(Z,c)}}}else{W=function(b){U.extend(b,Z);a.call(Z,b)}}}W.handler=a;V.push(W);return W}function E(){for(var V=0,W=D.length;V<W;V++){U.stopObserving(D[V]);D[V]=null}}var D=[];if(Prototype.Browser.IE){window.attachEvent("onunload",E)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}var I=Prototype.K;if(!Prototype.Browser.IE){I=function(W){var V={mouseenter:"mouseover",mouseleave:"mouseout"};return W in V?V[W]:W}}function R(Y,X,Z){Y=$(Y);var W=K(Y,X,Z);if(!W){return Y}if(X.include(":")){if(Y.addEventListener){Y.addEventListener("dataavailable",W,false)}else{Y.attachEvent("ondataavailable",W);Y.attachEvent("onfilterchange",W)}}else{var V=I(X);if(Y.addEventListener){Y.addEventListener(V,W,false)}else{Y.attachEvent("on"+V,W)}}return Y}function H(a,Y,b){a=$(a);var X=Element.retrieve(a,"prototype_event_registry");if(Object.isUndefined(X)){return a}if(Y&&!b){var Z=X.get(Y);if(Object.isUndefined(Z)){return a}Z.each(function(c){Element.stopObserving(a,Y,c.handler)});return a}else{if(!Y){X.each(function(e){var c=e.key,d=e.value;d.each(function(g){Element.stopObserving(a,c,g.handler)})});return a}}var Z=X.get(Y);if(!Z){return }var W=Z.find(function(c){return c.handler===b});if(!W){return a}var V=I(Y);if(Y.include(":")){if(a.removeEventListener){a.removeEventListener("dataavailable",W,false)}else{a.detachEvent("ondataavailable",W);a.detachEvent("onfilterchange",W)}}else{if(a.removeEventListener){a.removeEventListener(V,W,false)}else{a.detachEvent("on"+V,W)}}X.set(Y,Z.without(W));return a}function T(Y,X,W,V){Y=$(Y);if(Object.isUndefined(V)){V=true}if(Y==document&&document.createEvent&&!Y.dispatchEvent){Y=document.documentElement}var Z;if(document.createEvent){Z=document.createEvent("HTMLEvents");Z.initEvent("dataavailable",true,true)}else{Z=document.createEventObject();Z.eventType=V?"ondataavailable":"onfilterchange"}Z.eventName=X;Z.memo=W||{};if(document.createEvent){Y.dispatchEvent(Z)}else{Y.fireEvent(Z.eventType,Z)}return U.extend(Z)}Object.extend(U,U.Methods);Object.extend(U,{fire:T,observe:R,stopObserving:H});Element.addMethods({fire:T,observe:R,stopObserving:H});Object.extend(document,{fire:T.methodize(),observe:R.methodize(),stopObserving:H.methodize(),loaded:false});if(window.Event){Object.extend(window.Event,U)}else{window.Event=U}})();(function(){var D;function A(){if(document.loaded){return }if(D){window.clearTimeout(D)}document.loaded=true;document.fire("dom:loaded")}function C(){if(document.readyState==="complete"){document.stopObserving("readystatechange",C);A()}}function B(){try{document.documentElement.doScroll("left")}catch(E){D=B.defer();return }A()}if(document.addEventListener){document.addEventListener("DOMContentLoaded",A,false)}else{document.observe("readystatechange",C);if(window==top){D=B.defer()}}Event.observe(window,"load",A)})();Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(A,B){return Element.insert(A,{before:B})},Top:function(A,B){return Element.insert(A,{top:B})},Bottom:function(A,B){return Element.insert(A,{bottom:B})},After:function(A,B){return Element.insert(A,{after:B})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(B,A,C){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(B,A,C)}this.xcomp=A;this.ycomp=C;this.offset=Element.cumulativeOffset(B);return(C>=this.offset[1]&&C<this.offset[1]+B.offsetHeight&&A>=this.offset[0]&&A<this.offset[0]+B.offsetWidth)},withinIncludingScrolloffsets:function(B,A,D){var C=Element.cumulativeScrollOffset(B);this.xcomp=A+C[0]-this.deltaX;this.ycomp=D+C[1]-this.deltaY;this.offset=Element.cumulativeOffset(B);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+B.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+B.offsetWidth)},overlap:function(B,A){if(!B){return 0}if(B=="vertical"){return((this.offset[1]+A.offsetHeight)-this.ycomp)/A.offsetHeight}if(B=="horizontal"){return((this.offset[0]+A.offsetWidth)-this.xcomp)/A.offsetWidth}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(A){Position.prepare();return Element.absolutize(A)},relativize:function(A){Position.prepare();return Element.relativize(A)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(B,C,A){A=A||{};return Element.clonePosition(C,B,A)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(B){function A(C){return C.blank()?null:"[contains(concat(' ', @class, ' '), ' "+C+" ')]"}B.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(C,E){E=E.toString().strip();var D=/\s/.test(E)?$w(E).map(A).join(""):A(E);return D?document._getElementsByXPath(".//*"+D,C):[]}:function(E,F){F=F.toString().strip();var G=[],H=(/\s/.test(F)?$w(F):null);if(!H&&!F){return G}var C=$(E).getElementsByTagName("*");F=" "+F+" ";for(var D=0,J,I;J=C[D];D++){if(J.className&&(I=" "+J.className+" ")&&(I.include(F)||(H&&H.all(function(K){return !K.toString().blank()&&I.include(" "+K+" ")})))){G.push(Element.extend(J))}}return G};return function(D,C){return $(C||document.body).getElementsByClassName(D)}}(Element.Methods)}Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(A){this.element=$(A)},_each:function(A){this.element.className.split(/\s+/).select(function(B){return B.length>0})._each(A)},set:function(A){this.element.className=A},add:function(A){if(this.include(A)){return }this.set($A(this).concat(A).join(" "))},remove:function(A){if(!this.include(A)){return }this.set($A(this).without(A).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);var n2i={browser:{}};n2i.browser.opera=/opera/i.test(navigator.userAgent);n2i.browser.msie=!n2i.browser.opera&&/MSIE/.test(navigator.userAgent);n2i.browser.msie6=navigator.userAgent.indexOf("MSIE 6")!==-1;n2i.browser.msie7=navigator.userAgent.indexOf("MSIE 7")!==-1;n2i.browser.msie8=navigator.userAgent.indexOf("MSIE 8")!==-1;n2i.browser.webkit=navigator.userAgent.indexOf("WebKit")!==-1;n2i.browser.safari=navigator.userAgent.indexOf("Safari")!==-1;n2i.browser.webkitVersion=null;n2i.browser.gecko=!n2i.browser.webkit&&navigator.userAgent.indexOf("Gecko")!=-1;(function(){var A=/Safari\/([\d.]+)/.exec(navigator.userAgent);if(A){n2i.browser.webkitVersion=parseFloat(A[1])}})();n2i.ELEMENT_NODE=1;n2i.ATTRIBUTE_NODE=2;n2i.TEXT_NODE=3;n2i.log=function(A){try{console.log(A)}catch(B){}};n2i.camelize=function(F){var D=F.split("-");if(D.length==1){return D[0]}var B=F.indexOf("-")==0?D[0].charAt(0).toUpperCase()+D[0].substring(1):D[0];for(var C=1,A=D.length;C<A;C++){var E=D[C];B+=E.charAt(0).toUpperCase()+E.substring(1)}return B};n2i.override=function(B,A){if(A){for(prop in A){B[prop]=A[prop]}}return B};n2i.trim=function(A){if(!A){return A}return A.replace(/^[\s\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]+|[\s\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]+$/g,"")};n2i.escapeHTML=function(A){var B=document.createElement("div");B.appendChild(document.createTextNode(A));return B.innerHTML};n2i.isEmpty=n2i.isBlank=function(A){if(A===null||typeof (A)==="undefined"){return true}return typeof (A)=="string"&&n2i.trim(A).length==0};n2i.isDefined=function(A){return A!==null&&typeof (A)!=="undefined"};n2i.inArray=function(A,C){for(var B=0;B<A.length;B++){if(A[B]==C){return true}}return false};n2i.flipInArray=function(A,B){if(n2i.inArray(A,B)){n2i.removeFromArray(A,B)}else{A.push(B)}};n2i.removeFromArray=function(A,C){for(var B=A.length-1;B>=0;B--){if(A[B]==C){A.splice(B,1)}}};n2i.addToArray=function(A,C){if(C.constructor==Array){for(var B=0;B<C.length;B++){if(!n2i.inArray(A,C[B])){A.push(C)}}}else{if(!n2i.inArray(A,C)){A.push(C)}}};n2i.scrollTo=function(A){A=$(A);if(A){var B=A.cumulativeOffset();window.scrollTo(B.left,B.top-50)}};n2i.dom={isElement:function(B,A){return B.nodeType==n2i.ELEMENT_NODE&&(A===undefined?true:B.nodeName==A)},isDefinedText:function(A){return A.nodeType==n2i.TEXT_NODE&&A.nodeValue.length>0},addText:function(A,B){A.appendChild(document.createTextNode(B))},getNodeText:function(C){var A="";var D=C.childNodes;for(var B=0;B<D.length;B++){if(D[B].nodeType==n2i.TEXT_NODE&&D[B].nodeValue!=null){A+=D[B].nodeValue}}return A}};n2i.getStyle=function(B,C){B=$(B);var E=n2i.camelize(C);var D=B.style[E];if(!D){if(document.defaultView&&document.defaultView.getComputedStyle){var A=document.defaultView.getComputedStyle(B,null);D=A?A.getPropertyValue(C):null}else{if(B.currentStyle){D=B.currentStyle[E]}}}if(window.opera&&["left","top","right","bottom"].include(C)){if(n2i.getStyle(B,"position")=="static"){D="auto"}}return D=="auto"?null:D};n2i.setOpacity=function(B,A){if(n2i.browser.msie){if(A==1){B.style["filter"]=null}else{B.style["filter"]="alpha(opacity="+(A*100)+")"}}else{B.style["opacity"]=A}};n2i.copyStyle=function(B,C,A){A.each(function(D){var E=B.getStyle(D);if(E){C.style[D]=B.getStyle(D)}})};n2i.isReturnKey=function(A){return A.keyCode==13};n2i.isRightKey=function(A){return A.keyCode==39};n2i.isLeftKey=function(A){return A.keyCode==37};n2i.isEscapeKey=function(A){return A.keyCode==27};n2i.isSpaceKey=function(A){return A.keyCode==32};n2i.getFrameDocument=function(A){if(A.contentDocument){return A.contentDocument}else{if(A.contentWindow){return A.contentWindow.document}else{if(A.document){return A.document}}}};n2i.getFrameWindow=function(A){if(A.defaultView){return A.defaultView}else{if(A.contentWindow){return A.contentWindow}}};n2i.getSelectedText=function(A){A=A||document;if(A.getSelection){return A.getSelection()+""}else{if(A.selection){return A.selection.createRange().text}}return""};n2i.getScrollTop=function(){if(self.pageYOffset){return self.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){return document.documentElement.scrollTop}else{if(document.body){return document.body.scrollTop}}}};n2i.getScrollLeft=function(){if(self.pageYOffset){return self.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollTop){return document.documentElement.scrollLeft}else{if(document.body){return document.body.scrollLeft}}}};n2i.getViewPortHeight=function(){var A;if(window.innerHeight){return window.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){return document.documentElement.clientHeight}else{if(document.body){return document.body.clientHeight}}}};n2i.getInnerHeight=function(){var A;if(window.innerHeight){return window.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){return document.documentElement.clientHeight}else{if(document.body){return document.body.clientHeight}}}};n2i.getDocumentWidth=n2i.getInnerWidth=function(){if(window.innerHeight){return window.innerWidth}else{if(document.documentElement&&document.documentElement.clientHeight){return document.documentElement.clientWidth}else{if(document.body){return document.body.clientWidth}}}};n2i.getDocumentHeight=function(){if(n2i.browser.msie6){var A=Math.max(document.body.clientHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight);$(document.body).childElements().each(function(B){A=Math.max(A,B.getHeight())});return A}if(window.scrollMaxY&&window.innerHeight){return window.scrollMaxY+window.innerHeight}else{return Math.max(document.body.clientHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight)}};n2i.place=function(B){var E=0,D=0;var A=B.target.element;var C=A.cumulativeOffset();E=C.left+A.clientWidth*B.target.horizontal;D=C.top+A.clientHeight*B.target.vertical;var F=B.source.element;E-=F.clientWidth*B.source.horizontal;D-=F.clientHeight*B.source.vertical;var F=B.source.element;F.style.top=D+"px";F.style.left=E+"px"};n2i.Preloader=function(A){this.options=A||{};this.delegate={};this.images=[];this.loaded=0};n2i.Preloader.prototype={addImages:function(A){if(typeof (A)=="object"){for(var B=0;B<A.length;B++){this.images.push(A[B])}}else{this.images.push(A)}},setDelegate:function(A){this.delegate=A},load:function(E){E=E||0;var B=this;this.obs=[];for(var D=E;D<this.images.length+E;D++){var C=D;if(C>=this.images.length){C=C-this.images.length}var A=new Image();A.n2iPreloaderIndex=C;A.onload=function(){B.imageChanged(this.n2iPreloaderIndex,"imageDidLoad")};A.onerror=function(){B.imageChanged(this.n2iPreloaderIndex,"imageDidGiveError")};A.onabort=function(){B.imageChanged(this.n2iPreloaderIndex,"imageDidAbort")};A.src=(this.options.context?this.options.context:"")+this.images[C];this.obs.push(A)}},imageChanged:function(A,B){this.loaded++;if(this.delegate[B]){this.delegate[B](this.loaded,this.images.length,A)}if(this.loaded==this.images.length&&this.delegate.allImagesDidLoad){this.delegate.allImagesDidLoad()}}};n2i.cookie={set:function(C,D,E){if(E){var B=new Date();B.setTime(B.getTime()+(E*24*60*60*1000));var A="; expires="+B.toGMTString()}else{var A=""}document.cookie=C+"="+D+A+"; path=/"},get:function(B){var D=B+"=";var A=document.cookie.split(";");for(var C=0;C<A.length;C++){var E=A[C];while(E.charAt(0)==" "){E=E.substring(1,E.length)}if(E.indexOf(D)==0){return E.substring(D.length,E.length)}}return null},clear:function(A){this.set(A,"",-1)}};n2i.URL=function(A){this.url=A||""};n2i.URL.prototype={addParameter:function(A,B){this.url+=this.url.indexOf("?")!=-1?"&":"?";this.url+=A+"="+(n2i.isDefined(B)?B:"")},toString:function(){return this.url}};n2i.location={getParameter:function(A){var C=n2i.location.getParameters();for(var B=0;B<C.length;B++){if(C[B].name==A){return C[B].value}}return null},setParameter:function(A,E){var C=n2i.location.getParameters();var D=false;for(var B=0;B<C.length;B++){if(C[B].name==A){C[B].value=E;D=true;break}}if(!D){C.push({name:A,value:E})}n2i.location.setParameters(C)},hasHash:function(A){var B=document.location.hash;if(B!==""){return B=="#"+A}return false},getHashParameter:function(A){var D=document.location.hash;if(D!==""){var B=D.indexOf(A+"=");if(B!==-1){var C=D.substring(B+A.length+1);if(C.indexOf("&")!==-1){return C.substring(0,C.indexOf("&"))}return C}}return null},clearHash:function(){document.location.hash="#"},setParameters:function(B){var C="";for(var A=0;A<B.length;A++){C+=A==0?"?":"&";C+=B[A].name+"="+B[A].value}document.location.search=C},getBoolean:function(A){var B=n2i.location.getParameter(A);return(B=="true"||B=="1")},getParameters:function(){var B=document.location.search.substring(1).split("&");var A=[];for(var D=0;D<B.length;D++){var E=B[D].split("=");var C=unescape(E[0]).replace(/^\s*|\s*$/g,"");var F=unescape(E[1]).replace(/^\s*|\s*$/g,"");if(C){A.push({name:C,value:F})}}return A}};n2i.ani=n2i.animate=function(A,C,D,E,B){n2i.animation.get(A).animate(null,D,C,E,B)};n2i.animation={objects:{},running:false,latestId:0,get:function(A){A=$(A);if(!A.n2iAnimationId){A.n2iAnimationId=this.latestId++}if(!this.objects[A.n2iAnimationId]){this.objects[A.n2iAnimationId]=new n2i.animation.Item(A)}return this.objects[A.n2iAnimationId]},start:function(){if(!this.running){n2i.animation.render()}}};n2i.animation.render=function(F){this.running=true;var H=false;var A=new Date().getTime();for(id in this.objects){var E=this.objects[id];if(E.work){for(var G=0;G<E.work.length;G++){var K=E.work[G];if(K.finished){continue}var D=(A-K.start)/(K.end-K.start);if(D<0){H=true;continue}else{if(isNaN(D)){D=1}else{if(D>1){D=1}else{if(D<1){H=true}}}}var N=D;if(K.delegate&&K.delegate.ease){N=K.delegate.ease(N)}var M=null;if(!K.css){E.element[K.property]=Math.round(K.from+(K.to-K.from)*N)}else{if(K.property=="transform"&&!n2i.browser.msie){var O=K.transform;var J="";if(O.rotate){J+=" rotate("+(O.rotate.from+(O.rotate.to-O.rotate.from)*N)+O.rotate.unit+")"}if(O.scale){J+=" scale("+(O.scale.from+(O.scale.to-O.scale.from)*N)+")"}E.element.style[n2i.animation.TRANSFORM]=J}else{if(K.to.red!=null){var B=Math.round(K.from.red+(K.to.red-K.from.red)*N);var C=Math.round(K.from.green+(K.to.green-K.from.green)*N);var L=Math.round(K.from.blue+(K.to.blue-K.from.blue)*N);M="rgb("+B+","+C+","+L+")";E.element.style[K.property]=M}else{if(n2i.browser.msie&&K.property=="opacity"){var I=(K.from+(K.to-K.from)*N);if(I==1){E.element.style.removeAttribute("filter")}else{E.element.style["filter"]="alpha(opacity="+(I*100)+")"}}else{M=new String(K.from+(K.to-K.from)*N)+(K.unit!=null?K.unit:"");E.element.style[K.property]=M}}}}if(D==1){K.finished=true;if(K.delegate&&K.delegate.onComplete){window.setTimeout(K.delegate.onComplete)}else{if(K.delegate&&K.delegate.hideOnComplete){E.element.style.display="none"}}}}}}if(H){window.setTimeout(function(){n2i.animation.render()},0)}else{this.running=false}};n2i.animation.parseStyle=function(D){var B={type:null,value:null,unit:null};var C;if(!n2i.isDefined(D)){return B}else{if(!isNaN(D)){B.value=parseFloat(D)}else{if(C=D.match(/([\-]?[0-9\.]+)(px|pt|%)/)){B.type="length";B.value=parseFloat(C[1]);B.unit=C[2]}else{if(C=D.match(/rgb\(([0-9]+),[ ]?([0-9]+),[ ]?([0-9]+)\)/)){B.type="color";B.value={red:parseInt(C[1]),green:parseInt(C[2]),blue:parseInt(C[3])}}else{var A=new n2i.Color(D);if(A.ok){B.value={red:A.r,green:A.g,blue:A.b}}}}}}return B};n2i.animation.Item=function(A){this.element=A;this.work=[]};n2i.animation.Item.prototype.animate=function(H,I,J,B,F){var D=true;if(J=="scrollLeft"||J=="scrollTop"){D=false}var G=this.getWork(D?n2i.camelize(J):J);G.delegate=F;G.finished=false;G.css=D;if(H!=null){G.from=H}else{if(J=="transform"){G.transform=n2i.animation.Item.parseTransform(I,this.element)}else{if(G.css&&n2i.browser.msie&&J=="opacity"){G.from=this.getIEOpacity(this.element)}else{if(G.css){var A=n2i.getStyle(this.element,J);var C=n2i.animation.parseStyle(A);G.from=C.value}else{G.from=this.element[J]}}}}if(G.css){var E=n2i.animation.parseStyle(I);G.to=E.value;G.unit=E.unit}else{G.to=I;G.unit=null}G.start=new Date().getTime();if(F&&F.delay){G.start+=F.delay}G.end=G.start+B;n2i.animation.start()};n2i.animation.TRANSFORM=n2i.browser.gecko?"MozTransform":"WebkitTransform";n2i.animation.Item.parseTransform=function(G,D){var I={};var H=/rotate\(([0-9\.]+)([a-z]+)\)/i;var C=G.match(H);if(C){var F=0;if(D.style[n2i.animation.TRANSFORM]){var E=D.style[n2i.animation.TRANSFORM].match(H);if(E){F=parseFloat(E[1])}}I.rotate={from:F,to:parseFloat(C[1]),unit:C[2]}}var A=/scale\(([0-9\.]+)\)/i;var B=G.match(A);if(B){var F=1;if(D.style[n2i.animation.TRANSFORM]){var E=D.style[n2i.animation.TRANSFORM].match(A);if(E){F=parseFloat(E[1])}}I.scale={from:F,to:parseFloat(B[1])}}return I};n2i.animation.Item.prototype.getIEOpacity=function(B){var C=n2i.getStyle(B,"filter").toLowerCase();var A;if(A=C.match(/opacity=([0-9]+)/)){return parseFloat(A[1])/100}else{return 1}};n2i.animation.Item.prototype.getWork=function(C){for(var B=0;B<this.work.length;B++){if(this.work[B].property==C){return this.work[B]}}var A={property:C};this.work[this.work.length]=A;return A};n2i.animation.Loop=function(A){this.recipe=A;this.position=-1;this.running=false};n2i.animation.Loop.prototype.next=function(){this.position++;if(this.position>=this.recipe.length){this.position=0}var B=this.recipe[this.position];if(typeof (B)=="function"){B()}else{if(B.element){n2i.ani(B.element,B.property,B.value,B.duration,{ease:B.ease})}}var A=this;var C=B.duration||0;window.setTimeout(function(){A.next()},C)};n2i.animation.Loop.prototype.start=function(){this.running=true;this.next()};n2i.Color=function(G){this.ok=false;if(G.charAt(0)=="#"){G=G.substr(1,6)}G=G.replace(/ /g,"");G=G.toLowerCase();var A={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};for(var C in A){if(G==C){G=A[C]}}var H=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(I){return[parseInt(I[1]),parseInt(I[2]),parseInt(I[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(I){return[parseInt(I[1],16),parseInt(I[2],16),parseInt(I[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(I){return[parseInt(I[1]+I[1],16),parseInt(I[2]+I[2],16),parseInt(I[3]+I[3],16)]}}];for(var B=0;B<H.length;B++){var E=H[B].re;var D=H[B].process;var F=E.exec(G);if(F){channels=D(F);this.r=channels[0];this.g=channels[1];this.b=channels[2];this.ok=true}}this.r=(this.r<0||isNaN(this.r))?0:((this.r>255)?255:this.r);this.g=(this.g<0||isNaN(this.g))?0:((this.g>255)?255:this.g);this.b=(this.b<0||isNaN(this.b))?0:((this.b>255)?255:this.b);this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"};this.toHex=function(){var K=this.r.toString(16);var J=this.g.toString(16);var I=this.b.toString(16);if(K.length==1){K="0"+K}if(J.length==1){J="0"+J}if(I.length==1){I="0"+I}return"#"+K+J+I}};n2i.ease={slowFastSlow:function(C){var B=1.6;var A=1.4;return -1*Math.pow(Math.cos((Math.PI/2)*Math.pow(C,B)),Math.pow(Math.PI,A))+1},fastSlow:function(C){var B=0.5;var A=0.7;return -1*Math.pow(Math.cos((Math.PI/2)*Math.pow(C,B)),Math.pow(Math.PI,A))+1},elastic:function(A){return 1-n2i.ease.elastic2(1-A)},elastic2:function(B,A,D){if(B<=0||B>=1){return B}if(!D){D=0.45}var C;if(!A||A<1){A=1;C=D/4}else{C=D/(2*Math.PI)*Math.asin(1/A)}return -(A*Math.pow(2,10*(B-=1))*Math.sin((B-C)*(2*Math.PI)/D))},bounce:function(A){if(A<(1/2.75)){return 7.5625*A*A}else{if(A<(2/2.75)){return(7.5625*(A-=(1.5/2.75))*A+0.75)}else{if(A<(2.5/2.75)){return(7.5625*(A-=(2.25/2.75))*A+0.9375)}else{return(7.5625*(A-=(2.625/2.75))*A+0.984375)}}}},linear:function(A){return A},quadIn:function(A){return Math.pow(A,2)},quadOut:function(A){return A*(A-2)*-1},quadInOut:function(A){A=A*2;if(A<1){return Math.pow(A,2)/2}return -1*((--A)*(A-2)-1)/2},cubicIn:function(A){return Math.pow(A,3)},cubicOut:function(A){return Math.pow(A-1,3)+1},cubicInOut:function(A){A=A*2;if(A<1){return Math.pow(A,3)/2}A-=2;return(Math.pow(A,3)+2)/2},quartIn:function(A){return Math.pow(A,4)},quartOut:function(A){return -1*(Math.pow(A-1,4)-1)},quartInOut:function(A){A=A*2;if(A<1){return Math.pow(A,4)/2}A-=2;return -1/2*(Math.pow(A,4)-2)},quintIn:function(A){return Math.pow(A,5)},quintOut:function(A){return Math.pow(A-1,5)+1},quintInOut:function(A){A=A*2;if(A<1){return Math.pow(A,5)/2}A-=2;return(Math.pow(A,5)+2)/2},sineIn:function(A){return -1*Math.cos(A*(Math.PI/2))+1},sineOut:function(A){return Math.sin(A*(Math.PI/2))},sineInOut:function(A){return -1*(Math.cos(Math.PI*A)-1)/2},expoIn:function(A){return(A==0)?0:Math.pow(2,10*(A-1))},expoOut:function(A){return(A==1)?1:(-1*Math.pow(2,-10*A)+1)},expoInOut:function(A){if(A==0){return 0}if(A==1){return 1}A=A*2;if(A<1){return Math.pow(2,10*(A-1))/2}--A;return(-1*Math.pow(2,-10*A)+2)/2},circIn:function(A){return -1*(Math.sqrt(1-Math.pow(A,2))-1)},circOut:function(A){A=A-1;return Math.sqrt(1-Math.pow(A,2))},circInOut:function(A){A=A*2;if(A<1){return -1/2*(Math.sqrt(1-Math.pow(A,2))-1)}A-=2;return 1/2*(Math.sqrt(1-Math.pow(A,2))+1)},backIn:function(B){var A=1.70158;return Math.pow(B,2)*((A+1)*B-A)},backOut:function(B){B=B-1;var A=1.70158;return Math.pow(B,2)*((A+1)*B+A)+1},backInOut:function(B){var A=1.70158*1.525;B=B*2;if(B<1){return(Math.pow(B,2)*((A+1)*B-A))/2}B-=2;return(Math.pow(B,2)*((A+1)*B+A)+2)/2},elasticIn:function(C){if(C==0){return 0}if(C==1){return 1}var B=0.3;var A=B/4;C=C-1;return -1*Math.pow(2,10*C)*Math.sin((C-A)*(2*Math.PI)/B)},elasticOut:function(C){if(C==0){return 0}if(C==1){return 1}var B=0.3;var A=B/4;return Math.pow(2,-10*C)*Math.sin((C-A)*(2*Math.PI)/B)+1},elasticInOut:function(C){if(C==0){return 0}C=C*2;if(C==2){return 1}var B=0.3*1.5;var A=B/4;if(C<1){C-=1;return -0.5*(Math.pow(2,10*C)*Math.sin((C-A)*(2*Math.PI)/B))}C-=1;return 0.5*(Math.pow(2,-10*C)*Math.sin((C-A)*(2*Math.PI)/B))+1},bounceIn:function(A){return(1-n2i.ease.bounceOut(1-A))},bounceOut:function(D){var B=7.5625;var C=2.75;var A;if(D<(1/C)){A=B*Math.pow(D,2)}else{if(D<(2/C)){D-=(1.5/C);A=B*Math.pow(D,2)+0.75}else{if(D<(2.5/C)){D-=(2.25/C);A=B*Math.pow(D,2)+0.9375}else{D-=(2.625/C);A=B*Math.pow(D,2)+0.984375}}}return A},bounceInOut:function(A){if(A<0.5){return n2i.ease.bounceIn(A*2)/2}return(n2i.ease.bounceOut(A*2-1)/2)+0.5}};var WysiHat={};WysiHat.Editor={attach:function(A){A=$(A);A.hide();return WysiHat.iFrame.create(A,function(C){var B=C.getDocument();var D=C.getWindow();C.load();Event.observe(D,"focus",function(E){C.focus()});Event.observe(D,"blur",function(E){C.blur()});Event.observe(B,"mouseup",function(E){C.fire("wysihat:mouseup")});Event.observe(B,"mousemove",function(E){C.fire("wysihat:mousemove")});Event.observe(B,"keypress",function(E){C.fire("wysihat:change");C.fire("wysihat:keypress")});Event.observe(B,"keyup",function(E){C.fire("wysihat:change");C.fire("wysihat:keyup")});Event.observe(B,"keydown",function(E){if(E.keyCode==86){C.fire("wysihat:paste")}});Event.observe(D,"paste",function(E){C.fire("wysihat:paste")});C.observe("wysihat:change",function(E){E.target.save()})})}};WysiHat.Commands={boldSelection:function(){this.execCommand("bold",false,null)},underlineSelection:function(){this.execCommand("underline",false,null)},italicSelection:function(){this.execCommand("italic",false,null)},strikethroughSelection:function(){this.execCommand("strikethrough",false,null)},blockquoteSelection:function(){this.execCommand("blockquote",false,null)},colorSelection:function(A){this.execCommand("forecolor",false,A)},linkSelection:function(A){this.execCommand("createLink",false,A)},insertOrderedList:function(){this.execCommand("insertorderedlist",false,null)},insertUnorderedList:function(){this.execCommand("insertunorderedlist",false,null)},insertImage:function(A){this.execCommand("insertImage",false,A)},insertHTML:function(B){if(Prototype.Browser.IE){var A=this._selection.getRange();A.pasteHTML(B);A.collapse(false);A.select()}else{this.execCommand("insertHTML",false,B)}},execCommand:function(D,C,B){var A=this.getDocument();A.execCommand(D,C,B)},queryStateCommands:$A(["bold","italic","underline","strikethrough"]),queryCommandState:function(B){var A=this.getDocument();if(this.queryStateCommands.include(B)){return A.queryCommandState(B)}else{if((f=this["query"+B.capitalize()])){return f.bind(this).call()}else{return false}}}};WysiHat.Persistence=(function(){function G(H){return H.format_html_output()}function A(H){return H.format_html_input()}function E(){return this.outputFilter(this.rawContent())}function D(H){this.setRawContent(this.inputFilter(H))}function C(){this.textarea.value=this.content()}function F(){this.setContent(this.textarea.value)}function B(){this.selection.setBookmark();this.save();this.load();this.selection.moveToBookmark()}return{outputFilter:G,inputFilter:A,content:E,setContent:D,save:C,load:F,reload:B}})();WysiHat.Window=(function(){function C(){return this.contentDocument||this.contentWindow.document}function B(){if(this.contentWindow.document){return this.contentWindow}else{if(this.contentDocument){return this.contentDocument.defaultView}else{return null}}}function A(){this.getWindow().focus();if(this.hasFocus){return }this.hasFocus=true}function D(){this.hasFocus=false}return{getDocument:C,getWindow:B,focus:A,blur:D}})();WysiHat.iFrame={create:function(A,C){var B=new Element("iframe",{"id":A.id+"_editor","class":"editor",allowtransparency:"true"});Object.extend(B,WysiHat.Commands);Object.extend(B,WysiHat.Persistence);Object.extend(B,WysiHat.Window);Object.extend(B,WysiHat.iFrame.Methods);B.attach(A,C);A.insert({before:B});return B}};WysiHat.iFrame.Methods={attach:function(A,B){this.textarea=A;this.observe("load",function(){function D(F,I){if(Prototype.Browser.IE){var H=F.createStyleSheet();H.addRule("body","border: 0");H.addRule("p","margin: 0");$H(I).each(function(K){var J=K.first().underscore().dasherize()+": "+K.last();H.addRule("body",J)})}else{if(Prototype.Browser.Opera){var H=Element("style").update("p { margin: 0; }");var G=F.getElementsByTagName("head")[0];G.appendChild(H)}else{Element.setStyle(F.body,I)}}}try{var C=this.getDocument()}catch(E){return }this.selection=new WysiHat.Selection(this);if(this.ready&&C.designMode=="on"){return }D(C,WysiHat.Editor.styles||{});C.designMode="on";B(this);this.ready=true;if(C.body){this.fire("wysihat:loaded")}})},rawContent:function(){var A=this.getDocument();return A.body.innerHTML},setRawContent:function(B){var A=this.getDocument();if(A.body){A.body.innerHTML=B}}};Object.extend(String.prototype,(function(){function B(){var H=String(this);H=H.tidy_xhtml();if(Prototype.Browser.WebKit){H=H.replace(/(<div>)+/g,"\n");H=H.replace(/(<\/div>)+/g,"");H=H.replace(/<p>\s*<\/p>/g,"");H=H.replace(/<br \/>(\n)*/g,"\n")}else{if(Prototype.Browser.Gecko){H=H.replace(/<p>/g,"");H=H.replace(/<\/p>(\n)?/g,"\n");H=H.replace(/<br \/>(\n)*/g,"\n")}else{if(Prototype.Browser.IE||Prototype.Browser.Opera){H=H.replace(/<p>(&nbsp;|&#160;|\s)<\/p>/g,"<p></p>");H=H.replace(/<br \/>/g,"");H=H.replace(/<p>/g,"");H=H.replace(/&nbsp;/g,"");H=H.replace(/<\/p>(\n)?/g,"\n");H=H.gsub(/^<p>/,"");H=H.gsub(/<\/p>$/,"")}}}H=H.gsub(/<b>/,"<strong>");H=H.gsub(/<\/b>/,"</strong>");H=H.gsub(/<i>/,"<em>");H=H.gsub(/<\/i>/,"</em>");H=H.replace(/\n\n+/g,"</p>\n\n<p>");H=H.gsub(/(([^\n])(\n))(?=([^\n]))/,"#{2}<br />\n");H="<p>"+H+"</p>";H=H.replace(/<p>\s*/g,"<p>");H=H.replace(/\s*<\/p>/g,"</p>");var E=Element("body");E.innerHTML=H;if(Prototype.Browser.WebKit||Prototype.Browser.Gecko){var G;do{G=false;E.select("span").each(function(I){if(I.hasClassName("Apple-style-span")){I.removeClassName("Apple-style-span");if(I.className==""){I.removeAttribute("class")}G=true}else{if(I.getStyle("fontWeight")=="bold"){I.setStyle({fontWeight:""});if(I.style.length==0){I.removeAttribute("style")}I.update("<strong>"+I.innerHTML+"</strong>");G=true}else{if(I.getStyle("fontStyle")=="italic"){I.setStyle({fontStyle:""});if(I.style.length==0){I.removeAttribute("style")}I.update("<em>"+I.innerHTML+"</em>");G=true}else{if(I.getStyle("textDecoration")=="underline"){I.setStyle({textDecoration:""});if(I.style.length==0){I.removeAttribute("style")}I.update("<u>"+I.innerHTML+"</u>");G=true}else{if(I.attributes.length==0){I.replace(I.innerHTML);G=true}}}}}})}while(G)}for(var D=0;D<E.descendants().length;D++){var F=E.descendants()[D];if(F.innerHTML.blank()&&F.nodeName!="BR"&&F.id!="bookmark"){F.remove()}}H=E.innerHTML;H=H.tidy_xhtml();H=H.replace(/<br \/>(\n)*/g,"<br />\n");H=H.replace(/<\/p>\n<p>/g,"</p>\n\n<p>");H=H.replace(/<p>\s*<\/p>/g,"");H=H.replace(/\s*$/g,"");return H}function C(){var E=String(this);var D=Element("body");D.innerHTML=E;if(Prototype.Browser.Gecko||Prototype.Browser.WebKit){D.select("strong").each(function(F){F.replace('<span style="font-weight: bold;">'+F.innerHTML+"</span>")});D.select("em").each(function(F){F.replace('<span style="font-style: italic;">'+F.innerHTML+"</span>")});D.select("u").each(function(F){F.replace('<span style="text-decoration: underline;">'+F.innerHTML+"</span>")})}if(Prototype.Browser.WebKit){D.select("span").each(function(F){if(F.getStyle("fontWeight")=="bold"){F.addClassName("Apple-style-span")}if(F.getStyle("fontStyle")=="italic"){F.addClassName("Apple-style-span")}if(F.getStyle("textDecoration")=="underline"){F.addClassName("Apple-style-span")}})}E=D.innerHTML;E=E.tidy_xhtml();E=E.replace(/<\/p>(\n)*<p>/g,"\n\n");E=E.replace(/(\n)?<br( \/)?>(\n)?/g,"\n");E=E.replace(/^<p>/g,"");E=E.replace(/<\/p>$/g,"");if(Prototype.Browser.Gecko){E=E.replace(/\n/g,"<br>");E=E+"<br>"}else{if(Prototype.Browser.WebKit){E=E.replace(/\n/g,"</div><div>");E="<div>"+E+"</div>";E=E.replace(/<div><\/div>/g,"<div><br></div>")}else{if(Prototype.Browser.IE||Prototype.Browser.Opera){E=E.replace(/\n/g,"</p>\n<p>");E="<p>"+E+"</p>";E=E.replace(/<p><\/p>/g,"<p>&nbsp;</p>");E=E.replace(/(<p>&nbsp;<\/p>)+$/g,"")}}}return E}function A(){var D=String(this);D=D.gsub(/\r\n?/,"\n");D=D.gsub(/<([A-Z]+)([^>]*)>/,function(E){return"<"+E[1].toLowerCase()+E[2]+">"});D=D.gsub(/<\/([A-Z]+)>/,function(E){return"</"+E[1].toLowerCase()+">"});D=D.replace(/<br>/g,"<br />");return D}return{format_html_output:B,format_html_input:C,tidy_xhtml:A}})());Object.extend(String.prototype,{sanitize:function(A){return Element("div").update(this).sanitize(A).innerHTML.tidy_xhtml()}});Element.addMethods({sanitize:function(C,B){C=$(C);B=$H(B);var A=$A(B.get("tags")||[]);var D=$A(B.get("attributes")||[]);var E=Element(C.nodeName);$A(C.childNodes).each(function(H){if(H.nodeType==1){var F=$(H).sanitize(B).childNodes;if(A.include(H.nodeName.toLowerCase())){var G=Element(H.nodeName);D.each(function(I){if((value=H.readAttribute(I))){G.writeAttribute(I,value)}});E.appendChild(G);$A(F).each(function(I){G.appendChild(I)})}else{$A(F).each(function(I){E.appendChild(I)})}}else{if(H.nodeType==3){E.appendChild(H)}}});return E}});if(Prototype.Browser.IE){function Range(A){this.ownerDocument=A;this.startContainer=this.ownerDocument.documentElement;this.startOffset=0;this.endContainer=this.ownerDocument.documentElement;this.endOffset=0;this.collapsed=true;this.commonAncestorContainer=null;this.START_TO_START=0;this.START_TO_END=1;this.END_TO_END=2;this.END_TO_START=3}document.createRange=function(){return new Range(this)};Object.extend(Range.prototype,{setStart:function(A,B){},setEnd:function(A,B){},setStartBefore:function(A){},setStartAfter:function(A){},setEndBefore:function(A){},setEndAfter:function(A){},collapse:function(A){},selectNode:function(A){},selectNodeContents:function(A){},compareBoundaryPoints:function(A,B){},deleteContents:function(){},extractContents:function(){},cloneContents:function(){},insertNode:function(C){var A=this.ownerDocument.selection.createRange();var B=this.ownerDocument.createElement("div");B.appendChild(C);A.collapse();A.pasteHTML(B.innerHTML)},surroundContents:function(C){var A=this.ownerDocument.selection.createRange();var B=this.document.createElement("div");B.appendChild(C);node.innerHTML+=A.htmlText;A.pasteHTML(B.innerHTML)},cloneRange:function(){},toString:function(){},detach:function(){}})}WysiHat.Selection=Class.create((function(){function F(J){this.window=J.getWindow();this.document=J.getDocument()}function E(){return this.window.getSelection?this.window.getSelection():this.document.selection}function A(){var K=this.getSelection();try{var J;if(K.getRangeAt){J=K.getRangeAt(0)}else{J=K.createRange()}}catch(L){return null}if(Prototype.Browser.WebKit){J.setStart(K.baseNode,K.baseOffset);J.setEnd(K.extentNode,K.extentOffset)}return J}function D(L){var K=this.getSelection();if(Prototype.Browser.IE){var J=G(this.document,L);J.select()}else{if(Prototype.Browser.WebKit){K.setBaseAndExtent(L,0,L,L.innerText.length)}else{if(Prototype.Browser.Opera){J=this.document.createRange();J.selectNode(L);K.removeAllRanges();K.addRange(J)}else{var J=G(this.document,L);K.removeAllRanges();K.addRange(J)}}}}function C(){var J=null,O=[],M,L;var P=this.getRange();if(!P){return null}var Q;if(P.parentElement){Q=P.parentElement()}else{Q=P.commonAncestorContainer}if(Q){while(Q.nodeType!=1){Q=Q.parentNode}if(Q.nodeName.toLowerCase()!="body"){L=Q;do{L=L.parentNode;O[O.length]=L}while(L.nodeName.toLowerCase()!="body")}M=Q.all||Q.getElementsByTagName("*");for(var N=0;N<M.length;N++){O[O.length]=M[N]}J=[Q];for(var R=0,K;R<O.length;R++){K=G(this.document,O[R]);if(K&&B(P,K)){J[J.length]=O[R]}}}return J.first()}function G(J,L){if(J.body.createTextRange){var K=J.body.createTextRange();K.moveToElementText(L)}else{if(J.createRange){var K=J.createRange();K.selectNodeContents(L)}}return K}function B(K,J){if(K.compareEndPoints){return !(J.compareEndPoints("StartToStart",K)==1&&J.compareEndPoints("EndToEnd",K)==1&&J.compareEndPoints("StartToEnd",K)==1&&J.compareEndPoints("EndToStart",K)==1||J.compareEndPoints("StartToStart",K)==-1&&J.compareEndPoints("EndToEnd",K)==-1&&J.compareEndPoints("StartToEnd",K)==-1&&J.compareEndPoints("EndToStart",K)==-1)}else{if(K.compareBoundaryPoints){return !(J.compareBoundaryPoints(0,K)==1&&J.compareBoundaryPoints(2,K)==1&&J.compareBoundaryPoints(1,K)==1&&J.compareBoundaryPoints(3,K)==1||J.compareBoundaryPoints(0,K)==-1&&J.compareBoundaryPoints(2,K)==-1&&J.compareBoundaryPoints(1,K)==-1&&J.compareBoundaryPoints(3,K)==-1)}}return null}function I(){var K=this.document.getElementById("bookmark");if(K){K.parentNode.removeChild(K)}K=this.document.createElement("span");K.id="bookmark";K.innerHTML="&nbsp;";var J;if(Prototype.Browser.IE){J=new Range(this.document)}else{J=this.getRange()}J.insertNode(K)}function H(){var L=this.document.getElementById("bookmark");if(!L){return }if(Prototype.Browser.IE){var J=this.getRange();J.moveToElementText(L);J.collapse();J.select()}else{if(Prototype.Browser.WebKit){var K=this.getSelection();K.setBaseAndExtent(L,0,L,0)}else{var J=this.getRange();J.setStartBefore(L)}}L.parentNode.removeChild(L)}return{initialize:F,getSelection:E,getRange:A,getNode:C,selectNode:D,setBookmark:I,moveToBookmark:H}})());WysiHat.Toolbar=Class.create((function(){function C(H){this.editArea=H;this.hasMouseDown=false;this.element=new Element("div",{"class":"editor_toolbar"});var I=this;this.element.observe("mousedown",function(J){I.mouseDown(J)});this.element.observe("mouseup",function(J){I.mouseUp(J)});this.editArea.insert({before:this.element})}function G(I){var H=this;$A(I).each(function(K){var J=K.first();var L=K.last();H.addButton(J,L)})}function F(H,J){H=$H(H);var I=Element("a",{"class":"button","href":"#"}).update("<span>"+H.get("label")+"</span>");I.addClassName(H.get("name"));this.observeButtonClick(I,J);this.observeStateChanges(I,H.get("name"));this.element.appendChild(I)}function D(H,I){var J=this;$(H).observe("click",function(K){J.hasMouseDown=true;I(J.editArea);J.editArea.fire("wysihat:change");Event.stop(K);J.hasMouseDown=false})}function E(H,I){this.editArea.observe("wysihat:mousemove",function(J){if(J.target.queryCommandState(I)){H.addClassName("selected")}else{H.removeClassName("selected")}})}function B(H){this.hasMouseDown=true}function A(H){this.editArea.focus();this.hasMouseDown=false}return{initialize:C,addButtonSet:G,addButton:F,observeButtonClick:D,observeStateChanges:E,mouseDown:B,mouseUp:A}})());WysiHat.Toolbar.ButtonSets={};WysiHat.Toolbar.ButtonSets.Basic=$A([[{name:"bold",label:"Bold"},function(A){A.boldSelection()}],[{name:"underline",label:"Underline"},function(A){A.underlineSelection()}],[{name:"italic",label:"Italic"},function(A){A.italicSelection()}]]);var SWFUpload=function(A){this.initSWFUpload(A)};SWFUpload.prototype.initSWFUpload=function(B){try{this.customSettings={};this.settings=B;this.eventQueue=[];this.movieName="SWFUpload_"+SWFUpload.movieCount++;this.movieElement=null;SWFUpload.instances[this.movieName]=this;this.initSettings();this.loadFlash();this.displayDebugInfo()}catch(A){delete SWFUpload.instances[this.movieName];throw A}};SWFUpload.instances={};SWFUpload.movieCount=0;SWFUpload.version="2.2.0 Alpha";SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130};SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290};SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5};SWFUpload.BUTTON_ACTION={SELECT_FILE:-100,SELECT_FILES:-110,START_UPLOAD:-120};SWFUpload.prototype.initSettings=function(){this.ensureDefault=function(B,A){this.settings[B]=(this.settings[B]==undefined)?A:this.settings[B]};this.ensureDefault("upload_url","");this.ensureDefault("file_post_name","Filedata");this.ensureDefault("post_params",{});this.ensureDefault("use_query_string",false);this.ensureDefault("requeue_on_error",false);this.ensureDefault("file_types","*.*");this.ensureDefault("file_types_description","All Files");this.ensureDefault("file_size_limit",0);this.ensureDefault("file_upload_limit",0);this.ensureDefault("file_queue_limit",0);this.ensureDefault("flash_url","swfupload.swf");this.ensureDefault("prevent_swf_caching",true);this.ensureDefault("button_image_url","");this.ensureDefault("button_width",1);this.ensureDefault("button_height",1);this.ensureDefault("button_text","");this.ensureDefault("button_text_style","color: #000000; font-size: 16pt;");this.ensureDefault("button_text_top_padding",0);this.ensureDefault("button_text_left_padding",0);this.ensureDefault("button_action",SWFUpload.BUTTON_ACTION.SELECT_FILES);this.ensureDefault("button_disabled",false);this.ensureDefault("button_placeholder_id",null);this.ensureDefault("debug",false);this.settings.debug_enabled=this.settings.debug;this.settings.return_upload_start_handler=this.returnUploadStart;this.ensureDefault("swfupload_loaded_handler",null);this.ensureDefault("file_dialog_start_handler",null);this.ensureDefault("file_queued_handler",null);this.ensureDefault("file_queue_error_handler",null);this.ensureDefault("file_dialog_complete_handler",null);this.ensureDefault("upload_start_handler",null);this.ensureDefault("upload_progress_handler",null);this.ensureDefault("upload_error_handler",null);this.ensureDefault("upload_success_handler",null);this.ensureDefault("upload_complete_handler",null);this.ensureDefault("debug_handler",function(A){n2i.log(A)});this.ensureDefault("custom_settings",{});this.customSettings=this.settings.custom_settings;if(this.settings.prevent_swf_caching){this.settings.flash_url=this.settings.flash_url+"?swfuploadrnd="+Math.floor(Math.random()*999999999)}delete this.ensureDefault};SWFUpload.prototype.loadFlash=function(){if(this.settings.button_placeholder_id!==""){this.replaceWithFlash()}else{this.appendFlash()}};SWFUpload.prototype.appendFlash=function(){var B,A;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added"}B=document.getElementsByTagName("body")[0];if(B==undefined){throw"Could not find the 'body' element."}A=document.createElement("div");A.style.width="1px";A.style.height="1px";A.style.overflow="hidden";B.appendChild(A);A.innerHTML=this.getFlashHTML()};SWFUpload.prototype.replaceWithFlash=function(){var A,B;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added"}A=this.settings.button_placeholder||document.getElementById(this.settings.button_placeholder_id);if(A==undefined){throw"Could not find the placeholder element."}B=document.createElement("div");B.innerHTML=this.getFlashHTML();A.parentNode.replaceChild(B.firstChild,A)};SWFUpload.prototype.getFlashHTML=function(){var A=this.settings.button_image_url===""?true:false;return['<object id="',this.movieName,'" type="application/x-shockwave-flash" data="',this.settings.flash_url,'" width="',this.settings.button_width,'" height="',this.settings.button_height,'" class="swfupload">','<param name="wmode" value="',A?"transparent":"window",'" />','<param name="movie" value="',this.settings.flash_url,'" />','<param name="quality" value="high" />','<param name="menu" value="false" />','<param name="allowScriptAccess" value="always" />','<param name="flashvars" value="'+this.getFlashVars()+'" />',"</object>"].join("")};SWFUpload.prototype.getFlashVars=function(){var A=this.buildParamString();return["movieName=",encodeURIComponent(this.movieName),"&amp;uploadURL=",encodeURIComponent(this.settings.upload_url),"&amp;useQueryString=",encodeURIComponent(this.settings.use_query_string),"&amp;requeueOnError=",encodeURIComponent(this.settings.requeue_on_error),"&amp;params=",encodeURIComponent(A),"&amp;filePostName=",encodeURIComponent(this.settings.file_post_name),"&amp;fileTypes=",encodeURIComponent(this.settings.file_types),"&amp;fileTypesDescription=",encodeURIComponent(this.settings.file_types_description),"&amp;fileSizeLimit=",encodeURIComponent(this.settings.file_size_limit),"&amp;fileUploadLimit=",encodeURIComponent(this.settings.file_upload_limit),"&amp;fileQueueLimit=",encodeURIComponent(this.settings.file_queue_limit),"&amp;debugEnabled=",encodeURIComponent(this.settings.debug_enabled),"&amp;buttonImageURL=",encodeURIComponent(this.settings.button_image_url),"&amp;buttonWidth=",encodeURIComponent(this.settings.button_width),"&amp;buttonHeight=",encodeURIComponent(this.settings.button_height),"&amp;buttonText=",encodeURIComponent(this.settings.button_text),"&amp;buttonTextTopPadding=",encodeURIComponent(this.settings.button_text_top_padding),"&amp;buttonTextLeftPadding=",encodeURIComponent(this.settings.button_text_left_padding),"&amp;buttonTextStyle=",encodeURIComponent(this.settings.button_text_style),"&amp;buttonAction=",encodeURIComponent(this.settings.button_action),"&amp;buttonDisabled=",encodeURIComponent(this.settings.button_disabled)].join("")};SWFUpload.prototype.getMovieElement=function(){if(this.movieElement==undefined){this.movieElement=document.getElementById(this.movieName)}if(this.movieElement===null){throw"Could not find Flash element"}return this.movieElement};SWFUpload.prototype.buildParamString=function(){var C=this.settings.post_params;var B=[];if(typeof (C)==="object"){for(var A in C){if(C.hasOwnProperty(A)){B.push(encodeURIComponent(A.toString())+"="+encodeURIComponent(C[A].toString()))}}}return B.join("&amp;")};SWFUpload.prototype.destroy=function(){try{this.stopUpload();var B=null;try{B=this.getMovieElement()}catch(C){}if(B!=undefined&&B.parentNode!=undefined&&typeof B.parentNode.removeChild==="function"){var A=B.parentNode;if(A!=undefined){A.removeChild(B);if(A.parentNode!=undefined&&typeof A.parentNode.removeChild==="function"){A.parentNode.removeChild(A)}}}SWFUpload.instances[this.movieName]=null;delete SWFUpload.instances[this.movieName];delete this.movieElement;delete this.settings;delete this.customSettings;delete this.eventQueue;delete this.movieName;delete window[this.movieName];return true}catch(D){return false}};SWFUpload.prototype.displayDebugInfo=function(){this.debug(["---SWFUpload Instance Info---\n","Version: ",SWFUpload.version,"\n","Movie Name: ",this.movieName,"\n","Settings:\n","\t","upload_url:               ",this.settings.upload_url,"\n","\t","flash_url:                ",this.settings.flash_url,"\n","\t","use_query_string:         ",this.settings.use_query_string.toString(),"\n","\t","file_post_name:           ",this.settings.file_post_name,"\n","\t","post_params:              ",this.settings.post_params.toString(),"\n","\t","file_types:               ",this.settings.file_types,"\n","\t","file_types_description:   ",this.settings.file_types_description,"\n","\t","file_size_limit:          ",this.settings.file_size_limit,"\n","\t","file_upload_limit:        ",this.settings.file_upload_limit,"\n","\t","file_queue_limit:         ",this.settings.file_queue_limit,"\n","\t","debug:                    ",this.settings.debug.toString(),"\n","\t","prevent_swf_caching:      ",this.settings.prevent_swf_caching.toString(),"\n","\t","button_placeholder_id:    ",this.settings.button_placeholder_id.toString(),"\n","\t","button_image_url:         ",this.settings.button_image_url.toString(),"\n","\t","button_width:             ",this.settings.button_width.toString(),"\n","\t","button_height:            ",this.settings.button_height.toString(),"\n","\t","button_text:              ",this.settings.button_text.toString(),"\n","\t","button_text_style:        ",this.settings.button_text_style.toString(),"\n","\t","button_text_top_padding:  ",this.settings.button_text_top_padding.toString(),"\n","\t","button_text_left_padding: ",this.settings.button_text_left_padding.toString(),"\n","\t","button_action:            ",this.settings.button_action.toString(),"\n","\t","button_disabled:          ",this.settings.button_disabled.toString(),"\n","\t","custom_settings:          ",this.settings.custom_settings.toString(),"\n","Event Handlers:\n","\t","swfupload_loaded_handler assigned:  ",(typeof this.settings.swfupload_loaded_handler==="function").toString(),"\n","\t","file_dialog_start_handler assigned: ",(typeof this.settings.file_dialog_start_handler==="function").toString(),"\n","\t","file_queued_handler assigned:       ",(typeof this.settings.file_queued_handler==="function").toString(),"\n","\t","file_queue_error_handler assigned:  ",(typeof this.settings.file_queue_error_handler==="function").toString(),"\n","\t","upload_start_handler assigned:      ",(typeof this.settings.upload_start_handler==="function").toString(),"\n","\t","upload_progress_handler assigned:   ",(typeof this.settings.upload_progress_handler==="function").toString(),"\n","\t","upload_error_handler assigned:      ",(typeof this.settings.upload_error_handler==="function").toString(),"\n","\t","upload_success_handler assigned:    ",(typeof this.settings.upload_success_handler==="function").toString(),"\n","\t","upload_complete_handler assigned:   ",(typeof this.settings.upload_complete_handler==="function").toString(),"\n","\t","debug_handler assigned:             ",(typeof this.settings.debug_handler==="function").toString(),"\n"].join(""))};SWFUpload.prototype.addSetting=function(B,C,A){if(C==undefined){return(this.settings[B]=A)}else{return(this.settings[B]=C)}};SWFUpload.prototype.getSetting=function(A){if(this.settings[A]!=undefined){return this.settings[A]}return""};SWFUpload.prototype.callFlash=function(C,D){D=D||[];var A=this.getMovieElement();var B;if(typeof A[C]==="function"){if(D.length===0){B=A[C]()}else{if(D.length===1){B=A[C](D[0])}else{if(D.length===2){B=A[C](D[0],D[1])}else{if(D.length===3){B=A[C](D[0],D[1],D[2])}else{throw"Too many arguments"}}}}if(B!=undefined&&typeof B.post==="object"){B=this.unescapeFilePostParams(B)}return B}else{throw"Invalid function name: "+C}};SWFUpload.prototype.selectFile=function(){this.callFlash("SelectFile")};SWFUpload.prototype.selectFiles=function(){this.callFlash("SelectFiles")};SWFUpload.prototype.startUpload=function(A){this.callFlash("StartUpload",[A])};SWFUpload.prototype.cancelUpload=function(A){this.callFlash("CancelUpload",[A])};SWFUpload.prototype.stopUpload=function(){this.callFlash("StopUpload")};SWFUpload.prototype.getStats=function(){return this.callFlash("GetStats")};SWFUpload.prototype.setStats=function(A){this.callFlash("SetStats",[A])};SWFUpload.prototype.getFile=function(A){if(typeof (A)==="number"){return this.callFlash("GetFileByIndex",[A])}else{return this.callFlash("GetFile",[A])}};SWFUpload.prototype.addFileParam=function(A,B,C){return this.callFlash("AddFileParam",[A,B,C])};SWFUpload.prototype.removeFileParam=function(A,B){this.callFlash("RemoveFileParam",[A,B])};SWFUpload.prototype.setUploadURL=function(A){this.settings.upload_url=A.toString();this.callFlash("SetUploadURL",[A])};SWFUpload.prototype.setPostParams=function(A){this.settings.post_params=A;this.callFlash("SetPostParams",[A])};SWFUpload.prototype.addPostParam=function(A,B){this.settings.post_params[A]=B;this.callFlash("SetPostParams",[this.settings.post_params])};SWFUpload.prototype.removePostParam=function(A){delete this.settings.post_params[A];this.callFlash("SetPostParams",[this.settings.post_params])};SWFUpload.prototype.setFileTypes=function(A,B){this.settings.file_types=A;this.settings.file_types_description=B;this.callFlash("SetFileTypes",[A,B])};SWFUpload.prototype.setFileSizeLimit=function(A){this.settings.file_size_limit=A;this.callFlash("SetFileSizeLimit",[A])};SWFUpload.prototype.setFileUploadLimit=function(A){this.settings.file_upload_limit=A;this.callFlash("SetFileUploadLimit",[A])};SWFUpload.prototype.setFileQueueLimit=function(A){this.settings.file_queue_limit=A;this.callFlash("SetFileQueueLimit",[A])};SWFUpload.prototype.setFilePostName=function(A){this.settings.file_post_name=A;this.callFlash("SetFilePostName",[A])};SWFUpload.prototype.setUseQueryString=function(A){this.settings.use_query_string=A;this.callFlash("SetUseQueryString",[A])};SWFUpload.prototype.setRequeueOnError=function(A){this.settings.requeue_on_error=A;this.callFlash("SetRequeueOnError",[A])};SWFUpload.prototype.setDebugEnabled=function(A){this.settings.debug_enabled=A;this.callFlash("SetDebugEnabled",[A])};SWFUpload.prototype.setButtonImageURL=function(A){if(A==undefined){A=""}this.settings.button_image_url=A;this.callFlash("SetButtonImageURL",[A])};SWFUpload.prototype.setButtonDimensions=function(C,A){this.settings.button_width=C;this.settings.button_height=A;var B=this.getMovieElement();if(B!=undefined){B.style.width=C+"px";B.style.height=A+"px"}this.callFlash("SetButtonDimensions",[C,A])};SWFUpload.prototype.setButtonText=function(A){this.settings.button_text=A;this.callFlash("SetButtonText",[A])};SWFUpload.prototype.setButtonTextPadding=function(B,A){this.settings.button_text_top_padding=A;this.settings.button_text_left_padding=B;this.callFlash("SetButtonTextPadding",[B,A])};SWFUpload.prototype.setButtonTextStyle=function(A){this.settings.button_text_style=A;this.callFlash("SetButtonTextStyle",[A])};SWFUpload.prototype.setButtonDisabled=function(A){this.settings.button_disabled=A;this.callFlash("SetButtonDisabled",[A])};SWFUpload.prototype.setButtonAction=function(A){this.settings.button_action=A;this.callFlash("SetButtonAction",[A])};SWFUpload.prototype.queueEvent=function(B,C){if(C==undefined){C=[]}else{if(!(C instanceof Array)){C=[C]}}var A=this;if(typeof this.settings[B]==="function"){this.eventQueue.push(function(){this.settings[B].apply(this,C)});setTimeout(function(){A.executeNextEvent()},0)}else{if(this.settings[B]!==null){throw"Event handler "+B+" is unknown or is not a function"}}};SWFUpload.prototype.executeNextEvent=function(){var A=this.eventQueue?this.eventQueue.shift():null;if(typeof (A)==="function"){A.apply(this)}};SWFUpload.prototype.unescapeFilePostParams=function(C){var E=/[$]([0-9a-f]{4})/i;var F={};var D;if(C!=undefined){for(var A in C.post){if(C.post.hasOwnProperty(A)){D=A;var B;while((B=E.exec(D))!==null){D=D.replace(B[0],String.fromCharCode(parseInt("0x"+B[1],16)))}F[D]=C.post[A]}}C.post=F}return C};SWFUpload.prototype.flashReady=function(){var A=this.getMovieElement();if(typeof A.StartUpload!=="function"){throw"ExternalInterface methods failed to initialize."}if(window[this.movieName]==undefined){window[this.movieName]=A}this.queueEvent("swfupload_loaded_handler")};SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler")};SWFUpload.prototype.fileQueued=function(A){A=this.unescapeFilePostParams(A);this.queueEvent("file_queued_handler",A)};SWFUpload.prototype.fileQueueError=function(A,C,B){A=this.unescapeFilePostParams(A);this.queueEvent("file_queue_error_handler",[A,C,B])};SWFUpload.prototype.fileDialogComplete=function(A,B){this.queueEvent("file_dialog_complete_handler",[A,B])};SWFUpload.prototype.uploadStart=function(A){A=this.unescapeFilePostParams(A);this.queueEvent("return_upload_start_handler",A)};SWFUpload.prototype.returnUploadStart=function(A){var B;if(typeof this.settings.upload_start_handler==="function"){A=this.unescapeFilePostParams(A);B=this.settings.upload_start_handler.call(this,A)}else{if(this.settings.upload_start_handler!=undefined){throw"upload_start_handler must be a function"}}if(B===undefined){B=true}B=!!B;this.callFlash("ReturnUploadStart",[B])};SWFUpload.prototype.uploadProgress=function(A,C,B){A=this.unescapeFilePostParams(A);this.queueEvent("upload_progress_handler",[A,C,B])};SWFUpload.prototype.uploadError=function(A,C,B){A=this.unescapeFilePostParams(A);this.queueEvent("upload_error_handler",[A,C,B])};SWFUpload.prototype.uploadSuccess=function(B,A){B=this.unescapeFilePostParams(B);this.queueEvent("upload_success_handler",[B,A])};SWFUpload.prototype.uploadComplete=function(A){A=this.unescapeFilePostParams(A);this.queueEvent("upload_complete_handler",A)};SWFUpload.prototype.debug=function(A){n2i.log(A)};Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(B){if(Date.formatFunctions[B]==null){Date.createNewFormat(B)}var A=Date.formatFunctions[B];return this[A]()};Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;var code="Date.prototype."+funcName+" = function(){return ";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true}else{if(special){special=false;code+="'"+String.escape(ch)+"' + "}else{code+=Date.getFormatCode(ch)}}}eval(code.substring(0,code.length-3)+";}")};Date.getFormatCode=function(A){switch(A){case"d":return"String.leftPad(this.getDate(), 2, '0') + ";case"D":return"Date.dayNames[this.getDay()].substring(0, 3) + ";case"j":return"this.getDate() + ";case"l":return"Date.dayNames[this.getDay()] + ";case"S":return"this.getSuffix() + ";case"w":return"this.getDay() + ";case"z":return"this.getDayOfYear() + ";case"W":return"this.getWeekOfYear() + ";case"F":return"Date.monthNames[this.getMonth()] + ";case"m":return"String.leftPad(this.getMonth() + 1, 2, '0') + ";case"M":return"Date.monthNames[this.getMonth()].substring(0, 3) + ";case"n":return"(this.getMonth() + 1) + ";case"t":return"this.getDaysInMonth() + ";case"L":return"(this.isLeapYear() ? 1 : 0) + ";case"Y":return"this.getFullYear() + ";case"y":return"('' + this.getFullYear()).substring(2, 4) + ";case"a":return"(this.getHours() < 12 ? 'am' : 'pm') + ";case"A":return"(this.getHours() < 12 ? 'AM' : 'PM') + ";case"g":return"((this.getHours() %12) ? this.getHours() % 12 : 12) + ";case"G":return"this.getHours() + ";case"h":return"String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";case"H":return"String.leftPad(this.getHours(), 2, '0') + ";case"i":return"String.leftPad(this.getMinutes(), 2, '0') + ";case"s":return"String.leftPad(this.getSeconds(), 2, '0') + ";case"O":return"this.getGMTOffset() + ";case"T":return"this.getTimezone() + ";case"Z":return"(this.getTimezoneOffset() * -60) + ";default:return"'"+String.escape(A)+"' + "}};Date.parseDate=function(A,C){if(Date.parseFunctions[C]==null){Date.createParser(C)}var B=Date.parseFunctions[C];return Date[B](A)};Date.createParser=function(format){var funcName="parse"+Date.parseFunctions.count++;var regexNum=Date.parseRegexes.length;var currentGroup=1;Date.parseFunctions[format]=funcName;var code="Date."+funcName+" = function(input){\nvar y = -1, m = -1, d = -1, h = -1, i = -1, s = -1;\nvar d = new Date();\ny = d.getFullYear();\nm = d.getMonth();\nd = d.getDate();\nvar results = input.match(Date.parseRegexes["+regexNum+"]);\nif (results && results.length > 0) {";var regex="";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true}else{if(special){special=false;regex+=String.escape(ch)}else{obj=Date.formatCodeToRegex(ch,currentGroup);currentGroup+=obj.g;regex+=obj.s;if(obj.g&&obj.c){code+=obj.c}}}}code+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n{return new Date(y, m, d, h, i);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0)\n{return new Date(y, m, d, h);}\nelse if (y > 0 && m >= 0 && d > 0)\n{return new Date(y, m, d);}\nelse if (y > 0 && m >= 0)\n{return new Date(y, m);}\nelse if (y > 0)\n{return new Date(y);}\n}return null;}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$");eval(code)};Date.formatCodeToRegex=function(B,A){switch(B){case"D":return{g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case"j":case"d":return{g:1,c:"d = parseInt(results["+A+"], 10);\n",s:"(\\d{1,2})"};case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case"w":return{g:0,c:null,s:"\\d"};case"z":return{g:0,c:null,s:"(?:\\d{1,3})"};case"W":return{g:0,c:null,s:"(?:\\d{2})"};case"F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+A+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+A+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case"n":case"m":return{g:1,c:"m = parseInt(results["+A+"], 10) - 1;\n",s:"(\\d{1,2})"};case"t":return{g:0,c:null,s:"\\d{1,2}"};case"L":return{g:0,c:null,s:"(?:1|0)"};case"Y":return{g:1,c:"y = parseInt(results["+A+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+A+"], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+A+"] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+A+"] == 'AM') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case"g":case"G":case"h":case"H":return{g:1,c:"h = parseInt(results["+A+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+A+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+A+"], 10);\n",s:"(\\d{2})"};case"O":return{g:0,c:null,s:"[+-]\\d{4}"};case"T":return{g:0,c:null,s:"[A-Z]{3}"};case"Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(B)}}};Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3")};Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(this.getTimezoneOffset()/60),2,"0")+String.leftPad(this.getTimezoneOffset()%60,2,"0")};Date.prototype.getDayOfYear=function(){var A=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var B=0;B<this.getMonth();++B){A+=Date.daysInMonth[B]}return A+this.getDate()-1};Date.prototype.getWeekOfYear=function(){var B=this.getDayOfYear()+(5-this.getDay());var A=new Date(this.getFullYear(),0,1);var C=(5-A.getDay());return parseInt(String.leftPad(((B-C)/7)+1,2,"0"))};Date.prototype.isLeapYear=function(){var A=this.getFullYear();return((A&3)==0&&(A%100||(A%400==0&&A)))};Date.prototype.getFirstDayOfMonth=function(){var A=(this.getDay()-(this.getDate()-1))%7;return(A<0)?(A+7):A};Date.prototype.getLastDayOfMonth=function(){var A=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return(A<0)?(A+7):A};Date.prototype.getDaysInMonth=function(){Date.daysInMonth[1]=this.isLeapYear()?29:28;return Date.daysInMonth[this.getMonth()]};Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}};String.escape=function(A){return A.replace(/('|\\)/g,"\\$1")};String.leftPad=function(D,B,C){var A=new String(D);if(C==null){C=" "}while(A.length<B){A=C+A}return A};Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.y2kYear=50;Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11};Date.patterns={ISO8601LongPattern:"Y-m-d H:i:s",ISO8601ShortPattern:"Y-m-d",ShortDatePattern:"n/j/Y",LongDatePattern:"l, F d, Y",FullDateTimePattern:"l, F d, Y g:i:s A",MonthDayPattern:"F d",ShortTimePattern:"g:i A",LongTimePattern:"g:i:s A",SortableDateTimePattern:"Y-m-d\\TH:i:s",UniversalSortableDateTimePattern:"Y-m-d H:i:sO",YearMonthPattern:"F, Y"};if(!this.JSON){JSON=function(){function f(n){return n<10?"0"+n:n}Date.prototype.toJSON=function(){return this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z"};var m={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function stringify(value,whitelist){var a,i,k,l,r=/["\\\x00-\x1f\x7f-\x9f]/g,v;switch(typeof value){case"string":return r.test(value)?'"'+value.replace(r,function(a){var c=m[a];if(c){return c}c=a.charCodeAt();return"\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16)})+'"':'"'+value+'"';case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}if(typeof value.toJSON==="function"){return stringify(value.toJSON())}a=[];if(typeof value.length==="number"&&!(value.propertyIsEnumerable("length"))){l=value.length;for(i=0;i<l;i+=1){a.push(stringify(value[i],whitelist)||"null")}return"["+a.join(",")+"]"}if(whitelist){l=whitelist.length;for(i=0;i<l;i+=1){k=whitelist[i];if(typeof k==="string"){v=stringify(value[k],whitelist);if(v){a.push(stringify(k)+":"+v)}}}}else{for(k in value){if(typeof k==="string"){v=stringify(value[k],whitelist);if(v){a.push(stringify(k)+":"+v)}}}}return"{"+a.join(",")+"}"}}return{stringify:stringify,parse:function(text,filter){var j;function walk(k,v){var i,n;if(v&&typeof v==="object"){for(i in v){if(Object.prototype.hasOwnProperty.apply(v,[i])){n=walk(i,v[i]);if(n!==undefined){v[i]=n}}}}return filter(k,v)}if(/^[\],:{}\s]*$/.test(text.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof filter==="function"?walk("",j):j}throw new SyntaxError("parseJSON")}}}()}var in2igui={locales:{"da/DK":{decimal:",",thousands:"."},"en/US":{decimal:".",thousands:","}},locale:{decimal:",",thousands:"."},setLocale:function(A){if(this.locales[A]){this.locale=this.locales[A]}}};function In2iGui(){this.domLoaded=false;this.overflows=null;this.delegates=[];this.objects=$H();this.layoutWidgets=[];this.state="default";this.addBehavior()}window.ui=In2iGui;In2iGui.latestObjectIndex=0;In2iGui.latestIndex=500;In2iGui.latestPanelIndex=1000;In2iGui.latestAlertIndex=1500;In2iGui.latestTopIndex=2000;In2iGui.toolTips={};In2iGui.get=function(A){if(!In2iGui.instance){In2iGui.instance=new In2iGui()}if(A){if(A.element){return A}return In2iGui.instance.objects.get(A)}else{return In2iGui.instance}};document.observe("dom:loaded",function(){In2iGui.get().ignite()});In2iGui.prototype={ignite:function(){if(window.dwr){if(dwr&&dwr.engine&&dwr.engine.setErrorHandler){dwr.engine.setErrorHandler(function(B,A){n2i.log(B);n2i.log(A);In2iGui.get().alert({title:"An unexpected error occurred!",text:B,emotion:"gasp"})})}}this.domLoaded=true;In2iGui.domReady=true;this.resize();In2iGui.callSuperDelegates(this,"interfaceIsReady");this.reLayout();Event.observe(window,"resize",this.reLayout.bind(this))},addBehavior:function(){Event.observe(window,"resize",this.resize.bind(this))},listen:function(A){this.delegates.push(A)},listen:function(A){this.delegates.push(A)},getTopPad:function(A){var B,C;B=parseInt(n2i.getStyle(A,"padding"),10);C=parseInt(n2i.getStyle(A,"padding-top"),10);if(B){return B}if(C){return C}return 0},getBottomPad:function(B){var C,A;C=parseInt(n2i.getStyle(B,"padding"),10);A=parseInt(n2i.getStyle(B,"padding-bottom"),10);if(C){return C}if(A){return A}return 0},resize:function(){if(!this.overflows){return }var A=n2i.getInnerHeight();this.overflows.each(function(B){if(n2i.browser.webkit||n2i.browser.gecko){B.element.style.display="none";B.element.style.width=B.element.parentNode.clientWidth+"px";B.element.style.display=""}B.element.style.height=A+B.diff+"px"})},registerOverflow:function(C,A){if(!this.overflows){this.overflows=[]}var B=$(C);this.overflows.push({element:B,diff:A})},alert:function(A){if(!this.alertBox){this.alertBox=In2iGui.Alert.create(A);this.alertBoxButton=In2iGui.Button.create({name:"in2iGuiAlertBoxButton",text:"OK"});this.alertBoxButton.listen(this);this.alertBox.addButton(this.alertBoxButton)}else{this.alertBox.update(A)}this.alertBoxCallBack=A.onOK;this.alertBoxButton.setText(A.button?A.button:"OK");this.alertBox.show()},$click$in2iGuiAlertBoxButton:function(){In2iGui.get().alertBox.hide();if(this.alertBoxCallBack){this.alertBoxCallBack();this.alertBoxCallBack=null}},confirm:function(A){if(!A.name){A.name="in2iguiConfirm"}var D=In2iGui.get(A.name);var B;if(!D){D=In2iGui.Alert.create(A);var C=In2iGui.Button.create({name:name+"_cancel",text:A.cancel||"Cancel",highlighted:A.highlighted==="cancel"});C.listen({$click:function(){D.hide();if(A.onCancel){A.onCancel()}In2iGui.callDelegates(D,"cancel")}});D.addButton(C);B=In2iGui.Button.create({name:name+"_ok",text:A.ok||"OK",highlighted:A.highlighted==="ok"});D.addButton(B)}else{D.update(A);B=In2iGui.get(name+"_ok");B.setText(A.ok||"OK");B.setHighlighted(A.highlighted=="ok");B.clearDelegates();In2iGui.get(name+"_cancel").setText(A.ok||"Cancel");In2iGui.get(name+"_cancel").setHighlighted(A.highlighted=="cancel");if(A.cancel){In2iGui.get(name+"_cancel").setText(A.cancel)}}B.listen({$click:function(){D.hide();if(A.onOK){A.onOK()}In2iGui.callDelegates(D,"ok")}});D.show()},reLayout:function(){for(var A=this.layoutWidgets.length-1;A>=0;A--){this.layoutWidgets[A]["$$layout"]()}},getDescendants:function(G){var F=[],C=G.getElement?G.getElement():G;if(C){var E=C.descendants();var D=this.objects.values();for(var B=0;B<E.length;B++){for(var A=0;A<D.length;A++){if(E[B]==D[A].element){F.push(D[A])}}}}return F},getAncestors:function(D){var G=[];var E=D.element;if(E){var A=E.ancestors();var F=this.objects.values();for(var C=0;C<A.length;C++){for(var B=0;B<F.length;B++){if(F[B].element==A[C]){G.push(F[B])}}}}return G},getAncestor:function(D,B){var A=this.getAncestors(D);for(var C=0;C<A.length;C++){if(A[C].getElement().hasClassName(B)){return A[C]}}return null}};In2iGui.confirmOverlays={};In2iGui.confirmOverlay=function(B){var E=B.element||B.widget.getElement();if(In2iGui.confirmOverlays[E]){var A=In2iGui.confirmOverlays[E];A.clear()}else{var A=ui.Overlay.create({modal:true});In2iGui.confirmOverlays[E]=A}if(B.text){A.addText(B.text)}var C=ui.Button.create({text:B.okText||"OK",highlighted:"true"});C.click(function(){if(B.onOk){B.onOk()}A.hide()});A.add(C);var D=ui.Button.create({text:B.cancelText||"Cancel"});D.onClick(function(){A.hide()});A.add(D);A.show({element:E})};In2iGui.destroyDescendants=function(B){var E=In2iGui.get().getDescendants(B);var C=In2iGui.get().objects;for(var A=0;A<E.length;A++){var D=C.unset(E[A].name);if(!D){n2i.log("not found: "+E[A].name)}}};In2iGui.changeState=function(B){if(In2iGui.get().state===B){return }var A=In2iGui.get().objects.values();A.each(function(C){if(C.options&&C.options.state){if(C.options.state==B){C.show()}else{C.hide()}}});In2iGui.get().state==B};In2iGui.nextIndex=function(){In2iGui.latestIndex++;return In2iGui.latestIndex};In2iGui.nextPanelIndex=function(){In2iGui.latestPanelIndex++;return In2iGui.latestPanelIndex};In2iGui.nextAlertIndex=function(){In2iGui.latestAlertIndex++;return In2iGui.latestAlertIndex};In2iGui.nextTopIndex=function(){In2iGui.latestTopIndex++;return In2iGui.latestTopIndex};In2iGui.showCurtain=function(B,D){if(B.getElement){In2iGui.showCurtainOld(B,D);return }var C=B.widget;if(!C.curtain){C.curtain=new Element("div",{"class":"in2igui_curtain"}).setStyle({"z-index":"none"});C.curtain.onclick=function(){if(C["$curtainWasClicked"]){C["$curtainWasClicked"]()}};var A=$$(".in2igui_body")[0];if(!A){A=document.body}A.appendChild(C.curtain)}if(B.color){C.curtain.style.backgroundColor=B.color}if(n2i.browser.msie){C.curtain.style.height=n2i.getDocumentHeight()+"px"}else{C.curtain.style.position="fixed";C.curtain.style.top="0";C.curtain.style.left="0";C.curtain.style.bottom="0";C.curtain.style.right="0"}C.curtain.style.zIndex=B.zIndex;n2i.setOpacity(C.curtain,0);C.curtain.style.display="block";n2i.ani(C.curtain,"opacity",0.7,1000,{ease:n2i.ease.slowFastSlow})};In2iGui.showCurtainOld=function(B,C){if(!B.curtain){B.curtain=new Element("div",{"class":"in2igui_curtain"}).setStyle({"z-index":"none"});B.curtain.onclick=function(){if(B.curtainWasClicked){B.curtainWasClicked()}};var A=$$(".in2igui_body")[0];if(!A){A=document.body}A.appendChild(B.curtain)}B.curtain.style.height=n2i.getDocumentHeight()+"px";B.curtain.style.zIndex=C;n2i.setOpacity(B.curtain,0);B.curtain.style.display="block";n2i.ani(B.curtain,"opacity",0.7,1000,{ease:n2i.ease.slowFastSlow})};In2iGui.hideCurtain=function(A){if(A.curtain){n2i.ani(A.curtain,"opacity",0,200,{hideOnComplete:true})}};In2iGui.alert=function(A){In2iGui.get().alert(A)};In2iGui.showMessage=function(A){if(typeof (A)=="string"){A={text:A}}if(!In2iGui.message){In2iGui.message=new Element("div",{"class":"in2igui_message"}).update("<div><div></div></div>");if(!n2i.browser.msie){In2iGui.message.setStyle({opacity:0})}document.body.appendChild(In2iGui.message)}In2iGui.message.select("div")[1].update(A.text);In2iGui.message.setStyle({"display":"block",zIndex:In2iGui.nextTopIndex()});In2iGui.message.setStyle({marginLeft:(In2iGui.message.getWidth()/-2)+"px",marginTop:n2i.getScrollTop()+"px"});if(!n2i.browser.msie){n2i.ani(In2iGui.message,"opacity",1,300)}window.clearTimeout(In2iGui.messageTimer);if(A.duration){In2iGui.messageTimer=window.setTimeout(In2iGui.hideMessage,A.duration)}};In2iGui.hideMessage=function(){if(In2iGui.message){if(!n2i.browser.msie){n2i.ani(In2iGui.message,"opacity",0,300,{hideOnComplete:true})}else{In2iGui.message.setStyle({display:"none"})}}};In2iGui.showToolTip=function(A){var C=A.key||"common";var B=In2iGui.toolTips[C];if(!B){B=new Element("div",{"class":"in2igui_tooltip"}).update("<div><div></div></div>").setStyle({display:"none"});document.body.appendChild(B);In2iGui.toolTips[C]=B}B.onclick=function(){In2iGui.hideToolTip(A)};var E=$(A.element);var D=E.cumulativeOffset();B.select("div")[1].update(A.text);if(B.style.display=="none"&&!n2i.browser.msie){B.setStyle({opacity:0})}B.setStyle({"display":"block",zIndex:In2iGui.nextTopIndex()});B.setStyle({left:(D.left-B.getWidth()+4)+"px",top:(D.top+2-(B.getHeight()/2)+(E.getHeight()/2))+"px"});if(!n2i.browser.msie){n2i.ani(B,"opacity",1,300)}};In2iGui.hideToolTip=function(A){var C=A?A.key||"common":"common";var B=In2iGui.toolTips[C];if(B){if(!n2i.browser.msie){n2i.ani(B,"opacity",0,300,{hideOnComplete:true})}else{B.setStyle({display:"none"})}}};In2iGui.isWithin=function(B,A){Event.extend(B);var D=A.cumulativeOffset();var C=A.getDimensions();return B.pointerX()>D.left&&B.pointerX()<D.left+C.width&&B.pointerY()>D.top&&B.pointerY()<D.top+C.height};In2iGui.getIconUrl=function(B,A){return In2iGui.context+"/In2iGui/icons/"+B+A+".png"};In2iGui.createIcon=function(B,A){return new Element("span",{"class":"in2igui_icon in2igui_icon_"+A}).setStyle({"backgroundImage":"url("+In2iGui.getIconUrl(B,A)+")"})};In2iGui.onDomReady=In2iGui.onReady=function(A){if(In2iGui.domReady){return A()}if(n2i.browser.gecko&&document.baseURI.endsWith("xml")){window.setTimeout(A,1000);return }document.observe("dom:loaded",A)};In2iGui.wrapInField=function(B){var A=new Element("div",{"class":"in2igui_field"}).update('<span class="in2igui_field_top"><span><span></span></span></span><span class="in2igui_field_middle"><span class="in2igui_field_middle"><span class="in2igui_field_content"></span></span></span><span class="in2igui_field_bottom"><span><span></span></span></span>');A.select("span.in2igui_field_content")[0].insert(B);return A};In2iGui.addFocusClass=function(B){var A=B.classElement||B.element,C=B["class"];B.element.observe("focus",function(){A.addClassName(C)}).observe("blur",function(){A.removeClassName(C)})};In2iGui.NumberValidator=function(A){n2i.override({allowNull:false,min:0,max:10},A);this.min=A.min;this.max=A.max;this.allowNull=A.allowNull;this.middle=Math.max(Math.min(this.max,0),this.min)};In2iGui.NumberValidator.prototype={validate:function(B){if(n2i.isBlank(B)&&this.allowNull){return{valid:true,value:null}}var A=parseFloat(B);if(isNaN(A)){return{valid:false,value:this.middle}}else{if(A<this.min){return{valid:false,value:this.min}}else{if(A>this.max){return{valid:false,value:this.max}}}}return{valid:true,value:A}}};In2iGui.fadeIn=function(A,B){if($(A).getStyle("display")=="none"){A.setStyle({opacity:0,display:""})}n2i.ani(A,"opacity",1,B)};In2iGui.fadeOut=function(A,B){n2i.ani(A,"opacity",0,B,{hideOnComplete:true})};In2iGui.bounceIn=function(A,B){if(n2i.browser.msie){A.setStyle({"display":"block",visibility:"visible"})}else{A.setStyle({"display":"block","opacity":0,visibility:"visible"});n2i.animate(A,"transform","scale(0.1)",0);window.setTimeout(function(){n2i.animate(A,"opacity",1,300);n2i.animate(A,"transform","scale(1)",400,{ease:n2i.ease.backOut})})}};In2iGui.positionAtElement=function(C,G,B){B=B||{};C=$(C);G=$(G);var D=C.getStyle("display");if(D=="none"){C.setStyle({"visibility":"hidden","display":"block"})}var H=G.cumulativeOffset(),F=H.left,E=H.top;var A=B.vertical||null;if(B.horizontal&&B.horizontal=="right"){F=F+G.getWidth()-C.getWidth()}if(A=="topOutside"){E=E-C.getHeight()}else{if(A=="bottomOutside"){E=E+G.getHeight()}}F+=(B.left||0);E+=(B.top||0);C.setStyle({"left":F+"px","top":E+"px"});if(D=="none"){C.setStyle({"visibility":"visible","display":"none"})}};In2iGui.getDragProxy=function(){if(!In2iGui.dragProxy){In2iGui.dragProxy=new Element("div",{"class":"in2igui_dragproxy"}).setStyle({"display":"none"});document.body.appendChild(In2iGui.dragProxy)}return In2iGui.dragProxy};In2iGui.startDrag=function(E,C,A){E=E||window.event;var D=C.dragDropInfo;In2iGui.dropTypes=In2iGui.findDropTypes(D);if(!In2iGui.dropTypes){return }var B=In2iGui.getDragProxy();Event.observe(document.body,"mousemove",In2iGui.dragListener);Event.observe(document.body,"mouseup",In2iGui.dragEndListener);In2iGui.dragInfo=D;if(D.icon){B.style.backgroundImage="url("+In2iGui.getIconUrl(D.icon,1)+")"}In2iGui.startDragPos={top:Event.pointerY(E),left:Event.pointerX(E)};B.innerHTML=D.title?"<span>"+D.title.escapeHTML()+"</span>":"###";In2iGui.dragging=true;document.body.onselectstart=function(){return false}};In2iGui.findDropTypes=function(D){var A=In2iGui.get();var F=null;for(var C=0;C<A.delegates.length;C++){if(A.delegates[C].dragDrop){for(var B=0;B<A.delegates[C].dragDrop.length;B++){var E=A.delegates[C].dragDrop[B];if(E.drag==D.kind){if(F==null){F={}}F[E.drop]={}}}}}return F};In2iGui.dragListener=function(B){In2iGui.dragProxy.style.left=(Event.pointerX(B)+10)+"px";In2iGui.dragProxy.style.top=Event.pointerY(B)+"px";In2iGui.dragProxy.style.display="block";var A=In2iGui.findDropTarget(Event.element(B));if(A&&In2iGui.dropTypes[A.dragDropInfo["kind"]]){if(In2iGui.latestDropTarget){In2iGui.latestDropTarget.removeClassName("in2igui_drop")}A.addClassName("in2igui_drop");In2iGui.latestDropTarget=A}else{if(In2iGui.latestDropTarget){In2iGui.latestDropTarget.removeClassName("in2igui_drop");In2iGui.latestDropTarget=null}}return false};In2iGui.findDropTarget=function(A){while(A){if(A.dragDropInfo){return A}A=A.parentNode}return null};In2iGui.dragEndListener=function(A){Event.stopObserving(document.body,"mousemove",In2iGui.dragListener);Event.stopObserving(document.body,"mouseup",In2iGui.dragEndListener);In2iGui.dragging=false;if(In2iGui.latestDropTarget){In2iGui.latestDropTarget.removeClassName("in2igui_drop");In2iGui.callDelegatesDrop(In2iGui.dragInfo,In2iGui.latestDropTarget.dragDropInfo);In2iGui.dragProxy.style.display="none"}else{n2i.ani(In2iGui.dragProxy,"left",(In2iGui.startDragPos.left+10)+"px",200,{ease:n2i.ease.fastSlow});n2i.ani(In2iGui.dragProxy,"top",(In2iGui.startDragPos.top-5)+"px",200,{ease:n2i.ease.fastSlow,hideOnComplete:true})}In2iGui.latestDropTarget=null;document.body.onselectstart=null};In2iGui.dropOverListener=function(A){if(In2iGui.dragging){}};In2iGui.dropOutListener=function(A){if(In2iGui.dragging){}};In2iGui.extend=function(C,A){if(!C.name){In2iGui.latestObjectIndex++;C.name="unnamed"+In2iGui.latestObjectIndex}if(A!==undefined){if(C.options){C.options=n2i.override(C.options,A)}C.element=$(A.element);C.name=A.name}var B=In2iGui.get();B.objects.set(C.name,C);C.delegates=[];C.listen=function(D){n2i.addToArray(this.delegates,D)};C.removeDelegate=function(D){n2i.removeFromArray(this.delegates,D)};C.clearDelegates=function(){this.delegates=[]};C.fire=function(F,E,D){In2iGui.callDelegates(this,F,E,D)};C.fireProperty=function(D,E){In2iGui.firePropertyChange(this,D,E)};if(!C.getElement){C.getElement=function(){return this.element}}if(!C.valueForProperty){C.valueForProperty=function(D){return this[D]}}if(C["$$layout"]){B.layoutWidgets.push(C)}};In2iGui.callDelegatesDrop=function(B,E){var C=In2iGui.get();var A=null;for(var D=0;D<C.delegates.length;D++){if(C.delegates[D]["$drop$"+B.kind+"$"+E.kind]){C.delegates[D]["$drop$"+B.kind+"$"+E.kind](B,E)}}};In2iGui.callAncestors=function(D,F,C,B){if(typeof (C)=="undefined"){C=D}var E=In2iGui.get().getAncestors(D);for(var A=0;A<E.length;A++){if(E[A][F]){E[A][F](C,B)}}};In2iGui.callDescendants=function(C,E,B,A){if(typeof (B)=="undefined"){B=C}var D=In2iGui.get().getDescendants(C);D.each(function(F){if(F[E]){thisResult=F[E](B,A)}})};In2iGui.callVisible=function(A){In2iGui.callDescendants(A,"$visibilityChanged")};In2iGui.listen=function(A){In2iGui.get().listen(A)};In2iGui.callDelegates=function(E,A,H,B){if(typeof (H)=="undefined"){H=E}var I=null;if(E.delegates){for(var F=0;F<E.delegates.length;F++){var G=E.delegates[F];var C=null;if(E.name&&G["$"+A+"$"+E.name]){C=G["$"+A+"$"+E.name](H,B)}else{if(G["$"+A]){C=G["$"+A](H,B)}}if(I==null&&C!=null&&typeof (C)!="undefined"){I=C}}}var D=In2iGui.callSuperDelegates(E,A,H,B);if(I==null&&D!=null){I=D}return I};In2iGui.callSuperDelegates=function(E,A,H,B){if(typeof (H)=="undefined"){H=E}var C=In2iGui.get();var I=null;for(var F=0;F<C.delegates.length;F++){var G=C.delegates[F];var D=null;if(E.name&&G["$"+A+"$"+E.name]){D=G["$"+A+"$"+E.name](H,B)}else{if(G["$"+A]){D=G["$"+A](H,B)}}if(I==null&&D!=null&&typeof (D)!="undefined"){I=D}}return I};In2iGui.resolveImageUrl=function(G,C,F,A){for(var D=0;D<G.delegates.length;D++){if(G.delegates[D].$resolveImageUrl){return G.delegates[D].$resolveImageUrl(C,F,A)}}var B=In2iGui.get();for(var D=0;D<B.delegates.length;D++){var E=B.delegates[D];if(E.$resolveImageUrl){return E.$resolveImageUrl(C,F,A)}}return null};In2iGui.firePropertyChange=function(C,A,B){In2iGui.callDelegates(C,"propertyChanged",{property:A,value:B})};In2iGui.bind=function(E,A){if(E.charAt(0)=="@"){var D=E.substring(1).split(".");var C=In2iGui.get(D[0]);if(!C){n2i.log("Unable to bind to "+E);return }var B=D.slice(1).join(".");C.listen({$propertyChanged:function(F){if(F.property==B){A(F.value)}}});return C.valueForProperty(B)}return E};In2iGui.dwrUpdate=function(){var C=arguments[0];var B={callback:function(D){In2iGui.handleDwrUpdate(D)}};var A=arguments.length;if(A==1){C(B)}else{if(A==2){C(arguments[1],B)}else{alert("Too many parameters")}}};In2iGui.handleDwrUpdate=function(C){var A=In2iGui.get();for(var B=0;B<C.length;B++){if(A.objects.get(C[B].name)){A.objects.get(C[B].name).updateFromObject(C[B])}}};In2iGui.update=function(A,B){var C={onSuccess:function(D){In2iGui.handleUpdate(D,B)}};$get(A,C)};In2iGui.handleUpdate=function(E,F){var A=In2iGui.get();var G=E.responseXML.firstChild;var D=G.childNodes;for(var C=0;C<D.length;C++){if(D[C].nodeType==1){var B=D[C].getAttribute("name");if(B&&B!=""&&A.objects.get(B)){A.objects.get(B).updateFromNode(D[C])}}}F.onSuccess()};In2iGui.jsonResponse=function(C,B){if(!C.responseXML||!C.responseXML.documentElement){var D=C.responseText.replace(/^\s+|\s+$/g,"");if(D.length>0){var A=C.responseText.evalJSON(true)}else{A=""}In2iGui.callDelegates(A,"success$"+B)}else{In2iGui.callDelegates(C,"success$"+B)}};In2iGui.json=function(D,C,B){var A={method:"post",parameters:{},onException:function(E){throw E}};if(typeof (B)=="string"){A.onSuccess=function(E){In2iGui.jsonResponse(E,B)}}else{delegate=B}for(key in D){A.parameters[key]=Object.toJSON(D[key])}new Ajax.Request(C,A)};In2iGui.jsonRequest=function(B){var A={method:"post",parameters:{},onException:function(C){throw C}};if(typeof (B.event)=="string"){A.onSuccess=function(C){In2iGui.jsonResponse(C,B.event)}}else{delegate=delegateOrKey}for(key in B.parameters){A.parameters[key]=Object.toJSON(B.parameters[key])}new Ajax.Request(B.url,A)};In2iGui.request=function(A){A=n2i.override({method:"post",parameters:{}},A);if(A.json){for(key in A.json){A.parameters[key]=Object.toJSON(A.json[key])}}var C=A.onSuccess;A.onSuccess=function(E){if(typeof (C)=="string"){In2iGui.jsonResponse(E,C)}else{if(E.responseXML&&E.responseXML.documentElement&&E.responseXML.documentElement.nodeName!="parsererror"&&A.onXML){A.onXML(E.responseXML)}else{if(A.onJSON){var F=E.responseText.replace(/^\s+|\s+$/g,"");if(F.length>0){var D=E.responseText.evalJSON(true)}else{var D=null}A.onJSON(D)}else{if(typeof (C)=="function"){C(E)}}}}};var B=A.onFailure;A.onFailure=function(D){if(typeof (B)=="string"){In2iGui.callDelegates(D,"failure$"+B)}else{if(typeof (B)=="function"){B(D)}}};A.onException=function(D,E){n2i.log(E)};new Ajax.Request(A.url,A)};In2iGui.parseItems=function(C){var A=C.documentElement;var B=[];In2iGui.parseSubItems(A,B);return B};In2iGui.parseSubItems=function(D,F){var B=D.childNodes;for(var A=0;A<B.length;A++){var E=B[A];if(E.nodeType==1&&E.nodeName=="item"){var C=[];In2iGui.parseSubItems(E,C);F.push({title:E.getAttribute("title"),value:E.getAttribute("value"),icon:E.getAttribute("icon"),kind:E.getAttribute("kind"),badge:E.getAttribute("badge"),children:C})}}};In2iGui.Source=function(A){this.options=n2i.override({url:null,dwr:null,parameters:[],lazy:false},A);this.name=A.name;this.data=null;this.parameters=this.options.parameters;In2iGui.extend(this);if(A.delegate){this.listen(A.delegate)}this.busy=false;In2iGui.onDomReady(this.init.bind(this))};In2iGui.Source.prototype={init:function(){var A=this;this.parameters.each(function(C){var B=In2iGui.bind(C.value,function(D){A.changeParameter(C.key,D)});C.value=A.convertValue(B)});if(!this.options.lazy){this.refresh()}},convertValue:function(A){if(A&&A.getTime){return A.getTime()}return A},refresh:function(){if(this.delegates.length==0){return }for(var i=0;i<this.delegates.length;i++){var d=this.delegates[i];if(d["$sourceShouldRefresh"]&&d["$sourceShouldRefresh"]()==false){return }}if(this.busy){this.pendingRefresh=true;return }this.pendingRefresh=false;var self=this;if(this.options.url){var url=new n2i.URL(this.options.url);this.parameters.each(function(p){url.addParameter(p.key,p.value)});this.busy=true;In2iGui.callDelegates(this,"sourceIsBusy");new Ajax.Request(url.toString(),{onSuccess:function(t){self.parse(t)},onException:function(t,e){n2i.log(e)}})}else{if(this.options.dwr){var pair=this.options.dwr.split(".");var facade=eval(pair[0]);var method=pair[1];var args=facade[method].argumentNames();for(var i=0;i<args.length;i++){if(this.parameters[i]){args[i]=this.parameters[i].value===undefined?null:this.parameters[i].value}}args[args.length-1]=function(r){self.parseDWR(r)};this.busy=true;In2iGui.callDelegates(this,"sourceIsBusy");facade[method].apply(facade,args)}}},end:function(){In2iGui.callDelegates(this,"sourceIsNotBusy");this.busy=false;if(this.pendingRefresh){this.refresh()}},parse:function(B){if(B.responseXML){this.parseXML(B.responseXML)}else{var C=B.responseText.replace(/^\s+|\s+$/g,"");if(C.length>0){var A=B.responseText.evalJSON(true)}else{var A=null}this.fire("objectsLoaded",A)}this.end()},parseXML:function(A){if(A.documentElement.tagName=="items"){this.data=In2iGui.parseItems(A);this.fire("itemsLoaded",this.data)}else{if(A.documentElement.tagName=="list"){this.fire("listLoaded",A)}else{if(A.documentElement.tagName=="articles"){this.fire("articlesLoaded",A)}}}},parseDWR:function(A){this.data=A;this.fire("objectsLoaded",A);this.end()},addParameter:function(A){n2i.log(A.value);this.parameters.push(A)},changeParameter:function(A,B){B=this.convertValue(B);this.parameters.each(function(C){if(C.key==A){C.value=B}});window.clearTimeout(this.paramDelay);this.paramDelay=window.setTimeout(function(){this.refresh()}.bind(this),100)}};Element.addMethods({setClassName:function(B,A,C){if(C){B.addClassName(A)}else{B.removeClassName(A)}return B}});In2iGui.Window=function(A){this.element=$(A.element);this.name=A.name;this.close=this.element.select(".in2igui_window_close")[0];this.titlebar=this.element.select(".in2igui_window_titlebar")[0];this.title=this.titlebar.select(".in2igui_window_title")[0];this.content=this.element.select(".in2igui_window_body")[0];this.visible=false;In2iGui.extend(this);this.addBehavior()};In2iGui.Window.create=function(A){A=n2i.override({title:"Window",close:true},A);var C=A.element=new Element("div",{"class":"in2igui_window"+(A.variant?" in2igui_window_"+A.variant:"")});var B=(A.close?'<div class="in2igui_window_close"></div>':"")+'<div class="in2igui_window_titlebar"><div><div>';if(A.icon){B+='<span class="in2igui_window_icon" style="background-image: url('+In2iGui.getIconUrl(A.icon,1)+')"></span>'}B+='<span class="in2igui_window_title">'+A.title+'</span></div></div></div><div class="in2igui_window_content"><div class="in2igui_window_content"><div class="in2igui_window_body" style="'+(A.width?"width:"+A.width+"px;":"")+(A.padding?"padding:"+A.padding+"px;":"")+'"></div></div></div><div class="in2igui_window_bottom"><div class="in2igui_window_bottom"><div class="in2igui_window_bottom"></div></div></div>';C.update(B);document.body.appendChild(C);return new In2iGui.Window(A)};In2iGui.Window.prototype={addBehavior:function(){var A=this;if(this.close){this.close.observe("click",function(B){this.hide();this.fire("userClosedWindow")}.bind(this)).observe("mousedown",function(B){B.stop()})}this.titlebar.onmousedown=function(B){A.startDrag(B);return false};this.element.observe("mousedown",function(){A.element.style.zIndex=In2iGui.nextPanelIndex()})},setTitle:function(A){this.title.update(A)},show:function(){if(this.visible){return }this.element.setStyle({zIndex:In2iGui.nextPanelIndex(),visibility:"hidden",display:"block",top:(n2i.getScrollTop()+40)+"px"});var A=this.element.clientWidth;this.element.setStyle({width:A+"px",visibility:"visible"});if(!n2i.browser.msie){n2i.ani(this.element,"opacity",1,0)}this.visible=true;In2iGui.callDescendants(this,"parentShown");In2iGui.callVisible(this)},toggle:function(){(this.visible?this.hide():this.show())},hide:function(){if(!this.visible){return }if(!n2i.browser.msie){n2i.ani(this.element,"opacity",0,200,{hideOnComplete:true})}else{this.element.setStyle({display:"none"})}this.visible=false},add:function(A){if(A.getElement){this.content.insert(A.getElement())}else{this.content.insert(A)}},setVariant:function(A){this.element.removeClassName("in2igui_window_dark");this.element.removeClassName("in2igui_window_light");if(A=="dark"||A=="light"){this.element.addClassName("in2igui_window_"+A)}},startDrag:function(C){var B=Event.extend(C||window.event);this.element.style.zIndex=In2iGui.nextPanelIndex();var D=this.element.cumulativeOffset();this.dragState={left:B.pointerX()-D.left,top:B.pointerY()-D.top};this.latestPosition={left:this.dragState.left,top:this.dragState.top};this.latestTime=new Date().getMilliseconds();var A=this;this.moveListener=function(E){A.drag(E)};this.upListener=function(E){A.endDrag(E)};Event.observe(document,"mousemove",this.moveListener);Event.observe(document,"mouseup",this.upListener);Event.observe(document,"mousedown",this.upListener);B.stop();document.body.onselectstart=function(){return false};return false},calc:function(B,A){this.a=this.latestPosition.left-A;this.b=this.latestPosition.top-B;this.dist=Math.sqrt(Math.pow((this.a),2),Math.pow((this.b),2));this.latestTime=new Date().getMilliseconds();this.latestPosition={"top":B,"left":A}},drag:function(D){var A=Event.extend(D);this.element.style.right="auto";var C=(A.pointerY()-this.dragState.top);var B=(A.pointerX()-this.dragState.left);this.element.style.top=Math.max(C,0)+"px";this.element.style.left=Math.max(B,0)+"px";return false},endDrag:function(A){Event.stopObserving(document,"mousemove",this.moveListener);Event.stopObserving(document,"mouseup",this.upListener);Event.stopObserving(document,"mousedown",this.upListener);document.body.onselectstart=null}};In2iGui.Formula=function(A){this.options=A;In2iGui.extend(this,A);this.addBehavior()};In2iGui.Formula.create=function(A){A=A||{};var B={"class":"in2igui_formula"};if(A.action){B.action=A.action}if(A.method){B.method=A.method}A.element=new Element("form",B);return new In2iGui.Formula(A)};In2iGui.Formula.prototype={addBehavior:function(){this.element.onsubmit=function(){return false}},submit:function(){this.fire("submit")},getValues:function(){var B={};var C=In2iGui.get().getDescendants(this);for(var A=0;A<C.length;A++){if(C[A].options&&C[A].options.key&&C[A].getValue){B[C[A].options.key]=C[A].getValue()}else{if(C[A].name&&C[A].getValue){B[C[A].name]=C[A].getValue()}}}return B},setValues:function(A){var D=In2iGui.get().getDescendants(this);for(var C=0;C<D.length;C++){if(D[C].options&&D[C].options.key){var B=D[C].options.key;if(B&&A[B]!=undefined){D[C].setValue(A[B])}}}},focus:function(){var B=In2iGui.get().getDescendants(this);for(var A=0;A<B.length;A++){if(B[A].focus){B[A].focus();return }}},reset:function(){var B=In2iGui.get().getDescendants(this);for(var A=0;A<B.length;A++){if(B[A].reset){B[A].reset()}}},add:function(A){this.element.insert(A.getElement())},createGroup:function(A){var B=In2iGui.Formula.Group.create(A);this.add(B);return B},buildGroup:function(A,C){var B=this.createGroup(A);C.each(function(E){if(In2iGui.Formula[E.type]){var D=In2iGui.Formula[E.type].create(E.options);B.add(D)}});return B},childValueChanged:function(A){this.fire("valuesChanged",this.getValues())}};In2iGui.Formula.Group=function(A){this.name=A.name;this.element=$(A.element);this.body=this.element.select("tbody")[0];this.options=n2i.override({above:true},A);In2iGui.extend(this)};In2iGui.Formula.Group.create=function(A){A=n2i.override({above:true},A);var B=A.element=new Element("table",{"class":"in2igui_formula_group"});if(A.above){B.addClassName("in2igui_formula_group_above")}B.insert(new Element("tbody"));return new In2iGui.Formula.Group(A)};In2iGui.Formula.Group.prototype={add:function(D){var C=new Element("tr");this.body.insert(C);if(D.getLabel){var A=D.getLabel();if(A){var B=new Element("th");B.insert(new Element("label").insert(A));C.insert(B)}}var E=new Element("td");E.insert(new Element("div",{"class":"in2igui_formula_item"}).insert(D.getElement()));if(this.options.above){C=new Element("tr");this.body.insert(C)}C.insert(E)},createButtons:function(B){var C=new Element("tr");this.body.insert(C);var D=new Element("td",{colspan:this.options.above?1:2});C.insert(D);var A=In2iGui.Buttons.create(B);D.insert(A.getElement());return A}};In2iGui.Formula.Text=function(B){this.options=n2i.override({label:null,key:null,lines:1,live:false},B);this.element=$(B.element);this.name=B.name;In2iGui.extend(this);this.input=this.element.select(".in2igui_formula_text")[0];this.placeholder=this.element.select(".in2igui_field_placeholder")[0];this.value=this.input.value;if(this.placeholder){var A=this;In2iGui.onDomReady(function(){window.setTimeout(function(){A.value=A.input.value;A.updateClass()},500)})}this.addBehavior()};In2iGui.Formula.Text.create=function(B){B=n2i.override({lines:1},B);var C,A;if(B.lines>1){A=new Element("textarea",{"class":"in2igui_formula_text","rows":B.lines});C=new Element("span",{"class":"in2igui_formula_text_multiline"}).insert(A)}else{A=new Element("input",{"class":"in2igui_formula_text"});C=new Element("span",{"class":"in2igui_field_singleline"}).insert(A)}if(B.value!==undefined){A.value=B.value}B.element=In2iGui.wrapInField(C);return new In2iGui.Formula.Text(B)};In2iGui.Formula.Text.prototype={addBehavior:function(){In2iGui.addFocusClass({element:this.input,classElement:this.element,"class":"in2igui_field_focused"});this.input.observe("keyup",this.onKeyUp.bind(this));var A=this.element.select("em")[0];if(A){this.updateClass();A.observe("mousedown",function(){window.setTimeout(function(){this.input.focus();this.input.select()}.bind(this))}.bind(this));A.observe("mouseup",function(){this.input.focus();this.input.select()}.bind(this))}},updateClass:function(){this.element.setClassName("in2igui_field_dirty",this.value.length>0)},onKeyUp:function(B){if(this.options.lines<2&&B.keyCode===Event.KEY_RETURN){this.fire("submit");var A=In2iGui.get().getAncestor(this,"in2igui_formula");if(A){A.submit()}return }if(this.input.value==this.value){return }this.value=this.input.value;this.updateClass();In2iGui.callAncestors(this,"childValueChanged",this.input.value);this.fire("valueChanged",this.input.value)},updateFromNode:function(A){if(A.firstChild){this.setValue(A.firstChild.nodeValue)}else{this.setValue(null)}},updateFromObject:function(A){this.setValue(A.value)},focus:function(){try{this.input.focus()}catch(A){}},select:function(){try{this.input.focus();this.input.select()}catch(A){}},reset:function(){this.setValue("")},setValue:function(A){if(A===undefined||A===null){A=""}this.value=A;this.input.value=A},getValue:function(){return this.input.value},getLabel:function(){return this.options.label},isEmpty:function(){return this.input.value==""},isBlank:function(){return this.input.value.strip()==""},setError:function(A){var B=A?true:false;this.element.setClassName("in2igui_field_error",B);if(typeof (A)=="string"){In2iGui.showToolTip({text:A,element:this.element,key:this.name})}if(!B){In2iGui.hideToolTip({key:this.name})}}};In2iGui.Formula.DateTime=function(A){this.inputFormats=["d-m-Y","d/m-Y","d/m/Y","d-m-Y H:i:s","d/m-Y H:i:s","d/m/Y H:i:s","d-m-Y H:i","d/m-Y H:i","d/m/Y H:i","d-m-Y H","d/m-Y H","d/m/Y H","d-m","d/m","d","Y","m-d-Y","m-d","m/d"];this.outputFormat="d-m-Y H:i:s";this.name=A.name;this.element=$(A.element);this.input=this.element.select("input")[0];this.options=n2i.override({returnType:null,label:null,allowNull:true,value:null},A);this.value=this.options.value;In2iGui.extend(this);this.addBehavior();this.updateUI()};In2iGui.Formula.DateTime.create=function(B){var A=new Element("input",{"class":"in2igui_formula_text"});var C=new Element("span",{"class":"in2igui_formula_text_singleline"}).insert(A);B.element=In2iGui.wrapInField(C);return new In2iGui.Formula.DateTime(B)};In2iGui.Formula.DateTime.prototype={addBehavior:function(){In2iGui.addFocusClass({element:this.input,classElement:this.element,"class":"in2igui_field_focused"});this.input.observe("blur",this.check.bind(this))},updateFromNode:function(A){if(A.firstChild){this.setValue(A.firstChild.nodeValue)}else{this.setValue(null)}},updateFromObject:function(A){this.setValue(A.value)},focus:function(){try{this.input.focus()}catch(A){}},reset:function(){this.setValue("")},setValue:function(A){if(!A){this.value=null}else{if(A.constructor==Date){this.value=A}else{this.value=new Date();this.value.setTime(parseInt(A)*1000)}}this.updateUI()},check:function(){var C=this.input.value;var A=null;for(var B=0;B<this.inputFormats.length&&A==null;B++){A=Date.parseDate(C,this.inputFormats[B])}if(this.options.allowNull||A!=null){this.value=A}this.updateUI()},getValue:function(){if(this.value!=null&&this.options.returnType=="seconds"){return Math.round(this.value.getTime()/1000)}return this.value},getElement:function(){return this.element},getLabel:function(){return this.options.label},updateUI:function(){if(this.value){this.input.value=this.value.dateFormat(this.outputFormat)}else{this.input.value=""}}};In2iGui.Formula.Number=function(B){this.options=n2i.override({min:0,max:10000,value:null,decimals:0,allowNull:false},B);this.name=B.name;var A=this.element=$(B.element);this.input=A.select("input")[0];this.up=A.select(".in2igui_number_up")[0];this.down=A.select(".in2igui_number_down")[0];this.value=this.options.value;In2iGui.extend(this);this.addBehavior()};In2iGui.Formula.Number.create=function(B){var A=B.element=new Element("span",{"class":"in2igui_number"});A.update('<span><span><input type="text" value="'+(B.value!==undefined?B.value:"0")+'"/><a class="in2igui_number_up"></a><a class="in2igui_number_down"></a></span></span>');return new In2iGui.Formula.Number(B)};In2iGui.Formula.Number.prototype={addBehavior:function(){var A=this.element;this.input.observe("focus",function(){A.addClassName("in2igui_number_focused")});this.input.observe("blur",this.blurEvent.bind(this));this.input.observe("keyup",this.keyEvent.bind(this));this.up.observe("mousedown",this.upEvent.bind(this));this.down.observe("mousedown",this.downEvent.bind(this))},blurEvent:function(){this.element.removeClassName("in2igui_number_focused");this.updateField()},keyEvent:function(B){if(B.keyCode==Event.KEY_UP){B.stop();this.upEvent()}else{if(B.keyCode==Event.KEY_DOWN){this.downEvent()}else{var A=parseInt(this.input.value,10);if(!isNaN(A)){this.setLocalValue(A,true)}else{this.setLocalValue(null,true)}}}},downEvent:function(){if(this.value===null){this.setLocalValue(this.options.min,true)}else{this.setLocalValue(this.value-1,true)}this.updateField()},upEvent:function(){this.setLocalValue(this.value+1,true);this.updateField()},getValue:function(){return this.value},getLabel:function(){return this.options.label},setValue:function(A){A=parseInt(A,10);if(!isNaN(A)){this.setLocalValue(A,false)}this.updateField()},updateField:function(){this.input.value=this.value===null||this.value===undefined?"":this.value},setLocalValue:function(B,A){var C=this.value;if(B===null||B===undefined&&this.options.allowNull){this.value=null}else{this.value=Math.min(Math.max(B,this.options.min),this.options.max)}if(A&&C!==this.value){In2iGui.callAncestors(this,"childValueChanged",this.value);this.fire("valueChanged",this.value)}},reset:function(){if(this.options.allowNull){this.value=null}else{this.value=Math.min(Math.max(0,this.options.min),this.options.max)}this.updateField()}};In2iGui.Formula.DropDown=function(B){this.options=n2i.override({label:null,placeholder:null,url:null,source:null},B);this.name=B.name;var A=this.element=$(B.element);this.inner=A.select("strong")[0];this.items=B.items||[];this.index=-1;this.value=this.options.value||null;this.dirty=true;In2iGui.extend(this);this.addBehavior();this.updateIndex();this.updateUI();if(this.options.url){this.options.source=new In2iGui.Source({url:this.options.url,delegate:this})}else{if(this.options.source){this.options.source.listen(this)}}};In2iGui.Formula.DropDown.create=function(A){A=A||{};A.element=new Element("a",{"class":"in2igui_dropdown",href:"#"}).update("<span><span><strong></strong></span></span>");return new In2iGui.Formula.DropDown(A)};In2iGui.Formula.DropDown.prototype={addBehavior:function(){In2iGui.addFocusClass({element:this.element,"class":"in2igui_dropdown_focused"});this.element.observe("click",this.clicked.bind(this));this.element.observe("blur",this.hideSelector.bind(this))},updateIndex:function(){this.index=-1;this.items.each(function(B,A){if(B.value==this.value){this.index=A}}.bind(this))},updateUI:function(){var A=this.items[this.index];if(A){var B=A.label||A.title||"";this.inner.update(B.split("").join("\u200B"))}else{if(this.options.placeholder){this.inner.update(new Element("em").update(this.options.placeholder.escapeHTML()))}else{this.inner.update()}}if(!this.selector){return }this.selector.select("a").each(function(C,D){if(this.index==D){C.addClassName("in2igui_selected")}else{C.className=""}}.bind(this))},clicked:function(H){H.stop();this.buildSelector();var E=this.element,D=this.selector;E.focus();if(!this.items){return }var B=n2i.getDocumentHeight();if(B<200){var G=this.element.cumulativeOffset().left;this.selector.setStyle({"left":G+"px",top:"5px"})}else{n2i.place({target:{element:this.element,vertical:1,horizontal:0},source:{element:this.selector,vertical:0,horizontal:0}})}D.setStyle({visibility:"hidden",display:"block",width:""});var A=Math.min(B-D.cumulativeOffset().top-5,200);var C=Math.max(E.getWidth()-5,100,D.getWidth());var F=n2i.getDocumentWidth()-E.cumulativeOffset().left-20;C=Math.min(C,F);D.setStyle({visibility:"visible",width:C+"px",zIndex:In2iGui.nextTopIndex(),maxHeight:A+"px"})},getValue:function(A){return this.value},setValue:function(A){this.value=A;this.updateIndex();this.updateUI()},reset:function(){this.setValue(null)},getLabel:function(){return this.options.label},refresh:function(){if(this.options.source){this.options.source.refresh()}},addItem:function(A){this.items.push(A);this.dirty=true;this.updateIndex();this.updateUI()},setItems:function(A){this.items=A;this.dirty=true;this.index=-1;this.updateIndex();this.updateUI()},$itemsLoaded:function(A){this.setItems(A)},hideSelector:function(){if(!this.selector){return }this.selector.hide()},buildSelector:function(){if(!this.dirty||!this.items){return }if(!this.selector){this.selector=new Element("div",{"class":"in2igui_dropdown_selector"});document.body.appendChild(this.selector)}else{this.selector.update()}var A=this;this.items.each(function(C,B){var D=new Element("a",{href:"#"}).update(C.label||C.title).observe("mousedown",function(E){E.stop();A.itemClicked(C,B)});if(B==A.index){D.addClassName("in2igui_selected")}A.selector.insert(D)});this.dirty=false},itemClicked:function(B,A){this.index=A;var C=this.value!=this.items[A].value;this.value=this.items[A].value;this.updateUI();this.hideSelector();if(C){In2iGui.callAncestors(this,"childValueChanged",this.value);this.fire("valueChanged",this.value)}}};In2iGui.Formula.Radiobuttons=function(A){this.options=A;this.element=$(A.element);this.name=A.name;this.radios=[];this.value=A.value;this.defaultValue=this.value;In2iGui.extend(this)};In2iGui.Formula.Radiobuttons.prototype={click:function(){this.value=!this.value;this.updateUI()},updateUI:function(){for(var B=0;B<this.radios.length;B++){var A=this.radios[B];$(A.id).setClassName("in2igui_selected",A.value==this.value)}},setValue:function(A){this.value=A;this.updateUI()},getValue:function(){return this.value},reset:function(){this.setValue(this.defaultValue)},registerRadiobutton:function(B){this.radios.push(B);var C=$(B.id);var A=this;C.onclick=function(){A.setValue(B.value)}}};In2iGui.Formula.Checkbox=function(A){this.element=$(A.element);this.control=this.element.select("span")[0];this.options=A;this.name=A.name;this.value=A.value==="true"||A.value===true;In2iGui.extend(this);this.addBehavior()};In2iGui.Formula.Checkbox.create=function(B){var A=B.element=new Element("a",{"class":"in2igui_checkbox",href:"#"});if(B.value){A.addClassName("in2igui_checkbox_selected")}A.update("<span><span></span></span>");return new In2iGui.Formula.Checkbox(B)};In2iGui.Formula.Checkbox.prototype={addBehavior:function(){In2iGui.addFocusClass({element:this.element,"class":"in2igui_checkbox_focused"});this.element.observe("click",this.click.bind(this))},click:function(A){A.stop();this.element.focus();this.value=!this.value;this.updateUI();In2iGui.callAncestors(this,"childValueChanged",this.value);this.fire("valueChanged",this.value)},updateUI:function(){this.element.setClassName("in2igui_checkbox_selected",this.value)},setValue:function(A){this.value=A===true||A==="true";this.updateUI()},getValue:function(){return this.value},reset:function(){this.setValue(false)},getLabel:function(){return this.options.label}};In2iGui.Formula.Checkboxes=function(A){this.options=A;this.element=$(A.element);this.name=A.name;this.items=A.items||[];this.sources=[];this.subItems=[];this.values=A.values||A.value||[];n2i.log(this.values);In2iGui.extend(this);this.addBehavior();this.updateUI();if(A.url){new In2iGui.Source({url:A.url,delegate:this})}};In2iGui.Formula.Checkboxes.create=function(A){A.element=new Element("div",{"class":A.vertical?"in2igui_checkboxes in2igui_checkboxes_vertical":"in2igui_checkboxes"});if(A.items){A.items.each(function(C){var B=new Element("a",{"class":"in2igui_checkbox",href:"javascript:void(0);"}).update("<span><span></span></span>"+C.title);In2iGui.addFocusClass({element:B,"class":"in2igui_checkbox_focused"});A.element.insert(B)})}return new In2iGui.Formula.Checkboxes(A)};In2iGui.Formula.Checkboxes.prototype={addBehavior:function(){this.element.select("a.in2igui_checkbox").each(function(A,B){A.observe("click",function(C){C.stop();this.flipValue(this.items[B].value)}.bind(this))}.bind(this))},getValue:function(){return this.values},getValues:function(){return this.values},checkValues:function(){var B=[];for(var C=0;C<this.values.length;C++){var E=this.values[C];var D=false;for(var A=0;A<this.items.length;A++){D=D||this.items[A].value===E}for(var A=0;A<this.subItems.length;A++){D=D||this.subItems[A].hasValue(E)}if(D){B.push(E)}}this.values=B},setValue:function(A){this.values=A;this.checkValues();this.updateUI()},setValues:function(A){this.setValue(A)},flipValue:function(A){n2i.flipInArray(this.values,A);this.checkValues();this.updateUI();this.fire("valueChanged",this.values);In2iGui.callAncestors(this,"childValueChanged",this.values)},updateUI:function(){for(var B=0;B<this.subItems.length;B++){this.subItems[B].updateUI()}var A=this.element.select("a.in2igui_checkbox");this.items.each(function(D,C){A[C].setClassName("in2igui_checkbox_selected",this.values.indexOf(D.value)!==-1)}.bind(this))},refresh:function(){for(var A=0;A<this.subItems.length;A++){this.subItems[A].refresh()}},reset:function(){this.setValues([])},registerSource:function(A){A.parent=this;this.sources.push(A)},registerItems:function(A){A.parent=this;this.subItems.push(A)},getLabel:function(){return this.options.label},$itemsLoaded:function(A){A.each(function(C){var B=new Element("a",{"class":"in2igui_checkbox",href:"javascript:void(0);"}).update("<span><span></span></span>"+C.title);B.observe("click",function(D){D.stop();this.flipValue(C.value)}.bind(this));In2iGui.addFocusClass({element:B,"class":"in2igui_checkbox_focused"});this.element.insert(B);this.items.push(C)}.bind(this));this.checkValues();this.updateUI()}};In2iGui.Formula.Checkboxes.Items=function(A){this.element=$(A.element);this.name=A.name;this.parent=null;this.options=A;this.checkboxes=[];In2iGui.extend(this);if(this.options.source){this.options.source.listen(this)}};In2iGui.Formula.Checkboxes.Items.prototype={refresh:function(){if(this.options.source){this.options.source.refresh()}},$itemsLoaded:function(B){this.checkboxes=[];this.element.update();var A=this;B.each(function(D){var C=new Element("a",{"class":"in2igui_checkbox",href:"#"}).update("<span><span></span></span>"+D.title).observe("click",function(E){E.stop();C.focus();A.itemWasClicked(D)});In2iGui.addFocusClass({element:C,"class":"in2igui_checkbox_focused"});A.element.insert(C);A.checkboxes.push({title:D.title,element:C,value:D.value})});this.parent.checkValues();this.updateUI()},itemWasClicked:function(A){this.parent.flipValue(A.value)},updateUI:function(){for(var A=0;A<this.checkboxes.length;A++){var B=this.checkboxes[A];B.element.setClassName("in2igui_checkbox_selected",this.parent.values.indexOf(B.value)!=-1)}},hasValue:function(B){for(var A=0;A<this.checkboxes.length;A++){if(this.checkboxes[A].value==B){return true}}return false}};In2iGui.Formula.Tokens=function(A){this.options=n2i.override({label:null,key:null},A);this.element=$(A.element);this.name=A.name;this.value=[""];In2iGui.extend(this);this.updateUI()};In2iGui.Formula.Tokens.create=function(A){A=A||{};A.element=new Element("div").addClassName("in2igui_tokens");return new In2iGui.Formula.Tokens(A)};In2iGui.Formula.Tokens.prototype={setValue:function(A){this.value=A;this.value.push("");this.updateUI()},reset:function(){this.value=[""];this.updateUI()},getValue:function(){var A=[];this.value.each(function(B){B=B.strip();if(B.length>0){A.push(B)}});return A},getLabel:function(){return this.options.label},updateUI:function(){this.element.update();this.value.each(function(C,B){var A=new Element("input").addClassName("in2igui_tokens_token");if(this.options.width){A.setStyle({width:this.options.width+"px"})}A.value=C;A.in2iguiIndex=B;this.element.insert(A);A.observe("keyup",function(){this.inputChanged(A,B)}.bind(this))}.bind(this))},inputChanged:function(A,B){if(B==this.value.length-1&&A.value!=this.value[B]){this.addField()}this.value[B]=A.value},addField:function(){var B=new Element("input").addClassName("in2igui_tokens_token");if(this.options.width){B.setStyle({width:this.options.width+"px"})}var C=this.value.length;this.value.push("");this.element.insert(B);var A=this;B.observe("keyup",function(){A.inputChanged(B,C)})}};In2iGui.Formula.StyleLength=function(C){this.options=n2i.override({value:null,min:0,max:1000,units:["px","pt","em","%"],defaultUnit:"px",allowNull:false},C);this.name=C.name;var B=this.element=$(C.element);this.input=B.select("input")[0];var A=B.select("a");this.up=A[0];this.down=A[1];this.value=this.parseValue(this.options.value);In2iGui.extend(this);this.addBehavior()};In2iGui.Formula.StyleLength.prototype={addBehavior:function(){var A=this.element;this.input.observe("focus",function(){A.addClassName("in2igui_number_focused")});this.input.observe("blur",this.blurEvent.bind(this));this.input.observe("keyup",this.keyEvent.bind(this));this.up.observe("mousedown",this.upEvent.bind(this));this.down.observe("mousedown",this.downEvent.bind(this))},parseValue:function(E){var B=parseFloat(E,10);if(isNaN(B)){return null}var A={number:B,unit:this.options.defaultUnit};for(var C=0;C<this.options.units.length;C++){var D=this.options.units[C];if(E.indexOf(D)!=-1){A.unit=D;break}}A.number=Math.max(this.options.min,Math.min(this.options.max,A.number));return A},blurEvent:function(){this.element.removeClassName("in2igui_number_focused");this.updateInput()},keyEvent:function(A){if(A.keyCode==Event.KEY_UP){A.stop();this.upEvent()}else{if(A.keyCode==Event.KEY_DOWN){this.downEvent()}else{this.checkAndSetValue(this.parseValue(this.input.value))}}},updateInput:function(){this.input.value=this.getValue()},checkAndSetValue:function(B){var A=this.value;var C=false;if(A===null&&B===null){}else{if(A!=null&&B!=null&&A.number===B.number&&A.unit===B.unit){}else{C=true}}this.value=B;if(C){this.fire("valueChanged",this.getValue())}},downEvent:function(){if(this.value){this.checkAndSetValue({number:Math.max(this.options.min,this.value.number-1),unit:this.value.unit})}else{this.checkAndSetValue({number:this.options.min,unit:this.options.defaultUnit})}this.updateInput()},upEvent:function(){if(this.value){this.checkAndSetValue({number:Math.min(this.options.max,this.value.number+1),unit:this.value.unit})}else{this.checkAndSetValue({number:this.options.min+1,unit:this.options.defaultUnit})}this.updateInput()},getValue:function(){return this.value?this.value.number+this.value.unit:""},setValue:function(A){this.value=this.parseValue(A);this.updateInput()}};In2iGui.Formula.Location=function(A){this.options=n2i.override({value:null},A);this.name=A.name;this.element=$(A.element);this.chooser=this.element.select("a")[0];this.latField=new In2iGui.TextField({element:this.element.select("input")[0],validator:new In2iGui.NumberValidator({min:-90,max:90,allowNull:true})});this.latField.listen(this);this.lngField=new In2iGui.TextField({element:this.element.select("input")[1],validator:new In2iGui.NumberValidator({min:-180,max:180,allowNull:true})});this.lngField.listen(this);this.value=this.options.value;In2iGui.extend(this);this.setValue(this.value);this.addBehavior()};In2iGui.Formula.Location.create=function(B){B=B||{};var C=B.element=new Element("div",{"class":"in2igui_location"});var A=new Element("span");A.update('<span class="in2igui_location_latitude"><span><input/></span></span><span class="in2igui_location_longitude"><span><input/></span></span>');C.insert(In2iGui.wrapInField(A));C.insert('<a class="in2igui_location_picker" href="javascript:void(0);"></a>');return new In2iGui.Formula.Location(B)};In2iGui.Formula.Location.prototype={addBehavior:function(){this.chooser.observe("click",this.showPicker.bind(this));In2iGui.addFocusClass({element:this.latField.element,classElement:this.element,"class":"in2igui_field_focused"});In2iGui.addFocusClass({element:this.lngField.element,classElement:this.element,"class":"in2igui_field_focused"})},getLabel:function(){return this.options.label},reset:function(){this.setValue()},getValue:function(){return this.value},setValue:function(A){if(A){this.latField.setValue(A.latitude);this.lngField.setValue(A.longitude);this.value=A}else{this.latField.setValue();this.lngField.setValue();this.value=null}this.updatePicker();n2i.log(this.value)},updatePicker:function(){if(this.picker){this.picker.setLocation(this.value)}},showPicker:function(){if(!this.picker){this.picker=new In2iGui.LocationPicker();this.picker.listen(this)}this.picker.show({node:this.chooser,location:this.value})},$locationChanged:function(A){this.setValue(A)},$valueChanged:function(){var B=this.latField.getValue();var A=this.lngField.getValue();if(B===null||A===null){this.value=null}else{this.value={latitude:B,longitude:A}}this.updatePicker()}};In2iGui.List=function(A){this.options=n2i.override({url:null,source:null},A);this.element=$(A.element);this.name=A.name;if(this.options.source){this.options.source.listen(this)}this.url=A.url;this.table=this.element.select("table")[0];this.head=this.element.select("thead")[0];this.body=this.element.select("tbody")[0];this.columns=[];this.rows=[];this.selected=[];this.navigation=this.element.select(".in2igui_list_navigation")[0];this.count=this.navigation.select(".in2igui_list_count")[0];this.windowPage=this.navigation.select(".window_page")[0];this.windowPageBody=this.navigation.select(".window_page_body")[0];this.parameters={};this.sortKey=null;this.sortDirection=null;this.window={size:null,page:0,total:0};if(A.windowSize!=""){this.window.size=parseInt(A.windowSize)}In2iGui.extend(this);if(this.url){this.refresh()}};In2iGui.List.create=function(A){A=n2i.override({},A);var B=A.element=new Element("div",{"class":"in2igui_list"});B.update('<div class="in2igui_list_navigation"><div class="in2igui_list_selection window_page"><div><div class="window_page_body"></div></div></div><span class="in2igui_list_count"></span></div><div class="in2igui_list_body"'+(A.maxHeight>0?' style="max-height: '+A.maxHeight+'px;"':"")+'><table cellspacing="0" cellpadding="0"><thead><tr></tr></thead><tbody></tbody></table></div>');return new In2iGui.List(A)};In2iGui.List.prototype={hide:function(){this.element.hide()},show:function(){this.element.show();this.refresh()},registerColumn:function(A){this.columns.push(A)},getSelection:function(){var A=[];for(var B=0;B<this.selected.length;B++){A.push(this.rows[this.selected[B]])}return A},getFirstSelection:function(){var A=this.getSelection();if(A.length>0){return A[0]}else{return null}},setParameter:function(A,B){this.parameters[A]=B},loadData:function(A){this.setUrl(A)},setSource:function(A){if(this.options.source!=A){if(this.options.source){this.options.source.removeDelegate(this)}A.listen(this);this.options.source=A;A.refresh()}},setUrl:function(A){if(this.options.source){this.options.source.removeDelegate(this);this.options.source=null}this.url=A;this.selected=[];this.sortKey=null;this.sortDirection=null;this.resetState();this.refresh()},clear:function(){this.selected=[];this.columns=[];this.rows=[];this.navigation.style.display="none";this.body.update();this.head.update();if(this.options.source){this.options.source.removeDelegate(this)}this.options.source=null;this.url=null},resetState:function(){this.window={size:null,page:0,total:0};In2iGui.firePropertyChange(this,"window",this.window);In2iGui.firePropertyChange(this,"window.page",this.window.page)},valueForProperty:function(A){if(A=="window.page"){return this.window.page}if(A=="window.page"){return this.window.page}else{if(A=="sort.key"){return this.sortKey}else{if(A=="sort.direction"){return(this.sortDirection||"ascending")}else{return this[A]}}}},$sourceShouldRefresh:function(){return this.element.style.display!="none"},refresh:function(){if(this.options.source){this.options.source.refresh();return }if(!this.url){return }var A=this.url;if(typeof (this.window.page)=="number"){A+=A.indexOf("?")==-1?"?":"&";A+="windowPage="+this.window.page}if(this.window.size){A+=A.indexOf("?")==-1?"?":"&";A+="windowSize="+this.window.size}if(this.sortKey){A+=A.indexOf("?")==-1?"?":"&";A+="sort="+this.sortKey}if(this.sortDirection){A+=A.indexOf("?")==-1?"?":"&";A+="direction="+this.sortDirection}for(key in this.parameters){A+=A.indexOf("?")==-1?"?":"&";A+=key+"="+this.parameters[key]}In2iGui.request({url:A,onJSON:this.$objectsLoaded.bind(this),onXML:this.$listLoaded.bind(this)})},sort:function(A){var B=this.columns[A].key;if(B==this.sortKey){this.sortDirection=this.sortDirection=="ascending"?"descending":"ascending";In2iGui.firePropertyChange(this,"sort.direction",this.sortDirection)}else{In2iGui.firePropertyChange(this,"sort.key",B)}this.sortKey=B},$listLoaded:function(U){this.selected=[];this.parseWindow(U);this.buildNavigation();this.body.update();this.head.update();this.rows=[];this.columns=[];var R=new Element("tr");var Q=U.getElementsByTagName("sort");this.sortKey=null;this.sortDirection=null;if(Q.length>0){this.sortKey=Q[0].getAttribute("key");this.sortDirection=Q[0].getAttribute("direction")}var B=U.getElementsByTagName("header");for(var N=0;N<B.length;N++){var C="";var F=new Element("th");var K=B[N].getAttribute("width");var T=B[N].getAttribute("key");var D=B[N].getAttribute("sortable")=="true";if(K&&K!=""){F.style.width=K+"%"}if(D){var J=this;F.in2iguiIndex=N;F.onclick=function(){J.sort(this.in2iguiIndex)};C+="sortable"}if(T==this.sortKey){C+=" sort_"+this.sortDirection}F.className=C;var M=new Element("span");F.appendChild(M);M.appendChild(document.createTextNode(B[N].getAttribute("title")));R.appendChild(F);this.columns.push({"key":T,"sortable":D,"width":K})}this.head.appendChild(R);var A=document.createDocumentFragment();var I=U.getElementsByTagName("row");for(var N=0;N<I.length;N++){var E=I[N].getElementsByTagName("cell");var G=new Element("tr");var P=I[N].getAttribute("icon");var S=I[N].getAttribute("title");for(var L=0;L<E.length;L++){var H=new Element("td");this.parseCell(E[L],H);G.insert(H);if(!S){S=E[L].innerText||E[L].textContent}if(!P&&E[L].getAttribute("icon")){P=E[L].getAttribute("icon")}}var O={id:I[N].getAttribute("id"),kind:I[N].getAttribute("kind"),icon:P,title:S,index:N};G.dragDropInfo=O;this.addRowBehavior(G,N);A.appendChild(G);this.rows.push(O)}this.body.appendChild(A);this.fire("selectionReset")},$objectsLoaded:function(A){if(A==null){}else{if(A.constructor==Array){this.setObjects(A)}else{this.setData(A)}}this.fire("selectionReset")},$sourceIsBusy:function(){},$sourceIsNotBusy:function(){},filter:function(G){var A=20;var E=new RegExp("[\\w]{"+A+",}","g");var C=E.exec(G);if(C){for(var D=0;D<C.length;D++){var F="";for(var B=0;B<C[D].length;B++){F+=C[D][B];if((B+1)%A==0){F+="\u200B"}}G=G.replace(C[D],F)}}return G},parseCell:function(E,A){var D=E.getAttribute("icon");if(D!=null&&!D.blank()){A.insert(In2iGui.createIcon(D,1))}for(var C=0;C<E.childNodes.length;C++){var G=E.childNodes[C];if(n2i.dom.isDefinedText(G)){n2i.dom.addText(A,G.nodeValue)}else{if(n2i.dom.isElement(G,"break")){A.insert(new Element("br"))}else{if(n2i.dom.isElement(G,"line")){var B=new Element("p",{"class":"in2igui_list_line"}).insert(n2i.dom.getNodeText(G));if(G.getAttribute("dimmed")=="true"){B.addClassName("in2igui_list_dimmed")}A.insert(B)}else{if(n2i.dom.isElement(G,"object")){var F=new Element("div",{"class":"object"});if(G.getAttribute("icon")){F.insert(In2iGui.createIcon(G.getAttribute("icon"),1))}if(G.firstChild&&G.firstChild.nodeType==n2i.TEXT_NODE&&G.firstChild.nodeValue.length>0){F.appendChild(document.createTextNode(G.firstChild.nodeValue))}A.insert(F)}}}}}},parseWindow:function(B){var C=B.getElementsByTagName("window");if(C.length>0){var A=C[0];this.window.total=parseInt(A.getAttribute("total"));this.window.size=parseInt(A.getAttribute("size"));this.window.page=parseInt(A.getAttribute("page"))}else{this.window.total=0;this.window.size=0;this.window.page=0}},buildNavigation:function(){var B=this;var A=this.window.size>0?Math.ceil(this.window.total/this.window.size):0;if(A<2){this.navigation.style.display="none";return }this.navigation.style.display="block";var E=((this.window.page)*this.window.size+1);this.count.update(E+"-"+Math.min((this.window.page+1)*this.window.size,this.window.total)+" / "+this.window.total);var C=this.windowPageBody;C.update();if(A<2){this.windowPage.style.display="none"}else{var D=$R(0,A-1);D=this.buildPages(A,this.window.page);D.each(function(G){if(G===""){C.insert("<span>·</span>")}else{var F=document.createElement("a");F.appendChild(document.createTextNode(G+1));F.onclick=function(){B.windowPageWasClicked(this,G);return false};if(G==B.window.page){F.className="selected"}C.appendChild(F)}});this.windowPage.style.display="block"}},buildPages:function(E,D){var B=[];var A=false;for(var C=0;C<E;C++){if(C<1||C>E-2||Math.abs(D-C)<5){B.push(C);A=false}else{if(!A){B.push("")}A=true}}return B},setData:function(A){this.selected=[];var B=A.window||{};this.window.total=B.total||0;this.window.size=B.size||0;this.window.page=B.page||0;this.buildNavigation();this.buildHeaders(A.headers);this.buildRows(A.rows)},buildHeaders:function(B){this.head.update();this.columns=[];var A=new Element("tr");this.head.insert(A);B.each(function(D,C){var E=new Element("th");if(D.width){E.setStyle({width:D.width+"%"})}if(D.sortable){E.observe("click",function(){this.sort(C)}.bind(this));E.addClassName("sortable")}E.insert(new Element("span").update(D.title));A.insert(E);this.columns.push(D)}.bind(this))},buildRows:function(B){var A=this;this.body.update();this.rows=[];if(!B){return }B.each(function(E,C){var F=new Element("tr");var D=E.icon;var H=E.title;E.cells.each(function(J){var I=new Element("td");if(J.icon){I.insert(In2iGui.createIcon(J.icon,1));D=D||J.icon}if(J.text){I.appendChild(document.createTextNode(J.text));H=H||J.text}F.insert(I)});A.body.insert(F);var G={id:E.id,kind:E.kind,icon:D,title:H,index:C};F.dragDropInfo=G;A.rows.push({id:E.id,kind:E.kind,icon:D,title:H,index:C,data:E.data});this.addRowBehavior(F,C)}.bind(this))},setObjects:function(I){this.selected=[];this.body.update();this.rows=[];for(var E=0;E<I.length;E++){var J=new Element("tr");var D=I[E];var F=null;for(var C=0;C<this.columns.length;C++){var H=new Element("td");if(this.builder){H.update(this.builder.buildColumn(this.columns[C],D))}else{var G=D[this.columns[C].key]||"";if(G.constructor==Array){for(var B=0;B<G.length;B++){if(G[B].constructor==Object){H.insert(this.createObject(G[B]))}else{H.insert(new Element("div").update(G))}}}else{if(G.constructor==Object){H.insert(this.createObject(G[C]))}else{H.insert(G);F=F==null?G:F}}}J.insert(H)}var A={id:D.id,kind:D.kind,title:F};J.dragDropInfo=A;this.body.insert(J);this.addRowBehavior(J,E);this.rows.push(D)}},createObject:function(A){var B=new Element("div",{"class":"object"});if(A.icon){B.insert(In2iGui.createIcon(A.icon,1))}return B.insert(A.text||A.name||"")},addRowBehavior:function(C,B){var A=this;C.onmousedown=function(D){A.rowDown(B);In2iGui.startDrag(D,C);return false};C.ondblclick=function(){A.rowDoubleClick(B);return false}},changeSelection:function(A){var C=this.body.getElementsByTagName("tr");for(var B=0;B<this.selected.length;B++){C[this.selected[B]].removeClassName("selected")}for(var B=0;B<A.length;B++){C[A[B]].addClassName("selected")}this.selected=A;this.fire("selectionChanged",this.rows[A[0]])},rowDown:function(A){this.changeSelection([A])},rowDoubleClick:function(A){this.fire("listRowWasOpened",this.getFirstSelection())},windowPageWasClicked:function(A,B){this.window.page=B;In2iGui.firePropertyChange(this,"window",this.window);In2iGui.firePropertyChange(this,"window.page",this.window.page)}};In2iGui.Tabs=function(A){A=A||{};this.name=A.name;this.element=$(A.element);this.activeTab=-1;this.bar=this.element.select(".in2igui_tabs_bar ul")[0];this.tabs=this.bar.select("li");this.contents=this.element.select(".in2igui_tabs_tab");this.addBehavior();In2iGui.extend(this)};In2iGui.Tabs.create=function(B){B=B||{};var E=B.element=new Element("div",{"class":"in2igui_tabs"});var A="in2igui_tabs_bar";if(B.small){A+=" in2igui_tabs_bar_small"}if(B.centered){A+=" in2igui_tabs_bar_centered"}var D=new Element("div",{"class":A});E.insert(D);var C=new Element("ul");D.insert(C);return new In2iGui.Tabs(B)};In2iGui.Tabs.prototype={addBehavior:function(){this.tabs.each(this.addTabBehavior.bind(this))},addTabBehavior:function(B,A){B.observe("click",function(){this.tabWasClicked(A)}.bind(this))},registerTab:function(A){A.parent=this;this.tabs.push(A)},tabWasClicked:function(A){this.activeTab=A;this.updateGUI()},updateGUI:function(){for(var A=0;A<this.tabs.length;A++){this.tabs[A].setClassName("in2igui_tabs_selected",A==this.activeTab);this.contents[A].setStyle({display:(A==this.activeTab?"block":"none")})}},createTab:function(A){A=A||{};var B=new Element("li").update("<a><span><span>"+A.title+"</span></span></a>");this.bar.insert(B);this.addTabBehavior(B,this.tabs.length);this.tabs.push(B);var C=A.element=new Element("div",{"class":"in2igui_tabs_tab"});if(A.padding>0){C.setStyle({"padding":A.padding+"px"})}this.contents.push(C);this.element.insert(C);if(this.activeTab==-1){this.activeTab=0;B.addClassName("in2igui_tabs_selected")}else{C.setStyle({display:"none"})}return new In2iGui.Tab(A)}};In2iGui.Tab=function(A){this.name=A.name;this.element=$(A.element)};In2iGui.Tab.prototype={add:function(A){this.element.insert(A.element)}};In2iGui.ObjectList=function(A){this.options=n2i.override({key:null},A);this.name=A.name;this.element=$(A.element);this.body=this.element.select("tbody")[0];this.template=[];this.objects=[];In2iGui.extend(this)};In2iGui.ObjectList.create=function(D){D=D||{};var C=D.element=new Element("table",{"class":"in2igui_objectlist",cellpadding:"0",cellspacing:"0"});if(D.template){var A="<thead><tr>";D.template.each(function(E){A+="<th>"+(E.label||"")+"</th>"});A+="</tr></thead>";C.insert(A)}C.insert(new Element("tbody"));var B=new In2iGui.ObjectList(D);if(D.template){D.template.each(function(E){B.registerTemplateItem(new In2iGui.ObjectList.Text(E.key))})}return B};In2iGui.ObjectList.prototype={ignite:function(){this.addObject({})},addObject:function(B,D){if(this.objects.length==0||D){var C=new In2iGui.ObjectList.Object(this.objects.length,B,this);this.objects.push(C);this.body.appendChild(C.getElement())}else{var A=this.objects.pop();var C=new In2iGui.ObjectList.Object(A.index,B,this);A.index++;this.objects.push(C);this.objects.push(A);this.body.insertBefore(C.getElement(),A.getElement())}},reset:function(){for(var B=0;B<this.objects.length;B++){var A=this.objects[B].getElement();A.parentNode.removeChild(A)}this.objects=[];this.addObject({})},addObjects:function(B){for(var A=0;A<B.length;A++){this.addObject(B[A])}},setObjects:function(A){this.reset();this.addObjects(A)},getObjects:function(C){var B=[];for(var A=0;A<this.objects.length-1;A++){B.push(this.objects[A].getData())}return B},getValue:function(){return this.getObjects()},setValue:function(A){this.setObjects(A)},registerTemplateItem:function(A){this.template.push(A)},objectDidChange:function(A){if(A.index>=this.objects.length-1){this.addObject({},true)}},getLabel:function(){return this.options.label}};In2iGui.ObjectList.Object=function(A,C,B){this.data=C;this.index=A;this.list=B;this.fields=[]};In2iGui.ObjectList.Object.prototype={getElement:function(){if(!this.element){var B=this;this.element=document.createElement("tr");for(var C=0;C<this.list.template.length;C++){var D=this.list.template[C];var E=D.clone();E.object=this;this.fields.push(E);var A=document.createElement("td");if(C==0){A.className="first"}A.appendChild(E.getElement());E.setValue(this.data[D.key]);this.element.appendChild(A)}}return this.element},valueDidChange:function(){this.list.objectDidChange(this)},getData:function(){var B=this.data;for(var A=0;A<this.fields.length;A++){B[this.fields[A].key]=this.fields[A].getValue()}return B}};In2iGui.ObjectList.Text=function(A){this.key=A;this.value=null};In2iGui.ObjectList.Text.prototype={clone:function(){return new In2iGui.ObjectList.Text(this.key)},getElement:function(){var A=new Element("input",{"class":"in2igui_formula_text"});var B=In2iGui.wrapInField(A);this.wrapper=new In2iGui.TextField({element:A});this.wrapper.listen(this);return B},$valueChanged:function(A){this.value=A;this.object.valueDidChange()},getValue:function(){return this.value},setValue:function(A){this.value=A;this.wrapper.setValue(A)}};In2iGui.ObjectList.Select=function(A){this.key=A;this.value=null;this.options=[]};In2iGui.ObjectList.Select.prototype={clone:function(){var A=new In2iGui.ObjectList.Select(this.key);A.options=this.options;return A},getElement:function(){this.select=new Element("select");for(var B=0;B<this.options.length;B++){this.select.options[this.select.options.length]=new Option(this.options[B].label,this.options[B].value)}var A=this;this.select.onchange=function(){A.object.valueDidChange()};return this.select},getValue:function(){return this.select.value},setValue:function(A){this.select.value=A},addOption:function(B,A){this.options.push({value:B,label:A})}};In2iGui.Alert=function(A){this.options=n2i.override({modal:false},A);this.element=$(A.element);this.name=A.name;this.body=this.element.select(".in2igui_alert_body")[0];this.content=this.element.select(".in2igui_alert_content")[0];this.emotion=this.options.emotion;this.title=this.element.select("h1").first();In2iGui.extend(this)};In2iGui.Alert.create=function(B){B=n2i.override({title:"",text:"",emotion:null,title:null},B);var C=B.element=new Element("div",{"class":"in2igui_alert"});var A=new Element("div",{"class":"in2igui_alert_body"});C.insert(A);var D=new Element("div",{"class":"in2igui_alert_content"});A.insert(D);document.body.appendChild(C);var E=new In2iGui.Alert(B);if(B.emotion){E.setEmotion(B.emotion)}if(B.title){E.setTitle(B.title)}if(B.text){E.setText(B.text)}return E};In2iGui.Alert.prototype={show:function(){var A=In2iGui.nextAlertIndex();if(this.options.modal){In2iGui.showCurtain(this,A);A++}this.element.style.zIndex=A;this.element.style.display="block";this.element.style.top=(n2i.getScrollTop()+100)+"px";n2i.animate(this.element,"opacity",1,200);n2i.animate(this.element,"margin-top","40px",600,{ease:n2i.ease.elastic})},hide:function(){n2i.animate(this.element,"opacity",0,200,{hideOnComplete:true});n2i.animate(this.element,"margin-top","0px",200);In2iGui.hideCurtain(this)},setTitle:function(A){if(!this.title){this.title=new Element("h1");this.content.appendChild(this.title)}this.title.innerHTML=A},setText:function(A){if(!this.text){this.text=new Element("p");this.content.appendChild(this.text)}this.text.innerHTML=A||""},setEmotion:function(A){if(this.emotion){this.body.removeClassName(this.emotion)}this.emotion=A;this.body.addClassName(A)},update:function(A){A=A||{};this.setTitle(A.title||null);this.setText(A.text||null);this.setEmotion(A.emotion||null)},addButton:function(A){if(!this.buttons){this.buttons=In2iGui.Buttons.create({align:"right"});this.body.appendChild(this.buttons.element)}this.buttons.add(A)}};In2iGui.Button=function(A){this.options=A;this.name=A.name;this.element=$(A.element);this.enabled=!this.element.hasClassName("in2igui_button_disabled");In2iGui.extend(this);this.addBehavior()};In2iGui.Button.create=function(F){var F=n2i.override({text:"",highlighted:false,enabled:true},F);var D="in2igui_button"+(F.highlighted?" in2igui_button_highlighted":"");if(F.small&&F.rounded){D+=" in2igui_button_small_rounded"}if(!F.enabled){D+=" in2igui_button_disabled"}var A=F.element=new Element("a",{"class":D,href:"#"});var E=new Element("span");A.appendChild(E);var C=new Element("span");E.appendChild(C);if(F.icon){var B=new Element("em",{"class":"in2igui_button_icon"}).setStyle({"backgroundImage":"url("+In2iGui.getIconUrl(F.icon,1)+")"});if(!F.text||F.text.length==0){B.addClassName("in2igui_button_icon_notext")}C.insert(B)}if(F.text&&F.text.length>0){C.insert(F.text)}if(F.title&&F.title.length>0){C.insert(F.title)}return new In2iGui.Button(F)};In2iGui.Button.prototype={addBehavior:function(){var A=this;this.element.observe("click",function(B){A.clicked();Event.stop(B)})},clicked:function(){if(this.enabled){if(this.options.confirm){In2iGui.confirmOverlay({widget:this,text:this.options.confirm.text,okText:this.options.confirm.okText,cancelText:this.options.confirm.cancelText,onOk:this.fireClick.bind(this)})}else{this.fireClick()}}else{this.element.blur()}},fireClick:function(){this.fire("click");if(this.options.submit){var A=In2iGui.get().getAncestor(this,"in2igui_formula");if(A){A.submit()}}},click:function(A){if(A){this.listen({$click:A})}else{this.clicked()}},onClick:function(A){this.listen({$click:A})},setEnabled:function(A){this.enabled=A;this.updateUI()},setHighlighted:function(A){this.element.setClassName("in2igui_button_highlighted",A)},updateUI:function(){this.element.setClassName("in2igui_button_disabled",!this.enabled)},setText:function(A){this.element.getElementsByTagName("span")[1].innerHTML=A}};In2iGui.Buttons=function(A){this.name=A.name;this.element=$(A.element);this.body=this.element.select(".in2igui_buttons_body")[0];In2iGui.extend(this)};In2iGui.Buttons.create=function(B){B=n2i.override({top:0},B);var A=B.element=new Element("div",{"class":"in2igui_buttons"});if(B.align=="right"){A.addClassName("in2igui_buttons_right")}if(B.align=="center"){A.addClassName("in2igui_buttons_center")}if(B.top>0){A.setStyle({paddingTop:B.top+"px"})}A.insert(new Element("div",{"class":"in2igui_buttons_body"}));return new In2iGui.Buttons(B)};In2iGui.Buttons.prototype={add:function(A){this.body.insert(A.element);return this}};In2iGui.Selection=function(A){this.options=n2i.override({value:null},A);this.element=$(A.element);this.name=A.name;this.items=[];this.subItems=[];this.selection=null;if(this.options.value!=null){this.selection={value:this.options.value}}In2iGui.extend(this)};In2iGui.Selection.create=function(A){A=n2i.override({width:0},A);var B=A.element=new Element("div",{"class":"in2igui_selection"});if(A.width>0){B.setStyle({width:A.width+"px"})}return new In2iGui.Selection(A)};In2iGui.Selection.prototype={getValue:function(){return this.selection},valueForProperty:function(A){if(A==="value"){return this.selection?this.selection.value:null}else{if(A==="kind"){return this.selection?this.selection.kind:null}}return undefined},setValue:function(B){var A=this.getSelectionWithValue(B);if(A===null){this.selection=null}else{this.selection=A;this.kind=A.kind}this.updateUI();this.fireChange()},getSelectionWithValue:function(D){for(var C=0;C<this.items.length;C++){if(this.items[C].value==D){return this.items[C]}}for(var C=0;C<this.subItems.length;C++){var A=this.subItems[C].items;for(var B=0;B<A.length;B++){if(A[B].value==D){return A[B]}}}return null},reset:function(){this.setValue(null)},updateUI:function(){this.items.each(function(A){A.element.setClassName("in2igui_selected",this.isSelection(A))}.bind(this));this.subItems.each(function(A){A.updateUI()})},changeSelection:function(A){this.subItems.each(function(B){B.selectionChanged(this.selection,A)});this.selection=A;this.updateUI();this.fireChange()},fireChange:function(){this.fire("selectionChanged",this.selection);this.fireProperty("value",this.selection?this.selection.value:null);this.fireProperty("kind",this.selection?this.selection.kind:null)},registerItems:function(A){A.parent=this;this.subItems.push(A)},registerItem:function(H,G,D,A,F,C){var B=$(H);var E={id:H,title:G,icon:D,badge:A,element:B,value:F,kind:C};this.items.push(E);this.addItemBehavior(B,E);this.selection=this.getSelectionWithValue(this.options.value)},addItemBehavior:function(B,A){B.observe("click",function(){this.itemWasClicked(A)}.bind(this));B.observe("dblclick",function(){this.itemWasDoubleClicked(A)}.bind(this));B.dragDropInfo=A},setObjects:function(A){this.items=[];A.each(function(D){this.items.push(D);var C=new Element("div",{"class":"in2igui_selection_item"});D.element=C;this.element.insert(C);var B=new Element("span",{"class":"in2igui_selection_label"}).update(D.title);if(D.icon){C.insert(In2iGui.createIcon(D.icon,1))}C.insert(B);C.observe("click",function(){this.itemWasClicked(D)}.bind(this));C.observe("dblclick",function(E){this.itemWasDoubleClicked(D);E.stop()}.bind(this))}.bind(this))},isSelection:function(B){if(this.selection===null){return false}var A=B.value==this.selection.value;if(this.selection.kind){A=A&&B.kind==this.selection.kind}return A},itemWasClicked:function(A){this.changeSelection(A)},itemWasDoubleClicked:function(A){this.fire("selectionWasOpened",A)}};In2iGui.Selection.Items=function(A){this.options=n2i.override({source:null},A);this.element=$(A.element);this.name=A.name;this.parent=null;this.items=[];In2iGui.extend(this);if(this.options.source){this.options.source.listen(this)}};In2iGui.Selection.Items.prototype={refresh:function(){if(this.options.source){this.options.source.refresh()}},$objectsLoaded:function(A){this.$itemsLoaded(A)},$itemsLoaded:function(A){this.items=[];this.element.update();this.buildLevel(this.element,A,0);this.parent.updateUI()},buildLevel:function(D,B,E){if(!B){return }var A=this.isHierarchy(B);var C=E==0;var F=new Element("div",{"class":"in2igui_selection_level"}).setStyle({display:C?"block":"none"});D.insert(F);B.each(function(K){var G=K.children&&K.children.length>0;var M=E*16+6;if(!A&&E>0||A&&!G){M+=13}var J=new Element("div",{"class":"in2igui_selection_item"}).setStyle({paddingLeft:M+"px"});if(K.badge){J.insert(new Element("strong",{"class":"in2igui_selection_badge"}).update(K.badge))}if(A&&G){var I=this;J.insert(new Element("span",{"class":"in2igui_disclosure"}).observe("click",function(N){N.stop();I.toggle(this)}))}var H=new Element("span",{"class":"in2igui_selection_label"});if(K.icon){J.insert(new Element("span",{"class":"in2igui_icon_1"}).setStyle({"backgroundImage":"url("+In2iGui.getIconUrl(K.icon,1)+")"}))}J.insert(H.insert(K.title));J.observe("click",function(N){this.parent.itemWasClicked(K)}.bind(this));J.observe("dblclick",function(N){this.parent.itemWasDoubleClicked(K)}.bind(this));F.insert(J);var L={title:K.title,icon:K.icon,badge:K.badge,kind:K.kind,element:J,value:K.value};J.dragDropInfo=L;this.items.push(L);this.buildLevel(F,K.children,E+1)}.bind(this))},toggle:function(A){if(A.hasClassName("in2igui_disclosure_open")){A.parentNode.next().hide();A.removeClassName("in2igui_disclosure_open")}else{A.parentNode.next().show();A.addClassName("in2igui_disclosure_open")}},isHierarchy:function(A){if(!A){return false}for(var B=0;B<A.length;B++){if(A[B]!==null&&A[B].children&&A[B].children.length>0){return true}}return false},getValue:function(){if(this.parent.selection==null){return null}for(var A=0;A<this.items.length;A++){if(this.items[A].value==this.parent.selection.value){return this.items[A]}}return null},updateUI:function(){this.items.each(function(A){A.element.setClassName("in2igui_selected",this.parent.isSelection(A))}.bind(this))},selectionChanged:function(B,A){for(var C=0;C<this.items.length;C++){var D=this.items[C].value;if(D==A.value){this.fireProperty("value",A.value);return }}this.fireProperty("value",null)}};In2iGui.Toolbar=function(A){this.element=$(A.element);this.name=A.name;In2iGui.extend(this)};In2iGui.Toolbar.create=function(A){A=A||{};A.element=new Element("div",{"class":"in2igui_toolbar"});if(A.labels==false){A.element.addClassName("in2igui_toolbar_nolabels")}return new In2iGui.Toolbar(A)};In2iGui.Toolbar.prototype={add:function(A){this.element.appendChild(A.getElement())},addDivider:function(){this.element.appendChild(new Element("span",{"class":"in2igui_divider"}))}};In2iGui.RevealingToolbar=function(A){this.element=$(A.element);this.name=A.name;In2iGui.extend(this)};In2iGui.RevealingToolbar.create=function(B){B=B||{};B.element=new Element("div",{"class":"in2igui_revealing_toolbar"}).setStyle({"display":"none"});document.body.appendChild(B.element);var A=new In2iGui.RevealingToolbar(B);var C=In2iGui.Toolbar.create();A.setToolbar(C);return A};In2iGui.RevealingToolbar.prototype={setToolbar:function(A){this.toolbar=A;this.element.appendChild(A.getElement())},getToolbar:function(){return this.toolbar},show:function(A){this.element.style.display="";n2i.ani(this.element,"height","58px",A?0:600,{ease:n2i.ease.slowFastSlow})},hide:function(){n2i.ani(this.element,"height","0px",500,{ease:n2i.ease.slowFastSlow,hideOnComplete:true})}};In2iGui.Toolbar.Icon=function(A){this.options=A;this.element=$(A.element);this.name=A.name;this.enabled=!this.element.hasClassName("in2igui_toolbar_icon_disabled");this.element.tabIndex=this.enabled?0:-1;this.icon=this.element.select(".in2igui_icon")[0];In2iGui.extend(this);this.addBehavior()};In2iGui.Toolbar.Icon.create=function(C){var D=C.element=new Element("a",{"class":"in2igui_toolbar_icon"});var F=new Element("span",{"class":"in2igui_icon"}).setStyle({"backgroundImage":"url("+In2iGui.getIconUrl(C.icon,2)+")"});var A=new Element("span",{"class":"in2igui_toolbar_inner_icon"});var E=new Element("span",{"class":"in2igui_toolbar_inner_icon"});D.insert(A);A.insert(E);var G=new Element("strong");G.innerHTML=C.title;if(C.overlay){var B=new Element("span",{"class":"in2igui_icon_overlay"}).setStyle({"backgroundImage":"url("+In2iGui.getIconUrl("overlay/"+C.overlay,2)+")"});F.insert(B)}E.insert(F);E.insert(G);return new In2iGui.Toolbar.Icon(C)};In2iGui.Toolbar.Icon.prototype={addBehavior:function(){var A=this;this.element.onclick=function(){A.wasClicked()}},setEnabled:function(A){this.enabled=A;this.element.tabIndex=A?0:-1;this.element.setClassName("in2igui_toolbar_icon_disabled",!this.enabled)},setSelected:function(A){this.element.setClassName("in2igui_toolbar_icon_selected",A)},wasClicked:function(){if(this.enabled){if(this.options.confirm){In2iGui.confirmOverlay({widget:this,text:this.options.confirm.text,okText:this.options.confirm.okText,cancelText:this.options.confirm.cancelText,onOk:this.fireClick.bind(this)})}else{this.fireClick()}}},fireClick:function(){In2iGui.callDelegates(this,"toolbarIconWasClicked");In2iGui.callDelegates(this,"click")}};In2iGui.Toolbar.SearchField=function(A){this.options=A;this.element=$(A.element);this.name=A.name;this.field=this.element.select("input")[0];this.value=this.field.value;In2iGui.extend(this);this.addBehavior()};In2iGui.Toolbar.SearchField.create=function(A){A=A||{};var B=A.element=new Element("div",{"class":A.adaptive?"in2igui_toolbar_search in2igui_toolbar_search_adaptive":"in2igui_toolbar_search"});B.update('<div class="in2igui_searchfield"><strong class="in2igui_searchfield_button"></strong><div><div><input type="text"/></div></div></div><span>'+A.title+"</span>");return new In2iGui.Toolbar.SearchField(A)};In2iGui.Toolbar.SearchField.prototype={getValue:function(){return this.field.value},addBehavior:function(){var A=this;this.field.onkeyup=function(){A.fieldChanged()};if(!this.options.adaptive){this.field.onfocus=function(){n2i.ani(this,"width","120px",500,{ease:n2i.ease.slowFastSlow})};this.field.onblur=function(){n2i.ani(this,"width","80px",500,{ease:n2i.ease.slowFastSlow})}}},fieldChanged:function(){if(this.field.value!=this.value){this.value=this.field.value;In2iGui.callDelegates(this,"valueChanged");In2iGui.firePropertyChange(this,"value",this.value)}}};In2iGui.Toolbar.Badge=function(A){this.element=$(A.element);this.name=A.name;this.label=this.element.select("strong")[0];this.text=this.element.select("span")[0];In2iGui.extend(this)};In2iGui.Toolbar.Badge.prototype={setLabel:function(A){this.label.update(A)},setText:function(A){this.text.update(A)}};In2iGui.ImagePicker=function(A){this.name=A.name;this.options=A||{};this.element=$(A.element);this.images=[];this.object=null;this.thumbnailsLoaded=false;In2iGui.extend(this);this.addBehavior()};In2iGui.ImagePicker.prototype={addBehavior:function(){this.element.onclick=this.showPicker.bind(this)},setObject:function(A){this.object=A;this.updateUI()},getObject:function(){return this.object},reset:function(){this.object=null;this.updateUI()},updateUI:function(){if(this.object==null){this.element.style.backgroundImage=""}else{var A=In2iGui.resolveImageUrl(this,this.object,48,48);this.element.style.backgroundImage="url("+A+")"}},showPicker:function(){if(!this.picker){var B=this;this.picker=In2iGui.BoundPanel.create();this.content=new Element("div",{"class":"in2igui_imagepicker_thumbs"});var C=In2iGui.Buttons.create({align:"right"});var D=In2iGui.Button.create({text:"Luk",highlighted:true});D.listen({$click:function(){B.hidePicker()}});var A=In2iGui.Button.create({text:"Fjern"});A.listen({$click:function(){B.setObject(null);B.hidePicker()}});C.add(A).add(D);this.picker.add(this.content);this.picker.add(C)}this.picker.position(this.element);this.picker.show();if(!this.thumbnailsLoaded){this.updateImages();this.thumbnailsLoaded=true}},hidePicker:function(){this.picker.hide()},updateImages:function(){var A=this;var B={onSuccess:function(C){A.parse(C.responseXML)}};new Ajax.Request(this.options.source,B)},parse:function(G){this.content.update();var A=G.getElementsByTagName("image");var D=this;for(var F=0;F<A.length;F++){var H=A[F].getAttribute("id");var C={id:A[F].getAttribute("id")};var E=In2iGui.resolveImageUrl(this,C,48,48);var B=new Element("div",{"class":"in2igui_imagepicker_thumbnail"}).setStyle({"backgroundImage":"url("+E+")"});B.in2iguiObject={"id":H};B.onclick=function(){D.setObject(this.in2iguiObject);D.hidePicker()};this.content.appendChild(B)}}};In2iGui.BoundPanel=function(A){this.element=$(A.element);this.name=A.name;this.visible=false;this.content=this.element.select("div.in2igui_boundpanel_content")[0];this.arrow=this.element.select("div.in2igui_boundpanel_arrow")[0];In2iGui.extend(this)};In2iGui.BoundPanel.create=function(A){var A=n2i.override({name:null,top:0,left:0,width:null,padding:null},A);var C=A.element=new Element("div",{"class":"in2igui_boundpanel"}).setStyle({"display":"none","zIndex":In2iGui.nextPanelIndex(),"top":A.top+"px","left":A.left+"px"});var B='<div class="in2igui_boundpanel_arrow"></div><div class="in2igui_boundpanel_top"><div><div></div></div></div><div class="in2igui_boundpanel_body"><div class="in2igui_boundpanel_body"><div class="in2igui_boundpanel_body"><div class="in2igui_boundpanel_content" style="';if(A.width){B+="width:"+A.width+"px;"}if(A.padding){B+="padding:"+A.padding+"px;"}B+='"></div></div></div></div><div class="in2igui_boundpanel_bottom"><div><div></div></div></div>';C.innerHTML=B;document.body.appendChild(C);return new In2iGui.BoundPanel(A)};In2iGui.BoundPanel.prototype={show:function(){if(!this.visible){if(!n2i.browser.msie){n2i.setOpacity(this.element,0)}if(this.relativePosition=="left"){this.element.style.marginLeft="30px"}else{this.element.style.marginLeft="-30px"}this.element.setStyle({visibility:"hidden",display:"block"});var A=this.element.clientWidth;this.element.setStyle({width:A+"px",visibility:"visible"});this.element.style.marginTop="0px";this.element.style.display="block";if(!n2i.browser.msie){n2i.animate(this.element,"opacity",1,400,{ease:n2i.ease.fastSlow})}n2i.animate(this.element,"margin-left","0px",800,{ease:n2i.ease.bounce})}this.element.style.zIndex=In2iGui.nextPanelIndex();this.visible=true},hide:function(){if(n2i.browser.msie){this.element.style.display="none"}else{n2i.animate(this.element,"opacity",0,300,{ease:n2i.ease.slowFast,hideOnComplete:true})}this.visible=false},add:function(A){if(A.getElement){this.content.insert(A.getElement())}else{this.content.insert(A)}},addSpace:function(A){this.add(new Element("div").setStyle({fontSize:"0px",height:A+"px"}))},getDimensions:function(){if(this.element.style.display=="none"){this.element.style.visibility="hidden";this.element.style.display="block";var B=this.element.getWidth();var A=this.element.getHeight();this.element.style.display="none";this.element.style.visibility=""}else{var B=this.element.getWidth();var A=this.element.getHeight()}return{width:B,height:A}},position:function(C){C=$(C);var F=C.cumulativeOffset();var G=C.cumulativeScrollOffset();var J=this.getDimensions();var D=n2i.getInnerWidth();var L=F.left-G.left+n2i.getScrollLeft();var K=C.getWidth();var A=C.getHeight();var E=F.top-G.top+n2i.getScrollTop();if((L+K/2)/D<0.5){this.relativePosition="left";var B=L+K+10;this.arrow.className="in2igui_boundpanel_arrow in2igui_boundpanel_arrow_left";var H=-14}else{this.relativePosition="right";var B=L-J.width-10;this.arrow.className="in2igui_boundpanel_arrow in2igui_boundpanel_arrow_right";var H=J.width-4}var I=Math.max(0,E+(A-J.height)/2);this.arrow.style.marginTop=(J.height-32)/2+Math.min(0,E+(A-J.height)/2)+"px";this.arrow.style.marginLeft=H+"px";if(this.visible){n2i.animate(this.element,"top",I+"px",500,{ease:n2i.ease.fastSlow});n2i.animate(this.element,"left",B+"px",500,{ease:n2i.ease.fastSlow})}else{this.element.style.top=I+"px";this.element.style.left=B+"px"}}};In2iGui.RichText=function(A){this.name=A.name;var B=this.element=$(A.element);this.options=n2i.override({debug:false,value:"",autoHideToolbar:true,style:"font-family: sans-serif;"},A);this.textarea=new Element("textarea");B.insert(this.textarea);this.editor=WysiHat.Editor.attach(this.textarea);this.editor.setAttribute("frameborder","0");this.toolbar=B.select(".in2igui_richtext_toolbar")[0];this.toolbarContent=B.select(".in2igui_richtext_toolbar_content")[0];this.value=this.options.value;this.document=null;this.ignited=false;this.buildToolbar();this.ignite();In2iGui.extend(this)};In2iGui.RichText.actions=[{key:"bold",cmd:"bold",value:null,icon:"edit/text_bold"},{key:"italic",cmd:"italic",value:null,icon:"edit/text_italic"},{key:"underline",cmd:"underline",value:null,icon:"edit/text_underline"},null,{key:"justifyleft",cmd:"justifyleft",value:null,icon:"edit/text_align_left"},{key:"justifycenter",cmd:"justifycenter",value:null,icon:"edit/text_align_center"},{key:"justifyright",cmd:"justifyright",value:null,icon:"edit/text_align_right"},null,{key:"increasefontsize",cmd:"increasefontsize",value:null,icon:"edit/increase_font_size"},{key:"decreasefontsize",cmd:"decreasefontsize",value:null,icon:"edit/decrease_font_size"},{key:"color",cmd:null,value:null,icon:"common/color"}];In2iGui.RichText.replaceInput=function(B){B=B||{};var A=$(B.input);A.style.display="none";B.value=A.value;var C=In2iGui.RichText.create(B);A.parentNode.insertBefore(C.element,A);C.ignite()};In2iGui.RichText.create=function(A){A=A||{};A.element=new Element("div",{"class":"in2igui_richtext"}).update('<div class="in2igui_richtext_toolbar"><div class="in2igui_richtext_inner_toolbar"><div class="in2igui_richtext_toolbar_content"></div></div></div>');return new In2iGui.RichText(A)};In2iGui.RichText.prototype={isCompatible:function(){var A=navigator.userAgent.toLowerCase();return true;return(A.indexOf("msie 6")>-1||A.indexOf("msie 7")>-1||(A.indexOf("gecko")>-1&&A.indexOf("safari")<0))},ignite:function(){var A=this;this.editor.observe("wysihat:loaded",function(B){if(this.ignited){return }this.editor.setStyle(this.options.style);this.editor.setRawContent(this.value);this.document=this.editor.getDocument();if(this.document.body){this.document.body.style.minHeight="100%";this.document.body.style.margin="0";this.document.documentElement.style.cursor="text";this.document.documentElement.style.minHeight="100%";Element.setStyle(this.document.body,this.options.style)}this.window=this.editor.getWindow();Event.observe(this.window,"focus",function(){A.documentFocused()});Event.observe(this.window,"blur",function(){A.documentBlurred()});this.document.body.focus();this.ignited=true}.bind(this));this.editor.observe("wysihat:change",function(B){this.documentChanged()}.bind(this))},setHeight:function(A){this.editor.style.height=A+"px"},focus:function(){try{var A=this.document.createRange();A.selectNodeContents(this.document.body);this.window.getSelection().addRange(A)}catch(B){}if(this.window){this.window.focus()}},setValue:function(A){this.value=A;this.editor.setRawContent(this.value)},getValue:function(){return this.value},deactivate:function(){if(this.colorPicker){this.colorPicker.hide()}if(this.toolbar){this.toolbar.style.display="none"}},buildToolbar:function(){this.toolbar.onmousedown=function(){this.toolbarMouseDown=true}.bind(this);this.toolbar.onmouseup=function(){this.toolbarMouseDown=false}.bind(this);var B=this;var D=In2iGui.RichText.actions;for(var C=0;C<D.length;C++){if(D[C]==null){this.toolbarContent.insert(new Element("div",{"class":"in2igui_richtext_divider"}))}else{var E=new Element("div").addClassName("action action_"+D[C].key);E.title=D[C].key;E.in2iguiRichTextAction=D[C];E.onclick=E.ondblclick=function(F){return B.actionWasClicked(this.in2iguiRichTextAction,F)};var A=new Element("img");A.src=In2iGui.context+"/In2iGui/gfx/trans.png";if(D[C].icon){E.setStyle({"backgroundImage":"url("+In2iGui.getIconUrl(D[C].icon,1)+")"})}E.insert(A);this.toolbarContent.appendChild(E);E.onmousedown=In2iGui.RichText.stopEvent}}},documentFocused:function(){if(n2i.browser.msie){this.toolbar.style.display="block";return }if(this.toolbar.style.display!="block"){this.toolbar.style.marginTop="-40px";n2i.setOpacity(this.toolbar,0);this.toolbar.style.display="block";n2i.ani(this.toolbar,"opacity",1,300);n2i.ani(this.toolbar,"margin-top","-32px",300)}},documentBlurred:function(){if(this.toolbarMouseDown){return }if(this.options.autoHideToolbar){if(n2i.browser.msie){var A=this;window.setTimeout(function(){A.toolbar.style.display="none"},100);return }n2i.ani(this.toolbar,"opacity",0,300,{hideOnComplete:true});n2i.ani(this.toolbar,"margin-top","-40px",300)}this.documentChanged();In2iGui.callDelegates(this,"richTextDidChange")},documentChanged:function(){this.value=this.editor.content();if(this.options.input){$(this.options.input).value=this.value}},disabler:function(B){var A=B?B:window.event;if(A.returnValue){A.returnValue=false}else{if(A.preventDefault){A.preventDefault()}}return false},actionWasClicked:function(A,B){In2iGui.RichText.stopEvent(B);if(A.key=="color"){this.showColorPicker()}else{this.execCommand(A)}this.document.body.focus();return false},execCommand:function(A){this.editor.execCommand(A.cmd,false,A.value);this.documentChanged()},showColorPicker:function(){if(!this.colorPicker){var A=In2iGui.Window.create({variant:"dark"});var B=In2iGui.ColorPicker.create();B.listen(this);A.add(B);A.show();this.colorPicker=A}this.colorPicker.show()},$colorWasHovered:function(A){},$colorWasSelected:function(A){this.document.execCommand("forecolor",false,A);this.documentChanged()}};In2iGui.RichText.stopEvent=function(B){var A=B?B:window.event;if(A.returnValue){A.returnValue=false}else{if(A.preventDefault){A.preventDefault()}else{return false}}};In2iGui.ImageViewer=function(A){this.options=n2i.override({maxWidth:800,maxHeight:600,perimeter:100,sizeSnap:100,margin:0,ease:n2i.ease.slowFastSlow,easeEnd:n2i.ease.bounce,easeAuto:n2i.ease.slowFastSlow,easeReturn:n2i.ease.cubicInOut,transition:400,transitionEnd:1000,transitionReturn:300},A);this.element=$(A.element);this.box=this.options.box;this.viewer=this.element.select(".in2igui_imageviewer_viewer")[0];this.innerViewer=this.element.select(".in2igui_imageviewer_inner_viewer")[0];this.status=this.element.select(".in2igui_imageviewer_status")[0];this.previousControl=this.element.select(".in2igui_imageviewer_previous")[0];this.controller=this.element.select(".in2igui_imageviewer_controller")[0];this.nextControl=this.element.select(".in2igui_imageviewer_next")[0];this.playControl=this.element.select(".in2igui_imageviewer_play")[0];this.closeControl=this.element.select(".in2igui_imageviewer_close")[0];this.text=this.element.select(".in2igui_imageviewer_text")[0];this.dirty=false;this.width=600;this.height=460;this.index=0;this.playing=false;this.name=A.name;this.images=[];this.box.listen(this);this.addBehavior();In2iGui.extend(this)};In2iGui.ImageViewer.create=function(A){A=A||{};var B=A.element=new Element("div",{"class":"in2igui_imageviewer"});B.update('<div class="in2igui_imageviewer_viewer"><div class="in2igui_imageviewer_inner_viewer"></div></div><div class="in2igui_imageviewer_text"></div><div class="in2igui_imageviewer_status"></div><div class="in2igui_imageviewer_controller"><div><div><a class="in2igui_imageviewer_previous"></a><a class="in2igui_imageviewer_play"></a><a class="in2igui_imageviewer_next"></a><a class="in2igui_imageviewer_close"></a></div></div></div>');var C=In2iGui.Box.create({absolute:true,modal:true,closable:true});C.add(B);C.addToDocument();A.box=C;return new In2iGui.ImageViewer(A)};In2iGui.ImageViewer.prototype={addBehavior:function(){var A=this;this.nextControl.onclick=function(){A.next(true)};this.previousControl.onclick=function(){A.previous(true)};this.playControl.onclick=function(){A.playOrPause()};this.closeControl.onclick=this.hide.bind(this);this.viewer.observe("click",this.zoom.bind(this));this.timer=function(){A.next(false)};this.keyListener=function(B){if(n2i.isRightKey(B)){A.next(true)}else{if(n2i.isLeftKey(B)){A.previous(true)}else{if(n2i.isEscapeKey(B)){A.hide()}else{if(n2i.isReturnKey(B)){A.playOrPause()}}}}},this.viewer.observe("mousemove",this.mouseMoveEvent.bind(this));this.controller.observe("mouseenter",function(){A.overController=true});this.controller.observe("mouseleave",function(){A.overController=false});this.viewer.observe("mouseout",function(B){if(!In2iGui.isWithin(B,this.viewer)){A.hideController()}}.bind(this))},mouseMoveEvent:function(){window.clearTimeout(this.ctrlHider);if(this.shouldShowController()){this.ctrlHider=window.setTimeout(this.hideController.bind(this),2000);if(n2i.browser.msie){this.controller.show()}else{In2iGui.fadeIn(this.controller,200)}}},hideController:function(){if(!this.overController){if(n2i.browser.msie){this.controller.hide()}else{In2iGui.fadeOut(this.controller,500)}}},zoom:function(D){var A=this.images[this.index];if(A.width<=this.width&&A.height<=this.height){return }if(!this.zoomer){this.zoomer=new Element("div",{"class":"in2igui_imageviewer_zoomer"}).setStyle({width:this.viewer.clientWidth+"px",height:this.viewer.clientHeight+"px"});this.element.insert({top:this.zoomer});this.zoomer.observe("mousemove",this.zoomMove.bind(this));this.zoomer.observe("click",function(){this.hide()})}this.pause();var C=this.getLargestSize({width:2000,height:2000},A);var B=In2iGui.resolveImageUrl(this,A,C.width,C.height);this.zoomer.update('<div style="width:'+C.width+"px;height:"+C.height+'px;"><img src="'+B+'"/></div>').show();this.zoomInfo={width:C.width,height:C.height};this.zoomMove(D)},zoomMove:function(B){if(!this.zoomInfo){return }var C=this.zoomer.cumulativeOffset();var A=(B.pointerX()-C.left)/this.zoomer.clientWidth*(this.zoomInfo.width-this.zoomer.clientWidth);var D=(B.pointerY()-C.top)/this.zoomer.clientHeight*(this.zoomInfo.height-this.zoomer.clientHeight);this.zoomer.scrollLeft=A;this.zoomer.scrollTop=D},getLargestSize:function(A,B){if(B.width<=A.width&&B.height<=A.height){return{width:B.width,height:B.height}}else{if(A.width/A.height>B.width/B.height){return{width:Math.round(A.height/B.height*B.width),height:A.height}}else{if(A.width/A.height<B.width/B.height){return{width:A.width,height:Math.round(A.width/B.width*B.height)}}else{return{width:A.width,height:A.height}}}}},calculateSize:function(){var A=this.options.sizeSnap;var F=n2i.getInnerWidth()-this.options.perimeter;F=Math.floor(F/A)*A;F=Math.min(F,this.options.maxWidth);var B=n2i.getInnerHeight()-this.options.perimeter;B=Math.floor(B/A)*A;B=Math.min(B,this.options.maxHeight);var E=0;var D=0;for(var C=0;C<this.images.length;C++){var G=this.getLargestSize({width:F,height:B},this.images[C]);E=Math.max(E,G.width);D=Math.max(D,G.height)}B=Math.floor(Math.min(B,D));F=Math.floor(Math.min(F,E));if(F!=this.width||B!=this.height){this.width=F;this.height=B;this.dirty=true}},adjustSize:function(){},showById:function(B){for(var A=0;A<this.images.length;A++){if(this.images[A].id==B){this.show(A);break}}},show:function(A){this.index=A||0;this.calculateSize();this.updateUI();var B=this.options.margin;this.element.setStyle({width:(this.width+B)+"px",height:(this.height+B*2-1)+"px"});this.viewer.setStyle({width:(this.width+B)+"px",height:(this.height-1)+"px"});this.innerViewer.setStyle({width:((this.width+B)*this.images.length)+"px",height:(this.height-1)+"px"});this.controller.setStyle({marginLeft:((this.width-180)/2+B*0.5)+"px",display:"none"});this.box.show();this.goToImage(false,0,false);Event.observe(document,"keydown",this.keyListener)},hide:function(A){this.pause();this.box.hide();Event.stopObserving(document,"keydown",this.keyListener)},$boxCurtainWasClicked:function(){this.hide()},$boxWasClosed:function(){this.hide()},updateUI:function(){if(this.dirty){this.innerViewer.innerHTML="";for(var B=0;B<this.images.length;B++){var A=new Element("div",{"class":"in2igui_imageviewer_image"}).setStyle({"width":(this.width+this.options.margin)+"px","height":(this.height-1)+"px"});this.innerViewer.appendChild(A)}if(this.shouldShowController()){this.controller.show()}else{this.controller.hide()}this.dirty=false;this.preload()}},shouldShowController:function(){return this.images.length>1},goToImage:function(C,D,B){if(C){if(D>1){n2i.ani(this.viewer,"scrollLeft",this.index*(this.width+this.options.margin),Math.min(D*this.options.transitionReturn,2000),{ease:this.options.easeReturn})}else{var A=this.index==0||this.index==this.images.length-1;var F=(A?this.options.easeEnd:this.options.ease);if(!B){F=this.options.easeAuto}n2i.ani(this.viewer,"scrollLeft",this.index*(this.width+this.options.margin),(A?this.options.transitionEnd:this.options.transition),{ease:F})}}else{this.viewer.scrollLeft=this.index*(this.width+this.options.margin)}var E=this.images[this.index].text;if(E){this.text.update(E).show()}else{this.text.update().hide()}},clearImages:function(){this.images=[];this.dirty=true},addImages:function(A){for(var B=0;B<A.length;B++){this.addImage(A[B])}},addImage:function(A){this.images.push(A);this.dirty=true},play:function(){if(!this.interval){this.interval=window.setInterval(this.timer,6000)}this.next(false);this.playing=true;this.playControl.className="in2igui_imageviewer_pause"},pause:function(){window.clearInterval(this.interval);this.interval=null;this.playControl.className="in2igui_imageviewer_play";this.playing=false},playOrPause:function(){if(this.playing){this.pause()}else{this.play()}},resetPlay:function(){if(this.playing){window.clearInterval(this.interval);this.interval=window.setInterval(this.timer,6000)}},previous:function(A){var B=1;this.index--;if(this.index<0){this.index=this.images.length-1;B=this.images.length-1}this.goToImage(true,B,A);this.resetPlay()},next:function(A){var B=1;this.index++;if(this.index==this.images.length){this.index=0;B=this.images.length-1}this.goToImage(true,B,A);this.resetPlay()},preload:function(){var B=new n2i.Preloader();B.addImages(In2iGui.context+"In2iGui/gfx/imageviewer_controls.png");var A=this;B.setDelegate({allImagesDidLoad:function(){A.preloadImages()}});B.load()},preloadImages:function(){var A=new n2i.Preloader();A.setDelegate(this);for(var C=0;C<this.images.length;C++){var B=In2iGui.resolveImageUrl(this,this.images[C],this.width,this.height);if(B!==null){A.addImages(B)}}this.status.innerHTML="0%";this.status.style.display="";A.load(this.index)},allImagesDidLoad:function(){this.status.style.display="none"},imageDidLoad:function(C,D,B){this.status.innerHTML=Math.round(C/D*100)+"%";var A=In2iGui.resolveImageUrl(this,this.images[B],this.width,this.height);A=A.replace(/&amp;/g,"&");this.innerViewer.childNodes[B].style.backgroundImage="url('"+A+"')";Element.setClassName(this.innerViewer.childNodes[B],"in2igui_imageviewer_image_abort",false);Element.setClassName(this.innerViewer.childNodes[B],"in2igui_imageviewer_image_error",false)},imageDidGiveError:function(B,C,A){Element.setClassName(this.innerViewer.childNodes[A],"in2igui_imageviewer_image_error",true)},imageDidAbort:function(B,C,A){Element.setClassName(this.innerViewer.childNodes[A],"in2igui_imageviewer_image_abort",true)}};In2iGui.Picker=function(A){A=this.options=n2i.override({itemWidth:100,itemHeight:150,itemsVisible:null,shadow:true,valueProperty:"value"},A);this.element=$(A.element);this.name=A.name;this.container=this.element.select(".in2igui_picker_container")[0];this.content=this.element.select(".in2igui_picker_content")[0];this.title=this.element.select("in2igui_picker_title")[0];this.objects=[];this.selected=null;this.value=null;this.addBehavior();In2iGui.extend(this)};In2iGui.Picker.create=function(B){B=n2i.override({shadow:true},B);var A=new Element("div",{"class":"in2igui_picker"});A.update('<div class="in2igui_picker_top"><div><div></div></div></div><div class="in2igui_picker_middle"><div class="in2igui_picker_middle">'+(B.title?'<div class="in2igui_picker_title">'+B.title+"</div>":"")+'<div class="in2igui_picker_container"><div class="in2igui_picker_content"></div></div></div></div><div class="in2igui_picker_bottom"><div><div></div></div></div>');if(B.shadow==true){A.addClassName("in2igui_picker_shadow")}B.element=A;return new In2iGui.Picker(B)};In2iGui.Picker.prototype={addBehavior:function(){var A=this;this.content.observe("mousedown",function(B){A.startDrag(B);return false})},setObjects:function(A){this.selected=null;this.objects=A||[];this.updateUI()},setValue:function(A){this.value=A;this.updateSelection()},getValue:function(){return this.value},reset:function(){this.value=null;this.updateSelection()},updateUI:function(){var A=this;this.content.update();this.container.scrollLeft=0;if(this.options.itemsVisible){var B=this.options.itemsVisible*(this.options.itemWidth+14)}else{var B=this.container.clientWidth}this.container.setStyle({width:B+"px",height:(this.options.itemHeight+10)+"px"});this.content.style.width=(this.objects.length*(this.options.itemWidth+14))+"px";this.content.style.height=(this.options.itemHeight+10)+"px";this.objects.each(function(C,D){var E=new Element("div",{"class":"in2igui_picker_item",title:C.title});if(A.value!=null&&C[A.options.valueProperty]==A.value){E.addClassName("in2igui_picker_item_selected")}E.update('<div class="in2igui_picker_item_middle"><div class="in2igui_picker_item_middle"><div style="width:'+A.options.itemWidth+"px;height:"+A.options.itemHeight+"px;background-image:url('"+C.image+'\')"></div></div></div><div class="in2igui_picker_item_bottom"><div><div></div></div></div>');E.observe("mouseup",function(){A.selectionChanged(C[A.options.valueProperty])});A.content.insert(E)})},updateSelection:function(){var B=this.content.childNodes;for(var A=0;A<B.length;A++){Element.setClassName(B[A],"in2igui_picker_item_selected",this.value!=null&&this.objects[A][this.options.valueProperty]==this.value)}},selectionChanged:function(A){if(this.dragging){return }if(this.value==A){return }this.value=A;this.updateSelection();this.fire("selectionChanged",A)},startDrag:function(B){B.stop();var A=this;this.dragX=Event.pointerX(B);this.dragScroll=this.container.scrollLeft;In2iGui.Picker.mousemove=function(C){A.drag(C);return false};In2iGui.Picker.mouseup=In2iGui.Picker.mousedown=function(C){A.endDrag(C);return false};window.document.observe("mousemove",In2iGui.Picker.mousemove);window.document.observe("mouseup",In2iGui.Picker.mouseup);window.document.observe("mousedown",In2iGui.Picker.mouseup)},drag:function(A){this.dragging=true;Event.stop(A);this.container.scrollLeft=this.dragX-A.pointerX()+this.dragScroll},endDrag:function(B){this.dragging=false;Event.stop(B);window.document.stopObserving("mousemove",In2iGui.Picker.mousemove);window.document.stopObserving("mouseup",In2iGui.Picker.mouseup);window.document.stopObserving("mousedown",In2iGui.Picker.mouseup);var A=(this.options.itemWidth+14);n2i.ani(this.container,"scrollLeft",Math.round(this.container.scrollLeft/A)*A,500,{ease:n2i.ease.bounceOut})},$visibilityChanged:function(){this.container.setStyle({display:"none"});if(this.options.itemsVisible){var A=this.options.itemsVisible*(this.options.itemWidth+14)}else{var A=this.container.parentNode.clientWidth-12}A=Math.max(A,0);this.container.setStyle({width:A+"px",display:"block"})}};In2iGui.Editor=function(){this.name="In2iGuiEditor";this.parts=[];this.rows=[];this.partControllers=[];this.activePart=null;this.active=false;this.dragProxy=null;In2iGui.extend(this)};In2iGui.Editor.get=function(){if(!In2iGui.Editor.instance){In2iGui.Editor.instance=new In2iGui.Editor()}return In2iGui.Editor.instance};In2iGui.Editor.prototype={ignite:function(){this.reload()},addPartController:function(B,C,A){this.partControllers.push({key:B,"title":C,"controller":A})},getPartController:function(A){var B=null;this.partControllers.each(function(C){if(C.key==A){B=C}});return B},reload:function(){if(this.partControls){this.partControls.hide()}var A=this;this.parts=[];var B=$$(".row");B.each(function(F,E){var D=F.select(".column");A.reloadColumns(D,E);D.each(function(H,G){var I=H.select(".part");A.reloadParts(I,E,G)})});var C=$$(".part");this.parts.each(function(D){var E=C.indexOf(D.element);if(E!=-1){delete (C[E])}});this.reloadParts(C,-1,-1)},partExists:function(A){},reloadColumns:function(B,C){var A=this;B.each(function(E,D){E.observe("mouseover",function(){A.hoverColumn(E)});E.observe("mouseout",function(){A.blurColumn()});E.observe("contextmenu",function(F){A.contextColumn(E,C,D,F)})})},reloadParts:function(C,D,B){var A=this;C.each(function(G,I){if(!G){return }var F=G.className.match(/part_([\w]+)/i);if(F&&F[1]){var H=A.getPartController(F[1]);if(H){var E=new H.controller(G,D,B,I);E.type=F[1];G.observe("click",function(){A.editPart(E)});G.observe("mouseover",function(J){A.hoverPart(E)});G.observe("mouseout",function(J){A.blurPart(J)});G.observe("mousedown",function(J){A.startPartDrag(J)});A.parts.push(E)}}})},activate:function(){this.active=true},deactivate:function(){this.active=false;if(this.activePart){this.activePart.deactivate()}if(this.partControls){this.partControls.hide()}},hoverColumn:function(A){this.hoveredColumn=A;if(!this.active||this.activePart){return }A.addClassName("in2igui_editor_column_hover")},blurColumn:function(){if(!this.active||!this.hoveredColumn){return }this.hoveredColumn.removeClassName("in2igui_editor_column_hover")},contextColumn:function(B,E,A,C){if(!this.active||this.activePart){return }if(!this.columnMenu){var D=In2iGui.Menu.create({name:"In2iGuiEditorColumnMenu"});D.addItem({title:"Rediger kolonne",value:"editColumn"});D.addItem({title:"Slet kolonne",value:"removeColumn"});D.addItem({title:"Tilføj kolonne",value:"addColumn"});D.addDivider();this.partControllers.each(function(F){D.addItem({title:F.title,value:F.key})});this.columnMenu=D;D.listen(this)}this.hoveredRow=E;this.hoveredColumnIndex=A;this.columnMenu.showAtPointer(C)},$itemWasClicked$In2iGuiEditorColumnMenu:function(A){if(A=="removeColumn"){this.fire("removeColumn",{"row":this.hoveredRow,"column":this.hoveredColumnIndex})}else{if(A=="editColumn"){this.editColumn(this.hoveredRow,this.hoveredColumnIndex)}else{if(A=="addColumn"){this.fire("addColumn",{"row":this.hoveredRow,"position":this.hoveredColumnIndex+1})}else{this.fire("addPart",{"row":this.hoveredRow,"column":this.hoveredColumnIndex,"position":0,type:A})}}}},editColumn:function(C,A){this.closeColumn();var B=this.activeColumn=$$(".row")[C].select(".column")[A];B.addClassName("in2igui_editor_column_edit");this.showColumnWindow();this.columnEditorForm.setValues({width:B.getStyle("width"),paddingLeft:B.getStyle("padding-left")})},closeColumn:function(){if(this.activeColumn){this.activeColumn.removeClassName("in2igui_editor_column_edit")}},showColumnWindow:function(){if(!this.columnEditor){var A=this.columnEditor=In2iGui.Window.create({name:"columnEditor",title:"Rediger kolonne",width:200});var F=this.columnEditorForm=In2iGui.Formula.create();var C=F.createGroup();var B=In2iGui.Formula.Text.create({label:"Bredde",key:"width"});B.listen({$valueChanged:function(G){this.changeColumnWidth(G)}.bind(this)});C.add(B);var E=In2iGui.Formula.Text.create({label:"Venstremargen",key:"left"});E.listen({$valueChanged:function(G){this.changeColumnLeftMargin(G)}.bind(this)});C.add(E);var D=In2iGui.Formula.Text.create({label:"Højremargen",key:"right"});D.listen({$valueChanged:this.changeColumnRightMargin.bind(this)});C.add(D);A.add(F);A.listen(this)}this.columnEditor.show()},$userClosedWindow$columnEditor:function(){this.closeColumn();var A=this.columnEditorForm.getValues();A.row=this.hoveredRow;A.column=this.hoveredColumnIndex;this.fire("updateColumn",A)},changeColumnWidth:function(A){this.activeColumn.setStyle({"width":A})},changeColumnLeftMargin:function(A){this.activeColumn.setStyle({"paddingLeft":A})},changeColumnRightMargin:function(A){this.activeColumn.setStyle({"paddingRight":A})},hoverPart:function(B,C){if(!this.active||this.activePart){return }this.hoveredPart=B;B.element.addClassName("in2igui_editor_part_hover");var A=this;this.partControlTimer=window.setTimeout(function(){A.showPartControls()},200)},blurPart:function(A){window.clearTimeout(this.partControlTimer);if(!this.active){return }if(this.partControls&&!In2iGui.isWithin(A,this.partControls.element)){this.hidePartControls();this.hoveredPart.element.removeClassName("in2igui_editor_part_hover")}if(!this.partControls&&this.hoveredPart){this.hoveredPart.element.removeClassName("in2igui_editor_part_hover")}},showPartEditControls:function(){if(!this.partEditControls){this.partEditControls=In2iGui.Overlay.create({name:"In2iGuiEditorPartEditActions"});this.partEditControls.addIcon("save","common/save");this.partEditControls.addIcon("cancel","common/close");this.partEditControls.listen(this)}this.partEditControls.showAtElement(this.activePart.element,{"horizontal":"right","vertical":"topOutside"})},showPartControls:function(){if(!this.partControls){this.partControls=In2iGui.Overlay.create({name:"In2iGuiEditorPartActions"});this.partControls.addIcon("edit","common/edit");this.partControls.addIcon("new","common/new");this.partControls.addIcon("delete","common/delete");var A=this;this.partControls.getElement().observe("mouseout",function(B){A.blurControls(B)});this.partControls.getElement().observe("mouseover",function(B){A.hoverControls(B)});this.partControls.listen(this)}if(this.hoveredPart.column==-1){this.partControls.hideIcons(["new","delete"])}else{this.partControls.showIcons(["new","delete"])}this.partControls.showAtElement(this.hoveredPart.element,{"horizontal":"right"})},hoverControls:function(A){this.hoveredPart.element.addClassName("in2igui_editor_part_hover")},blurControls:function(A){this.hoveredPart.element.removeClassName("in2igui_editor_part_hover");if(!In2iGui.isWithin(A,this.hoveredPart.element)){this.hidePartControls()}},$iconWasClicked$In2iGuiEditorPartActions:function(A,B){if(A=="delete"){this.deletePart(this.hoveredPart)}else{if(A=="new"){this.newPart(B)}else{if(A=="edit"){this.editPart(this.hoveredPart)}}}},$iconWasClicked$In2iGuiEditorPartEditActions:function(A,B){if(A=="cancel"){this.cancelPart(this.activePart)}else{if(A=="save"){this.savePart(this.activePart)}}},hidePartControls:function(){if(this.partControls){this.partControls.hide()}},hidePartEditControls:function(){if(this.partEditControls){this.partEditControls.hide()}},editPart:function(A){if(!this.active||this.activePart){return }if(this.activePart){this.activePart.deactivate()}if(this.hoveredPart){this.hoveredPart.element.removeClassName("in2igui_editor_part_hover")}this.activePart=A;this.showPartEditControls();A.element.addClassName("in2igui_editor_part_active");A.activate();window.clearTimeout(this.partControlTimer);this.hidePartControls();this.blurColumn();this.showPartEditor()},showPartEditor:function(){},updatePartProperties:function(A){this.activePart.element.setStyle({marginTop:A.top,marginBottom:A.bottom,marginLeft:A.left,marginRight:A.right});this.activePart.properties=A;n2i.log(A)},hidePartEditor:function(){if(this.partEditor){this.partEditor.hide()}},cancelPart:function(A){A.cancel();this.hidePartEditor()},savePart:function(A){A.save();this.hidePartEditor()},getEditorForElement:function(B){for(var A=0;A<this.parts.length;A++){if(this.parts[A].element==B){return this.parts[A]}}return null},partDidDeacivate:function(A){A.element.removeClassName("in2igui_editor_part_active");this.activePart=null;this.hidePartEditControls()},partChanged:function(A){In2iGui.callDelegates(A,"partChanged")},deletePart:function(A){In2iGui.callDelegates(A,"deletePart");this.partControls.hide()},newPart:function(A){if(!this.newPartMenu){var B=In2iGui.Menu.create({name:"In2iGuiEditorNewPartMenu"});this.partControllers.each(function(C){B.addItem({title:C.title,value:C.key})});B.listen(this);this.newPartMenu=B}this.newPartMenu.showAtPointer(A)},itemWasClicked$In2iGuiEditorNewPartMenu:function(A){var B={row:this.hoveredPart.row,column:this.hoveredPart.column,position:this.hoveredPart.position+1,type:A};In2iGui.callDelegates(this,"addPart",B)},startPartDrag:function(B){return true;if(!this.active||this.activePart){return true}if(!this.dragProxy){this.dragProxy=new Element("div").addClassName("in2igui_editor_dragproxy part part_header");document.body.appendChild(this.dragProxy)}var A=this.hoveredPart.element;this.dragProxy.setStyle({"width":A.getWidth()+"px"});this.dragProxy.innerHTML=A.innerHTML;In2iGui.Editor.startDrag(B,this.dragProxy);return ;Element.observe(document.body,"mouseup",function(){self.endPartDrag()})},dragPart:function(){},endPartDrag:function(){In2iGui.get()}};In2iGui.Editor.startDrag=function(B,A){In2iGui.Editor.dragElement=A;Element.observe(document.body,"mousemove",In2iGui.Editor.dragListener);Element.observe(document.body,"mouseup",In2iGui.Editor.dragEndListener);In2iGui.Editor.startDragPos={top:B.pointerY(),left:B.pointerX()};B.stop();return false};In2iGui.Editor.dragListener=function(B){var A=In2iGui.Editor.dragElement;A.style.left=B.pointerX()+"px";A.style.top=B.pointerY()+"px";A.style.display="block";return false};In2iGui.Editor.dragEndListener=function(A){Event.stopObserving(document.body,"mousemove",In2iGui.Editor.dragListener);Event.stopObserving(document.body,"mouseup",In2iGui.Editor.dragEndListener);In2iGui.Editor.dragElement.style.display="none";In2iGui.Editor.dragElement=null};In2iGui.Editor.getPartId=function(B){var A=B.id.match(/part\-([\d]+)/i);if(A&&A.length>0){return A[1]}};In2iGui.Editor.Header=function(B,D,C,A){this.element=$(B);this.row=D;this.column=C;this.position=A;this.id=In2iGui.Editor.getPartId(this.element);this.header=this.element.firstDescendant();this.field=null};In2iGui.Editor.Header.prototype={activate:function(){this.value=this.header.innerHTML;this.field=new Element("textarea").addClassName("in2igui_editor_header");this.field.value=this.value;this.header.style.visibility="hidden";this.updateFieldStyle();this.element.insertBefore(this.field,this.header);this.field.focus();this.field.select();this.field.observe("keydown",function(A){if(A.keyCode==Event.KEY_RETURN){this.save()}}.bind(this))},save:function(){var A=this.field.value;this.header.innerHTML=A;this.deactivate();if(A!=this.value){this.value=A;In2iGui.Editor.get().partChanged(this)}},cancel:function(){this.deactivate()},deactivate:function(){this.header.style.visibility="";this.element.removeChild(this.field);In2iGui.Editor.get().partDidDeacivate(this)},updateFieldStyle:function(){this.field.setStyle({width:this.header.getWidth()+"px",height:this.header.getHeight()+"px"});n2i.copyStyle(this.header,this.field,["fontSize","marginTop","fontWeight","fontFamily","textAlign","color","fontStyle"])},getValue:function(){return this.value}};In2iGui.Editor.Html=function(B,D,C,A){this.element=$(B);this.row=D;this.column=C;this.position=A;this.id=In2iGui.Editor.getPartId(this.element);this.field=null};In2iGui.Editor.Html.prototype={activate:function(){this.value=this.element.innerHTML;var A=this.element.getHeight();this.element.update("");var B=this.buildStyle();this.editor=In2iGui.RichText.create({autoHideToolbar:false,style:B});this.editor.setHeight(A);this.element.appendChild(this.editor.getElement());this.editor.listen(this);this.editor.ignite();this.editor.setValue(this.value);this.editor.focus()},buildStyle:function(){return{"textAlign":n2i.getStyle(this.element,"text-align"),"fontFamily":n2i.getStyle(this.element,"font-family"),"fontSize":n2i.getStyle(this.element,"font-size"),"fontWeight":n2i.getStyle(this.element,"font-weight"),"color":n2i.getStyle(this.element,"color")}},cancel:function(){this.deactivate();this.element.innerHTML=this.value},save:function(){this.deactivate();var A=this.editor.value;if(A!=this.value){this.value=A;In2iGui.Editor.get().partChanged(this)}this.element.innerHTML=this.value},deactivate:function(){if(this.editor){this.editor.deactivate();this.element.innerHTML=this.value}In2iGui.Editor.get().partDidDeacivate(this)},richTextDidChange:function(){},getValue:function(){return this.value}};In2iGui.Menu=function(A){this.options=n2i.override({autoHide:false,parentElement:null},A);this.element=$(A.element);this.name=A.name;this.value=null;this.subMenus=[];this.visible=false;In2iGui.extend(this);this.addBehavior()};In2iGui.Menu.create=function(A){A=A||{};A.element=new Element("div").addClassName("in2igui_menu");var B=new In2iGui.Menu(A);document.body.appendChild(A.element);return B};In2iGui.Menu.prototype={addBehavior:function(){var B=this;this.hider=function(){B.hide()};if(this.options.autoHide){var A=function(C){if(!In2iGui.isWithin(C,B.element)&&(!B.options.parentElement||!In2iGui.isWithin(C,B.options.parentElement))){if(!B.isSubMenuVisible()){B.hide()}}};this.element.observe("mouseout",A);if(this.options.parentElement){this.options.parentElement.observe("mouseout",A)}}},addDivider:function(){this.element.insert(new Element("div").addClassName("in2igui_menu_divider"))},addItem:function(D){var A=this;var B=new Element("div").addClassName("in2igui_menu_item").update(D.title);B.observe("click",function(E){A.itemWasClicked(D.value);Event.stop(E)});if(D.children){var C=In2iGui.Menu.create(null,{autoHide:true,parentElement:B});C.addItems(D.children);B.observe("mouseover",function(E){C.showAtElement(B,E,"horizontal")});A.subMenus.push(C);B.addClassName("in2igui_menu_item_children")}this.element.insert(B)},addItems:function(A){for(var B=0;B<A.length;B++){if(A[B]==null){this.addDivider()}else{this.addItem(A[B])}}},getValue:function(){return this.value},itemWasClicked:function(A){this.value=A;In2iGui.callDelegates(this,"itemWasClicked",A);In2iGui.callDelegates(this,"select",A);this.hide()},showAtPointer:function(A){if(A){Event.stop(A)}this.showAtPoint({"top":A.pointerY(),"left":A.pointerX()})},showAtElement:function(C,D,B){if(D){Event.stop(D)}C=$(C);var A=C.cumulativeOffset();if(B=="horizontal"){A.left+=C.getWidth()}else{if(B=="vertical"){A.top+=C.getHeight()}}this.showAtPoint(A)},showAtPoint:function(H){var F=n2i.getInnerWidth();var A=n2i.getInnerHeight();var C=n2i.getScrollTop();var E=n2i.getScrollLeft();if(!this.visible){this.element.setStyle({"display":"block","visibility":"hidden",opacity:0})}var B=this.element.getWidth();var I=this.element.getHeight();var D=Math.min(H.left,F-B-20+E);var G=Math.max(0,Math.min(H.top,A-I-20+C));this.element.setStyle({"top":G+"px","left":D+"px","visibility":"visible",zIndex:In2iGui.nextTopIndex(),"width":(B-2)+"px"});if(!this.visible){n2i.ani(this.element,"opacity",1,200);this.addHider();this.visible=true}},hide:function(){if(!this.visible){return }var A=this;n2i.ani(this.element,"opacity",0,200,{onComplete:function(){A.element.setStyle({"display":"none"})}});this.removeHider();for(var B=0;B<this.subMenus.length;B++){this.subMenus[B].hide()}this.visible=false},isSubMenuVisible:function(){for(var A=0;A<this.subMenus.length;A++){if(this.subMenus[A].visible){return true}}return false},addHider:function(){Element.observe(document.body,"click",this.hider)},removeHider:function(){Event.stopObserving(document.body,"click",this.hider)}};In2iGui.Overlay=function(A){this.options=A;this.element=$(A.element);this.content=this.element.select("div.in2igui_inner_overlay")[1];this.name=A.name;this.icons=new Hash();this.visible=false;In2iGui.extend(this);this.addBehavior()};In2iGui.Overlay.create=function(A){A=A||{};var B=A.element=new Element("div").addClassName("in2igui_overlay").setStyle({"display":"none"});B.update('<div class="in2igui_inner_overlay"><div class="in2igui_inner_overlay"></div></div>');document.body.appendChild(B);return new In2iGui.Overlay(A)};In2iGui.Overlay.prototype={addBehavior:function(){var A=this;this.hider=function(B){if(A.boundElement){if(In2iGui.isWithin(B,A.boundElement)||In2iGui.isWithin(B,A.element)){return }A.boundElement.removeClassName("in2igui_overlay_bound");A.boundElement=null;A.hide()}};this.element.observe("mouseout",this.hider)},addIcon:function(C,D){var A=this;var B=new Element("div").addClassName("in2igui_overlay_icon");B.setStyle({"backgroundImage":"url("+In2iGui.getIconUrl(D,2)+")"});B.observe("click",function(E){A.iconWasClicked(C,E)});this.icons.set(C,B);this.content.insert(B)},addText:function(A){this.content.insert(new Element("span",{"class":"in2igui_overlay_text"}).update(A))},add:function(A){this.content.insert(A.getElement())},hideIcons:function(B){var A=this;B.each(function(C){A.icons.get(C).hide()})},showIcons:function(B){var A=this;B.each(function(C){A.icons.get(C).show()})},iconWasClicked:function(A,B){In2iGui.callDelegates(this,"iconWasClicked",A,B)},showAtElement:function(B,A){A=A||{};In2iGui.positionAtElement(this.element,B,A);if(this.visible){return }if(n2i.browser.msie){this.element.setStyle({"display":"block"})}else{this.element.setStyle({"display":"block","opacity":0});n2i.ani(this.element,"opacity",1,150)}this.visible=true;if(A.autoHide){this.boundElement=B;B.observe("mouseout",this.hider);B.addClassName("in2igui_overlay_bound")}if(this.options.modal){var C=In2iGui.nextAlertIndex();this.element.style.zIndex=C+1;In2iGui.showCurtain({widget:this,zIndex:C})}return },show:function(B){B=B||{};if(!this.visible){this.element.setStyle({"display":"block",visibility:"hidden"})}if(B.element){n2i.place({source:{element:this.element,vertical:0,horizontal:0.5},target:{element:B.element,vertical:0.5,horizontal:0.5}})}if(this.visible){return }In2iGui.bounceIn(this.element);this.visible=true;if(B.autoHide&&B.element){this.boundElement=B.element;B.element.observe("mouseout",this.hider);B.element.addClassName("in2igui_overlay_bound")}if(this.options.modal){var C=In2iGui.nextAlertIndex();this.element.style.zIndex=C+1;var A=$(document.body).getStyle("background-color");In2iGui.showCurtain({widget:this,zIndex:C,color:A})}},$curtainWasClicked:function(){this.hide()},hide:function(){In2iGui.hideCurtain(this);this.element.setStyle({"display":"none"});this.visible=false},clear:function(){In2iGui.destroyDescendants(this.content);this.content.update()}};In2iGui.Upload=function(A){this.options=n2i.override({url:"",parameters:{},maxItems:50,maxSize:"20480",types:"*.*",useFlash:true,fieldName:"file",chooseButton:"Choose files..."},A);this.element=$(A.element);this.itemContainer=this.element.select(".in2igui_upload_items")[0];this.status=this.element.select(".in2igui_upload_status")[0];this.placeholder=this.element.select(".in2igui_upload_placeholder")[0];this.name=A.name;this.items=[];this.busy=false;this.loaded=false;this.useFlash=this.options.useFlash;if(this.options.useFlash){this.useFlash=In2iGui.Flash.getMajorVersion()>=10}In2iGui.extend(this);this.addBehavior()};In2iGui.Upload.nameIndex=0;In2iGui.Upload.create=function(A){A=A||{};A.element=new Element("div",{"class":"in2igui_upload"});A.element.update('<div class="in2igui_upload_items"></div><div class="in2igui_upload_status"></div>'+(A.placeholder?'<div class="in2igui_upload_placeholder"><span class="in2igui_upload_icon"></span>'+(A.placeholder.title?"<h2>"+A.placeholder.title+"</h2>":"")+(A.placeholder.text?"<p>"+A.placeholder.text+"</p>":"")+"</div>":""));return new In2iGui.Upload(A)};In2iGui.Upload.prototype={addBehavior:function(){if(!this.useFlash){this.createIframeVersion();return }In2iGui.onDomReady(this.createFlashVersion.bind(this))},createIframeVersion:function(){In2iGui.Upload.nameIndex++;var A="in2igui_upload_"+In2iGui.Upload.nameIndex;var F={"action":this.options.url||"","method":"post","enctype":"multipart/form-data","encoding":"multipart/form-data","target":A};var E=this.form=new Element("form",F);if(this.options.parameters){$H(this.options.parameters).each(function(H){var G=new Element("input",{"type":"hidden","name":H.key});G.setValue(H.value);E.insert(G)})}var D=this.iframe=new Element("iframe",{name:A,id:A,src:In2iGui.context+"/In2iGui/html/blank.html",style:"display:none"});this.element.insert(D);this.fileInput=new Element("input",{"type":"file","class":"file","name":this.options.fieldName});this.fileInput.observe("change",this.iframeSubmit.bind(this));E.insert(this.fileInput);var B=new Element("span",{"class":"in2igui_upload_button"});var C=new Element("span",{"class":"in2igui_upload_button_input"});C.insert(E);B.insert(C);if(this.options.widget){In2iGui.onDomReady(function(){var G=In2iGui.get(this.options.widget);G.element.wrap(B)}.bind(this))}else{B.insert('<a href="javascript:void(0);" class="in2igui_button"><span><span>'+this.options.chooseButton+"</span></span></a>");this.element.insert(B)}D.observe("load",function(){this.iframeUploadComplete()}.bind(this))},iframeUploadComplete:function(){n2i.log("iframeUploadComplete uploading: "+this.uploading+" ("+this.name+")");if(!this.uploading){return }this.uploading=false;this.form.reset();var B=n2i.getFrameDocument(this.iframe);var A=this.items.last();if(B.body.innerHTML.indexOf("SUCCESS")!=-1){if(A){A.update({progress:1,filestatus:"Færdig"})}}else{if(A){A.setError("Upload af filen fejlede!")}}this.fire("uploadDidCompleteQueue");this.iframe.src=In2iGui.context+"/In2iGui/html/blank.html";this.endIframeProgress()},iframeSubmit:function(){n2i.log("iframeSubmit");this.startIframeProgress();this.uploading=true;if(n2i.browser.msie){var A=this.options.parameters;$H(this.options.parameters).each(function(C){this.form[C.key].value=C.value}.bind(this))}this.form.submit();this.fire("uploadDidSubmit");var B=this.fileInput.value.split("\\").pop();this.addItem({name:B,filestatus:"I gang"}).setWaiting()},startIframeProgress:function(){this.form.style.display="none"},endIframeProgress:function(){n2i.log("endIframeProgress");this.form.style.display="block";this.form.reset()},clear:function(){for(var A=0;A<this.items.length;A++){if(this.items[A]){this.items[A].destroy()}}this.items=[];this.itemContainer.hide();this.status.hide();if(this.placeholder){this.placeholder.show()}},getAbsoluteUrl:function(B){var C=new String(document.location);var A=C.slice(0,C.lastIndexOf("/"));while(B.indexOf("../")===0){B=B.substring(3);A=A.slice(0,A.lastIndexOf("/"))}A+="/"+B;return A},createFlashVersion:function(){n2i.log("Creating flash verison");var E=this.getAbsoluteUrl(this.options.url);var C=n2i.cookie.get("JSESSIONID");if(C){E+=";jsessionid="+C}var F=n2i.cookie.get("PHPSESSID");if(F){E+="?PHPSESSID="+F}var D=new Element("span",{"class":"in2igui_upload_button"});var G=new Element("span",{"class":"in2igui_upload_button_object"});D.insert(G);if(this.options.widget){var A=In2iGui.get(this.options.widget);A.element.wrap(D)}else{D.insert('<a href="javascript:void(0);" class="in2igui_button"><span><span>'+this.options.chooseButton+"</span></span></a>");this.element.insert(D)}var B=this;this.loader=new SWFUpload({upload_url:E,flash_url:In2iGui.context+"/In2iGui/lib/swfupload/swfupload.swf",file_size_limit:this.options.maxSize,file_queue_limit:this.options.maxItems,file_post_name:this.options.fieldName,file_upload_limit:this.options.maxItems,file_types:this.options.types,debug:true,post_params:this.options.parameters,button_placeholder_id:"x",button_placeholder:G,button_width:"100%",button_height:30,swfupload_loaded_handler:this.flashLoaded.bind(this),file_queued_handler:B.fileQueued.bind(B),file_queue_error_handler:this.fileQueueError.bind(this),file_dialog_complete_handler:this.fileDialogComplete.bind(this),upload_start_handler:this.uploadStart.bind(this),upload_progress_handler:this.uploadProgress.bind(this),upload_error_handler:this.uploadError.bind(this),upload_success_handler:this.uploadSuccess.bind(this),upload_complete_handler:this.uploadComplete.bind(this)})},startNextUpload:function(){this.loader.startUpload()},flashLoaded:function(){n2i.log("flash loaded");this.loaded=true},addError:function(B,A){var C=this.addItem(B);C.setError(A)},fileQueued:function(A){this.addItem(A)},fileQueueError:function(B,A,C){if(B!==null){this.addError(B,A)}else{In2iGui.showMessage({text:In2iGui.Upload.errors[A],duration:4000})}},fileDialogComplete:function(){n2i.log("fileDialogComplete");this.startNextUpload()},uploadStart:function(){this.status.setStyle({display:"block"});n2i.log("uploadStart");if(!this.busy){this.fire("uploadDidStartQueue")}this.busy=true},uploadProgress:function(B,A,C){this.updateStatus();this.items[B.index].updateProgress(A,C)},uploadError:function(B,A,C){n2i.log("uploadError file:"+B+", error:"+A+", message:"+C);if(B){this.items[B.index].update(B)}},uploadSuccess:function(A,B){n2i.log("uploadSuccess file:"+A+", data:"+B);this.items[A.index].updateProgress(A.size,A.size)},uploadComplete:function(B){this.items[B.index].update(B);this.startNextUpload();var A=this;this.fire("uploadDidComplete",B);if(this.loader.getStats().files_queued==0){this.fire("uploadDidCompleteQueue")}this.updateStatus();this.busy=false},addItem:function(B){var A=B.index;if(A===undefined){A=this.items.length;B.index=A}var C=new In2iGui.Upload.Item(B);this.items[A]=C;this.itemContainer.insert(C.element);this.itemContainer.setStyle({display:"block"});if(this.placeholder){this.placeholder.hide()}return C},updateStatus:function(){var A=this.loader.getStats();if(this.items.length==0){this.status.hide()}else{this.status.update("Status: "+Math.round(A.successful_uploads/this.items.length*100)+"%").setStyle({display:"block"})}n2i.log(A)}};In2iGui.Upload.Item=function(A){this.element=new Element("div").addClassName("in2igui_upload_item");if(A.index%2==1){this.element.addClassName("in2igui_upload_item_alt")}this.content=new Element("div").addClassName("in2igui_upload_item_content");this.icon=In2iGui.createIcon("file/generic",2);this.element.insert(this.icon);this.element.insert(this.content);this.info=new Element("strong");this.status=new Element("em");this.progress=In2iGui.ProgressBar.create({small:true});this.content.insert(this.progress.getElement());this.content.insert(this.info);this.content.insert(this.status);this.update(A)};In2iGui.Upload.Item.prototype={update:function(A){this.status.update(In2iGui.Upload.status[A.filestatus]||A.filestatus);if(A.name){this.info.update(A.name)}if(A.progress!==undefined){this.setProgress(A.progress)}if(A.filestatus==SWFUpload.FILE_STATUS.ERROR){this.element.addClassName("in2igui_upload_item_error");this.progress.hide()}},setError:function(A){this.status.update(In2iGui.Upload.errors[A]||A);this.element.addClassName("in2igui_upload_item_error");this.progress.hide()},updateProgress:function(A,B){this.progress.setValue(A/B);return this},setProgress:function(A){this.progress.setValue(A);return this},setWaiting:function(A){this.progress.setWaiting();return this},hide:function(){this.element.hide()},destroy:function(){this.element.remove()}};if(window.SWFUpload){(function(){var B=In2iGui.Upload.errors={};B[SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED]="Der er valgt for mange filer";B[SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT]="Filen er for stor";B[SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE]="Filen er tom";B[SWFUpload.QUEUE_ERROR.INVALID_FILETYPE]="Filens type er ikke understøttet";B[SWFUpload.UPLOAD_ERROR.HTTP_ERROR]="Der skete en netværksfejl";B[SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL]="Upload-adressen findes ikke";B[SWFUpload.UPLOAD_ERROR.IO_ERROR]="Der skete en IO-fejl";B[SWFUpload.UPLOAD_ERROR.SECURITY_ERROR]="Der skete en sikkerhedsfejl";B[SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED]="Upload-størrelsen er overskredet";B[SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED]="Upload af filen fejlede";B[SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND]="Filens id kunne ikke findes";B[SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED]="Validering af filen fejlede";B[SWFUpload.UPLOAD_ERROR.FILE_CANCELLED]="Filen blev afbrudt";B[SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED]="Upload af filen blev stoppet";var A=In2iGui.Upload.status={};A[SWFUpload.FILE_STATUS.QUEUED]="I kø";A[SWFUpload.FILE_STATUS.IN_PROGRESS]="I gang";A[SWFUpload.FILE_STATUS.ERROR]="Filen gav fejl";A[SWFUpload.FILE_STATUS.COMPLETE]="Færdig";A[SWFUpload.FILE_STATUS.CANCELLED]="Afbrudt"}())}In2iGui.ProgressBar=function(A){this.element=$(A.element);this.name=A.name;this.WAITING=A.small?"in2igui_progressbar_small_waiting":"in2igui_progressbar_waiting";this.COMPLETE=A.small?"in2igui_progressbar_small_complete":"in2igui_progressbar_complete";this.options=A||{};this.indicator=this.element.firstDescendant();In2iGui.extend(this)};In2iGui.ProgressBar.create=function(B){B=B||{};var A=B.element=new Element("div",{"class":"in2igui_progressbar"}).insert(new Element("div"));if(B.small){A.addClassName("in2igui_progressbar_small")}return new In2iGui.ProgressBar(B)};In2iGui.ProgressBar.prototype={setValue:function(B){var A=this.element;if(this.waiting){A.removeClassName(this.WAITING)}A.setClassName(this.COMPLETE,B==1);n2i.ani(this.indicator,"width",(B*100)+"%",200)},setWaiting:function(){this.waiting=true;this.indicator.setStyle({width:0});this.element.addClassName(this.WAITING)},reset:function(){var A=this.element;if(this.waiting){A.removeClassName(this.WAITING)}A.removeClassName(this.COMPLETE);this.indicator.style.width="0%"},hide:function(){this.element.style.display="none"},show:function(){this.element.style.display="block"}};In2iGui.Gallery=function(A){this.options=A||{};this.name=A.name;this.element=$(A.element);this.objects=[];this.nodes=[];this.selected=[];this.width=100;this.height=100;In2iGui.extend(this);if(this.options.source){this.options.source.listen(this)}};In2iGui.Gallery.create=function(A){A=A||{};A.element=new Element("div",{"class":"in2igui_gallery"});return new In2iGui.Gallery(A)};In2iGui.Gallery.prototype={setObjects:function(A){this.objects=A;this.render()},getObjects:function(){return this.objects},$objectsLoaded:function(A){this.setObjects(A)},$itemsLoaded:function(A){this.setObjects(A)},render:function(){this.nodes=[];this.element.update();var A=this;this.objects.each(function(D,E){var C=A.resolveImageUrl(D);if(C!==null){C=C.replace(/&amp;/,"&")}if(D.height<D.width){var G=(A.height-(A.height*D.height/D.width))/2}else{var G=0}var B=new Element("img",{src:C}).setStyle({margin:G+"px auto 0px"});var F=new Element("div",{"class":"in2igui_gallery_item"}).setStyle({"width":A.width+"px","height":A.height+"px"}).insert(B);F.observe("click",function(){A.itemClicked(E)});F.dragDropInfo={kind:"image",icon:"common/image",id:D.id,title:D.name};F.onmousedown=function(H){In2iGui.startDrag(H,F);return false};F.observe("dblclick",function(){A.itemDoubleClicked(E)});A.element.insert(F);A.nodes.push(F)})},updateUI:function(){var A=this.selected;this.nodes.each(function(C,B){C.setClassName("in2igui_gallery_item_selected",n2i.inArray(A,B))})},resolveImageUrl:function(A){return In2iGui.resolveImageUrl(this,A,this.width,this.height);for(var B=0;B<this.delegates.length;B++){if(this.delegates[B]["$resolveImageUrl"]){return this.delegates[B]["$resolveImageUrl"](A,this.width,this.height)}}return""},itemClicked:function(A){this.selected=[A];this.fire("selectionChanged");this.updateUI()},getFirstSelection:function(){if(this.selected.length>0){return this.objects[this.selected[0]]}return null},itemDoubleClicked:function(A){this.fire("itemOpened",this.objects[A])},setSource:function(A){if(this.options.source!=A){if(this.options.source){this.options.source.removeDelegate(this)}A.listen(this);this.options.source=A;A.refresh()}}};In2iGui.Calendar=function(A){this.name=A.name;this.options=n2i.override({startHour:7,endHour:24},A);this.element=$(A.element);this.head=$(this.element.getElementsByTagName("thead")[0]);this.body=$(this.element.getElementsByTagName("tbody")[0]);this.date=new Date();In2iGui.extend(this);this.buildUI();this.updateUI();if(this.options.source){this.options.source.listen(this)}};In2iGui.Calendar.prototype={show:function(){this.element.style.display="block";if(this.options.source){this.options.source.refresh()}},hide:function(){this.element.style.display="none"},getFirstDay:function(){var A=new Date(this.date.getTime());A.setDate(A.getDate()-A.getDay()+1);A.setHours(0);A.setMinutes(0);A.setSeconds(0);return A},getLastDay:function(){var A=new Date(this.date.getTime());A.setDate(A.getDate()-A.getDay()+7);A.setHours(23);A.setMinutes(59);A.setSeconds(59);return A},clearEvents:function(){this.events=[];var A=this.element.select(".in2igui_calendar_event");A.each(function(B){B.remove()});this.hideEventViewer()},$objectsLoaded:function(A){try{this.setEvents(A)}catch(B){n2i.log(B)}},$sourceIsBusy:function(){this.setBusy(true)},$sourceShouldRefresh:function(){return this.element.style.display!="none"},setEvents:function(D){D=D||[];for(var C=0;C<D.length;C++){var F=D[C];if(typeof (F.startTime)!="object"){F.startTime=new Date(parseInt(F.startTime)*1000)}if(typeof (F.endTime)!="object"){F.endTime=new Date(parseInt(F.endTime)*1000)}}this.setBusy(false);this.clearEvents();this.events=D;var A=this;var G=(this.options.endHour-this.options.startHour)*40;var B=this.getFirstDay().getWeekOfYear();var E=this.getFirstDay().getYear();this.events.each(function(L){var I=A.body.select(".in2igui_calendar_day")[L.startTime.getDay()-1];if(!I){return }if(L.startTime.getWeekOfYear()!=B||L.startTime.getYear()!=E){return }var K=new Element("div",{"class":"in2igui_calendar_event"});var M=((L.startTime.getHours()*60+L.startTime.getMinutes())/60-A.options.startHour)*40-1;var H=(L.endTime.getTime()-L.startTime.getTime())/1000/60/60*40+1;var H=Math.min(G-M,H);K.setStyle({"marginTop":M+"px","height":H+"px",visibility:"hidden"});var J=new Element("div");J.insert(new Element("p",{"class":"in2igui_calendar_event_time"}).update(L.startTime.dateFormat("H:i")));J.insert(new Element("p",{"class":"in2igui_calendar_event_text"}).update(L.text));if(L.location){J.insert(new Element("p",{"class":"in2igui_calendar_event_location"}).update(L.location))}I.insert(K.insert(J));window.setTimeout(function(){In2iGui.bounceIn(K)},Math.random()*200);K.observe("click",function(){A.eventWasClicked(L,this)})})},eventWasClicked:function(B,A){this.showEvent(B,A)},setBusy:function(A){if(A){this.element.addClassName("in2igui_calendar_busy")}else{this.element.removeClassName("in2igui_calendar_busy")}},updateUI:function(){var C=this.getFirstDay();var D=this.head.select(".day");for(var B=0;B<D.length;B++){var A=new Date(C.getTime());A.setDate(A.getDate()+B);D[B].update(A.dateFormat("l \\d. d M"))}},buildUI:function(){var F=this.element.select(".in2igui_calendar_bar")[0];this.toolbar=In2iGui.Toolbar.create({labels:false});F.insert(this.toolbar.getElement());var E=In2iGui.Button.create({name:"in2iguiCalendarPrevious",text:"",icon:"monochrome/previous"});E.listen(this);this.toolbar.add(E);var A=In2iGui.Button.create({name:"in2iguiCalendarToday",text:"Idag"});A.click(function(){this.setDate(new Date())}.bind(this));this.toolbar.add(A);var C=In2iGui.Button.create({name:"in2iguiCalendarNext",text:"",icon:"monochrome/next"});C.listen(this);this.toolbar.add(C);this.datePickerButton=In2iGui.Button.create({name:"in2iguiCalendarDatePicker",text:"Vælg dato..."});this.datePickerButton.listen(this);this.toolbar.add(this.datePickerButton);var G=this.body.select(".in2igui_calendar_day")[0];for(var B=this.options.startHour;B<=this.options.endHour;B++){var D=new Element("div",{"class":"in2igui_calendar_time"}).update("<span><em>"+B+":00</em></span>");if(B==this.options.startHour){D.addClassName("in2igui_calendar_time_first")}if(B==this.options.endHour){D.addClassName("in2igui_calendar_time_last")}G.insert(D)}},$click$in2iguiCalendarPrevious:function(){var A=new Date(this.date.getTime());A.setDate(this.date.getDate()-7);this.setDate(A)},$click$in2iguiCalendarNext:function(){var A=new Date(this.date.getTime());A.setDate(this.date.getDate()+7);this.setDate(A)},setDate:function(A){this.date=new Date(A.getTime());this.updateUI();this.refresh();if(this.datePicker){this.datePicker.setValue(this.date)}},$click$in2iguiCalendarDatePicker:function(){this.showDatePicker()},refresh:function(){this.clearEvents();this.setBusy(true);var A={"startTime":this.getFirstDay(),"endTime":this.getLastDay()};this.fire("calendarSpanChanged",A);In2iGui.firePropertyChange(this,"startTime",this.getFirstDay());In2iGui.firePropertyChange(this,"endTime",this.getLastDay())},valueForProperty:function(A){if(A=="startTime"){return this.getFirstDay()}if(A=="endTime"){return this.getLastDay()}return this[A]},showDatePicker:function(){if(!this.datePickerPanel){this.datePickerPanel=In2iGui.BoundPanel.create();this.datePicker=In2iGui.DatePicker.create({name:"in2iguiCalendarDatePicker",value:this.date});this.datePicker.listen(this);this.datePickerPanel.add(this.datePicker);this.datePickerPanel.addSpace(3);var A=In2iGui.Button.create({name:"in2iguiCalendarDatePickerClose",text:"Luk",small:true,rounded:true});A.listen(this);this.datePickerPanel.add(A)}this.datePickerPanel.position(this.datePickerButton.getElement());this.datePickerPanel.show()},$click$in2iguiCalendarDatePickerClose:function(){this.datePickerPanel.hide()},$dateChanged$in2iguiCalendarDatePicker:function(A){this.setDate(A)},showEvent:function(C,B){if(!this.eventViewerPanel){this.eventViewerPanel=In2iGui.BoundPanel.create({width:270,padding:3});this.eventInfo=In2iGui.InfoView.create(null,{height:240,clickObjects:true});this.eventViewerPanel.add(this.eventInfo);this.eventViewerPanel.addSpace(5);var A=In2iGui.Button.create({name:"in2iguiCalendarEventClose",text:"Luk"});A.listen(this);this.eventViewerPanel.add(A)}this.eventInfo.clear();this.eventInfo.setBusy(true);this.eventViewerPanel.position(B);this.eventViewerPanel.show();In2iGui.callDelegates(this,"requestEventInfo",C);return },updateEventInfo:function(A,B){this.eventInfo.setBusy(false);this.eventInfo.update(B)},click$in2iguiCalendarEventClose:function(){this.hideEventViewer()},hideEventViewer:function(){if(this.eventViewerPanel){this.eventViewerPanel.hide()}}};In2iGui.DatePicker=function(A){this.name=A.name;this.element=$(A.element);this.options={};n2i.override(this.options,A);this.cells=[];this.title=this.element.select("strong")[0];this.today=new Date();this.value=this.options.value?new Date(this.options.value.getTime()):new Date();this.viewDate=new Date(this.value.getTime());this.viewDate.setDate(1);In2iGui.extend(this);this.addBehavior();this.updateUI()};In2iGui.DatePicker.create=function(I){var B=I.element=new Element("div",{"class":"in2igui_datepicker"});B.insert('<div class="in2igui_datepicker_header"><a class="in2igui_datepicker_next"></a><a class="in2igui_datepicker_previous"></a><strong></strong></div>');var G=new Element("table");var E=new Element("tr");G.insert(new Element("thead").insert(E));for(var C=0;C<7;C++){E.insert(new Element("th").update(Date.dayNames[C].substring(0,3)))}var D=new Element("tbody");G.insert(D);for(var C=0;C<6;C++){var H=new Element("tr");for(var A=0;A<7;A++){var F=new Element("td");H.insert(F)}D.insert(H)}B.insert(G);return new In2iGui.DatePicker(I)};In2iGui.DatePicker.prototype={addBehavior:function(){var A=this;this.cells=this.element.select("td");this.cells.each(function(B,C){B.observe("mousedown",function(){A.selectCell(C)})});this.element.select(".in2igui_datepicker_next")[0].observe("mousedown",function(){A.next()});this.element.select(".in2igui_datepicker_previous")[0].observe("mousedown",function(){A.previous()})},setValue:function(A){this.value=new Date(A.getTime());this.viewDate=new Date(A.getTime());this.viewDate.setDate(1);this.updateUI()},updateUI:function(){this.title.update(this.viewDate.dateFormat("F Y"));var C=this.value.getFullYear()==this.viewDate.getFullYear();var E=this.viewDate.getMonth();for(var D=0;D<this.cells.length;D++){var B=this.indexToDate(D);var A=this.cells[D];if(B.getMonth()<E){A.className="in2igui_datepicker_dimmed"}else{if(B.getMonth()>E){A.className="in2igui_datepicker_dimmed"}else{A.className=""}}if(B.getDate()==this.value.getDate()&&B.getMonth()==this.value.getMonth()&&C){A.addClassName("in2igui_datepicker_selected")}if(B.getDate()==this.today.getDate()&&B.getMonth()==this.today.getMonth()&&B.getFullYear()==this.today.getFullYear()){A.addClassName("in2igui_datepicker_today")}A.update(B.getDate())}},getPreviousMonth:function(){var A=new Date(this.viewDate.getTime());A.setMonth(A.getMonth()-1);return A},getNextMonth:function(){var A=new Date(this.viewDate.getTime());A.setMonth(A.getMonth()+1);return A},previous:function(){this.viewDate=this.getPreviousMonth();this.updateUI()},next:function(){this.viewDate=this.getNextMonth();this.updateUI()},selectCell:function(A){this.value=this.indexToDate(A);this.viewDate=new Date(this.value.getTime());this.viewDate.setDate(1);this.updateUI();In2iGui.callDelegates(this,"dateChanged",this.value)},indexToDate:function(B){var D=this.viewDate.getDay();var E=this.viewDate.getDaysInMonth();var C=this.getPreviousMonth().getDaysInMonth();if(B<D){var A=this.getPreviousMonth();A.setDate(C-D+B+1);return A}else{if(B>D+E-1){var A=this.getPreviousMonth();A.setDate(B-D-E+1);return A;cell.update(i-D-E+1)}else{var A=new Date(this.viewDate.getTime());A.setDate(B+1-D);return A}}}};Date.monthNames=["Januar","Februar","Marts","April","Maj","Juni","Juli","August","September","Oktober","November","December"];Date.dayNames=["Søndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag"];In2iGui.Layout=function(A){this.name=A.name;this.options=A||{};this.element=$(A.element);In2iGui.extend(this)};In2iGui.Layout.prototype={$$layout:function(){if(!n2i.browser.msie7&&!n2i.browser.msie8){return }if(this.diff===undefined){var D=this.element.select("thead td")[0].firstDescendant().clientHeight;var C=this.element.select("tfoot td")[0];var B=0;if(C){B=C.firstDescendant().clientHeight}D+=this.element.cumulativeOffset().top;this.diff=B+D;if(this.element.parentNode!==document.body){this.diff+=15}else{}}var A=this.element.select("tbody tr td")[0];A.style.height=(n2i.getViewPortHeight()-this.diff)+"px"}};In2iGui.Columns=function(A){this.name=A.name;this.options=A||{};this.element=$(A.element);this.body=this.element.select("tr")[0];In2iGui.extend(this)};In2iGui.Columns.create=function(A){A=A||{};A.element=new Element("table",{"class":"in2igui_columns"}).insert(new Element("tbody").insert(new Element("tr")));return new In2iGui.Columns(A)};In2iGui.Columns.prototype={addToColumn:function(A,B){var C=this.ensureColumn(A);C.insert(B.getElement())},setColumnStyle:function(A,B){var C=this.ensureColumn(A);C.setStyle(B)},setColumnWidth:function(A,B){var C=this.ensureColumn(A);C.setStyle({width:B+"px"})},ensureColumn:function(A){var C=this.body.childElements();for(var B=C.length-1;B<A;B++){this.body.insert(new Element("td",{"class":"in2igui_columns_column"}))}return this.body.childElements()[A]}};In2iGui.Dock=function(A){this.options=A;this.element=$(A.element);this.iframe=this.element.select("iframe")[0];this.name=A.name;In2iGui.extend(this);this.diff=-69;if(this.options.tabs){this.diff-=15}};In2iGui.Dock.prototype={setUrl:function(A){n2i.getFrameDocument(this.iframe).location.href=A},$$layout:function(){var A=n2i.getInnerHeight();this.iframe.style.height=(A+this.diff)+"px"}};In2iGui.Box=function(A){this.options=n2i.override({},A);this.name=A.name;this.element=$(A.element);this.body=this.element.select(".in2igui_box_body")[0];this.close=this.element.select(".in2igui_box_close")[0];if(this.close){this.close.observe("click",function(B){B.stop();this.hide();this.fire("boxWasClosed")}.bind(this))}In2iGui.extend(this)};In2iGui.Box.create=function(A){A=n2i.override({},A);var B=A.element=new Element("div",{"class":"in2igui_box"});if(A.width){B.setStyle({width:A.width+"px"})}if(A.absolute){B.addClassName("in2igui_box_absolute")}B.update((A.closable?'<a class="in2igui_box_close" href="#"></a>':"")+'<div class="in2igui_box_top"><div><div></div></div></div><div class="in2igui_box_middle"><div class="in2igui_box_middle">'+(A.title?'<div class="in2igui_box_header"><strong class="in2igui_box_title">'+A.title+"</strong></div>":"")+'<div class="in2igui_box_body"'+(A.padding?' style="padding: '+A.padding+'px;"':"")+'></div></div></div><div class="in2igui_box_bottom"><div><div></div></div></div>');return new In2iGui.Box(A)};In2iGui.Box.prototype={addToDocument:function(){document.body.appendChild(this.element)},add:function(A){if(A.getElement){this.body.insert(A.getElement())}else{this.body.insert(A)}},show:function(){var D=this.element;if(this.options.modal){var B=In2iGui.nextPanelIndex();D.style.zIndex=B+1;In2iGui.showCurtain(this,B)}if(this.options.absolute){D.setStyle({display:"block",visibility:"hidden"});var A=D.getWidth();var C=(n2i.getInnerHeight()-D.getHeight())/2+n2i.getScrollTop();D.setStyle({"marginLeft":(A/-2)+"px",top:C+"px"});D.setStyle({display:"block",visibility:"visible"})}else{D.setStyle({display:"block"})}In2iGui.callVisible(this)},hide:function(){In2iGui.hideCurtain(this);this.element.setStyle({display:"none"})},curtainWasClicked:function(){this.fire("boxCurtainWasClicked")}};In2iGui.Wizard=function(A){this.options=A||{};this.element=$(A.element);this.name=A.name;this.container=this.element.select(".in2igui_wizard_steps")[0];this.steps=this.element.select(".in2igui_wizard_step");this.anchors=this.element.select("ul.in2igui_wizard a");this.selected=0;In2iGui.extend(this);this.addBehavior()};In2iGui.Wizard.prototype={addBehavior:function(){this.anchors.each(function(B,A){B.observe("mousedown",function(C){C.stop();this.goToStep(A)}.bind(this));B.observe("click",function(C){C.stop()})}.bind(this))},goToStep:function(A){var B=this.container;B.setStyle({height:B.getHeight()+"px"});this.anchors[this.selected].removeClassName("in2igui_selected");this.steps[this.selected].hide();this.anchors[A].addClassName("in2igui_selected");this.steps[A].show();this.selected=A;n2i.ani(B,"height",this.steps[A].getHeight()+"px",500,{ease:n2i.ease.slowFastSlow,onComplete:function(){B.setStyle({height:""})}});In2iGui.callVisible(this)},next:function(){if(this.selected<this.steps.length-1){this.goToStep(this.selected+1)}},previous:function(){if(this.selected>0){this.goToStep(this.selected-1)}}};In2iGui.Articles=function(A){this.options=A;this.name=A.name;this.element=$(A.element);if(A.source){A.source.listen(this)}};In2iGui.Articles.prototype={$articlesLoaded:function(H){this.element.update();var G=H.getElementsByTagName("article");for(var C=0;C<G.length;C++){var D=new Element("div",{"class":"in2igui_article"});var E=G[C].childNodes;for(var B=0;B<E.length;B++){if(n2i.dom.isElement(E[B],"title")){var F=n2i.dom.getNodeText(E[B]).escapeHTML();D.insert(new Element("h2").update(F))}else{if(n2i.dom.isElement(E[B],"paragraph")){var I=n2i.dom.getNodeText(E[B]).escapeHTML();var A=new Element("p").update(I);if(E[B].getAttribute("dimmed")==="true"){A.addClassName("in2igui_dimmed")}D.insert(A)}}}this.element.insert(D)}},$sourceIsBusy:function(){this.element.update('<div class="in2igui_articles_loading">Loading...</div>')},$sourceIsNotBusy:function(){this.element.removeClassName("in2igui_list_busy")}};In2iGui.TextField=function(A){this.options=n2i.override({placeholderElement:null,validator:null},A);var B=this.element=$(A.element);this.element.setAttribute("autocomplete","off");this.value=this.validate(this.element.value);this.isPassword=this.element.type=="password";this.name=A.name;In2iGui.extend(this);this.addBehavior();if(this.options.placeholderElement&&this.value!=""){In2iGui.fadeOut(this.options.placeholderElement,0)}this.checkPlaceholder();try{if(B==document.activeElement){this.focused()}}catch(B){}};In2iGui.TextField.prototype={addBehavior:function(){var B=this.element;B.observe("keyup",this.keyDidStrike.bind(this));var A=this.options.placeholderElement;B.observe("blur",this.onBlur.bind(this));if(A){B.observe("focus",this.focused.bind(this));B.observe("blur",this.checkPlaceholder.bind(this));if(A){A.setStyle({cursor:"text"});A.observe("mousedown",this.focus.bind(this)).observe("click",this.focus.bind(this))}}},focused:function(){var B=this.element,A=this.options.placeholderElement;if(A&&B.value==""){In2iGui.fadeOut(A,0)}},validate:function(C){var B=this.options.validator,A;if(B){A=B.validate(C);this.element.setClassName("in2igui_invalid",!A.valid);return A.value}return C},checkPlaceholder:function(){if(this.options.placeholderElement&&this.value==""){In2iGui.fadeIn(this.options.placeholderElement,200)}if(this.isPassword&&!n2i.browser.msie){this.element.type="password"}},keyDidStrike:function(){if(this.value!==this.element.value){var A=this.validate(this.element.value);var B=A!==this.value;this.value=A;if(B){this.fire("valueChanged",this.value)}}},onBlur:function(){this.element.removeClassName("in2igui_invalid");this.element.value=this.value||""},getValue:function(){return this.value},setValue:function(A){if(A===undefined||A===null){A=""}this.element.value=A;this.value=this.validate(A)},isEmpty:function(){return this.value==""},isBlank:function(){return this.value.strip()==""},focus:function(){this.element.focus()},setError:function(A){var B=A?true:false;this.element.setClassName("in2igui_field_error",B);if(typeof (A)=="string"){In2iGui.showToolTip({text:A,element:this.element,key:this.name})}if(!B){In2iGui.hideToolTip({key:this.name})}}};In2iGui.InfoView=function(A){this.options=n2i.override({clickObjects:false},A);this.element=$(A.element);this.body=this.element.select("tbody")[0];this.name=A.name;In2iGui.extend(this)};In2iGui.InfoView.create=function(A){A=A||{};var B=A.element=new Element("div",{"class":"in2igui_infoview"});if(A.height){B.setStyle({height:A.height+"px","overflow":"auto","overflowX":"hidden"})}if(A.margin){B.setStyle({margin:A.margin+"px"})}B.update("<table><tbody></tbody></table>");return new In2iGui.InfoView(A)};In2iGui.InfoView.prototype={addHeader:function(B){var A=new Element("tr");A.insert(new Element("th",{"class":"in2igui_infoview_header","colspan":"2"}).insert(B));this.body.insert(A)},addProperty:function(A,C){var B=new Element("tr");B.insert(new Element("th").insert(A));B.insert(new Element("td").insert(C));this.body.insert(B)},addObjects:function(B,D){if(!D||D.length==0){return }var E=new Element("tr");E.insert(new Element("th").insert(B));var A=new Element("td");var C=this.options.clickObjects;D.each(function(G){var F=new Element("div").insert(G.title);if(C){F.addClassName("in2igui_infoview_click");F.observe("click",function(){In2iGui.callDelegates(this,"objectWasClicked",G)})}A.insert(F)});E.insert(A);this.body.insert(E)},setBusy:function(A){if(A){this.element.addClassName("in2igui_infoview_busy")}else{this.element.removeClassName("in2igui_infoview_busy")}},clear:function(){this.body.update()},update:function(B){this.clear();for(var A=0;A<B.length;A++){switch(B[A].type){case"header":this.addHeader(B[A].value);break;case"property":this.addProperty(B[A].label,B[A].value);break;case"objects":this.addObjects(B[A].label,B[A].value);break}}}};In2iGui.Overflow=function(A){this.options=A;this.element=$(A.element);this.name=A.name;In2iGui.extend(this)};In2iGui.Overflow.create=function(A){A=A||{};var B=A.element=new Element("div",{"class":"in2igui_overflow"});if(A.height){B.setStyle({height:A.height+"px"})}return new In2iGui.Overflow(A)};In2iGui.Overflow.prototype={calculate:function(){var D,B,C,A;A=n2i.getInnerHeight();C=$(this.element.parentNode);D=this.element.cumulativeOffset().top;B=C.cumulativeOffset().top+C.getDimensions().height;this.element.nextSiblings().each(function(E){B-=E.clientHeight});this.diff=-1*(D+(A-B))},add:function(A){if(A.getElement){this.element.insert(A.getElement())}else{this.element.insert(A)}return this},$$layout:function(){if(!this.options.dynamic){if(this.options.vertical){var A=n2i.getInnerHeight();this.element.style.height=Math.max(0,A-this.options.vertical)+"px"}return }if(this.diff===undefined){this.calculate()}var A=n2i.getInnerHeight();this.element.style.height=Math.max(0,A+this.diff)+"px"}};In2iGui.SearchField=function(A){this.options=n2i.override({expandedWidth:null},A);this.element=$(A.element);this.name=A.name;this.field=this.element.select("input")[0];this.value=this.field.value;this.adaptive=this.element.hasClassName("in2igui_searchfield_adaptive");In2iGui.onDomReady(function(){this.initialWidth=parseInt(this.element.getStyle("width"))}.bind(this));In2iGui.extend(this);this.addBehavior();this.updateClass()};In2iGui.SearchField.create=function(A){A=A||{};var B=A.element=new Element("span",{"class":A.adaptive?"in2igui_searchfield in2igui_searchfield_adaptive":"in2igui_searchfield"});B.update('<em class="in2igui_searchfield_placeholder"></em><a href="javascript:void(0);" class="in2igui_searchfield_reset"></a><span><span><input type="text"/></span></span>');return new In2iGui.SearchField(A)};In2iGui.SearchField.prototype={addBehavior:function(){var B=this;this.field.observe("keyup",this.onKeyUp.bind(this));var C=this.element.select("a")[0];C.tabIndex=-1;var A=function(){B.field.focus();B.field.select()};this.element.observe("mousedown",A).observe("mouseup",A);C.observe("mousedown",function(D){D.stop();B.reset();A()});this.element.select("em")[0].observe("mousedown",A);this.field.observe("focus",function(){B.focused=true;B.updateClass()});this.field.observe("blur",function(){B.focused=false;B.updateClass()});if(this.options.expandedWidth>0){this.field.onfocus=function(){n2i.ani(B.element,"width",B.options.expandedWidth+"px",500,{ease:n2i.ease.slowFastSlow})};this.field.onblur=function(){n2i.ani(B.element,"width",B.initialWidth+"px",500,{ease:n2i.ease.slowFastSlow,delay:100})}}},onKeyUp:function(A){this.fieldChanged();if(A.keyCode===Event.KEY_RETURN){this.fire("submit")}},setValue:function(A){this.field.value=A===undefined||A===null?"":A;this.fieldChanged()},getValue:function(){return this.field.value},isEmpty:function(){return this.field.value==""},isBlank:function(){return this.field.value.strip()==""},reset:function(){this.field.value="";this.fieldChanged()},updateClass:function(){var A="in2igui_searchfield";if(this.adaptive){A+=" in2igui_searchfield_adaptive"}if(this.focused&&this.value!=""){A+=" in2igui_searchfield_focus_dirty"}else{if(this.focused){A+=" in2igui_searchfield_focus"}else{if(this.value!=""){A+=" in2igui_searchfield_dirty"}}}this.element.className=A},fieldChanged:function(){if(this.field.value!=this.value){this.value=this.field.value;this.updateClass();this.fire("valueChanged",this.value);In2iGui.firePropertyChange(this,"value",this.value)}}};In2iGui.Fragment=function(A){this.options=A;this.element=$(A.element);this.name=A.name;In2iGui.extend(this)};In2iGui.Fragment.prototype={show:function(){this.element.style.display="block"},hide:function(){this.element.style.display="none"}};In2iGui.LocationPicker=function(A){A=A||{};this.name=A.name;this.options=A.options||{};this.element=$(A.element);this.defaultCenter=new google.maps.LatLng(57.0465,9.9185);In2iGui.extend(this);this.addBehavior()};In2iGui.LocationPicker.prototype={addBehavior:function(){},show:function(C){if(!this.panel){var A=this.panel=In2iGui.BoundPanel.create({width:300});var G=new Element("div").setStyle({width:"300px",height:"300px"});A.add(G);var F=In2iGui.Buttons.create({align:"right",top:5});var D=In2iGui.Button.create({text:"Luk"});D.listen({$click:function(){A.hide()}});A.add(F.add(D));A.element.setStyle({left:"-10000px",top:"-10000px",display:""});var E=this.buildLatLng();var B={zoom:15,mapTypeId:google.maps.MapTypeId.TERRAIN};this.map=new google.maps.Map(G,B);google.maps.event.addListener(this.map,"click",function(H){var I={latitude:H.latLng.lat(),longitude:H.latLng.lng()};this.setLocation(I);this.fire("locationChanged",I)}.bind(this));A.element.setStyle({display:"none"})}this.setLocation(C.location);if(C.node){this.panel.position(C.node)}this.panel.show()},setLocation:function(A){if(!A&&this.marker){this.marker.setMap(null);this.map.setCenter(this.defaultCenter);return }A=this.buildLatLng(A);if(!this.marker){this.marker=new google.maps.Marker({position:A,map:this.map})}else{this.marker.setPosition(A);this.marker.setMap(this.map)}this.map.setCenter(A)},buildLatLng:function(A){if(!A){A={latitude:57.0465,longitude:9.9185}}return new google.maps.LatLng(A.latitude,A.longitude)}};In2iGui.Bar=function(A){this.options=n2i.override({},A);this.name=A.name;this.element=$(A.element);In2iGui.extend(this)};In2iGui.Bar.Button=function(A){this.options=n2i.override({},A);this.name=A.name;this.element=$(A.element);this.element.observe("click",this.onClick.bind(this));In2iGui.extend(this)};In2iGui.Bar.Button.prototype={onClick:function(){this.fire("click")}};In2iGui.IFrame=function(A){this.options=A;this.element=$(A.element);this.name=A.name;In2iGui.extend(this)};In2iGui.IFrame.prototype={setUrl:function(A){n2i.getFrameDocument(this.element).location.href=A},getDocument:function(){return n2i.getFrameDocument(this.element)},getWindow:function(){return n2i.getFrameWindow(this.element)},reload:function(){this.getWindow().location.reload()}};In2iGui.VideoPlayer=function(A){this.options=A;this.element=$(A.element);this.placeholder=this.element.select("div")[0];this.name=A.name;this.state={duration:0,time:0,loaded:0};this.handlers=[In2iGui.VideoPlayer.HTML5,In2iGui.VideoPlayer.QuickTime,In2iGui.VideoPlayer.Embedded];this.handler=null;In2iGui.extend(this);if(this.options.video){if(this.placeholder){this.placeholder.observe("click",function(){this.setVideo(this.options.video)}.bind(this))}else{In2iGui.onReady(function(){this.setVideo(this.options.video)}.bind(this))}}};In2iGui.VideoPlayer.prototype={setVideo:function(A){this.handler=this.getHandler(A);this.element.update(this.handler.element);if(this.handler.showController()){this.buildController()}},getHandler:function(C){for(var A=0;A<this.handlers.length;A++){var B=this.handlers[A];if(B.isSupported(C)){return new B(C,this)}}},buildController:function(){var A=new Element("div",{"class":"in2igui_videoplayer_controller"});this.playButton=new Element("a",{href:"javascript:void(0);","class":"in2igui_videoplayer_playpause"}).insert("wait!");this.playButton.observe("click",this.playPause.bind(this));this.status=new Element("span",{"class":"in2igui_videoplayer_status"});A.insert(this.playButton).insert(this.status);this.element.insert(A)},onCanPlay:function(){this.playButton.update("Play")},onLoad:function(){this.state.loaded=this.state.duration;this.updateStatus()},onDurationChange:function(A){this.state.duration=A;this.updateStatus()},onTimeChange:function(A){this.state.time=A;this.updateStatus()},onLoadProgressChange:function(A){this.state.loaded=A;this.updateStatus()},playPause:function(){if(this.handler.isPlaying()){this.pause()}else{this.play()}},play:function(){this.handler.play()},pause:function(){this.handler.pause()},updateStatus:function(){this.status.innerHTML=this.state.time+" / "+this.state.duration+" / "+this.state.loaded}};In2iGui.VideoPlayer.HTML5=function(B,A){var C=this.element=new Element("video",{width:B.width,height:B.height,src:B.src});C.observe("load",A.onLoad.bind(A));C.observe("canplay",A.onCanPlay.bind(A));C.observe("durationchange",function(D){A.onDurationChange(C.duration)});C.observe("timeupdate",function(){A.onTimeChange(this.element.currentTime)}.bind(this))};In2iGui.VideoPlayer.HTML5.isSupported=function(A){if(n2i.browser.webkitVersion>528&&(A.type==="video/quicktime"||A.type==="video/mp4")){return true}return false};In2iGui.VideoPlayer.HTML5.prototype={showController:function(){return true},pause:function(){this.element.pause()},play:function(){this.element.play()},getTime:function(){return this.element.currentTime},isPlaying:function(){return !this.element.paused}};In2iGui.VideoPlayer.QuickTime=function(B,A){this.player=A;var C=this.element=new Element("object",{width:B.width,height:B.height,data:B.src,type:"video/quicktime"});C.update('<param value="false" name="controller"/><param value="true" name="enablejavascript"/><param value="undefined" name="posterframe"/><param value="false" name="showlogo"/><param value="false" name="autostart"/><param value="true" name="cache"/><param value="white" name="bgcolor"/><param value="false" name="aggressivecleanup"/><param value="true" name="saveembedtags"/><param value="true" name="postdomevents"/>');C.observe("qt_canplay",A.onCanPlay.bind(A));C.observe("qt_load",A.onLoad.bind(A));C.observe("qt_progress",function(){A.onLoadProgressChange(C.GetMaxTimeLoaded()/3000)});C.observe("qt_durationchange",function(D){A.onDurationChange(C.GetDuration()/3000)});C.observe("qt_timechanged",function(){A.onTimeChange(C.GetTime())})};In2iGui.VideoPlayer.QuickTime.isSupported=function(A){return A.html==undefined};In2iGui.VideoPlayer.QuickTime.prototype={showController:function(){return true},pause:function(){window.clearInterval(this.observer);this.element.Stop()},play:function(){this.element.Play();this.observer=window.setInterval(this.observeVideo.bind(this),100)},observeVideo:function(){this.player.onTimeChange(this.element.GetTime()/3000)},getTime:function(){return this.element.GetTime()},isPlaying:function(){return this.element.GetRate()!==0}};In2iGui.VideoPlayer.Embedded=function(B,A){var C=this.element=new Element("div",{width:B.width,height:B.height});C.update(B.html)};In2iGui.VideoPlayer.Embedded.isSupported=function(A){return A.html!==undefined};In2iGui.VideoPlayer.Embedded.prototype={showController:function(){return false},pause:function(){},play:function(){},getTime:function(){},isPlaying:function(){}};In2iGui.Segmented=function(A){this.options=n2i.override({value:null,allowNull:false},A);this.element=$(A.element);this.name=A.name;this.value=this.options.value;In2iGui.extend(this);this.element.observe("click",this.onClick.bind(this))};In2iGui.Segmented.prototype={onClick:function(C){var A=C.findElement("a");if(A){var D=false;var B=A.getAttribute("rel");this.element.select(".in2igui_segmented_selected").each(function(E){E.removeClassName("in2igui_segmented_selected")});if(B===this.value&&this.options.allowNull){D=true;this.value=null;this.fire("valueChanged",this.value)}else{A.addClassName("in2igui_segmented_selected");D=this.value!==B;this.value=B}if(D){this.fire("valueChanged",this.value)}}},setValue:function(C){if(C===undefined){C=null}var A=this.element.select("a");this.value=null;for(var B=0;B<A.length;B++){if(A[B].getAttribute("rel")===C){A[B].addClassName("in2igui_segmented_selected");this.value=C}else{A[B].removeClassName("in2igui_segmented_selected")}}},getValue:function(){return this.value}};In2iGui.Flash={fullVersion:undefined,getMajorVersion:function(){var B=this.getFullVersion();if(B===null||B===undefined){return null}var A=(B+"").match(/[0-9]+/gi);return A.length>0?parseInt(A[0]):null},getFullVersion:function(){if(this.fullVersion!==undefined){return this.fullVersion}var G=null;if(navigator.plugins!=null&&navigator.plugins.length>0){if(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]){var F=navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"";var A=navigator.plugins["Shockwave Flash"+F].description;var E=A.split(" ");var C=E[2].split(".");var H=C[0];var B=C[1];var D=E[3];if(D==""){D=E[4]}if(D[0]=="d"){D=D.substring(1)}else{if(D[0]=="r"){D=D.substring(1);if(D.indexOf("d")>0){D=D.substring(0,D.indexOf("d"))}}}var G=H+"."+B+"."+D}}else{if(navigator.userAgent.toLowerCase().indexOf("webtv/2.6")!=-1){G=4}else{if(navigator.userAgent.toLowerCase().indexOf("webtv/2.5")!=-1){G=3}else{if(navigator.userAgent.toLowerCase().indexOf("webtv")!=-1){G=2}else{if(n2i.browser.msie){G=this.getActiveXVersion()}}}}}this.fullVersion=G;return G},getActiveXVersion:function(){var A;var B;var C;try{B=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");A=B.GetVariable("$version")}catch(C){}if(!A){try{B=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");A="WIN 6,0,21,0";B.AllowScriptAccess="always";A=B.GetVariable("$version")}catch(C){}}if(!A){try{B=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");A=B.GetVariable("$version")}catch(C){}}if(!A){try{B=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");A="WIN 3,0,18,0"}catch(C){}}if(!A){try{B=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");A="WIN 2,0,0,11"}catch(C){A=-1}}return A}};In2iGui.Link=function(A){this.options=A;this.name=A.name;this.element=$(A.element);In2iGui.extend(this);this.addBehavior()};In2iGui.Link.prototype={addBehavior:function(){var A=this;this.element.observe("click",function(B){A.fire("click");Event.stop(B)})}}