var c={GetObjectsNOM:["foldertime","pagetime","filetime","permtime"],GetPage:["pagetime","foldertime","permtime"],GetTasks:["net_milestonetime"],GetUsersInfos:["permtime","grouptime"],ListNetworkGroupsForUser:["net_grouptime","net_permtime"],ListWorkspaceGroupsForUser:["grouptime","permtime"]};var PBcacheability=PBcacheability||c;if(Object.extend){Object.extend(PBcacheability,c)}var c={kTrackingCookie:"pb_stat",kPolicyValidEmailRegex:"/^([a-zA-Z0-9])+([a-zA-Z0-9\\._+&'-])*@([a-zA-Z0-9-])+\\.([a-zA-Z0-9\\.-]+)+$/",kPolicyValidUIDRegex:"/^([a-f0-9]){40}$/i",kPolicyConvertOpenOfficeRegex:"/\\.(csv|docx?|ods|odt|rtf|wpd|xlsx?|pptx?)$/i",kPolicyConvertImageMagickRegex:"/\\.(jpe?g|png|gif|psd|bmp|tiff?|e?ps|pdf|ai|jng)$/i",kPolicyVideoFileRegex:"/\\.(mov|m4v|ogv|webm|mpe?g|wmv|flv|3gp|asf|avi|mp4)$/i",kPolicyAudioFileRegex:"/\\.(aac|m4a|aif|mp3|mpa|wav|wma|au)$/i",kPolicyImageFileRegex:"/\\.(jpe?g|png|gif)$/i",kMaxPageNameLength:100,kInvalidPageCharacters:".[]?&|/\\+#%",kInvalidFileCharacters:"%$?\\/|`",kMaxFileNameLength:100,kMaxFileSizePaid:1000000000,kMaxFileSizeFree:50000000,kInvalidFolderCharacters:".!@%&$#+\"'|",kMaxFolderNameLength:127,kMaxWikiNameLength:50,kMinWikiNameLength:4,kMaxPasswordLength:50,kMinPasswordLength:5,kMaxCommentLength:2000,kMaxMilestoneLength:100,kMaxActionLength:100,kPolicyValidWikiNameRegex:"/(^[a-zA-Z0-9]$)|(^[a-zA-Z0-9]+[a-zA-Z0-9-]*[a-zA-Z0-9]$)/",kSystemUid:"system-uid",kAPIAllowDeferWhenBusy:"allow_defer",kAPIDidDefer:"did_defer",kAPIDeferRetryInterval:5000,kAPIMaxDeferRetries:5,kAPIAsyncRetryInterval:1000,kShowStarBubblePrefsKey:"prompt_to_star_on_save",kShowSendALinkBubblePrefsKey:"prompt_to_send_a_link",kShowCreatePageBubblePrefsKey:"prompt_to_create_page",kSideBarCollapsed:"sidebar_collapsed",kUploadMaxFiles:50,kUploadMaxSize:1073741824,kLinkifyRegex:"/([a-z][\\w]+:\\/\\/)([\\w\\-]+([.][\\w\\-]+)*[.][a-z]{2,})(\\/([^\\s]*[^\\s\\!?.,])?)?/",kStaticDebugDirectory:"/shared/php/"};var PBconst=PBconst||c;if(Object.extend){Object.extend(PBconst,c)}var Prototype={Version:"1.7",Browser:(function(){var B=navigator.userAgent;var A=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!A,Opera:A,WebKit:B.indexOf("AppleWebKit/")>-1,Gecko:B.indexOf("Gecko")>-1&&B.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile/.test(B)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var A=window.Element||window.HTMLElement;return !!(A&&A.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var C=document.createElement("div"),B=document.createElement("form"),A=false;if(C.__proto__&&(C.__proto__!==B.__proto__)){A=true}C=B=null;return A})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(A){return A}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Abstract={};var Try={these:function(){var C;for(var B=0,D=arguments.length;B<D;B++){var A=arguments[B];try{C=A();break}catch(E){}}return C}};var Class=(function(){var D=(function(){for(var E in {toString:1}){if(E==="toString"){return false}}return true})();function A(){}function B(){var H=null,G=$A(arguments);if(Object.isFunction(G[0])){H=G.shift()}function E(){this.initialize.apply(this,arguments)}Object.extend(E,Class.Methods);E.superclass=H;E.subclasses=[];if(H){A.prototype=H.prototype;E.prototype=new A;H.subclasses.push(E)}for(var F=0,I=G.length;F<I;F++){E.addMethods(G[F])}if(!E.prototype.initialize){E.prototype.initialize=Prototype.emptyFunction}E.prototype.constructor=E;return E}function C(K){var G=this.superclass&&this.superclass.prototype,F=Object.keys(K);if(D){if(K.toString!=Object.prototype.toString){F.push("toString")}if(K.valueOf!=Object.prototype.valueOf){F.push("valueOf")}}for(var E=0,H=F.length;E<H;E++){var J=F[E],I=K[J];if(G&&Object.isFunction(I)&&I.argumentNames()[0]=="$super"){var L=I;I=(function(M){return function(){return G[M].apply(this,arguments)}})(J).wrap(L);I.valueOf=L.valueOf.bind(L);I.toString=L.toString.bind(L)}this.prototype[J]=I}return this}return{create:B,Methods:{addMethods:C}}})();(function(){var d=Object.prototype.toString,b="Null",O="Undefined",V="Boolean",F="Number",S="String",j="Object",T="[object Function]",Y="[object Boolean]",G="[object Number]",L="[object String]",H="[object Array]",X="[object Date]",I=window.JSON&&typeof JSON.stringify==="function"&&JSON.stringify(0)==="0"&&typeof JSON.stringify(Prototype.K)==="undefined";function K(l){switch(l){case null:return b;case (void 0):return O}var k=typeof l;switch(k){case"boolean":return V;case"number":return F;case"string":return S}return j}function Z(k,m){for(var l in m){k[l]=m[l]}return k}function h(k){try{if(C(k)){return"undefined"}if(k===null){return"null"}return k.inspect?k.inspect():String(k)}catch(l){if(l instanceof RangeError){return"..."}throw l}}function e(k){return g("",{"":k},[])}function g(t,q,r){var s=q[t],p=typeof s;if(K(s)===j&&typeof s.toJSON==="function"){s=s.toJSON(t)}var m=d.call(s);switch(m){case G:case Y:case L:s=s.valueOf()}switch(s){case null:return"null";case true:return"true";case false:return"false"}p=typeof s;switch(p){case"string":return s.inspect(true);case"number":return isFinite(s)?String(s):"null";case"object":for(var l=0,k=r.length;l<k;l++){if(r[l]===s){throw new TypeError()}}r.push(s);var o=[];if(m===H){for(var l=0,k=s.length;l<k;l++){var n=g(l,s,r);o.push(typeof n==="undefined"?"null":n)}o="["+o.join(",")+"]"}else{var u=Object.keys(s);for(var l=0,k=u.length;l<k;l++){var t=u[l],n=g(t,s,r);if(typeof n!=="undefined"){o.push(t.inspect(true)+":"+n)}}o="{"+o.join(",")+"}"}r.pop();return o}}function W(k){return JSON.stringify(k)}function J(k){return $H(k).toQueryString()}function P(k){return k&&k.toHTML?k.toHTML():String.interpret(k)}function R(k){if(K(k)!==j){throw new TypeError()}var l=[];for(var m in k){if(k.hasOwnProperty(m)){l.push(m)}}return l}function D(k){var l=[];for(var m in k){l.push(k[m])}return l}function a(k){return Z({},k)}function U(k){return !!(k&&k.nodeType==1)}function M(k){return d.call(k)===H}var B=(typeof Array.isArray=="function")&&Array.isArray([])&&!Array.isArray({});if(B){M=Array.isArray}function E(k){return k instanceof Hash}function A(k){return d.call(k)===T}function N(k){return d.call(k)===L}function Q(k){return d.call(k)===G}function f(k){return d.call(k)===X}function C(k){return typeof k==="undefined"}Z(Object,{extend:Z,inspect:h,toJSON:I?W:e,toQueryString:J,toHTML:P,keys:Object.keys||R,values:D,clone:a,isElement:U,isArray:M,isHash:E,isFunction:A,isString:N,isNumber:Q,isDate:f,isUndefined:C})})();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}})());(function(C){function B(){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"}function A(){return this.toISOString()}if(!C.toISOString){C.toISOString=B}if(!C.toJSON){C.toJSON=A}})(Date.prototype);RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(A){return String(A).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(B,A){this.callback=B;this.frequency=A;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer){return }clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=false}catch(A){this.currentlyExecuting=false;throw A}}}});Object.extend(String,{interpret:function(A){return A==null?"":String(A)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,(function(){var NATIVE_JSON_PARSE_SUPPORT=window.JSON&&typeof JSON.parse==="function"&&JSON.parse('{"test": true}').test;function prepareReplacement(replacement){if(Object.isFunction(replacement)){return replacement}var template=new Template(replacement);return function(match){return template.evaluate(match)}}function gsub(pattern,replacement){var result="",source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern)){pattern=RegExp.escape(pattern)}if(!(pattern.length||pattern.source)){replacement=replacement("");return replacement+source.split("").join(replacement)+replacement}while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length)}else{result+=source,source=""}}return result}function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0){return match[0]}return replacement(match)})}function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this)}function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?"...":truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this)}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"")}function stripScripts(){if(this.indexOf("<script")==-1){return this}return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,"img"),matchOne=new RegExp(Prototype.ScriptFragment,"im");return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||["",""])[1]})}function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}function escapeHTML(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function unescapeHTML(){return this.stripTags().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match){return{}}return match[1].split(separator||"&").inject({},function(hash,pair){if((pair=pair.split("="))[0]){var key=decodeURIComponent(pair.shift()),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(){return this.replace(/-+(.)?/g,function(match,chr){return chr?chr.toUpperCase():""})}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function underscore(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()}function dasherize(){return this.replace(/_/g,"-")}function inspect(useDoubleQuotes){var escapedString=this.replace(/[\x00-\x1f\\]/g,function(character){if(character in String.specialChar){return String.specialChar[character]}return"\\u00"+character.charCodeAt().toPaddedString(2,16)});if(useDoubleQuotes){return'"'+escapedString.replace(/"/g,'\\"')+'"'}return"'"+escapedString.replace(/'/g,"\\'")+"'"}function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,"$1")}function isJSON(){var str=this;if(str.blank()){return false}str=str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@");str=str.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");str=str.replace(/(?:^|:|,)(?:\s*\[)+/g,"");return(/^[\],:{}\s]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON(),cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;if(cx.test(json)){json=json.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function parseJSON(){var json=this.unfilterJSON();return JSON.parse(json)}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern){return this.lastIndexOf(pattern,0)===0}function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.indexOf(pattern,d)===d}function empty(){return this==""}function blank(){return/^\s*$/.test(this)}function interpolate(object,pattern){return new Template(this,pattern).evaluate(object)}return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim||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,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:NATIVE_JSON_PARSE_SUPPORT?parseJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate}})());var Template=Class.create({initialize:function(A,B){this.template=A.toString();this.pattern=B||Template.Pattern},evaluate:function(A){if(A&&Object.isFunction(A.toTemplateReplacements)){A=A.toTemplateReplacements()}return this.template.gsub(this.pattern,function(D){if(A==null){return(D[1]+"")}var F=D[1]||"";if(F=="\\"){return D[2]}var B=A,G=D[3],E=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;D=E.exec(G);if(D==null){return F}while(D!=null){var C=D[1].startsWith("[")?D[2].replace(/\\\\]/g,"]"):D[1];B=B[C];if(null==B||""==D[3]){break}G=G.substring("["==D[3]?D[1].length:D[0].length);D=E.exec(G)}return F+String.interpret(B)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function C(Y,X){var W=0;try{this._each(function(a){Y.call(X,a,W++)})}catch(Z){if(Z!=$break){throw Z}}return this}function R(Z,Y,X){var W=-Z,a=[],b=this.toArray();if(Z<1){return b}while((W+=Z)<b.length){a.push(b.slice(W,W+Z))}return a.collect(Y,X)}function B(Y,X){Y=Y||Prototype.K;var W=true;this.each(function(a,Z){W=W&&!!Y.call(X,a,Z);if(!W){throw $break}});return W}function I(Y,X){Y=Y||Prototype.K;var W=false;this.each(function(a,Z){if(W=!!Y.call(X,a,Z)){throw $break}});return W}function J(Y,X){Y=Y||Prototype.K;var W=[];this.each(function(a,Z){W.push(Y.call(X,a,Z))});return W}function T(Y,X){var W;this.each(function(a,Z){if(Y.call(X,a,Z)){W=a;throw $break}});return W}function H(Y,X){var W=[];this.each(function(a,Z){if(Y.call(X,a,Z)){W.push(a)}});return W}function G(Z,Y,X){Y=Y||Prototype.K;var W=[];if(Object.isString(Z)){Z=new RegExp(RegExp.escape(Z))}this.each(function(b,a){if(Z.match(b)){W.push(Y.call(X,b,a))}});return W}function A(W){if(Object.isFunction(this.indexOf)){if(this.indexOf(W)!=-1){return true}}var X=false;this.each(function(Y){if(Y==W){X=true;throw $break}});return X}function Q(X,W){W=Object.isUndefined(W)?null:W;return this.eachSlice(X,function(Y){while(Y.length<X){Y.push(W)}return Y})}function L(W,Y,X){this.each(function(a,Z){W=Y.call(X,W,a,Z)});return W}function V(X){var W=$A(arguments).slice(1);return this.map(function(Y){return Y[X].apply(Y,W)})}function P(Y,X){Y=Y||Prototype.K;var W;this.each(function(a,Z){a=Y.call(X,a,Z);if(W==null||a>=W){W=a}});return W}function N(Y,X){Y=Y||Prototype.K;var W;this.each(function(a,Z){a=Y.call(X,a,Z);if(W==null||a<W){W=a}});return W}function E(Z,X){Z=Z||Prototype.K;var Y=[],W=[];this.each(function(b,a){(Z.call(X,b,a)?Y:W).push(b)});return[Y,W]}function F(X){var W=[];this.each(function(Y){W.push(Y[X])});return W}function D(Y,X){var W=[];this.each(function(a,Z){if(!Y.call(X,a,Z)){W.push(a)}});return W}function M(X,W){return this.map(function(Z,Y){return{value:Z,criteria:X.call(W,Z,Y)}}).sort(function(e,d){var Z=e.criteria,Y=d.criteria;return Z<Y?-1:Z>Y?1:0}).pluck("value")}function O(){return this.map()}function S(){var X=Prototype.K,W=$A(arguments);if(Object.isFunction(W.last())){X=W.pop()}var Y=[this].concat(W).map($A);return this.map(function(a,Z){return X(Y.pluck(Z))})}function K(){return this.toArray().length}function U(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:C,eachSlice:R,all:B,every:B,any:I,some:I,collect:J,map:J,detect:T,findAll:H,select:H,filter:H,grep:G,include:A,member:A,inGroupsOf:Q,inject:L,invoke:V,max:P,min:N,partition:E,pluck:F,reject:D,sortBy:M,toArray:O,entries:O,zip:S,size:K,inspect:U,find:T}})();function $A(C){if(!C){return[]}if("toArray" in Object(C)){return C.toArray()}var B=C.length||0,A=new Array(B);while(B--){A[B]=C[B]}return A}function $w(A){if(!Object.isString(A)){return[]}A=A.strip();return A?A.split(/\s+/):[]}Array.from=$A;(function(){var R=Array.prototype,M=R.slice,O=R.forEach;function B(W,V){for(var U=0,X=this.length>>>0;U<X;U++){if(U in this){W.call(V,this[U],U,this)}}}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(U){return U!=null})}function T(){return this.inject([],function(V,U){if(Object.isArray(U)){return V.concat(U.flatten())}V.push(U);return V})}function H(){var U=M.call(arguments,0);return this.select(function(V){return !U.include(V)})}function F(U){return(U===false?this.toArray():this)._reverse()}function K(U){return this.inject([],function(X,W,V){if(0==V||(U?X.last()!=W:!X.include(W))){X.push(W)}return X})}function P(U){return this.uniq().findAll(function(V){return U.detect(function(W){return V===W})})}function Q(){return M.call(this,0)}function J(){return this.length}function S(){return"["+this.map(Object.inspect).join(", ")+"]"}function A(W,U){U||(U=0);var V=this.length;if(U<0){U=V+U}for(;U<V;U++){if(this[U]===W){return U}}return -1}function N(V,U){U=isNaN(U)?this.length:(U<0?this.length+U:U)+1;var W=this.slice(0,U).reverse().indexOf(V);return(W<0)?W:U-W-1}function C(){var Z=M.call(this,0),X;for(var V=0,W=arguments.length;V<W;V++){X=arguments[V];if(Object.isArray(X)&&!("callee" in X)){for(var U=0,Y=X.length;U<Y;U++){Z.push(X[U])}}else{Z.push(X)}}return Z}Object.extend(R,Enumerable);if(!R._reverse){R._reverse=R.reverse}Object.extend(R,{_each:O,clear:L,first:D,last:G,compact:I,flatten:T,without:H,reverse:F,uniq:K,intersect:P,clone:Q,toArray:Q,size:J,inspect:S});var E=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(E){R.concat=C}if(!R.indexOf){R.indexOf=A}if(!R.lastIndexOf){R.lastIndexOf=N}})();function $H(A){return new Hash(A)}var Hash=Class.create(Enumerable,(function(){function E(P){this._object=Object.isHash(P)?P.toObject():Object.clone(P)}function F(Q){for(var P in this._object){var R=this._object[P],S=[P,R];S.key=P;S.value=R;Q(S)}}function J(P,Q){return this._object[P]=Q}function C(P){if(this._object[P]!==Object.prototype[P]){return this._object[P]}}function M(P){var Q=this._object[P];delete this._object[P];return Q}function O(){return Object.clone(this._object)}function N(){return this.pluck("key")}function L(){return this.pluck("value")}function G(Q){var P=this.detect(function(R){return R.value===Q});return P&&P.key}function I(P){return this.clone().update(P)}function D(P){return new Hash(P).inject(this,function(Q,R){Q.set(R.key,R.value);return Q})}function B(P,Q){if(Object.isUndefined(Q)){return P}return P+"="+encodeURIComponent(String.interpret(Q))}function A(){return this.inject([],function(T,W){var S=encodeURIComponent(W.key),Q=W.value;if(Q&&typeof Q=="object"){if(Object.isArray(Q)){var V=[];for(var R=0,P=Q.length,U;R<P;R++){U=Q[R];V.push(B(S,U))}return T.concat(V)}}else{T.push(B(S,Q))}return T}).join("&")}function K(){return"#<Hash:{"+this.map(function(P){return P.map(Object.inspect).join(": ")}).join(", ")+"}>"}function H(){return new Hash(this)}return{initialize:E,_each:F,set:J,get:C,unset:M,toObject:O,toTemplateReplacements:O,keys:N,values:L,index:G,merge:I,update:D,toQueryString:A,inspect:K,toJSON:O,clone:H}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function D(){return this.toPaddedString(2,16)}function B(){return this+1}function H(J,I){$R(0,this,true).each(J,I);return this}function G(K,J){var I=this.toString(J||10);return"0".times(K-I.length)+I}function A(){return Math.abs(this)}function C(){return Math.round(this)}function E(){return Math.ceil(this)}function F(){return Math.floor(this)}return{toColorPart:D,succ:B,times:H,toPaddedString:G,abs:A,round:C,ceil:E,floor:F}})());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.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.isString(this.options.parameters)?this.options.parameters:Object.toQueryString(this.options.parameters);if(!["get","post"].include(this.method)){D+=(D?"&":"")+"_method="+this.method;this.method="post"}if(D&&this.method==="get"){this.url+=(this.url.include("?")?"&":"?")+D}this.parameters=D.toQueryParams();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)||A==304},getStatus:function(){try{if(this.transport.status===1223){return 204}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(!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){function D(F,E){if(F==="select"){return false}if("type" in E){return false}return true}var B=(function(){try{var E=document.createElement('<input name="x">');return E.tagName.toLowerCase()==="input"&&E.name==="x"}catch(F){return false}})();var A=C.Element;C.Element=function(G,F){F=F||{};G=G.toLowerCase();var E=Element.cache;if(B&&F.name){G="<"+G+' name="'+F.name+'">';delete F.name;return Element.writeAttribute(document.createElement(G),F)}if(!E[G]){E[G]=Element.extend(document.createElement(G))}var H=D(G,F)?E[G].cloneNode(false):document.createElement(G);return Element.writeAttribute(H,F)};Object.extend(C.Element,A||{});if(A){C.Element.prototype=A.prototype}})(this);Element.idCounter=1;Element.cache={};Element._purgeElement=function(B){var A=B._prototypeUID;if(A){Element.stopObserving(B);B._prototypeUID=void 0;delete Element.Storage[A]}};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 D=(function(){var G=document.createElement("select"),H=true;G.innerHTML='<option value="test">test</option>';if(G.options&&G.options[0]){H=G.options[0].nodeName.toUpperCase()!=="OPTION"}G=null;return H})();var B=(function(){try{var G=document.createElement("table");if(G&&G.tBodies){G.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var I=typeof G.tBodies[0]=="undefined";G=null;return I}}catch(H){return true}})();var A=(function(){try{var G=document.createElement("div");G.innerHTML="<link>";var I=(G.childNodes.length===0);G=null;return I}catch(H){return true}})();var C=D||B||A;var F=(function(){var G=document.createElement("script"),I=false;try{G.appendChild(document.createTextNode(""));I=!G.firstChild||G.firstChild&&G.firstChild.nodeType!==3}catch(H){I=true}G=null;return I})();function E(K,L){K=$(K);var G=Element._purgeElement;var M=K.getElementsByTagName("*"),J=M.length;while(J--){G(M[J])}if(L&&L.toElement){L=L.toElement()}if(Object.isElement(L)){return K.update().insert(L)}L=Object.toHTML(L);var I=K.tagName.toUpperCase();if(I==="SCRIPT"&&F){K.text=L;return K}if(C){if(I in Element._insertionTranslations.tags){while(K.firstChild){K.removeChild(K.firstChild)}Element._getContentFromAnonymousElement(I,L.stripScripts()).each(function(N){K.appendChild(N)})}else{if(A&&Object.isString(L)&&L.indexOf("<link")>-1){while(K.firstChild){K.removeChild(K.firstChild)}var H=Element._getContentFromAnonymousElement(I,L.stripScripts(),true);H.each(function(N){K.appendChild(N)})}else{K.innerHTML=L.stripScripts()}}}else{K.innerHTML=L.stripScripts()}L.evalScripts.bind(L).defer();return K}return E})(),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(),D=(B[E]||"").toString();if(D){A+=" "+C+"="+D.inspect(true)}});return A+">"},recursivelyCollect:function(A,C,D){A=$(A);D=D||-1;var B=[];while(A=A[C]){if(A.nodeType==1){B.push(Element.extend(A))}if(B.length==D){break}}return B},ancestors:function(A){return Element.recursivelyCollect(A,"parentNode")},descendants:function(A){return Element.select(A,"*")},firstDescendant:function(A){A=$(A).firstChild;while(A&&A.nodeType!=1){A=A.nextSibling}return $(A)},immediateDescendants:function(B){var A=[],C=$(B).firstChild;while(C){if(C.nodeType===1){A.push(Element.extend(C))}C=C.nextSibling}return A},previousSiblings:function(A,B){return Element.recursivelyCollect(A,"previousSibling")},nextSiblings:function(A){return Element.recursivelyCollect(A,"nextSibling")},siblings:function(A){A=$(A);return Element.previousSiblings(A).reverse().concat(Element.nextSiblings(A))},match:function(B,A){B=$(B);if(Object.isString(A)){return Prototype.Selector.match(B,A)}return A.match(B)},up:function(B,D,A){B=$(B);if(arguments.length==1){return $(B.parentNode)}var C=Element.ancestors(B);return Object.isNumber(D)?C[D]:Prototype.Selector.find(C,D,A)},down:function(B,C,A){B=$(B);if(arguments.length==1){return Element.firstDescendant(B)}return Object.isNumber(C)?Element.descendants(B)[C]:Element.select(B,C)[A||0]},previous:function(B,C,A){B=$(B);if(Object.isNumber(C)){A=C,C=false}if(!Object.isNumber(A)){A=0}if(C){return Prototype.Selector.find(B.previousSiblings(),C,A)}else{return B.recursivelyCollect("previousSibling",A+1)[A]}},next:function(B,D,A){B=$(B);if(Object.isNumber(D)){A=D,D=false}if(!Object.isNumber(A)){A=0}if(D){return Prototype.Selector.find(B.nextSiblings(),D,A)}else{var C=Object.isNumber(A)?A+1:1;return B.recursivelyCollect("nextSibling",A+1)[A]}},select:function(A){A=$(A);var B=Array.prototype.slice.call(arguments,1).join(", ");return Prototype.Selector.select(B,A)},adjacent:function(A){A=$(A);var B=Array.prototype.slice.call(arguments,1).join(", ");return Prototype.Selector.select(B,A.parentNode).without(A)},identify:function(A){A=$(A);var B=Element.readAttribute(A,"id");if(B){return B}do{B="anonymous_element_"+Element.idCounter++}while($(B));Element.writeAttribute(A,"id",B);return B},readAttribute:function(C,A){C=$(C);if(Prototype.Browser.IE){var B=Element._attributeTranslations.read;if(B.values[A]){return B.values[A](C,A)}if(B.names[A]){A=B.names[A]}if(A.include(":")){return(!C.attributes||!C.attributes[A])?null:C.attributes[A].value}}return C.getAttribute(A)},writeAttribute:function(E,C,F){E=$(E);var B={},D=Element._attributeTranslations.write;if(typeof C=="object"){B=C}else{B[C]=Object.isUndefined(F)?true:F}for(var A in B){C=D.names[A]||A;F=B[A];if(D.values[A]){C=D.values[A](E,F)}if(F===false||F===null){E.removeAttribute(C)}else{if(F===true){E.setAttribute(C,C)}else{E.setAttribute(C,F)}}}return E},getHeight:function(A){return Element.getDimensions(A).height},getWidth:function(A){return Element.getDimensions(A).width},classNames:function(A){return new Element.ClassNames(A)},hasClassName:function(A,B){if(!(A=$(A))){return }var C=A.className;return(C.length>0&&(C==B||new RegExp("(^|\\s)"+B+"(\\s|$)").test(C)))},addClassName:function(A,B){if(!(A=$(A))){return }if(!Element.hasClassName(A,B)){A.className+=(A.className?" ":"")+B}return A},removeClassName:function(A,B){if(!(A=$(A))){return }A.className=A.className.replace(new RegExp("(^|\\s+)"+B+"(\\s+|$)")," ").strip();return A},toggleClassName:function(A,B){if(!(A=$(A))){return }return Element[Element.hasClassName(A,B)?"removeClassName":"addClassName"](A,B)},cleanWhitespace:function(B){B=$(B);var C=B.firstChild;while(C){var A=C.nextSibling;if(C.nodeType==3&&!/\S/.test(C.nodeValue)){B.removeChild(C)}C=A}return B},empty:function(A){return $(A).innerHTML.blank()},descendantOf:function(B,A){B=$(B),A=$(A);if(B.compareDocumentPosition){return(B.compareDocumentPosition(A)&8)===8}if(A.contains){return A.contains(B)&&A!==B}while(B=B.parentNode){if(B==A){return true}}return false},scrollTo:function(A){A=$(A);var B=Element.cumulativeOffset(A);window.scrollTo(B[0],B[1]);return A},getStyle:function(B,C){B=$(B);C=C=="float"?"cssFloat":C.camelize();var D=B.style[C];if(!D||D=="auto"){var A=document.defaultView.getComputedStyle(B,null);D=A?A[C]:null}if(C=="opacity"){return D?parseFloat(D):1}return D=="auto"?null:D},getOpacity:function(A){return $(A).getStyle("opacity")},setStyle:function(B,C){B=$(B);var E=B.style,A;if(Object.isString(C)){B.style.cssText+=";"+C;return C.include("opacity")?B.setOpacity(C.match(/opacity:\s*(\d?\.?\d*)/)[1]):B}for(var D in C){if(D=="opacity"){B.setOpacity(C[D])}else{E[(D=="float"||D=="cssFloat")?(Object.isUndefined(E.styleFloat)?"cssFloat":"styleFloat"):D]=C[D]}}return B},setOpacity:function(A,B){A=$(A);A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;return A},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},clonePosition:function(B,D){var A=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});D=$(D);var E=Element.viewportOffset(D),F=[0,0],C=null;B=$(B);if(Element.getStyle(B,"position")=="absolute"){C=Element.getOffsetParent(B);F=Element.viewportOffset(C)}if(C==document.body){F[0]-=document.body.offsetLeft;F[1]-=document.body.offsetTop}if(A.setLeft){B.style.left=(E[0]-F[0]+A.offsetLeft)+"px"}if(A.setTop){B.style.top=(E[1]-F[1]+A.offsetTop)+"px"}if(A.setWidth){B.style.width=D.offsetWidth+"px"}if(A.setHeight){B.style.height=D.offsetHeight+"px"}return B}};Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(D,B,C){switch(C){case"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.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",A="for",C=document.createElement("div");C.setAttribute(B,"x");if(C.className!=="x"){C.setAttribute("class","x");if(C.className==="x"){B="class"}}C=null;C=document.createElement("label");C.setAttribute(A,"x");if(C.htmlFor!=="x"){C.setAttribute("htmlFor","x");if(C.htmlFor==="x"){A="htmlFor"}}C=null;return{read:{names:{"class":B,className:B,"for":A,htmlFor:A},values:{_getAttr:function(D,E){return D.getAttribute(E)},_getAttr2:function(D,E){return D.getAttribute(E,2)},_getAttrNode:function(D,F){var E=D.getAttributeNode(F);return E?E.value:""},_getEv:(function(){var D=document.createElement("div"),F;D.onclick=Prototype.emptyFunction;var E=D.getAttribute("onclick");if(String(E).indexOf("{")>-1){F=function(G,H){H=G.getAttribute(H);if(!H){return null}H=H.toString();H=H.split("{")[1];H=H.split("}")[0];return H.strip()}}else{if(E===""){F=function(G,H){H=G.getAttribute(H);if(!H){return null}return H.strip()}}}D=null;return F})(),_flag:function(D,E){return $(D).hasAttribute(E)?E:null},style:function(D){return D.style.cssText.toLowerCase()},title:function(D){return D.title}}}}})();Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(A,B){A.checked=!!B},style:function(A,B){A.style.cssText=B?B:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(A){Element._attributeTranslations.write.names[A.toLowerCase()]=A;Element._attributeTranslations.has[A.toLowerCase()]=A});(function(A){Object.extend(A,{href:A._getAttr2,src:A._getAttr2,type:A._getAttr,action:A._getAttrNode,disabled:A._flag,checked:A._flag,readonly:A._flag,multiple:A._flag,onload:A._getEv,onunload:A._getEv,onclick:A._getEv,ondblclick:A._getEv,onmousedown:A._getEv,onmouseup:A._getEv,onmouseover:A._getEv,onmousemove:A._getEv,onmouseout:A._getEv,onfocus:A._getEv,onblur:A._getEv,onkeypress:A._getEv,onkeydown:A._getEv,onkeyup:A._getEv,onsubmit:A._getEv,onreset:A._getEv,onselect:A._getEv,onchange:A._getEv})})(Element._attributeTranslations.read.values);if(Prototype.BrowserFeatures.ElementExtensions){(function(){function A(E){var B=E.getElementsByTagName("*"),D=[];for(var C=0,F;F=B[C];C++){if(F.tagName!=="!"){D.push(F)}}return D}Element.Methods.down=function(C,D,B){C=$(C);if(arguments.length==1){return C.firstDescendant()}return Object.isNumber(D)?A(C)[D]:Element.select(C,D)[B||0]}})()}}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(A,B){A=$(A);A.style.opacity=(B==1)?0.999999:(B==="")?"":(B<0.00001)?0:B;return A}}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(A,B){A=$(A);A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;if(B==1){if(A.tagName.toUpperCase()=="IMG"&&A.width){A.width++;A.width--}else{try{var D=document.createTextNode(" ");A.appendChild(D);A.removeChild(D)}catch(C){}}}return A}}}}}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(),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(E,D,F){var G=new Element("div"),C=Element._insertionTranslations.tags[E];var A=false;if(C){A=true}else{if(F){A=true;C=["","",0]}}if(A){G.innerHTML="&nbsp;"+C[0]+D+C[1];G.removeChild(G.firstChild);for(var B=C[2];B--;){G=G.firstChild}}else{G.innerHTML=D}return $A(G.childNodes)};Element._insertionTranslations={before:function(A,B){A.parentNode.insertBefore(B,A)},top:function(A,B){A.insertBefore(B,A.firstChild)},bottom:function(A,B){A.appendChild(B)},after:function(A,B){A.parentNode.insertBefore(B,A.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};(function(){var A=Element._insertionTranslations.tags;Object.extend(A,{THEAD:A.TBODY,TFOOT:A.TBODY,TH:A.TD})})();Element.Methods.Simulated={hasAttribute:function(A,C){C=Element._attributeTranslations.has[C]||C;var B=$(A).getAttributeNode(C);return !!(B&&B.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(A){if(!Prototype.BrowserFeatures.ElementExtensions&&A.__proto__){window.HTMLElement={};window.HTMLElement.prototype=A.__proto__;Prototype.BrowserFeatures.ElementExtensions=true}A=null})(document.createElement("div"));Element.extend=(function(){function C(G){if(typeof window.Element!="undefined"){var I=window.Element.prototype;if(I){var K="_"+(Math.random()+"").slice(2),H=document.createElement(G);I[K]="x";var J=(H[K]!=="x");delete I[K];H=null;return J}}return false}function B(H,G){for(var J in G){var I=G[J];if(Object.isFunction(I)&&!(J in H)){H[J]=I.methodize()}}}var D=C("object");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(D){return function(H){if(H&&typeof H._extendedByPrototype=="undefined"){var G=H.tagName;if(G&&(/^(?:object|applet|embed)$/i.test(G))){B(H,Element.Methods);B(H,Element.Methods.Simulated);B(H,Element.Methods.ByTag[G.toUpperCase()])}}return H}}return Prototype.K}var A={},E=Element.Methods.ByTag;var F=Object.extend(function(I){if(!I||typeof I._extendedByPrototype!="undefined"||I.nodeType!=1||I==window){return I}var G=Object.clone(A),H=I.tagName.toUpperCase();if(E[H]){Object.extend(G,E[H])}B(I,G);I._extendedByPrototype=Prototype.emptyFunction;return I},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(A,Element.Methods);Object.extend(A,Element.Methods.Simulated)}}});F.refresh();return F})();if(document.documentElement.hasAttribute){Element.hasAttribute=function(A,B){return A.hasAttribute(B)}}else{Element.hasAttribute=Element.Methods.Simulated.hasAttribute}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),BUTTON: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),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}if(!Element.Storage[A]){Element.Storage[A]=$H()}return Element.Storage[A]},store:function(B,A,C){if(!(B=$(B))){return }if(arguments.length===2){Element.getStorage(B).update(A)}else{Element.getStorage(B).set(A,C)}return B},retrieve:function(C,B,A){if(!(C=$(C))){return }var E=Element.getStorage(C),D=E.get(B);if(Object.isUndefined(D)){E.set(B,A);D=A}return D},clone:function(C,A){if(!(C=$(C))){return }var E=C.cloneNode(A);E._prototypeUID=void 0;if(A){var D=Element.select(E,"*"),B=D.length;while(B--){D[B]._prototypeUID=void 0}}return Element.extend(E)},purge:function(C){if(!(C=$(C))){return }var A=Element._purgeElement;A(C);var D=C.getElementsByTagName("*"),B=D.length;while(B--){A(D[B])}return null}});(function(){function H(V){var U=V.match(/^(\d+)%?$/i);if(!U){return null}return(Number(U[1])/100)}function O(g,h,V){var Y=null;if(Object.isElement(g)){Y=g;g=Y.getStyle(h)}if(g===null){return null}if((/^(?:-)?\d+(\.\d+)?(px)?$/i).test(g)){return window.parseFloat(g)}var a=g.include("%"),W=(V===document.viewport);if(/\d/.test(g)&&Y&&Y.runtimeStyle&&!(a&&W)){var U=Y.style.left,f=Y.runtimeStyle.left;Y.runtimeStyle.left=Y.currentStyle.left;Y.style.left=g||0;g=Y.style.pixelLeft;Y.style.left=U;Y.runtimeStyle.left=f;return g}if(Y&&a){V=V||Y.parentNode;var X=H(g);var b=null;var Z=Y.getStyle("position");var e=h.include("left")||h.include("right")||h.include("width");var d=h.include("top")||h.include("bottom")||h.include("height");if(V===document.viewport){if(e){b=document.viewport.getWidth()}else{if(d){b=document.viewport.getHeight()}}}else{if(e){b=$(V).measure("width")}else{if(d){b=$(V).measure("height")}}}return(b===null)?0:b*X}return 0}function G(U){if(Object.isString(U)&&U.endsWith("px")){return U}return U+"px"}function J(V){var U=V;while(V&&V.parentNode){var W=V.getStyle("display");if(W==="none"){return false}V=$(V.parentNode)}return true}var D=Prototype.K;if("currentStyle" in document.documentElement){D=function(U){if(!U.currentStyle.hasLayout){U.style.zoom=1}return U}}function F(U){if(U.include("border")){U=U+"-width"}return U.camelize()}Element.Layout=Class.create(Hash,{initialize:function($super,V,U){$super();this.element=$(V);Element.Layout.PROPERTIES.each(function(W){this._set(W,null)},this);if(U){this._preComputing=true;this._begin();Element.Layout.PROPERTIES.each(this._compute,this);this._end();this._preComputing=false}},_set:function(V,U){return Hash.prototype.set.call(this,V,U)},set:function(V,U){throw"Properties of Element.Layout are read-only."},get:function($super,V){var U=$super(V);return U===null?this._compute(V):U},_begin:function(){if(this._prepared){return }var Y=this.element;if(J(Y)){this._prepared=true;return }var a={position:Y.style.position||"",width:Y.style.width||"",visibility:Y.style.visibility||"",display:Y.style.display||""};Y.store("prototype_original_styles",a);var b=Y.getStyle("position"),U=Y.getStyle("width");if(U==="0px"||U===null){Y.style.display="block";U=Y.getStyle("width")}var V=(b==="fixed")?document.viewport:Y.parentNode;Y.setStyle({position:"absolute",visibility:"hidden",display:"block"});var W=Y.getStyle("width");var X;if(U&&(W===U)){X=O(Y,"width",V)}else{if(b==="absolute"||b==="fixed"){X=O(Y,"width",V)}else{var d=Y.parentNode,Z=$(d).getLayout();X=Z.get("width")-this.get("margin-left")-this.get("border-left")-this.get("padding-left")-this.get("padding-right")-this.get("border-right")-this.get("margin-right")}}Y.setStyle({width:X+"px"});this._prepared=true},_end:function(){var V=this.element;var U=V.retrieve("prototype_original_styles");V.store("prototype_original_styles",null);V.setStyle(U);this._prepared=false},_compute:function(V){var U=Element.Layout.COMPUTATIONS;if(!(V in U)){throw"Property not found."}return this._set(V,U[V].call(this,this.element))},toObject:function(){var U=$A(arguments);var V=(U.length===0)?Element.Layout.PROPERTIES:U.join(" ").split(" ");var W={};V.each(function(X){if(!Element.Layout.PROPERTIES.include(X)){return }var Y=this.get(X);if(Y!=null){W[X]=Y}},this);return W},toHash:function(){var U=this.toObject.apply(this,arguments);return new Hash(U)},toCSS:function(){var U=$A(arguments);var W=(U.length===0)?Element.Layout.PROPERTIES:U.join(" ").split(" ");var V={};W.each(function(X){if(!Element.Layout.PROPERTIES.include(X)){return }if(Element.Layout.COMPOSITE_PROPERTIES.include(X)){return }var Y=this.get(X);if(Y!=null){V[F(X)]=Y+"px"}},this);return V},inspect:function(){return"#<Element.Layout>"}});Object.extend(Element.Layout,{PROPERTIES:$w("height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height"),COMPOSITE_PROPERTIES:$w("padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height"),COMPUTATIONS:{height:function(W){if(!this._preComputing){this._begin()}var U=this.get("border-box-height");if(U<=0){if(!this._preComputing){this._end()}return 0}var X=this.get("border-top"),V=this.get("border-bottom");var Z=this.get("padding-top"),Y=this.get("padding-bottom");if(!this._preComputing){this._end()}return U-X-V-Z-Y},width:function(W){if(!this._preComputing){this._begin()}var V=this.get("border-box-width");if(V<=0){if(!this._preComputing){this._end()}return 0}var Z=this.get("border-left"),U=this.get("border-right");var X=this.get("padding-left"),Y=this.get("padding-right");if(!this._preComputing){this._end()}return V-Z-U-X-Y},"padding-box-height":function(V){var U=this.get("height"),X=this.get("padding-top"),W=this.get("padding-bottom");return U+X+W},"padding-box-width":function(U){var V=this.get("width"),W=this.get("padding-left"),X=this.get("padding-right");return V+W+X},"border-box-height":function(V){if(!this._preComputing){this._begin()}var U=V.offsetHeight;if(!this._preComputing){this._end()}return U},"border-box-width":function(U){if(!this._preComputing){this._begin()}var V=U.offsetWidth;if(!this._preComputing){this._end()}return V},"margin-box-height":function(V){var U=this.get("border-box-height"),W=this.get("margin-top"),X=this.get("margin-bottom");if(U<=0){return 0}return U+W+X},"margin-box-width":function(W){var V=this.get("border-box-width"),X=this.get("margin-left"),U=this.get("margin-right");if(V<=0){return 0}return V+X+U},top:function(U){var V=U.positionedOffset();return V.top},bottom:function(U){var X=U.positionedOffset(),V=U.getOffsetParent(),W=V.measure("height");var Y=this.get("border-box-height");return W-Y-X.top},left:function(U){var V=U.positionedOffset();return V.left},right:function(W){var Y=W.positionedOffset(),X=W.getOffsetParent(),U=X.measure("width");var V=this.get("border-box-width");return U-V-Y.left},"padding-top":function(U){return O(U,"paddingTop")},"padding-bottom":function(U){return O(U,"paddingBottom")},"padding-left":function(U){return O(U,"paddingLeft")},"padding-right":function(U){return O(U,"paddingRight")},"border-top":function(U){return O(U,"borderTopWidth")},"border-bottom":function(U){return O(U,"borderBottomWidth")},"border-left":function(U){return O(U,"borderLeftWidth")},"border-right":function(U){return O(U,"borderRightWidth")},"margin-top":function(U){return O(U,"marginTop")},"margin-bottom":function(U){return O(U,"marginBottom")},"margin-left":function(U){return O(U,"marginLeft")},"margin-right":function(U){return O(U,"marginRight")}}});if("getBoundingClientRect" in document.documentElement){Object.extend(Element.Layout.COMPUTATIONS,{right:function(V){var W=D(V.getOffsetParent());var X=V.getBoundingClientRect(),U=W.getBoundingClientRect();return(U.right-X.right).round()},bottom:function(V){var W=D(V.getOffsetParent());var X=V.getBoundingClientRect(),U=W.getBoundingClientRect();return(U.bottom-X.bottom).round()}})}Element.Offset=Class.create({initialize:function(V,U){this.left=V.round();this.top=U.round();this[0]=this.left;this[1]=this.top},relativeTo:function(U){return new Element.Offset(this.left-U.left,this.top-U.top)},inspect:function(){return"#<Element.Offset left: #{left} top: #{top}>".interpolate(this)},toString:function(){return"[#{left}, #{top}]".interpolate(this)},toArray:function(){return[this.left,this.top]}});function R(V,U){return new Element.Layout(V,U)}function B(U,V){return $(U).getLayout().get(V)}function N(V){V=$(V);var Z=Element.getStyle(V,"display");if(Z&&Z!=="none"){return{width:V.offsetWidth,height:V.offsetHeight}}var W=V.style;var U={visibility:W.visibility,position:W.position,display:W.display};var Y={visibility:"hidden",display:"block"};if(U.position!=="fixed"){Y.position="absolute"}Element.setStyle(V,Y);var X={width:V.offsetWidth,height:V.offsetHeight};Element.setStyle(V,U);return X}function L(U){U=$(U);if(E(U)||C(U)||M(U)||K(U)){return $(document.body)}var V=(Element.getStyle(U,"display")==="inline");if(!V&&U.offsetParent){return $(U.offsetParent)}while((U=U.parentNode)&&U!==document.body){if(Element.getStyle(U,"position")!=="static"){return K(U)?$(document.body):$(U)}}return $(document.body)}function T(V){V=$(V);var U=0,W=0;if(V.parentNode){do{U+=V.offsetTop||0;W+=V.offsetLeft||0;V=V.offsetParent}while(V)}return new Element.Offset(W,U)}function P(V){V=$(V);var W=V.getLayout();var U=0,Y=0;do{U+=V.offsetTop||0;Y+=V.offsetLeft||0;V=V.offsetParent;if(V){if(M(V)){break}var X=Element.getStyle(V,"position");if(X!=="static"){break}}}while(V);Y-=W.get("margin-top");U-=W.get("margin-left");return new Element.Offset(Y,U)}function A(V){var U=0,W=0;do{U+=V.scrollTop||0;W+=V.scrollLeft||0;V=V.parentNode}while(V);return new Element.Offset(W,U)}function S(Y){V=$(V);var U=0,X=0,W=document.body;var V=Y;do{U+=V.offsetTop||0;X+=V.offsetLeft||0;if(V.offsetParent==W&&Element.getStyle(V,"position")=="absolute"){break}}while(V=V.offsetParent);V=Y;do{if(V!=W){U-=V.scrollTop||0;X-=V.scrollLeft||0}}while(V=V.parentNode);return new Element.Offset(X,U)}function Q(U){U=$(U);if(Element.getStyle(U,"position")==="absolute"){return U}var Y=L(U);var X=U.viewportOffset(),V=Y.viewportOffset();var Z=X.relativeTo(V);var W=U.getLayout();U.store("prototype_absolutize_original_styles",{left:U.getStyle("left"),top:U.getStyle("top"),width:U.getStyle("width"),height:U.getStyle("height")});U.setStyle({position:"absolute",top:Z.top+"px",left:Z.left+"px",width:W.get("width")+"px",height:W.get("height")+"px"});return U}function I(V){V=$(V);if(Element.getStyle(V,"position")==="relative"){return V}var U=V.retrieve("prototype_absolutize_original_styles");if(U){V.setStyle(U)}return V}if(Prototype.Browser.IE){L=L.wrap(function(W,V){V=$(V);if(E(V)||C(V)||M(V)||K(V)){return $(document.body)}var U=V.getStyle("position");if(U!=="static"){return W(V)}V.setStyle({position:"relative"});var X=W(V);V.setStyle({position:U});return X});P=P.wrap(function(X,V){V=$(V);if(!V.parentNode){return new Element.Offset(0,0)}var U=V.getStyle("position");if(U!=="static"){return X(V)}var W=V.getOffsetParent();if(W&&W.getStyle("position")==="fixed"){D(W)}V.setStyle({position:"relative"});var Y=X(V);V.setStyle({position:U});return Y})}else{if(Prototype.Browser.Webkit){T=function(V){V=$(V);var U=0,W=0;do{U+=V.offsetTop||0;W+=V.offsetLeft||0;if(V.offsetParent==document.body){if(Element.getStyle(V,"position")=="absolute"){break}}V=V.offsetParent}while(V);return new Element.Offset(W,U)}}}Element.addMethods({getLayout:R,measure:B,getDimensions:N,getOffsetParent:L,cumulativeOffset:T,positionedOffset:P,cumulativeScrollOffset:A,viewportOffset:S,absolutize:Q,relativize:I});function M(U){return U.nodeName.toUpperCase()==="BODY"}function K(U){return U.nodeName.toUpperCase()==="HTML"}function E(U){return U.nodeType===Node.DOCUMENT_NODE}function C(U){return U!==document.body&&!Element.descendantOf(U,document.body)}if("getBoundingClientRect" in document.documentElement){Element.addMethods({viewportOffset:function(U){U=$(U);if(C(U)){return new Element.Offset(0,0)}var V=U.getBoundingClientRect(),W=document.documentElement;return new Element.Offset(V.left-W.clientLeft,V.top-W.clientTop)}})}})();window.$$=function(){var A=$A(arguments).join(", ");return Prototype.Selector.select(A,document)};Prototype.Selector=(function(){function A(){throw new Error('Method "Prototype.Selector.select" must be defined.')}function C(){throw new Error('Method "Prototype.Selector.match" must be defined.')}function D(K,L,H){H=H||0;var G=Prototype.Selector.match,J=K.length,F=0,I;for(I=0;I<J;I++){if(G(K[I],L)&&H==F++){return Element.extend(K[I])}}}function E(H){for(var F=0,G=H.length;F<G;F++){Element.extend(H[F])}return H}var B=Prototype.K;return{select:A,match:C,find:D,extendElements:(Element.extend===B)?B:E,extendElement:Element.extend}})();Prototype._original_property=window.Sizzle;
/*
 * Sizzle CSS Selector Engine - v1.0
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var P=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,I=0,D=Object.prototype.toString,N=false,H=true;[0,0].sort(function(){H=false;return 0});var B=function(f,U,b,W){b=b||[];var R=U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!f||typeof f!=="string"){return b}var d=[],e,Z,k,j,a,T,S=true,X=O(U),h=f;while((P.exec(""),e=P.exec(h))!==null){h=e[3];d.push(e[1]);if(e[2]){T=e[3];break}}if(d.length>1&&J.exec(f)){if(d.length===2&&E.relative[d[0]]){Z=F(d[0]+d[1],U)}else{Z=E.relative[d[0]]?[U]:B(d.shift(),U);while(d.length){f=d.shift();if(E.relative[f]){f+=d.shift()}Z=F(f,Z)}}}else{if(!W&&d.length>1&&U.nodeType===9&&!X&&E.match.ID.test(d[0])&&!E.match.ID.test(d[d.length-1])){var l=B.find(d.shift(),U,X);U=l.expr?B.filter(l.expr,l.set)[0]:l.set[0]}if(U){var l=W?{expr:d.pop(),set:A(W)}:B.find(d.pop(),d.length===1&&(d[0]==="~"||d[0]==="+")&&U.parentNode?U.parentNode:U,X);Z=l.expr?B.filter(l.expr,l.set):l.set;if(d.length>0){k=A(Z)}else{S=false}while(d.length){var V=d.pop(),Y=V;if(!E.relative[V]){V=""}else{Y=d.pop()}if(Y==null){Y=U}E.relative[V](k,Y,X)}}else{k=d=[]}}if(!k){k=Z}if(!k){throw"Syntax error, unrecognized expression: "+(V||f)}if(D.call(k)==="[object Array]"){if(!S){b.push.apply(b,k)}else{if(U&&U.nodeType===1){for(var g=0;k[g]!=null;g++){if(k[g]&&(k[g]===true||k[g].nodeType===1&&G(U,k[g]))){b.push(Z[g])}}}else{for(var g=0;k[g]!=null;g++){if(k[g]&&k[g].nodeType===1){b.push(Z[g])}}}}}else{A(k,b)}if(T){B(T,R,b,W);B.uniqueSort(b)}return b};B.uniqueSort=function(S){if(C){N=H;S.sort(C);if(N){for(var R=1;R<S.length;R++){if(S[R]===S[R-1]){S.splice(R--,1)}}}}return S};B.matches=function(R,S){return B(R,null,null,S)};B.find=function(Y,R,Z){var X,V;if(!Y){return[]}for(var U=0,T=E.order.length;U<T;U++){var W=E.order[U],V;if((V=E.leftMatch[W].exec(Y))){var S=V[1];V.splice(1,1);if(S.substr(S.length-1)!=="\\"){V[1]=(V[1]||"").replace(/\\/g,"");X=E.find[W](V,R,Z);if(X!=null){Y=Y.replace(E.match[W],"");break}}}}if(!X){X=R.getElementsByTagName("*")}return{set:X,expr:Y}};B.filter=function(b,a,f,U){var T=b,h=[],Y=a,W,R,X=a&&a[0]&&O(a[0]);while(b&&a.length){for(var Z in E.filter){if((W=E.match[Z].exec(b))!=null){var S=E.filter[Z],g,e;R=false;if(Y==h){h=[]}if(E.preFilter[Z]){W=E.preFilter[Z](W,Y,f,h,U,X);if(!W){R=g=true}else{if(W===true){continue}}}if(W){for(var V=0;(e=Y[V])!=null;V++){if(e){g=S(e,W,V,Y);var d=U^!!g;if(f&&g!=null){if(d){R=true}else{Y[V]=false}}else{if(d){h.push(e);R=true}}}}}if(g!==undefined){if(!f){Y=h}b=b.replace(E.match[Z],"");if(!R){return[]}break}}}if(b==T){if(R==null){throw"Syntax error, unrecognized expression: "+b}else{break}}T=b}return Y};var E=B.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(R){return R.getAttribute("href")}},relative:{"+":function(Y,R,X){var V=typeof R==="string",Z=V&&!/\W/.test(R),W=V&&!Z;if(Z&&!X){R=R.toUpperCase()}for(var U=0,T=Y.length,S;U<T;U++){if((S=Y[U])){while((S=S.previousSibling)&&S.nodeType!==1){}Y[U]=W||S&&S.nodeName===R?S||false:S===R}}if(W){B.filter(R,Y,true)}},">":function(X,S,Y){var V=typeof S==="string";if(V&&!/\W/.test(S)){S=Y?S:S.toUpperCase();for(var T=0,R=X.length;T<R;T++){var W=X[T];if(W){var U=W.parentNode;X[T]=U.nodeName===S?U:false}}}else{for(var T=0,R=X.length;T<R;T++){var W=X[T];if(W){X[T]=V?W.parentNode:W.parentNode===S}}if(V){B.filter(S,X,true)}}},"":function(U,S,W){var T=I++,R=Q;if(!/\W/.test(S)){var V=S=W?S:S.toUpperCase();R=M}R("parentNode",S,T,U,V,W)},"~":function(U,S,W){var T=I++,R=Q;if(typeof S==="string"&&!/\W/.test(S)){var V=S=W?S:S.toUpperCase();R=M}R("previousSibling",S,T,U,V,W)}},find:{ID:function(S,T,U){if(typeof T.getElementById!=="undefined"&&!U){var R=T.getElementById(S[1]);return R?[R]:[]}},NAME:function(T,W,X){if(typeof W.getElementsByName!=="undefined"){var S=[],V=W.getElementsByName(T[1]);for(var U=0,R=V.length;U<R;U++){if(V[U].getAttribute("name")===T[1]){S.push(V[U])}}return S.length===0?null:S}},TAG:function(R,S){return S.getElementsByTagName(R[1])}},preFilter:{CLASS:function(U,S,T,R,X,Y){U=" "+U[1].replace(/\\/g,"")+" ";if(Y){return U}for(var V=0,W;(W=S[V])!=null;V++){if(W){if(X^(W.className&&(" "+W.className+" ").indexOf(U)>=0)){if(!T){R.push(W)}}else{if(T){S[V]=false}}}}return false},ID:function(R){return R[1].replace(/\\/g,"")},TAG:function(S,R){for(var T=0;R[T]===false;T++){}return R[T]&&O(R[T])?S[1]:S[1].toUpperCase()},CHILD:function(R){if(R[1]=="nth"){var S=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(R[2]=="even"&&"2n"||R[2]=="odd"&&"2n+1"||!/\D/.test(R[2])&&"0n+"+R[2]||R[2]);R[2]=(S[1]+(S[2]||1))-0;R[3]=S[3]-0}R[0]=I++;return R},ATTR:function(V,S,T,R,W,X){var U=V[1].replace(/\\/g,"");if(!X&&E.attrMap[U]){V[1]=E.attrMap[U]}if(V[2]==="~="){V[4]=" "+V[4]+" "}return V},PSEUDO:function(V,S,T,R,W){if(V[1]==="not"){if((P.exec(V[3])||"").length>1||/^\w/.test(V[3])){V[3]=B(V[3],null,null,S)}else{var U=B.filter(V[3],S,T,true^W);if(!T){R.push.apply(R,U)}return false}}else{if(E.match.POS.test(V[0])||E.match.CHILD.test(V[0])){return true}}return V},POS:function(R){R.unshift(true);return R}},filters:{enabled:function(R){return R.disabled===false&&R.type!=="hidden"},disabled:function(R){return R.disabled===true},checked:function(R){return R.checked===true},selected:function(R){R.parentNode.selectedIndex;return R.selected===true},parent:function(R){return !!R.firstChild},empty:function(R){return !R.firstChild},has:function(T,S,R){return !!B(R[3],T).length},header:function(R){return/h\d/i.test(R.nodeName)},text:function(R){return"text"===R.type},radio:function(R){return"radio"===R.type},checkbox:function(R){return"checkbox"===R.type},file:function(R){return"file"===R.type},password:function(R){return"password"===R.type},submit:function(R){return"submit"===R.type},image:function(R){return"image"===R.type},reset:function(R){return"reset"===R.type},button:function(R){return"button"===R.type||R.nodeName.toUpperCase()==="BUTTON"},input:function(R){return/input|select|textarea|button/i.test(R.nodeName)}},setFilters:{first:function(S,R){return R===0},last:function(T,S,R,U){return S===U.length-1},even:function(S,R){return R%2===0},odd:function(S,R){return R%2===1},lt:function(T,S,R){return S<R[3]-0},gt:function(T,S,R){return S>R[3]-0},nth:function(T,S,R){return R[3]-0==S},eq:function(T,S,R){return R[3]-0==S}},filter:{PSEUDO:function(X,T,U,Y){var S=T[1],V=E.filters[S];if(V){return V(X,U,T,Y)}else{if(S==="contains"){return(X.textContent||X.innerText||"").indexOf(T[3])>=0}else{if(S==="not"){var W=T[3];for(var U=0,R=W.length;U<R;U++){if(W[U]===X){return false}}return true}}}},CHILD:function(R,U){var X=U[1],S=R;switch(X){case"only":case"first":while((S=S.previousSibling)){if(S.nodeType===1){return false}}if(X=="first"){return true}S=R;case"last":while((S=S.nextSibling)){if(S.nodeType===1){return false}}return true;case"nth":var T=U[2],a=U[3];if(T==1&&a==0){return true}var W=U[0],Z=R.parentNode;if(Z&&(Z.sizcache!==W||!R.nodeIndex)){var V=0;for(S=Z.firstChild;S;S=S.nextSibling){if(S.nodeType===1){S.nodeIndex=++V}}Z.sizcache=W}var Y=R.nodeIndex-a;if(T==0){return Y==0}else{return(Y%T==0&&Y/T>=0)}}},ID:function(S,R){return S.nodeType===1&&S.getAttribute("id")===R},TAG:function(S,R){return(R==="*"&&S.nodeType===1)||S.nodeName===R},CLASS:function(S,R){return(" "+(S.className||S.getAttribute("class"))+" ").indexOf(R)>-1},ATTR:function(W,U){var T=U[1],R=E.attrHandle[T]?E.attrHandle[T](W):W[T]!=null?W[T]:W.getAttribute(T),X=R+"",V=U[2],S=U[4];return R==null?V==="!=":V==="="?X===S:V==="*="?X.indexOf(S)>=0:V==="~="?(" "+X+" ").indexOf(S)>=0:!S?X&&R!==false:V==="!="?X!=S:V==="^="?X.indexOf(S)===0:V==="$="?X.substr(X.length-S.length)===S:V==="|="?X===S||X.substr(0,S.length+1)===S+"-":false},POS:function(V,S,T,W){var R=S[2],U=E.setFilters[R];if(U){return U(V,T,S,W)}}}};var J=E.match.POS;for(var L in E.match){E.match[L]=new RegExp(E.match[L].source+/(?![^\[]*\])(?![^\(]*\))/.source);E.leftMatch[L]=new RegExp(/(^(?:.|\r|\n)*?)/.source+E.match[L].source)}var A=function(S,R){S=Array.prototype.slice.call(S,0);if(R){R.push.apply(R,S);return R}return S};try{Array.prototype.slice.call(document.documentElement.childNodes,0)}catch(K){A=function(V,U){var S=U||[];if(D.call(V)==="[object Array]"){Array.prototype.push.apply(S,V)}else{if(typeof V.length==="number"){for(var T=0,R=V.length;T<R;T++){S.push(V[T])}}else{for(var T=0;V[T];T++){S.push(V[T])}}}return S}}var C;if(document.documentElement.compareDocumentPosition){C=function(S,R){if(!S.compareDocumentPosition||!R.compareDocumentPosition){if(S==R){N=true}return 0}var T=S.compareDocumentPosition(R)&4?-1:S===R?0:1;if(T===0){N=true}return T}}else{if("sourceIndex" in document.documentElement){C=function(S,R){if(!S.sourceIndex||!R.sourceIndex){if(S==R){N=true}return 0}var T=S.sourceIndex-R.sourceIndex;if(T===0){N=true}return T}}else{if(document.createRange){C=function(U,S){if(!U.ownerDocument||!S.ownerDocument){if(U==S){N=true}return 0}var T=U.ownerDocument.createRange(),R=S.ownerDocument.createRange();T.setStart(U,0);T.setEnd(U,0);R.setStart(S,0);R.setEnd(S,0);var V=T.compareBoundaryPoints(Range.START_TO_END,R);if(V===0){N=true}return V}}}}(function(){var S=document.createElement("div"),T="script"+(new Date).getTime();S.innerHTML="<a name='"+T+"'/>";var R=document.documentElement;R.insertBefore(S,R.firstChild);if(!!document.getElementById(T)){E.find.ID=function(V,W,X){if(typeof W.getElementById!=="undefined"&&!X){var U=W.getElementById(V[1]);return U?U.id===V[1]||typeof U.getAttributeNode!=="undefined"&&U.getAttributeNode("id").nodeValue===V[1]?[U]:undefined:[]}};E.filter.ID=function(W,U){var V=typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id");return W.nodeType===1&&V&&V.nodeValue===U}}R.removeChild(S);R=S=null})();(function(){var R=document.createElement("div");R.appendChild(document.createComment(""));if(R.getElementsByTagName("*").length>0){E.find.TAG=function(S,W){var V=W.getElementsByTagName(S[1]);if(S[1]==="*"){var U=[];for(var T=0;V[T];T++){if(V[T].nodeType===1){U.push(V[T])}}V=U}return V}}R.innerHTML="<a href='#'></a>";if(R.firstChild&&typeof R.firstChild.getAttribute!=="undefined"&&R.firstChild.getAttribute("href")!=="#"){E.attrHandle.href=function(S){return S.getAttribute("href",2)}}R=null})();if(document.querySelectorAll){(function(){var R=B,T=document.createElement("div");T.innerHTML="<p class='TEST'></p>";if(T.querySelectorAll&&T.querySelectorAll(".TEST").length===0){return }B=function(X,W,U,V){W=W||document;if(!V&&W.nodeType===9&&!O(W)){try{return A(W.querySelectorAll(X),U)}catch(Y){}}return R(X,W,U,V)};for(var S in R){B[S]=R[S]}T=null})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var R=document.createElement("div");R.innerHTML="<div class='test e'></div><div class='test'></div>";if(R.getElementsByClassName("e").length===0){return }R.lastChild.className="e";if(R.getElementsByClassName("e").length===1){return }E.order.splice(1,0,"CLASS");E.find.CLASS=function(S,T,U){if(typeof T.getElementsByClassName!=="undefined"&&!U){return T.getElementsByClassName(S[1])}};R=null})()}function M(S,X,W,b,Y,a){var Z=S=="previousSibling"&&!a;for(var U=0,T=b.length;U<T;U++){var R=b[U];if(R){if(Z&&R.nodeType===1){R.sizcache=W;R.sizset=U}R=R[S];var V=false;while(R){if(R.sizcache===W){V=b[R.sizset];break}if(R.nodeType===1&&!a){R.sizcache=W;R.sizset=U}if(R.nodeName===X){V=R;break}R=R[S]}b[U]=V}}}function Q(S,X,W,b,Y,a){var Z=S=="previousSibling"&&!a;for(var U=0,T=b.length;U<T;U++){var R=b[U];if(R){if(Z&&R.nodeType===1){R.sizcache=W;R.sizset=U}R=R[S];var V=false;while(R){if(R.sizcache===W){V=b[R.sizset];break}if(R.nodeType===1){if(!a){R.sizcache=W;R.sizset=U}if(typeof X!=="string"){if(R===X){V=true;break}}else{if(B.filter(X,[R]).length>0){V=R;break}}}R=R[S]}b[U]=V}}}var G=document.compareDocumentPosition?function(S,R){return S.compareDocumentPosition(R)&16}:function(S,R){return S!==R&&(S.contains?S.contains(R):true)};var O=function(R){return R.nodeType===9&&R.documentElement.nodeName!=="HTML"||!!R.ownerDocument&&R.ownerDocument.documentElement.nodeName!=="HTML"};var F=function(R,Y){var U=[],V="",W,T=Y.nodeType?[Y]:Y;while((W=E.match.PSEUDO.exec(R))){V+=W[0];R=R.replace(E.match.PSEUDO,"")}R=E.relative[R]?R+"*":R;for(var X=0,S=T.length;X<S;X++){B(R,T[X],U)}return B.filter(V,U)};window.Sizzle=B})();(function(C){var D=Prototype.Selector.extendElements;function A(E,F){return D(C(E,F||document))}function B(F,E){return C.matches(E,[F]).length==1}Prototype.Selector.engine=C;Prototype.Selector.select=A;Prototype.Selector.match=B})(Sizzle);window.Sizzle=Prototype._original_property;delete Prototype._original_property;var Form={reset:function(A){A=$(A);A.reset();return A},serializeElements:function(H,D){if(typeof D!="object"){D={hash:!!D}}else{if(Object.isUndefined(D.hash)){D.hash=true}}var E,G,A=false,F=D.submit,B,C;if(D.hash){C={};B=function(I,J,K){if(J in I){if(!Object.isArray(I[J])){I[J]=[I[J]]}I[J].push(K)}else{I[J]=K}return I}}else{C="";B=function(I,J,K){return I+(I?"&":"")+encodeURIComponent(J)+"="+encodeURIComponent(K)}}return H.inject(C,function(I,J){if(!J.disabled&&J.name){E=J.name;G=$(J).getValue();if(G!=null&&J.type!="file"&&(J.type!="submit"||(!A&&F!==false&&(!F||E==F)&&(A=true)))){I=B(I,E,G)}}return I})}};Form.Methods={serialize:function(B,A){return Form.serializeElements(Form.getElements(B),A)},getElements:function(E){var F=$(E).getElementsByTagName("*"),D,A=[],C=Form.Element.Serializers;for(var B=0;D=F[B];B++){A.push(D)}return A.inject([],function(G,H){if(C[H.tagName.toLowerCase()]){G.push(Element.extend(H))}return G})},getInputs:function(G,C,D){G=$(G);var A=G.getElementsByTagName("input");if(!C&&!D){return $A(A).map(Element.extend)}for(var E=0,H=[],F=A.length;E<F;E++){var B=A[E];if((C&&B.type!=C)||(D&&B.name!=D)){continue}H.push(Element.extend(B))}return H},disable:function(A){A=$(A);Form.getElements(A).invoke("disable");return A},enable:function(A){A=$(A);Form.getElements(A).invoke("enable");return A},findFirstElement:function(B){var C=$(B).getElements().findAll(function(D){return"hidden"!=D.type&&!D.disabled});var A=C.findAll(function(D){return D.hasAttribute("tabIndex")&&D.tabIndex>=0}).sortBy(function(D){return D.tabIndex}).first();return A?A:C.find(function(D){return/^(?:input|select|textarea)$/i.test(D.tagName)})},focusFirstElement:function(B){B=$(B);var A=B.findFirstElement();if(A){A.activate()}return B},request:function(B,A){B=$(B),A=Object.clone(A||{});var D=A.parameters,C=B.readAttribute("action")||"";if(C.blank()){C=window.location.href}A.parameters=B.serialize(true);if(D){if(Object.isString(D)){D=D.toQueryParams()}Object.extend(A.parameters,D)}if(B.hasAttribute("method")&&!A.method){A.method=B.method}return new Ajax.Request(C,A)}};Form.Element={focus:function(A){$(A).focus();return A},select:function(A){$(A).select();return A}};Form.Element.Methods={serialize:function(A){A=$(A);if(!A.disabled&&A.name){var B=A.getValue();if(B!=undefined){var C={};C[A.name]=B;return Object.toQueryString(C)}}return""},getValue:function(A){A=$(A);var B=A.tagName.toLowerCase();return Form.Element.Serializers[B](A)},setValue:function(A,B){A=$(A);var C=A.tagName.toLowerCase();Form.Element.Serializers[C](A,B);return A},clear:function(A){$(A).value="";return A},present:function(A){return $(A).value!=""},activate:function(A){A=$(A);try{A.focus();if(A.select&&(A.tagName.toLowerCase()!="input"||!(/^(?:button|reset|submit)$/i.test(A.type)))){A.select()}}catch(B){}return A},disable:function(A){A=$(A);A.disabled=true;return A},enable:function(A){A=$(A);A.disabled=false;return A}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers=(function(){function B(H,I){switch(H.type.toLowerCase()){case"checkbox":case"radio":return F(H,I);default:return E(H,I)}}function F(H,I){if(Object.isUndefined(I)){return H.checked?H.value:null}else{H.checked=!!I}}function E(H,I){if(Object.isUndefined(I)){return H.value}else{H.value=I}}function A(J,M){if(Object.isUndefined(M)){return(J.type==="select-one"?C:D)(J)}var I,K,N=!Object.isArray(M);for(var H=0,L=J.length;H<L;H++){I=J.options[H];K=this.optionValue(I);if(N){if(K==M){I.selected=true;return }}else{I.selected=M.include(K)}}}function C(I){var H=I.selectedIndex;return H>=0?G(I.options[H]):null}function D(K){var H,L=K.length;if(!L){return null}for(var J=0,H=[];J<L;J++){var I=K.options[J];if(I.selected){H.push(G(I))}}return H}function G(H){return Element.hasAttribute(H,"value")?H.value:H.text}return{input:B,inputSelector:F,textarea:E,select:A,selectOne:C,selectMany:D,optionValue:G,button:E}})();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 d={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 F=document.documentElement;var e="onmouseenter" in F&&"onmouseleave" in F;var A=function(f){return false};if(window.attachEvent){if(window.addEventListener){A=function(f){return !(f instanceof window.Event)}}else{A=function(f){return true}}}var R;function a(g,f){return g.which?(g.which===f+1):(g.button===f)}var O={0:1,1:4,2:2};function Y(g,f){return g.button===O[f]}function b(g,f){switch(f){case 0:return g.which==1&&!g.metaKey;case 1:return g.which==2||(g.which==1&&g.metaKey);case 2:return g.which==3;default:return false}}if(window.attachEvent){if(!window.addEventListener){R=Y}else{R=function(g,f){return A(g)?Y(g,f):a(g,f)}}}else{if(Prototype.Browser.WebKit){R=b}else{R=a}}function V(f){return R(f,0)}function T(f){return R(f,1)}function N(f){return R(f,2)}function D(h){h=d.extend(h);var g=h.target,f=h.type,j=h.currentTarget;if(j&&j.tagName){if(f==="load"||f==="error"||(f==="click"&&j.tagName.toLowerCase()==="input"&&j.type==="radio")){g=j}}if(g.nodeType==Node.TEXT_NODE){g=g.parentNode}return Element.extend(g)}function P(g,h){var f=d.element(g);if(!h){return f}while(f){if(Object.isElement(f)&&Prototype.Selector.match(f,h)){return Element.extend(f)}f=f.parentNode}}function S(f){return{x:C(f),y:B(f)}}function C(h){var g=document.documentElement,f=document.body||{scrollLeft:0};return h.pageX||(h.clientX+(g.scrollLeft||f.scrollLeft)-(g.clientLeft||0))}function B(h){var g=document.documentElement,f=document.body||{scrollTop:0};return h.pageY||(h.clientY+(g.scrollTop||f.scrollTop)-(g.clientTop||0))}function Q(f){d.extend(f);f.preventDefault();f.stopPropagation();f.stopped=true}d.Methods={isLeftClick:V,isMiddleClick:T,isRightClick:N,element:D,findElement:P,pointer:S,pointerX:C,pointerY:B,stop:Q};var X=Object.keys(d.Methods).inject({},function(f,g){f[g]=d.Methods[g].methodize();return f});if(window.attachEvent){function I(g){var f;switch(g.type){case"mouseover":case"mouseenter":f=g.fromElement;break;case"mouseout":case"mouseleave":f=g.toElement;break;default:return null}return Element.extend(f)}var U={stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}};d.extend=function(g,f){if(!g){return false}if(!A(g)){return g}if(g._extendedByPrototype){return g}g._extendedByPrototype=Prototype.emptyFunction;var h=d.pointer(g);Object.extend(g,{target:g.srcElement||f,relatedTarget:I(g),pageX:h.x,pageY:h.y});Object.extend(g,X);Object.extend(g,U);return g}}else{d.extend=Prototype.K}if(window.addEventListener){d.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(d.prototype,X)}function M(k,j,l){var h=Element.retrieve(k,"prototype_event_registry");if(Object.isUndefined(h)){E.push(k);h=Element.retrieve(k,"prototype_event_registry",$H())}var f=h.get(j);if(Object.isUndefined(f)){f=[];h.set(j,f)}if(f.pluck("handler").include(l)){return false}var g;if(j.include(":")){g=function(m){if(Object.isUndefined(m.eventName)){return false}if(m.eventName!==j){return false}d.extend(m,k);l.call(k,m)}}else{if(!e&&(j==="mouseenter"||j==="mouseleave")){if(j==="mouseenter"||j==="mouseleave"){g=function(n){d.extend(n,k);var m=n.relatedTarget;while(m&&m!==k){try{m=m.parentNode}catch(o){m=k}}if(m===k){return }l.call(k,n)}}}else{g=function(m){d.extend(m,k);l.call(k,m)}}}g.handler=l;f.push(g);return g}function H(){for(var f=0,g=E.length;f<g;f++){d.stopObserving(E[f]);E[f]=null}}var E=[];if(Prototype.Browser.IE){window.attachEvent("onunload",H)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}var L=Prototype.K,G={mouseenter:"mouseover",mouseleave:"mouseout"};if(!e){L=function(f){return(G[f]||f)}}function W(j,h,k){j=$(j);var g=M(j,h,k);if(!g){return j}if(h.include(":")){if(j.addEventListener){j.addEventListener("dataavailable",g,false)}else{j.attachEvent("ondataavailable",g);j.attachEvent("onlosecapture",g)}}else{var f=L(h);if(j.addEventListener){j.addEventListener(f,g,false)}else{j.attachEvent("on"+f,g)}}return j}function K(m,j,n){m=$(m);var h=Element.retrieve(m,"prototype_event_registry");if(!h){return m}if(!j){h.each(function(p){var o=p.key;K(m,o)});return m}var k=h.get(j);if(!k){return m}if(!n){k.each(function(o){K(m,j,o.handler)});return m}var l=k.length,g;while(l--){if(k[l].handler===n){g=k[l];break}}if(!g){return m}if(j.include(":")){if(m.removeEventListener){m.removeEventListener("dataavailable",g,false)}else{m.detachEvent("ondataavailable",g);m.detachEvent("onlosecapture",g)}}else{var f=L(j);if(m.removeEventListener){m.removeEventListener(f,g,false)}else{m.detachEvent("on"+f,g)}}h.set(j,k.without(g));return m}function Z(j,h,g,f){j=$(j);if(Object.isUndefined(f)){f=true}if(j==document&&document.createEvent&&!j.dispatchEvent){j=document.documentElement}var k;if(document.createEvent){k=document.createEvent("HTMLEvents");k.initEvent("dataavailable",f,true)}else{k=document.createEventObject();k.eventType=f?"ondataavailable":"onlosecapture"}k.eventName=h;k.memo=g||{};if(document.createEvent){j.dispatchEvent(k)}else{j.fireEvent(k.eventType,k)}return d.extend(k)}d.Handler=Class.create({initialize:function(h,g,f,j){this.element=$(h);this.eventName=g;this.selector=f;this.callback=j;this.handler=this.handleEvent.bind(this)},start:function(){d.observe(this.element,this.eventName,this.handler);return this},stop:function(){d.stopObserving(this.element,this.eventName,this.handler);return this},handleEvent:function(g){var f=d.findElement(g,this.selector);if(f){this.callback.call(this.element,g,f)}}});function J(h,g,f,j){h=$(h);if(Object.isFunction(f)&&Object.isUndefined(j)){j=f,f=null}return new d.Handler(h,g,f,j).start()}Object.extend(d,d.Methods);Object.extend(d,{fire:Z,observe:W,stopObserving:K,on:J});Element.addMethods({fire:Z,observe:W,stopObserving:K,on:J});Object.extend(document,{fire:Z.methodize(),observe:W.methodize(),stopObserving:K.methodize(),on:J.methodize(),loaded:false});if(window.Event){Object.extend(window.Event,d)}else{window.Event=d}})();(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);(function(){window.Selector=Class.create({initialize:function(A){this.expression=A.strip()},findElements:function(A){return Prototype.Selector.select(this.expression,A)},match:function(A){return Prototype.Selector.match(A,this.expression)},toString:function(){return this.expression},inspect:function(){return"#<Selector: "+this.expression+">"}});Object.extend(Selector,{matchElements:function(F,G){var A=Prototype.Selector.match,D=[];for(var C=0,E=F.length;C<E;C++){var B=F[C];if(A(B,G)){D.push(Element.extend(B))}}return D},findElement:function(F,G,B){B=B||0;var A=0,D;for(var C=0,E=F.length;C<E;C++){D=F[C];if(Prototype.Selector.match(D,G)&&B===A++){return Element.extend(D)}}},findChildElements:function(B,C){var A=C.toArray().join(", ");return Prototype.Selector.select(A,B||document)}})})();var PBdebugging=(function(){function A(){this.PROFILE=false;this.TIME=true;this.COUNT=false;this.GROUP=true;var C=function(){};if(window!==undefined&&window.console===undefined){window.console={log:C,error:C,warn:C,info:C,count:C,debug:C,profile:C,profileEnd:C,trace:C,dir:C,dirxml:C,assert:C,time:C,timeEnd:C,group:C,groupEnd:C}}if(window!==undefined&&window.console!==undefined){var B=window.console;if(!this.PROFILE){B.profile=C;B.profileEnd=C}if(B.debug===undefined){B.debug=function(){B.info($A(arguments))}}if(B.group===undefined){B.group=function(D){B.info("start - ",D)};B.groupEnd=function(D){B.info("end - ",D)}}if(B.groupCollapsed===undefined){B.groupCollapsed=function(D){B.group(D)}}if(!this.GROUP){B.group=C;B.groupCollapsed=C;B.groupEnd=C}if(this.TIME&&B.time===undefined){B.time=function(D,F){if(!D){return }var G=new Date().getTime();if(!B.timeCounters){B.timeCounters={}}var E="KEY"+D.toString();if(!F&&B.timeCounters[E]){return }B.timeCounters[E]=G};B.timeEnd=function(D){var H=new Date().getTime();if(!B.timeCounters){return }var E="KEY"+D.toString();var F=B.timeCounters[E];if(F){var G=H-F;B.info(D+": "+G+"ms");delete B.timeCounters[E]}return G}}if(!this.TIME){B.time=C;B.timeEnd=C}if(B.count===undefined){B.count=function(D){if(!D){return }if(!B.counters){B.counters={}}var E="KEY"+D.toString();var F=B.counters[E];if(!F){F=1}else{F++}B.counters[E]=F;B.info(D,":",F)}}if(!this.COUNT){B.count=C}}}return A})();var pbd=new PBdebugging();Object.Event={extend:function(A){A._objectEventSetup=function(B){this._observers=this._observers||{};this._observers[B]=this._observers[B]||[]};A.observe=function(D,B){if(typeof (D)=="string"&&typeof (B)!="undefined"){this._objectEventSetup(D);if(!this._observers[D].include(B)){this._observers[D].push(B)}}else{for(var C in D){this.observe(C,D[C])}}};A.stopObserving=function(C,B){this._objectEventSetup(C);if(C&&B){this._observers[C]=this._observers[C].without(B)}else{if(C){this._observers[C]=[]}else{this._observers={}}}};A.observeOnce=function(D,C){var B=function(){C.apply(this,arguments);this.stopObserving(D,B)}.bind(this);this._objectEventSetup(D);this._observers[D].push(B)};A.notify=function(F){this._objectEventSetup(F);var D=[];var B=$A(arguments).slice(1);try{for(var C=0;C<this._observers[F].length;++C){D.push(this._observers[F][C].apply(this._observers[F][C],B)||null)}}catch(E){if(E==$break){return false}else{throw E}}return D};if(A.prototype){A.prototype._objectEventSetup=A._objectEventSetup;A.prototype.observe=A.observe;A.prototype.stopObserving=A.stopObserving;A.prototype.observeOnce=A.observeOnce;A.prototype.notify=function(F){if(A.notify){var B=$A(arguments).slice(1);B.unshift(this);B.unshift(F);A.notify.apply(A,B)}this._objectEventSetup(F);var B=$A(arguments).slice(1);var D=[];try{if(this.options&&this.options[F]&&typeof (this.options[F])=="function"){D.push(this.options[F].apply(this,B)||null)}for(var C=0;C<this._observers[F].length;++C){D.push(this._observers[F][C].apply(this._observers[F][C],B)||null)}}catch(E){if(E==$break){return false}else{throw E}}return D}}}};Object.extend(Event,{wheel:function(A){var B=0;if(!A){A=window.event}if(A.wheelDelta){B=A.wheelDelta/120;if(window.opera){B=-B}}else{if(A.detail){B=-A.detail/3}}return Math.round(B)}});PBMenu=Class.create({classname:"PBMenu",initialize:function(A){var B={items:[]};Object.extend(B,A);this.options=B;this.items=new Array();this.create();this.enable();if(this.options.items){this.addItems(this.options.items)}document.observe("menu::hide",this.hide.bind(this));this.onClickOpen=this.show.bind(this);this.onClickClose=this.off.bind(this);this.options.toggle.observe("click",this.onClickOpen)},toggle:function(A){if(A){A.stop();this.options.toggle.blur()}if(this.isOpen){this.hide()}else{this.show()}},create:function(){if(this.options.toggle.id){var A=$(this.options.toggle.id+"-pbmenu");if(A){A.remove()}}this.elm=new Element("div",{"class":"pbMenu"});if(this.options.toggle.id){this.elm.id=this.options.toggle.id+"-pbmenu"}this.listElm=new Element("ul");this.elm.appendChild(this.listElm);this.elm.appendChild(new Element("img",{src:"/layout/common/images/shadow.png",width:"100%"}));document.body.appendChild(this.elm)},disable:function(){this.isEnabled=false;this.elm.addClassName("disabled")},enable:function(){this.isEnabled=true;this.elm.removeClassName("disabled")},show:function(B){if(B){B.stop();B.element().blur();if(B.element().disabled){return }}document.fire("menu::hide");var A=this.options.anchor||this.options.toggle;this.options.toggle.addClassName("active");if(this.isOpen||!this.isEnabled){return }var C=A.cumulativeOffset();C.top+=A.getHeight()-1;this.elm.setStyle({top:C.top+"px",left:(C.left-1)+"px",display:"block"});if(this.options.rightAligned){this.elm.setStyle({left:(C.left+A.getWidth()-this.elm.getWidth())+"px"})}this.isOpen=true;this.notify("onOpen");this.options.toggle.stopObserving("click",this.onClickOpen).observe("click",this.onClickClose);document.observe("click",this.onClickClose)},off:function(A){A.stop();A.element().blur();this.hide()},hide:function(){if(!this.isOpen){return }this.timer=null;this.isOpen=false;this.elm.setStyle({display:"none"});this.notify("onClose");this.options.toggle.stopObserving("click",this.onClickClose).observe("click",this.onClickOpen).removeClassName("active");document.stopObserving("click",this.onClickClose)},addItems:function(A){A.each(function(B){this.add(new PBMenu.Item(this,B))}.bind(this))},add:function(A){this.items.push(A);this.listElm.appendChild(A.elm)},getItem:function(B){for(var A=0;A<this.items.length;A++){if(this.items[A].options.name==B){return this.items[A]}}},removeAll:function(){this.items.each(function(A){this.remove(A)}.bind(this))},remove:function(A){A.remove();this.items=this.items.without(A)}});Object.Event.extend(PBMenu);PBMenu.Item=Class.create({classname:"PBMenu.Item",initialize:function(B,A){this.options=A;this.menu=B;this.elm=new Element("li").update(A.txt).observe("click",this.activate.bind(this)).addClassName(A.className);if(this.options.className){this.elm.className=this.options.className}if(this.options.name){this.elm.id="pbmenu-"+this.options.name.replace(/[^a-z]/gi,"")}(this.options.disabled)?this.disable():this.enable()},disable:function(){this.isDisabled=true;this.elm.addClassName("disabled")},enable:function(){this.isDisabled=false;this.elm.removeClassName("disabled")},activate:function(A){if(A){A.stop()}if(!this.isDisabled){this.menu.hide();this.notify("onClick")}},remove:function(){this.elm.parentNode.removeChild(this.elm)}});Object.Event.extend(PBMenu.Item);Util={classname:"Util",alert:function(B,A){if(!A){A={}}if(!A.title){A.title="Alert"}A.type="alert";A.html=B;if(A.delay){window.setTimeout(function(){new PBwiki.DialogCommands.Alert(A)},110)}else{new PBwiki.DialogCommands.Alert(A)}},confirm:function(B,A){if(!A){A={}}if(!A.title){A.title="Confirmation"}A.type="confirm";A.html=B;new PBwiki.DialogCommands.Alert(A)},prompt:function(B,A){if(!A){A={}}if(!A.title){A.title="Input needed"}A.type="prompt";A.html=B;new PBwiki.DialogCommands.Alert(A)},spinner:function(B,A){if(!A){A={}}A.title="";A.type="spinner";A.html=B;if(A.delay){window.setTimeout(function(){new PBwiki.DialogCommands.Alert(A)},110)}else{new PBwiki.DialogCommands.Alert(A)}},success:function(B,A){if(!A){A={}}A.title="";A.type="success";A.html=B;if(A.delay){window.setTimeout(function(){new PBwiki.DialogCommands.Alert(A)},110)}else{new PBwiki.DialogCommands.Alert(A)}},isInternetExplorer6:function(){return navigator.userAgent.indexOf("MSIE 6")>0&&!navigator.userAgent.match(/MSIE [789]/)},findEmails:function(D,A){var G=new Array();var F=D.split(/[,;\s]+|,/);for(var C=0;C<F.length;C++){var B=F[C].replace(/^\s+|\s+$/g,"");if(B==""){continue}var E=Util.is_valid_email(B);if(E!==true){A(E);return new Array()}else{G.push(B)}}return G},parseQueryString:function(B){var A={};$A(B.split("&")).each(function(D){var C=D.split("=");A[C[0]]=C[1]});return A},getURLParameter:function(D){var C=document.location.href;if(!C){return null}if(!C.indexOf("?")){return null}var A=C.substring(C.indexOf("?")+1);var B=Util.parseQueryString(A);if(B[D]&&!B[D].empty()){return B[D]}else{return null}},onFCKcomplete:function(A){document.fire("ui:fckeditor_oncomplete",{editorInstance:A})},strHasInvalidCharacters:function(C,B){for(var A=0;A<B.length;A++){if(C.indexOf(B.charAt(A))!==-1){return true}}return false},strToPageName:function(A){for(var B=0;B<PBconst.kInvalidPageCharacters.length;B++){A=A.replace(PBconst.kInvalidPageCharacters.charAt(B),"")}A=A.replace(/\./,"").strip();return A},is_valid_page_name:function(A){if(A==PBinfo.CurrentWiki.front_page){return"Cannot create a page called '"+PBinfo.CurrentWiki.front_page+"'"}if(A.strip().length==0){return"Empty page names are not allowed"}if(A.length>PBconst.kMaxPageNameLength){return"That name is too long (page names must be "+PBconst.kMaxPageNameLength+" characters or less)"}if(Util.strHasInvalidCharacters(A,PBconst.kInvalidPageCharacters)){return"Page names can't contain any of the following characters: "+PBconst.kInvalidPageCharacters}return true},is_valid_folder_name:function(A){if(A.length>PBconst.kMaxFolderNameLength){return"Folder names must be less than "+PBconst.kMaxFolderNameLength+" characters"}if(A.strip().length==0){return"Empty folder names are not allowed"}if(Util.strHasInvalidCharacters(A,PBconst.kInvalidFolderCharacters)){return"Folder names can't contain any of the following characters: "+PBconst.kInvalidFolderCharacters}return true},is_valid_file_name:function(A){if(A.length>PBconst.kMaxFileNameLength){return"File names must be less than "+PBconst.kMaxFileNameLength+" characters"}if(A.strip().length==0){return"Empty file names are not allowed"}if(Util.strHasInvalidCharacters(A,PBconst.kInvalidFileCharacters)){return"File names can't contain any of the following characters: "+PBconst.kInvalidFileCharacters}return true},is_valid_milestone_name:function(A){if(!A||A.strip().length==0){return"Empty milestone names are not allowed"}if(A.length>PBconst.kMaxMilestoneLength){return"Milestone names must be less than "+PBconst.kMaxMilestoneLength+" characters"}return true},is_valid_action_name:function(A){if(!A||A.strip().length==0){return"Empty action names are not allowed"}if(A.length>PBconst.kMaxActionLength){return"Action names must be less than "+PBconst.kMaxActionLength+" characters"}return true},is_valid_email:function(A){var B=this.string_to_reg_exp(PBconst.kPolicyValidEmailRegex);if(!B.test(A)){return"The address "+A+" isn't a proper email address."}return true},is_valid_domain_object_name:function(C,A){C=C.strip();if(C.length<PBconst.kMinWikiNameLength){return A+" names must be at least "+PBconst.kMinWikiNameLength+" characters."}if(C.length>PBconst.kMaxWikiNameLength){return A+" names must be no more than "+PBconst.kMaxWikiNameLength+" characters."}var B=this.string_to_reg_exp(PBconst.kPolicyValidWikiNameRegex);if(!B.test(C)){return A+" names can only have letters and numbers in them"}return true},is_valid_network_name:function(A){return Util.is_valid_domain_object_name(A,"Network")},is_valid_wiki_name:function(A){return Util.is_valid_domain_object_name(A,"Workspace")},is_valid_uid:function(A){var B=this.string_to_reg_exp(PBconst.kPolicyValidUIDRegex);return !!B.test(A)},is_valid_url:function(A){return/^http(s)?:(\/\/)([\w]+(.[\w]+))([\w\-\.\*,@?^=%&:;\/~\+#]*)$/.test(A)},dashified_link:function(A){if(A.indexOf("-")==-1){A=A.replace(/ /g,"-")}return A.strictEncodeURIComponent().replace(/%20/g,"+")},undashified_link:function(A){var B=A.indexOf("+")==-1;A=decodeURIComponent(A).replace(/\+/g," ");if(B&&A.indexOf("-")!=-1){A=A.replace(/-/g," ")}return A},getFolderLink:function(C){if(C){var A=PBwiki.feature("gui")?"ViewFolderNewGui":"ViewFolder";var B=C.strictEncodeURIComponent();return"/w/browse/#view="+A+"&param="+B}else{var A=PBwiki.feature("gui")?"ViewMainFolderNewGui":"ViewAllObjects";return"/w/browse/#view="+A}},getFileExtension:function(A){if(!A||typeof (A)!="string"){return }var B=A.lastIndexOf(".");if(B==-1){return }return A.substr(B+1).toLowerCase()},getLinkInfo:function(B){var A;var C="/folder.php?folder=";var D="/w/browse/#view=";if(B.indexOf(C)===0){A={type:"folder",txt:B.replace(C,"").replace(/\+/g," ")}}else{if(B.indexOf(D)===0){A={type:"folder",txt:decodeURIComponent(B.substr(B.lastIndexOf("&param=")+7))}}else{if(B.substr(0,7)=="mailto:"){A={type:"email",txt:B.replace("mailto:","")}}else{if(Util.isFileLink(B)){A={type:"file",txt:decodeURIComponent(B.substr(B.lastIndexOf("/")+1)).replace(/\+/g," ")}}else{if(B.substr(0,8)=="/w/page/"){A={type:"page",txt:decodeURIComponent(B.substr(B.lastIndexOf("/")+1))}}else{if(B.charAt(0)=="/"&&B.length>1&&B.lastIndexOf("/")===0){A={type:"page",txt:decodeURIComponent(B.substr(1))}}else{A={type:"url",txt:B}}}}}}}A.url=B;return A},getObjectLink:function(F){var E="";if(typeof F.oid!=="undefined"){E=F.oid+"/"}var D="";if(typeof F.revision!=="undefined"){D="?rev="+F.revision}var G="";switch(F.type){case"page":var C=encodeURIComponent(F.name+"");G="/w/page/"+E+C+D;break;case"file":var B="/w/file/"+E;var C=(F.name+"").strictEncodeURIComponent();G=B+C+D;break;case"folder":var A=PBwiki.feature("gui")?"ViewFolderNewGui":"ViewFolder";var C=(F.name+"").strictEncodeURIComponent();G="/w/browse/#view="+A+"&param="+C;break;default:return false}if(typeof F.wiki!=="undefined"){return Util.URLRelativeToContext(G,F)}return G},getFetchLink:function(E){var D="";if(typeof E.oid!=="undefined"){D=E.oid+"/"}var C="";if(typeof E.revision!=="undefined"){C="?rev="+E.revision}var A="/w/file/fetch/"+D;var B=(E.name+"").strictEncodeURIComponent();return A+B+C},getThumbnailLink:function(C,B){var A=(C.name+"").strictEncodeURIComponent();return"/f/"+C.mtime+"-"+B+"p/"+A},isFileLink:function(A){return A.startsWith("/f/")||A.startsWith("/w/file/")},getFileIcon:function(A){return Util.iconMap[Util.getFileExtension(A.toString())]||"fileicon"},iconMap:{pdf:"ob_item_pdf",doc:"ob_item_doc",odt:"ob_item_doc",rtf:"ob_item_doc",docx:"ob_item_doc",xls:"ob_item_xls",ods:"ob_item_xls",xlsx:"ob_item_xls",ppt:"ob_item_ppt",odp:"ob_item_ppt",pptx:"ob_item_ppt",zip:"ob_item_zip",rar:"ob_item_zip",jpg:"ob_item_jpg",gif:"ob_item_jpg",png:"ob_item_jpg",psd:"ob_item_jpg",bmp:"ob_item_jpg",jpeg:"ob_item_jpg",tiff:"ob_item_jpg",tif:"ob_item_jpg",txt:"ob_item_txt",css:"ob_item_txt",mp3:"ob_item_audio",m4a:"ob_item_audio",m4v:"ob_item_video",mpg:"ob_item_video",mov:"ob_item_video",htm:"ob_item_html",html:"ob_item_html"},addObjectTooltip:function(H,G){if(G.type!=="page"&&Util.shouldPreviewFile(G.name)){var F="img-"+Math.round(Math.random()*1000000);var C='<span id="'+F+'"><img src="/images/loadingSmaller.gif"></span>';if(PBwiki.feature("filepreview")){new Tooltip(H,{txt:'<div style="width: 180px;">'+C+"</div>"});H.observe("tooltip:show",function(I){var J=I.memo;if(!J.madeLoadCall){new PBwiki.APIRequest("GetFile",{format:"jpg-180-0",redirect:false,method:"post",file:G.name,wiki:G.wiki},{async:true,onSuccess:function(K){$(F).remove();J.setContent('<img src="'+K.url+'" alt="" />')},onFailure:function(K){J.setContent("Error: "+K)}});J.madeLoadCall=true}})}else{var A=(G.name+"").strictEncodeURIComponent();var B="/f/"+G.mtime+"-180p/"+A;if(G.wiki){B=Util.URLRelativeToContext(B,{wiki:G.wiki})}var E="try { $('"+F+"').remove(); } catch(e) { }";var D='<img src="'+B+'" alt="Loading preview image..." width="180" onload="'+E+'" />';new Tooltip(H,{txt:'<div style="width: 180px;">'+D+C+"</div>"})}}},addLinkTooltips:function(A){A.select("a.preview").each(function(B){var C=B.getAttribute("href");if(!C||(C.indexOf("/f/")==-1&&C.indexOf("/w/file/")==-1)||!Util.isPreviewable(C)||!B.getAttribute("time")||B.hasTooltip){return }Util.addObjectTooltip(B,{type:"file",wiki:B.readAttribute("wiki"),name:decodeURIComponent(C.substr(C.lastIndexOf("/")+1)),mtime:B.readAttribute("time")});B.hasTooltip=true})},isPreviewable:function(A){return["png","gif","jpg","jpeg","pdf","ps","bmp"].indexOf(Util.getFileExtension(A))!=-1},isImageFile:function(B){var A=this.string_to_reg_exp(PBconst.kPolicyImageFileRegex);return B.match(A)},isVideoFile:function(B){var A=this.string_to_reg_exp(PBconst.kPolicyVideoFileRegex);return B.match(A)},isAudioFile:function(B){var A=this.string_to_reg_exp(PBconst.kPolicyAudioFileRegex);return B.match(A)},shouldPreviewFile:function(C){var A=this.string_to_reg_exp(PBconst.kPolicyConvertOpenOfficeRegex);var B=this.string_to_reg_exp(PBconst.kPolicyConvertImageMagickRegex);return C.match(A)||C.match(B)},getAuthorNameFromObject:function(A){return A.user?A.user.name:(A.name||A.username||A.user_name||A.user_email||A.email||A.uid)},authorLinkFromObject:function(D,C){if(!D){return }var B=D.user?D.user.uid:(D.uid||D.user_id);var A=this.getAuthorNameFromObject(D);C=(C?C:"");D.userClass+=" usercard_trigger";if(B&&B!=PBconst.kSystemUid){var E=A?A.toString().escapeHTML():"";return C+'<a href="/user/'+B+'"'+((D.userClass)?' class="'+D.userClass+'"':"")+"ui:uid="+B+">"+E+"</a>"}else{return(A?C+A:"")}},linkify_text:function(A){var B=this.string_to_reg_exp(PBconst.kLinkifyRegex,"gi");return A.replace(B,function(C){return'<a href="'+C+'" rel="nofollow">'+C+"</a>"})},getLinkContent:function(A){if(A.charAt(0)=="/"){return Util.getCurrentContext()}var C=A.indexOf("//")+2;var B={wiki:A.substr(C,A.indexOf(".")-C)};var D=B.wiki.indexOf("-");if(D!=-1){B.network=B.wiki.substr(0,D)}return B},getCurrentContext:function(){var A={wiki:PBinfo.CurrentWiki.name};if(PBinfo.CurrentNetwork){A.network=PBinfo.CurrentNetwork.name}return A},URLRelativeToContext:function(A,B){var C=PBinfo.CurrentPage.host||window.location.host.substr(window.location.host.indexOf(".")+1);var D="";if(B.wiki||B.network){D=window.location.protocol+"//"+(B.wiki||B.network)+"."+C}else{D=window.location.protocol+"//"+C}if(A.charAt(0)!="/"){A="/"+A}return D+A},time_chunks:{yr:31536000,mo:2592000,wk:604800,day:86400,hr:3600,min:60},time_chunks_long:{year:31536000,month:2592000,week:604800,day:86400,hour:3600,minute:60},time_ago:function(C,F){var B=0,D=0,E="",A;if(C<0){C=0}if(typeof F==="undefined"){F=true}A=(F?Util.time_chunks_long:Util.time_chunks);for(itm in A){if((D=Math.floor(C/A[itm]))!=0){B++;if(B>1){E+=", "}E+=(D==1)?"1 "+itm:D+" "+itm+"s";C-=A[itm]*D}if(B==1){break}}if(B==0){return"0 "+itm+"s"}return E},trackingPrefix:"",trackingSuffix:"",tracking:function(C,A){C=Util.trackingPrefix+C+Util.trackingSuffix;if(A&&Util.trackingList.indexOf(C)!=-1){return }if(C.length>50){return false}var B=Cookie.get(PBconst.kTrackingCookie);B=(B)?B.evalJSON():[];B.push(C);if(B.length>10){B=[];Cookie.set(PBconst.kTrackingCookie,Object.toJSON(B));(new PBwiki.APIRequest("TrackingInit",{verb_list:B.join(",")}))}else{Cookie.set(PBconst.kTrackingCookie,Object.toJSON(B))}if(A){Util.trackingList.push(C)}},trackingList:[],flushTrackingSynchronous:function(){var A=Cookie.get(PBconst.kTrackingCookie);A=(A)?A.evalJSON():[];if(A.length==0){return }(new PBwiki.APIRequest("TrackingInit",{verb_list:A.join(",")},{asynchronous:false}))},executeUnlessEsc:function(B){esc_pressed=false;var A=function(){esc_pressed=true};document.observe("keypress:esc",A);setTimeout(function(){document.stopObserving("keypress:esc",A)},10);setTimeout(function(){if(!esc_pressed){B()}},10)},fixIE6RelativeElems:function(){if(!Util.isInternetExplorer6()){return }var A={};$$(".ie6-redisplay, div.button-bar").each(function(C){var D=C.style.display;if(D!=="none"){if(!A[D]){A[D]=[]}A[D].push(C)}});for(var B in A){A[B].each(function(C){C.style.display="none";C.style.display=B})}},_foldernameToID:function(B){if(!PBinfo.GetFolders||!PBinfo.GetFolders.folders){return false}var A=PBinfo.GetFolders.folders.find(function(C){return C.name==B});return A?A.oid:false},size_readable:function(C){var F="%01.1f %s";var E=["B","KB","MB","GB","TB","PB"];var B=1000;var D=E.length-1;var A=0;while(D!=A&&C>=1024&&A<(E.length-1)){C/=B;A++}if(A==0){return C+" bytes"}return Math.round(C*10)/10+" "+E[A]},get_fitted_text_to_element:function(A,F,L){L=L||"";var K=F.innerHTML;var D=K.split(/<br\/?>/i);var B=A.getStyle("height").match(/\d*/)||A.getHeight();B=new Number(B);if(F.getHeight()>B){F.update();var I=[];for(var E=0;F.getHeight()<B;E++){I.push(D[E]);F.update(I.join("<br/>")+L)}var J=I.pop();D=I.join("<br/>");if(F.getHeight()>B){var C=J.length-1;var H=0;D+=D.length==0?"":"<br/>";while(H<C-1){var G=Math.floor((C-H)/2)+H;F.update(D+J.slice(0,G)+L);if(F.getHeight()<=B){H=G}else{C=G}}D=D+J.slice(0,H)+L}else{D+="<br/>"+J+L}F.update(K);return D}else{return K}},string_to_reg_exp:function(D,A){var C=D.split("/");if(C.length!=3){return false}var B=C[1];if(!A){A=C[2]}return new RegExp(B,A)}};window.FCKeditor_OnComplete=Util.onFCKcomplete;
/*@cc_on
Util.IE6 = ( @_jscript_version == '5.6' );
@*/
Object.extend(Date.prototype,{strftime:function(G){var B=this.getDay(),F=this.getMonth();var A=this.getHours(),D=this.getMinutes(),C=this.getDate();function E(H){return H.toPaddedString(2)}return G.gsub(/\%([aAbBcdeHIlmMpPSwyY])/,function(H){switch(H[1]){case"a":return $w("Sun Mon Tue Wed Thu Fri Sat")[B];break;case"A":return $w("Sunday Monday Tuesday Wednesday Thursday Friday Saturday")[B];break;case"b":return $w("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec")[F];break;case"B":return $w("January February March April May June July August September October November December")[F];break;case"c":return this.toString();break;case"d":return E(this.getDate());break;case"H":return E(A);break;case"I":var I=((A+12)%12);return(I==0?12:E(I));break;case"l":var I=((A+12)%12);return(I==0?12:I);break;case"m":return E(F+1);break;case"M":return E(D);break;case"p":return A>=12?"PM":"AM";break;case"P":return A>=12?"pm":"pm";break;case"S":return E(this.getSeconds());break;case"w":return B;break;case"y":return E(this.getFullYear()%100);break;case"Y":return this.getFullYear().toString();break;case"e":return C;break;case"m":return F+1;break;case"M":return E(D);break}}.bind(this))}});Object.extend(String.prototype,{escapeTruncate:function(A){if(!A){A=40}if(this.length<A){return this.escapeHTML()}var B=Math.floor(A/2);return this.substr(0,B).escapeHTML()+"&hellip;"+this.substr(this.length-B).escapeHTML()},strictEncodeURIComponent:function(){return encodeURIComponent(this).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")},stripslashes:function(){return this.replace(/\\(["'\\])/g,"$1").replace(/(\\(?:[0-7]{1,3}|x[\dA-Fa-f]{1-2}))/g,function(A){return String.fromCharCode(A)})},addslashes:function(){return this.replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0")}});MiniTabSwitcher=Class.create({classname:"MiniTabSwitcher",linkPanelHash:null,initialize:function(A){this.linkPanelHash=new Hash();$H(A).each(function(C){if($(C.key)){var B=$(C.key);this.linkPanelHash.set(C.key,$(C.value));B.onmousedown=function(){return false};B.observe("click",this.handleTabOnclick.bindAsEventListener(this)).setAttribute("unselectable","on");if(B.hasClassName("active")){this.switchTab(B)}}}.bind(this))},handleTabOnclick:function(B){B.stop();var A=B.element();this.switchTab(A)},switchTab:function(A){this.linkPanelHash.each(function(B){$(B.key).removeClassName("active");B.value.hide()});A.addClassName("active");this.linkPanelHash.get(A.id).show();A.fire("ui:tabswitched")}});var Cookie={classname:"Cookie",set:function(C,E,B,F){var A="";if(B){var G=new Date();G.setTime(G.getTime()+(86400000*parseFloat(B)));A="; expires="+G.toGMTString()}var D="";if(F){D="; domain="+F}return(document.cookie=escape(C)+"="+escape(E||"")+A+D+"; path=/")},get:function(A){var B=document.cookie.split(";").find(function(C){if(C.strip().indexOf(A+"=")==0){return true}});return(B)?unescape(B.split("=")[1]):""}};PBwiki={classname:"PBwiki",ERROR_LEVEL:{error:4,warn:5,info:6,debug:7},log_history:[],is_dev:function(){var A=(window.location.hostname.endsWith("pbworks.us")||window.location.search.indexOf("?debug=")==0||(PBwiki.CurrentPage&&PBwiki.CurrentPage.is_dev));this.is_dev=function(){return A};return A},_initialize:function(){var C=this.classname+"._initialize()";console.groupCollapsed(C);console.time(C);for(var A=0;A<this.initFunctions.length;A++){var B=this.initFunctions[A].func;var E=this.initFunctions[A].classname;try{if(E){console.time(E);if(pbd&&pbd.PROFILE){console.profile(E)}}B()}catch(D){if(Prototype.Browser.IE){console.error(E," - ",D.message)}else{console.error(D)}}finally{if(E){if(pbd&&pbd.PROFILE){console.profileEnd()}console.timeEnd(E)}}}document.fire("pbwiki:init");console.debug(this.classname+" : init complete");console.timeEnd(C);console.groupEnd(C)},logHandler:function(C,B,A){PBwiki.log_history.push(B);if(C<=PBwiki.ERROR_LEVEL.warn&&PBwiki.is_dev()){alert("JS Error "+A+": "+Object.toJSON(B))}if(PBwiki.log_history.length>10){PBwiki.log_history.shift()}if(C<PBwiki.ERROR_LEVEL.warn&&!PBwiki.jsDebugSent&&A){(new Ajax.Request("/jsdebug.php",{parameters:{code:A,level:C,payload:Object.toJSON(PBwiki.sanitizedLogHistory())}}));PBwiki.jsDebugSent=true}if(!PBwiki.is_dev()||typeof (console)=="undefined"){return }if(B&&B.constructor&&B.constructor.name=="Object"){console.dir(B)}else{}},sanitizedLogHistory:function(C){var B=PBwiki.log_history;var A=[];B.each(function(E){if(typeof (E)=="string"){A.push(E.substr(0,100))}else{if(typeof (E)=="number"){A.push(E)}else{var D=$H(E).toJSON();if(!D){return }else{if(D&&D.length<(E&&E.message)?5000:100){A.push(E)}else{A.push(D.substr(0,100)+"...")}}}}});return A},initFunctions:[{classname:"PBwiki.logHandler.bind",func:function(){$H(PBwiki.ERROR_LEVEL).each(function(A){PBwiki[A.key]=PBwiki.logHandler.bind(PBwiki.logHandler,A.value)})}}],init:function(){var A=$A(arguments);var C;if(typeof A[0]==="string"){C=A.shift()}var B=A.shift();if(Object.isUndefined(B)){console.error("PBwiki.init() obj is undefined");return }if(!C){if(B.classname){C=B.classname}else{if(B.prototype&&B.prototype.classname){C=B.prototype.classname}else{if(!C){C="anonymous";console.error("oops, missed a label!")}}}}if(B.initialize){this.initFunctions.push({classname:C,func:function(){B.initialize.apply(null,A)}})}else{if(B.prototype){this.initFunctions.push({classname:C,func:function(){(function(D){new B(D)}).apply(null,A)}})}else{if(Object.isFunction(B)){this.initFunctions.push({classname:C,func:function(){B.apply(null,A)}})}}}},getPageName:function(){return PBinfo.CurrentPage.page},getEditURI:function(B,A,C){if(C){return"/"+encodeURIComponent(B.toString())+"?edit=1&new=1"+((A)?"&referer="+encodeURIComponent(window.location):"")}else{return"/"+encodeURIComponent(B.toString())+((A)?"?referer="+encodeURIComponent(window.location):"")+"#view=edit"}},getSessCookie:function(){var C=PBinfo.CurrentPage.sessCookie;var B={};var A=Cookie.get(C);if(A){B[C]=A}return B},getBuildTime:function(){return(PBinfo&&PBinfo.BuildTime)?PBinfo.BuildTime:PBwiki.getTimestamp()},getMaxUploadSize:function(){return PBinfo.CurrentWiki.premium?PBconst.kMaxFileSizePaid:PBconst.kMaxFileSizeFree},getUID:function(){var A=PBinfo.CheckPermissions.uid;return(!A||A=="public-browser-proxy-id")?null:A},feature:function(A){if(typeof (PBinfo)=="undefined"||!PBinfo.GetFeatures){return false}if(PBinfo.GetFeatures[A]){return true}if(!PBinfo.CurrentNetwork||!PBinfo.CurrentNetwork.experiments||!PBinfo.CurrentNetwork.experiments[A]){return false}return(PBinfo.CurrentNetwork.experiments[A]=="experiment")},getCache:function(A){return PBinfo[A]},getTimestamp:function(){return Math.floor(new Date().getTime()/1000)},relativeTimestamp:function(A){if(typeof PBwiki.timeOffset==="undefined"){PBwiki.timeOffset=0}return Util.time_ago(PBwiki.getTimestamp()-A-PBwiki.timeOffset)+" ago"},userCanCreateTask:function(){return PBwiki.feature("tasks")&&PBinfo.CheckPermissions&&["read","page"].indexOf(PBinfo.CheckPermissions.wikiperm)==-1},confirmDeletePage:function(){if(confirm("This will irretrievably delete this page and its revisions. Click OK to confirm this action.")){(new PBwiki.APIRequest("DeletePage",{page:PBwiki.getPageName()},{onSuccess:function(A){Page.EditPage.cancel=true;if(A.revcount==0){window.location.href="/w/browse/"}else{window.location.reload()}},onFailure:function(A){alert(A)},waitCursor:true,method:"post"}))}}};$(document).observe("dom:loaded",PBwiki._initialize.bind(PBwiki));PBwiki.UINotification=Class.create({classname:"PBwiki.UINotification",can_run:function(){return true},initialize:function(){if(this.can_run()){document.observe("ui:onNotifyUser",this.handleUserNotification.bind(this))}},handleUserNotification:function(A){if(A.memo.mode&&A.memo.mode=="success"){this.displaySuccess(A.memo.message)}else{this.displayError(A.memo.message)}},showMessage:function(B){var A=PBwiki.feature("gui")?$("workspace-border"):$("page-toolbar");if(A){A.parentNode.insertBefore(B,A)}},displayError:function(A){if(!this.errMsg){this.errMsg=new Element("div",{"class":PBwiki.feature("gui")?"admin-msg error":"yellow-note ui-page-notice"});this.showMessage(this.errMsg)}this.errMsg.update(A).show();if(this.errTimeout){window.clearTimeout(this.errTimeout);this.errTimeout=null}this.errTimeout=this.errMsg.hide.bind(this.errMsg).delay(10)},displaySuccess:function(A){if(!this.successMsg){if(PBwiki.feature("gui")){this.successContainer=new Element("div");this.successMsg=new Element("div",{"class":"admin-msg success"})}else{this.successContainer=new Element("ul",{"class":"page-notices ipm"});this.successMsg=new Element("li",{"class":"notification page-tick successmsg"})}this.successContainer.appendChild(this.successMsg);this.showMessage(this.successContainer)}this.successMsg.update(A).show();this.successContainer.show();if(this.successTimeout){window.clearTimeout(this.successTimeout);this.successTimeout=null}this.successTimeout=this.successContainer.hide.bind(this.successContainer).delay(10)}});var UIException=Class.create({classname:"UIException",element:null,message:"",parent:null,initialize:function(C,A,B){this.element=A;this.message=C;this.parent=B},toString:function(){var A=this.message+(this.element?"("+this.element+")":"");if(this.parent){A+=" > "+this.parent.toString()}return A}});PBwiki.init("Sniff OS, if unknown add body class [nn]",function(){var B=navigator.userAgent.indexOf("Windows NT 6.0")!=-1;var C=Prototype.Browser.WebKit;var A=navigator.userAgent.indexOf("Mac")!=-1;if(!(B||C||A)){$(document.body).addClassName("nn")}});if(Util.IE6){PBwiki.init("Display Error if IE6",function(){var A=new Element("div",{style:"text-align: center; font-size: 16px; border-bottom: 1px solid #DFDDCB; padding: 10px 0px; background-color: #FFFCDF;"});A.update('You are using Internet Explorer 6, an old browser not supported by PBworks. Please <a href="http://usermanual.pbworks.com/w/page/11632053/Contact-Support#Telluswhatbrowseryouareusing/Tryadifferentbrowser">update your browser</a>.');document.body.insertBefore(A,document.body.firstChild)})}PBwiki.init(PBwiki.UINotification);PBHistory=Class.create({classname:"PBHistory",initialize:function(A){var B={checkTime:100};Object.extend(B,A);this.options=B;this.keyList={};var C=this.getItems();for(itm in this.options.items){this.keyList[itm]=new PBHistory.Key(this.options.items[itm]);if(C[itm]){this.keyList[itm].lastVal=C[itm]}}},onLoadCheck:function(B,A){if(location.hash==B){if(typeof (history.replaceState)!="undefined"){history.replaceState({},"",window.location.pathname+window.location.search)}else{location.hash=""}A()}},start:function(){if("onhashchange" in window&&(document.documentMode===undefined||document.documentMode>7)){this.handler=this.check.bind(this);Event.observe(window,"hashchange",this.handler)}else{this.timer=setInterval(this.check.bind(this),this.options.checkTime)}return this},stop:function(){if(this.handler){Event.stopObserving(window,"hashchange",this.handler)}else{if(this.timer){this.timer.stop();this.timer=null}}},getItems:function(){var A=this.getHash();return A?A.toQueryParams():{}},setItems:function(B){var A=Object.toQueryString(B);if(A.length===0&&window.scrollY!==0){A="n"}if(A!=this.getHash()){this.updateKeys(B);location.hash=A}},getHash:function(){return(location.href.lastIndexOf("#")==-1)?"":location.href.substr(location.href.lastIndexOf("#")+1)},updateKeys:function(A){for(itm in A){this.getKey(itm).lastVal=A[itm]}for(itm in this.keyList){if(typeof (A[itm])=="undefined"){this.getKey(itm).lastVal=null}}},check:function(){var A=this.getItems();for(itm in this.keyList){this.getKey(itm).check(A[itm])}},getKey:function(B){if(!this.keyList[B]){var A=this.getItems();this.keyList[B]=new PBHistory.Key({item:B});this.keyList[B].lastVal=A[B]}return this.keyList[B]},hasKey:function(A){var B=this.getItems();return typeof (B[A])!="undefined"},removeKey:function(B){var A=this.getItems();if(A[B]){delete A[B];this.setItems(A)}},setValues:function(A){var A=Object.extend(this.getItems(),A);for(itm in A){if(A[itm]==null||A[itm]==undefined){delete A[itm]}}this.setItems(A)},getValue:function(B){var A=this.getItems();return A[B]}});Object.Event.extend(PBHistory);PBHistory.Key=Class.create({classname:"PBHistory.Key",initialize:function(A){this.options=A||{};this.lastVal=null},check:function(A){if(A!=this.lastVal){this.lastVal=A;this.notify("onChange",A,this.options.item)}},getValue:function(){return this.lastVal}});Object.Event.extend(PBHistory.Key);PBwiki.init("PBwiki.History",function(){PBwiki.History=new PBHistory()});PBwiki.ResourceLoader={classname:"PBwiki.ResourceLoader",scripts:{},load:function(A,B){A=PBwiki.ResourceLoader.getStaticURI(A);if(PBwiki.ResourceLoader.scripts[A]&&B){PBwiki.ResourceLoader.scripts[A].addCallback(B)}else{if(!PBwiki.ResourceLoader.scripts[A]){PBwiki.ResourceLoader.scripts[A]=new PBwiki.ResourceLoader.JSLoader(A,B)}}},loadManifest:function(B,D){var A="";if(PBinfo.noStatics==="per-file"){var C=new Ajax.Request(PBconst.kStaticDebugDirectory+"debug.php?list=true&manifest="+B,{onSuccess:function(F){var E=F.responseText.split("\n");var G=0;E.each(function(I){G+=1;var H=PBconst.kStaticDebugDirectory+"debug.php/"+I;PBwiki.ResourceLoader.load(H,function(){G-=1;if(G<1){D()}})})}});return }else{if(PBinfo.noStatics){A=PBconst.kStaticDebugDirectory+"debug.php?manifest="+B+"&rand"+Math.random()}else{A="/shared/statics/"+B}}PBwiki.ResourceLoader.load(A,D)},getStaticURI:function(B){var A=Util.getFileExtension(B);var C=B.split("/");if((C[1]=="shared"||C[1]=="swf")&&["js","css","swf"].indexOf(A)!=-1&&B.indexOf(".php")==-1&&!PBinfo.CurrentPage.isCustomDomain&&!Prototype.Browser.IE){var D=window.location.host.substr(window.location.host.indexOf(".")+1);return window.location.protocol+"//vs1."+D+B.replace("."+A,"-v"+PBwiki.getBuildTime()+"."+A)}return B},applyCSS:function(C){var B=null;if(Prototype.Browser.IE){B=document.createStyleSheet();B.cssText=C}else{B=new Element("style",{type:"text/css"});var A=($$("head")[0]||$$("body")[0]);A.insertBefore(B,A.firstChild);B[(Prototype.Browser.WebKit)?"innerText":"innerHTML"]=C}}};PBwiki.ResourceLoader.JSLoader=Class.create({classname:"PBwiki.ResourceLoader.JSLoader",initialize:function(B,A){this.isLoaded=false;this.callbacks=(A)?[A]:[];this.doLoad(B)},addCallback:function(A){if(this.isLoaded){A()}else{this.callbacks.push(A)}},onLoaded:function(){if(this.isLoaded){return }this.isLoaded=true;this.callbacks.each(function(A){A()})},doLoad:function(B){var A=document.createElement("script");A.src=B;A.type="text/javascript";$$("head")[0].appendChild(A);A.onreadystatechange=function(){if(A.readyState=="loaded"||A.readyState=="complete"){this.onLoaded()}}.bind(this);A.onload=this.onLoaded.bind(this)}});PBButton=Class.create({classname:"PBButton",initialize:function(A){var B={};Object.extend(B,A);this.options=B;this.create();this.enable();this.elm.observe("click",this.clicked.bindAsEventListener(this));return this},clicked:function(){if(this.isEnabled){this.notify("onClick")}},create:function(){this.elm=new Element("a",{id:this.options.id}).addClassName("button");this.span=new Element("span");if(this.options.icon){this.span.addClassName(this.options.icon).addClassName("iconbutton")}if(this.options.className){this.span.className=this.options.className}if(this.options.strong){new Element("strong").update(this.options.txt).wrap(this.span)}else{this.span.update(this.options.txt)}this.span.wrap(this.elm);if(this.options.addTo){this.addTo(this.options.addTo)}},disable:function(){this.isEnabled=false;this.elm.addClassName("disabled")},enable:function(){this.isEnabled=true;this.elm.removeClassName("disabled")},addTo:function(A){A.appendChild(this.elm)}});Object.Event.extend(PBButton);PBwiki.Components=PBwiki.Components||{};PBwiki.Components.Button=PBButton;PBwiki.Components.FolderSecurityButton=Class.create(PBwiki.Components.Button,{classname:"PBwiki.Components.FolderSecurityButton",create:function($super){$super();this.elm.addClassName("folder_sec");if(this.options.has_custom_perms){this.span.appendChild(new Element("sub").update("&nbsp;"))}}});PBwiki.Components.FileUploadButton=Class.create(PBwiki.Components.Button,{classname:"PBwiki.Components.FileUploadButton",create:function($super){$super();this.overlay=new PBwiki.Components.FileUploadOverlay({elm:this.elm,folder:this.options.folder,onUploaded:function(A,B){this.notify("onUploaded",A,B)}.bind(this)})},enable:function(){this.overlay.enable()},disable:function(){this.overlay.disable()},setUploadFolder:function(A){this.overlay.setUploadFolder(A)}});PBwiki.Components.FileUploadOverlay=Class.create({classname:"PBwiki.Components.FileUploadOverlay",initialize:function(A){this.options=A;this.elm=A.elm;this.placeholder=new Element("div",{id:this.options.id+"_placeholder"});this.elm.observe("click",this.clicked.bind(this));this.isEnabled=true;this.elm.insertBefore(this.placeholder,this.elm.firstChild);if(!PBinfo.CurrentPage.isCustomDomain&&(SWFUpload.DetectFlashVer(10,0,0)||(SWFUpload.DetectFlashVer(9,0,0)&&navigator.appVersion.indexOf("Mac")==-1))){this.createSwf()}this.obj=this.elm.down("object");if(this.obj){this.obj.setStyle({position:"absolute",zIndex:1000});if(Prototype.Browser.Gecko){this.obj.observe("mousedown",function(B){B.stop()})}}},setUploadFolder:function(A){this.options.folder=A;if(this.flashLoaded){this.swf.setUploadURL(this.getUploadUrl());this.swf.addPostParam("folder",this.options.folder)}},getUploadUrl:function(){var A={op:"PutFile",verbose:"true",_type:"xml"};Object.extend(A,PBwiki.getSessCookie());if(this.options.folder){A.folder=this.options.folder}return window.location.protocol+"//"+window.location.host+"/api_v2/?"+Object.toQueryString(A)},getLegacyUploadUrl:function(){var A={op:"PutFile",verbose:"true",_type:"iframe",callback:"top.PBwiki.APIRequest.DelegateFrameRequest"};Object.extend(A,PBwiki.getSessCookie());if(this.options.folder){A.folder=this.options.folder}return"/api_v2/?"+Object.toQueryString(A)},clicked:function(A){A.stop();if(this.isEnabled){setTimeout(this.openLegacyUpload.bind(this),100)}},disable:function(){if(this.obj){Element.hide(this.obj)}this.isEnabled=false;this.elm.addClassName("disabled")},enable:function(){if(this.obj){Element.show(this.obj)}this.isEnabled=true;this.elm.removeClassName("disabled")},openLegacyUpload:function(){if(this.isEnabled&&!this.flashLoaded){if(this.isRateLimited()){new PBwiki.DialogCommands.RateLimited({})}else{new PBwiki.DialogCommands.LegacyUploader({uploadUrl:this.getLegacyUploadUrl(),onUploaded:this.uploadFinshed.bind(this),folder:this.folder})}}},filesSelected:function(A){if(!this.flashLoaded){return false}if(A>PBconst.kUploadMaxFiles){return }try{this.obj.blur()}catch(B){}if(A==0){this.notify("onUploaded",0,"No files selected")}else{if(this.isRateLimited()){new PBwiki.DialogCommands.RateLimited({})}else{this.flashUploader=new PBwiki.DialogCommands.FlashUploader({swf:this.swf,onUploaded:this.uploadFinshed.bind(this),url:this.getUploadUrl()})}}},flashLoad:function(){this.flashLoaded=true;this.setUploadFolder(this.options.folder)},isRateLimited:function(){var A=PBwiki.getCache("GetStorageInfo");return A&&(A.ratelimited||((A.total>0)&&(A.used>A.total)))},uploadFinshed:function(A,B){this.notify("onUploaded",A,B)},fileQueueError:function(A){this.notify("onUploaded",0,"PBworks supports uploading "+PBconst.kUploadMaxFiles+" files at a time, please select fewer files and try again.")},createSwf:function(){var A={upload_url:this.getUploadUrl(),file_size_limit:PBconst.kUploadMaxSize,file_types:"*.*",file_types_description:"All Files",file_upload_limit:PBconst.kUploadMaxFiles,file_queue_limit:PBconst.kUploadMaxFiles,button_width:this.elm.getWidth(),button_height:this.elm.getHeight(),button_placeholder_id:this.options.id+"_placeholder",button_window_mode:SWFUpload.WINDOW_MODE.TRANSPARENT,button_text_top_padding:4,button_text_left_padding:8,file_dialog_start_handler:this.flashLoad.bind(this),file_dialog_complete_handler:this.filesSelected.bind(this),file_queue_error_handler:this.fileQueueError.bind(this),debug_handler:this.debug.bind(this),flash_url:"/w/browse/swfupload?"+Object.toQueryString(PBwiki.getSessCookie()),prevent_swf_caching:false,custom_settings:{progressTarget:"fsUploadProgress1"},debug:false};this.swf=new SWFUpload(A)},debug:function(A){}});Object.Event.extend(PBwiki.Components.FileUploadOverlay);if(Prototype.Browser.IE){PBwiki.Components.IEButtonFix=function(){if(/MSIE/.test(navigator.userAgent)&&$$("div.button-bar").length>0){if(PBwiki.resize_timer){window.clearTimeout(PBwiki.resize_timer)}PBwiki.resize_timer=window.setTimeout(Util.fixIE6RelativeElems,50)}};PBwiki.init("IEButtonFix bind window resize",function(){if(/MSIE/.test(navigator.userAgent)&&$$("div.button-bar").length>0){Event.observe(window,"resize",PBwiki.Components.IEButtonFix)}})}var Tooltip=Class.create({classname:"Tooltip",initialize:function(B,A){this.el=$(B);this.initialized=false;this.setOptions(A);this.showEvent=this.show.bindAsEventListener(this);this.hideEvent=this.hide.bindAsEventListener(this);this.updateEvent=this.update.bindAsEventListener(this);Event.observe(this.el,"mouseover",this.showEvent);Event.observe(this.el,"mouseout",this.hideEvent);this.content=this.options.txt;this.el.title="";this.el.descendants().each(function(C){if(Element.readAttribute(C,"alt")){C.alt=""}});Tooltip.setup()},setOptions:function(A){this.options={backgroundColor:"#fff",borderColor:"#ccc",textColor:"",textShadowColor:"",maxWidth:450,align:"left",delay:200,mouseFollow:true,opacity:0.95,appearDuration:0,hideDuration:0};Object.extend(this.options,A||{})},show:function(A){this.xCoord=Event.pointerX(A);this.yCoord=Event.pointerY(A);if(!this.initialized){this.timeout=window.setTimeout(this.appear.bind(this),this.options.delay);Event.fire(this.el,"tooltip:show",this)}},hide:function(A){if(this.initialized){if(this.appearingFX){this.appearingFX.cancel()}if(this.options.mouseFollow){Event.stopObserving(this.el,"mousemove",this.updateEvent)}if(typeof (Effect)!="undefined"){new Effect.Fade(this.tooltip,{duration:this.options.hideDuration,afterFinish:function(){Element.remove(this.tooltip)}.bind(this)})}else{this.tooltip.remove()}Event.fire(this.el,"tooltip:hide",this)}this._clearTimeout(this.timeout);this.initialized=false},update:function(A){this.xCoord=Event.pointerX(A);this.yCoord=Event.pointerY(A);this.setup()},updateCoords:function(){this.xCoord=Tooltip.xCoord;this.yCoord=Tooltip.yCoord},checkNode:function(){if(!this.el||!this.el.up("body")){this.hide()}else{if(this.initialized){setTimeout(this.checkNode.bind(this),1000)}}},setContent:function(A){this.content=A;this.tooltip.childNodes[1].innerHTML=A},appear:function(){this.tooltip=new Element("div",{className:"tooltip",style:"display: none;"});var A=new Element("div",{className:"xtop"});A.appendChild(new Element("div",{className:"xb2",style:"background-color:"+this.options.backgroundColor+"; border-color:"+this.options.borderColor+";"}));A.appendChild(new Element("div",{className:"xb3",style:"background-color:"+this.options.backgroundColor+"; border-color:"+this.options.borderColor+";"}));A.appendChild(new Element("div",{className:"xb4",style:"background-color:"+this.options.backgroundColor+"; border-color:"+this.options.borderColor+";"}));var B=new Element("div",{className:"xboxcontent",style:"background-color:"+this.options.backgroundColor+"; border-color:"+this.options.borderColor+((this.options.textColor!="")?"; color:"+this.options.textColor:"")+((this.options.textShadowColor!="")?"; text-shadow:2px 2px 0"+this.options.textShadowColor+";":"")});var C=new Element("div",{className:"xbottom"});C.appendChild(new Element("div",{className:"xb4",style:"background-color:"+this.options.backgroundColor+"; border-color:"+this.options.borderColor+";"}));C.appendChild(new Element("div",{className:"xb3",style:"background-color:"+this.options.backgroundColor+"; border-color:"+this.options.borderColor+";"}));C.appendChild(new Element("div",{className:"xb2",style:"background-color:"+this.options.backgroundColor+"; border-color:"+this.options.borderColor+";"}));C.appendChild(new Element("div",{className:"xb1",style:"background-color:"+this.options.borderColor+";"}));this.tooltip.appendChild(A);this.tooltip.appendChild(B);this.tooltip.appendChild(C);this.setContent(this.content);document.body.insertBefore(this.tooltip,document.body.childNodes[0]);Element.extend(this.tooltip);this.options.width=this.tooltip.getWidth();this.tooltip.style.width=this.options.width+"px";this.setup();if(this.options.mouseFollow){Event.observe(this.el,"mousemove",this.updateEvent)}this.initialized=true;this.updateCoords();this.setup();if(typeof (Effect)!="undefined"){this.appearingFX=new Effect.Appear(this.tooltip,{duration:this.options.appearDuration,to:this.options.opacity})}else{this.tooltip.show()}this.checkNode()},setup:function(){if(this.options.width>this.options.maxWidth){this.options.width=this.options.maxWidth;this.tooltip.style.width=this.options.width+"px"}if(this.xCoord+this.options.width>=Element.getWidth(document.body)){this.options.align="right";this.xCoord=this.xCoord-this.options.width+20}this.tooltip.style.left=this.xCoord-7+"px";this.tooltip.style.top=this.yCoord+22+"px"},_clearTimeout:function(A){clearTimeout(A);clearInterval(A);return null}});Tooltip.setup=function(){document.observe("mousemove",function(A){this.xCoord=Event.pointerX(A);this.yCoord=Event.pointerY(A)}.bind(Tooltip))};PBwiki.UserPrefs={classname:"PBwiki.UserPrefs",set:function(C,B,F,A){var D={key:C};if(F){D.wikiname=F}var E={method:"post",parameters:{value:(typeof (B)=="object")?Object.toJSON(B):B},asynchronous:!A};new PBwiki.APIRequest("SetUserPref",D,E);if(PBinfo.GetUserPrefs){PBinfo.GetUserPrefs[C]=(typeof (B)=="object")?Object.clone(B):B}},get:function(A){if(!PBinfo.GetUserPrefs){return }return PBinfo.GetUserPrefs[A]},group_add:function(C,B,A){new PBwiki.APIRequest("GroupAddPref",{group:C},{onSuccess:A,method:"post",parameters:{value:B}})}};PBwiki.UserPrefs.Stars={classname:"PBwiki.UserPrefs.Stars",get_starred_objects:function(A){if(PBinfo.GetUserPrefs&&PBinfo.GetUserPrefs.starred){A(PBinfo.GetUserPrefs.starred)}else{A([])}},is_current_page_starred:function(){return PBinfo.CurrentPage.starred},set_object_starred:function(C,B){if(typeof C==="boolean"){if(!PBinfo.CurrentObject){return }C={starred:C,oid:PBinfo.CurrentObject};if(PBinfo.CurrentPage&&PBinfo.CurrentPage.page){C.name=PBinfo.CurrentPage.page;C.type="page"}else{if(PBinfo.CurrentFile){C.name=PBinfo.CurrentFile.name;C.type="file"}}}var D=Object.clone(C);delete D.type;delete D.name;new PBwiki.APIRequest("SetObjectStarred",D,B);if(PBinfo.GetUserPrefs){if(!C.starred){var A=PBinfo.GetUserPrefs.starred.pluck("oid").indexOf(C.oid);if(A>-1){PBinfo.GetUserPrefs.starred.splice(A,1)}}else{PBinfo.GetUserPrefs.starred.push(C)}}if(PBinfo.CurrentPage.page==C.name){PBinfo.CurrentPage.starred=C.starred}document.fire("data:objectStarred",C)}};var UserPrefs={};UserPrefs.Manager={classname:"UserPrefs.Manager",can_run:function(){this.epcl=$("expand-collapse-page-link");return this.epcl!=undefined},initialize:function(){if(!this.can_run()){return }if(PBwiki.UserPrefs.get(PBconst.kSideBarCollapsed)){this.setCollapsed(true)}this.epcl.observe("click",function(A){try{A.stop();A.element().blur()}catch(A){}try{this.setCollapsed(!this.isCollapsed());if(PBwiki.getUID()){PBwiki.UserPrefs.set(PBconst.kSideBarCollapsed,this.isCollapsed())}}catch(A){alert(A.message)}}.bind(this))},isCollapsed:function(){return(document.body.className.indexOf("fullwidth")!=-1)},setCollapsed:function(A){(A)?Element.addClassName(document.body,"fullwidth"):Element.removeClassName(document.body,"fullwidth");if(!$("top-content")){return }$(document.body).appendChild($("top-content").addClassName("abs"))},goFullWidth:function(){this.setCollapsed(true)},saveWidth:function(){this.savedWidth=this.isCollapsed()},restoreWidth:function(){this.setCollapsed(this.savedWidth)}};PBwiki.init("UserPrefs.Manager",UserPrefs.Manager.initialize.bind(UserPrefs.Manager));PBwiki.APIRequest=Class.create({classname:"PBwiki.APIRequest",initialize:function(A,C,E){this.m=A;this.args=C;this.options={_type:"jsontext",method:"post",incUsess:true,evalJS:false,async:false};Object.extend(this.options,E);if(this.options.incUsess){Object.extend(this.args,PBwiki.getSessCookie())}if(this.options.async){delete this.options.cacheability;this.options.method="post";var B=this.args;if(this.options.parameters){Object.extend(B,this.options.parameters)}C=this.args={async_op:this.m};parameters=this.options.parameters={inputs:Object.toJSON(B)};A=this.m="Async";if(this.options.onSuccess){this.options.onFinish=this.options.onSuccess;this.options.onSuccess=function(G){this.async_id=G.id;this.retryAsync()}.bind(this)}}if(this.options.cacheability!==false&&typeof (this.options.cacheability)!="object"&&PBcacheability[this.m]){this.options.cacheability=PBcacheability[this.m]}if(this.options.cacheability&&PBinfo.GetTimes){this.options.method="get";var F={};this.options.cacheability.each(function(G){F[G]=PBinfo.GetTimes[G]||0});Object.extend(C,F);C._bt=PBwiki.getBuildTime()}if(this.options.method=="get"&&this.options.allowDefer){this.args[PBconst.kAPIAllowDeferWhenBusy]=true;this.deferCount=0}var D=PBwiki.APIRequest.callPreOp(A,this.args,this.options,this);if(D){return this.dispatchSuccess(D)}this.apiUrl=this.buildUri(A,this.args);this.reqOpts=Object.clone(this.options);Object.extend(this.reqOpts,{onSuccess:this.apiResponse.bind(this),onFailure:this.dispatchError.bind(this,"Sorry, your request has failed to reach the PBworks servers. Please reconnect and try again.",509),on504:this.dispatchError.bind(this,"Sorry, PBworks is experiencing slowness serving your request, Please try again or email support if the problem persists.",504),onException:this.dispatchError.bind(this,"Your internet connection is disconnected. Please reconnect and try again.",510)});this.doRequest()},retryAsync:function(){window.setTimeout(function(){new PBwiki.APIRequest("AsyncResponse",{id:this.async_id},{onSuccess:function(A){if(A.status==="finished"){if(A.response.error_status&&A.response.error_string){this.dispatchError(A.response.error_string,A.response.error_status);return }if(A.response._perm_cache_times&&PBinfo.GetTimes){Object.extend(PBinfo.GetTimes,A.response._perm_cache_times||{});PBinfo.GetTimes._client_time=PBwiki.APIRequest.lastClientTime}if(this.options.onFinish){this.options.onFinish(A.response)}}else{this.retryAsync()}}.bind(this),onFailure:this.dispatchError.bind(this,"Sorry, your request has failed to reach the PBworks servers. Please reconnect and try again.",509)})}.bind(this),PBconst.kAPIAsyncRetryInterval)},unicodeConvert:function(B){var A={0:"",1:"000",2:"00",3:"0",4:""};return B.replace(/[\u0080-\uFFFF]/g,function(D){var E=D[0]||D;var C=Math.floor(E.charCodeAt()/16).toString(16)+(E.charCodeAt()%16).toString(16);return"\\u"+A[C.length].concat(C)})},doRequest:function(){this.setWaitCursor(true);this.apiRequest=new Ajax.Request(this.apiUrl,this.reqOpts)},setWaitCursor:function(B){if(this.options.waitCursor&&this.waitCursor!=B){try{this.waitCursor=B;(B)?Element.addClassName(document.body,"wait"):Element.removeClassName(document.body,"wait")}catch(A){}}},buildUri:function(A,C){C.op=A;var B="/api_v2/?"+Object.toQueryString(C);if(!this.options.cacheability&&this.options.crossDomain&&this.options.incUsess==false&&PBinfo.CurrentWiki&&typeof (XMLHttpRequest)!="undefined"&&"withCredentials" in (new XMLHttpRequest())){B=Util.URLRelativeToContext(B,{network:PBinfo.CurrentNetwork.name})}return B},abortRequest:function(){this.setWaitCursor(false);this.isAborted=true;try{this.apiRequest.transport.abort()}catch(A){}},dispatchError:function(B,A){this.setWaitCursor(false);if(this.options.onFailure&&!this.isAborted){this.options.onFailure(B,A)}},apiResponseWasDeferred:function(){if(this.deferCount<PBconst.kAPIMaxDeferRetries){this.deferCount++;document.fire("api:deferred",this);window.setTimeout(this.retryRequest.bind(this),PBconst.kAPIDeferRetryInterval)}else{document.fire("api:timed_out",this);this.dispatchError("PBworks experiencing higher traffic than usual. Please try again later.",500)}},retryRequest:function(){this.doRequest()},apiResponse:function(A){var B=this.parseResponse(A.responseText);if(typeof (B)=="object"&&B[PBconst.kAPIDidDefer]){this.apiResponseWasDeferred();return }if(this.deferCount>0){document.fire("api:deferred_completed",this)}this.dispatchSuccess(B)},dispatchSuccess:function(B){this.setWaitCursor(false);if(B){this.handleResponse(this.m,B,this.args);try{if(this.options.onSuccess){this.options.onSuccess(B)}}catch(A){this.dispatchError((PBwiki.is_dev()?"Dev JS Exception: ":"Sorry, we encountered an error. ")+A.message,500)}}},parseResponse:function(A){var D=A.split("\n");if(D.length>2&&A.indexOf("/*-secure-")!=-1){if(this.options.raw){return D[1]}try{var C=(typeof (JSON)!="undefined")?JSON.parse(D[1]):D[1].evalJSON(true)}catch(B){this.dispatchError(this.getParseErrorMsg(A),511)}if(C.error_status){return this.dispatchError(C.error_string,C.error_status)}else{if(C.success===false){return this.dispatchError("Sorry, we encountered an error.",512)}}return C}else{this.dispatchError(this.getParseErrorMsg(A),511)}},getParseErrorMsg:function(A){if(PBwiki.is_dev()){var B=new RegExp("Dev-only error notice</h2><hr><h3>(.*?)</div>").exec(A.replace(/\n/g,""));if(B){return B[1].replace(/(<([^>]+)>)/ig," ").replace(/  /g," ")}else{return"Dev PHP Output: "+A.substr(0,150)}}else{return"Sorry, we encountered an error while processing your request. Please try again or email support if the problem persists. ("+this.m+" 511)"}},handleResponse:function(A,D,B){var C=PBwiki.APIRequest.lastClientTime=PBwiki.getTimestamp();if(this.options.raw){return }D._args=Object.clone(B);D._args.op=A;D._client_time=C;PBinfo[A]=D;if(D._perm_cache_times&&PBinfo.GetTimes){Object.extend(PBinfo.GetTimes,D._perm_cache_times||{});if(PBinfo[A]._args){Object.extend(PBinfo[A]._args,D._perm_cache_times||{})}PBinfo.GetTimes._client_time=C;if(!this.options.times){PBwiki.APIRequest.callPostOp("GetTimes",PBinfo.GetTimes)}}PBwiki.APIRequest.callPostOp(A,D)}});PBwiki.APIRequest.postOpCallbacks=new Array();PBwiki.APIRequest.observePostOp=function(B,A){if(!this.postOpCallbacks[B]){this.postOpCallbacks[B]=new Array()}this.postOpCallbacks[B].push(A)};PBwiki.APIRequest.callPostOp=function(B,A){if(!PBwiki.APIRequest.postOpCallbacks[B]){return }PBwiki.APIRequest.postOpCallbacks[B].each(function(C){C(A)})};PBwiki.APIRequest.preOpCallbacks=[];PBwiki.APIRequest.observePreOp=function(B,A){if(!this.preOpCallbacks[B]){this.preOpCallbacks[B]=new Array()}this.preOpCallbacks[B].push(A)};PBwiki.APIRequest.callPreOp=function(E,A,D,C){preOps=PBwiki.APIRequest.preOpCallbacks["*"].concat(PBwiki.APIRequest.preOpCallbacks[E]||[]);if(!preOps||preOps.length==0){return }var B=false;preOps.each(function(F){B=F(E,A,D,C);if(B){throw $break}});return B};PBwiki.APIRequest.DelegateFrameRequest=function(A){document.fire("frame:"+A.op,A)};PBwiki.MultiAPIRequest=Class.create(PBwiki.APIRequest,{classname:"PBwiki.MultiAPIRequest",initialize:function(D,C){this.reqOptions=new Array();this.async_ids=new Array();this.async_timer=null;this.options={times:true};Object.extend(this.options,C);var A={};if(this.options.incUsess){Object.extend(A,PBwiki.getSessCookie())}for(var B=0;B<D.length;B++){if(D[B].length==3&&D[B][2].async){D[B][1]={async_op:D[B][0],inputs:Object.toJSON(D[B][1])};D[B][0]="Async";if(D[B][2].onSuccess){D[B][2].onFinish=D[B][2].onSuccess}D[B][2].onSuccess=function(E,F){this.async_ids[F]=E.id;this.retryAsync()}.bindAsEventListener(this,B)}}if(this.options.times&&(PBinfo.CurrentWiki||PBinfo.CurrentNetwork)){D.push(["GetTimes",{},{onSuccess:function(E){PBinfo.GetTimes=E},counted:false}])}for(var B=0;B<D.length;B++){if(D[B].length==3){this.reqOptions[B]=D[B].pop()}}this.r=D;this.apiUrl=this.buildUri("Multi",A);this.reqOpts=Object.clone(this.options);this.reqOpts=Object.extend(this.reqOpts,{method:"post",parameters:{calls:this.unicodeConvert(Object.toJSON(D))},onSuccess:this.onMulti.bind(this),onFailure:this.dispatchError.bind(this,"Sorry, your request has failed to reach the PBworks servers. Please reconnect and try again.",509),on504:this.dispatchError.bind(this,"Sorry, PBworks is experiencing slowness serving your requests, Please try again or email support if the problem persists.",504),onException:function(E,F){this.dispatchError.bind(this,F.message,510)}.bind(this)});this.setWaitCursor(true);this.apiRequest=new Ajax.Request(this.apiUrl,this.reqOpts)},retryAsync:function(){if(this.async_timer){return }this.async_timer=window.setTimeout(function(){delete this.async_timer;var A=this.async_ids.compact();if(A.length===0){return }if(A.length===1){var C=A[0];new PBwiki.APIRequest("AsyncResponse",{id:C},{onSuccess:this.asyncResponseHandler.bindAsEventListener(this,C)})}else{var B=A.collect(function(D){return["AsyncResponse",{id:D},{onSuccess:this.asyncResponseHandler.bindAsEventListener(this,D)}]}.bind(this));new PBwiki.MultiAPIRequest(B,{times:this.options.times})}}.bind(this),PBconst.kAPIAsyncRetryInterval)},asyncResponseHandler:function(B,C){if(B.status=="finished"){var A=this.async_ids.indexOf(C);delete this.async_ids[A];if(B.response.error_status&&B.response.error_string){if(this.reqOptions[A].onFailure){this.reqOptions[A].onFailure(B.response.error_string,B.response.error_status)}}else{if(this.reqOptions[A].onFinish){this.reqOptions[A].onFinish(B.response)}}if(this.deferAllComplete){this.results.responses[A]=B.response;if(this.async_ids.compact().length===0){this.options.onAllComplete(this.results)}}}else{this.retryAsync()}},onMulti:function(E){this.setWaitCursor(false);var H=false;var F=0;var D=0;var G=this.parseResponse(E.responseText);if(!G){return }var A=G.response;if(A&&A.length==this.reqOptions.length){for(var C=0;C<A.length;C++){H=!A[C].error_status&&A[C].success!==false;this.handleResponse(this.r[C][0],G.response[C],this.r[C][1]);if(this.reqOptions[C].counted!==false){D++;if(H){F++}}if(!H){if(A[C].error_string){this.lastError=A[C].error_string}else{this.lastError=this.r[C][0]+" failed unexpectedly."}}if(H&&this.reqOptions[C].onSuccess){if(this.reqOptions[C].onSuccess){this.reqOptions[C].onSuccess(A[C])}}else{if(!H&&this.reqOptions[C].onFailure){if(this.reqOptions[C].onFailure){this.reqOptions[C].onFailure(this.lastError,A[C].error_status)}}}}}if(this.options.onAllComplete){var B={responses:G.response,successful:F,total:D,lastError:(this.lastError||"")};if(this.async_ids.compact().length===0){this.options.onAllComplete(B)}else{this.results=B;this.deferAllComplete=true}}}});PBwiki.APIRequest.sortResultObjectByParents=function(D,B){var C={};C[0]=[];D.each(function(F){if(F.parent_id){if(!C[F.parent_id]){C[F.parent_id]=[]}C[F.parent_id].push(F)}else{C[0].push(F)}});var E=[];var A=function(G,F){if(C[G]){C[G].each(function(H){H.indent=F;E.push(H);A(H.oid,F+1)})}};A(B||0,0);return E};PBwiki.Data={classname:"PBwiki.Data",debug:false,enabledLayers:["LocalCache"],initialize:function(){PBwiki.Data.Instances=[];PBwiki.Data.enabledLayers.each(function(A){PBwiki.Data.Instances.push(new PBwiki.Data.Layers[A])});if(this.debug){PBwiki.info(PBwiki.Data.Instances)}},check:function(A,B,D,C){var E=false;if(!PBwiki.Data.Instances){return }PBwiki.Data.Instances.each(function(F){E=F.check(A,B,D,C);if(E){throw $break}});return E},getInstance:function(B){var A=PBwiki.Data.enabledLayers.indexOf(B);return(A!=-1)?PBwiki.Data.Instances[A]:{hasData:function(){return false}}}};PBwiki.Data.HIGH_PRIORITY=1;PBwiki.Data.MED_PRIORITY=2;PBwiki.Data.LOW_PRIORITY=3;PBwiki.Data.NO_CACHE=4;PBwiki.APIRequest.observePreOp("*",PBwiki.Data.check);PBwiki.init(PBwiki.Data);PBwiki.Data.Layers={};PBwiki.Data.Layers.DOMStorageCache=Class.create({classname:"PBwiki.Data.Layers.DOMStorageCache",debug:PBwiki.Data.debug,data:{},hasData:function(){if(!this.hasDOMStorage()&&!this.data){return }return !!this.getData(this.storageKey+"-times")},storeData:function(A,D,B){if(!this.hasDOMStorage()){return }if(window.location.protocol=="https:"){A+="-s"}if(!B){B=location.host}this.data[A]=D;try{if(typeof (localStorage)!="undefined"){localStorage.setItem(A,D)}}catch(C){}try{if($("userDataElement")){$("userDataElement").setAttribute(A,D);$("userDataElement").save("PBstorage")}}catch(C){}},checkKey:"PBStorageTest",checkStorage:function(){if(!this.hasDOMStorage()){return false}var A=Math.round(Math.random()*1000);this.storeData(this.checkKey,A);if(this.getData(this.checkKey)==A){try{localStorage.removeItem(this.checkKey)}catch(B){}try{if($("userDataElement")){$("userDataElement").removeAttribute(this.checkKey)}}catch(B){}return true}},getData:function(A,B){if(!this.hasDOMStorage()){return }if(this.data[A]){return this.data[A]}if(window.location.protocol=="https:"){A+="-s"}if(!B){B=location.host}try{if(typeof (localStorage)!="undefined"){return localStorage.getItem(A)}}catch(C){}try{if($("userDataElement")){return $("userDataElement").getAttribute(A)}}catch(C){}return false},hasDOMStorage:function(){var B=(typeof (localStorage)!="undefined"||typeof (globalStorage)!="undefined");if(!B){try{if(!$("userDataElement")&&$$("body")[0].addBehavior){$$("head")[0].insert(new Element("link",{id:"userDataElement",style:"behavior:url(#default#userData)"}));$("userDataElement").load("PBstorage")}B=$("userDataElement")}catch(A){}}return B},check:function(A,B,D,C){if(!this.hasData()){return false}if(this.debug){PBwiki.info("HAS DATA")}if(this.methods.indexOf(A)==-1){return false}if(this.debug){PBwiki.info("METHOD MATCHES")}if(!this.checkTimes()){return false}if(this.debug){PBwiki.info("TIMES PASSED")}return true},checkTimes:function(){var B=true;var A=this.getData(this.storageKey+"-times");if(!A){return }A=A.evalJSON();if(!A._perm_cache_times){return }this.cacheTimes.each(function(C){if(A._perm_cache_times[C]!=PBinfo.GetTimes[C]){B=false;throw $break}});if(A._uid!=PBwiki.getUID()){return }return B}});PBwiki.Data.Layers.LocalCache=Class.create({classname:"PBwiki.Data.Layers.LocalCache",debug:PBwiki.Data.debug,check:function(F,D,E){if(E.cacheability&&PBinfo.GetTimes){var C=E.key||F;if(!PBinfo[C]){return }var A=Object.clone(D);delete A._bt;var B=$H(Object.clone(PBinfo[C]._args));E.cacheability.each(function(G){A[G]=parseInt(PBinfo.GetTimes[G])});A.op=F;A=$H(A);if(Object.toJSON(A.keys().sort())!=Object.toJSON(B.keys().sort())){if(this.debug){}return false}if(Object.toJSON(A.values().sort())!=Object.toJSON(B.values().sort())){if(this.debug){}return false}return PBinfo[C]}return false}});PBwiki.APIDeferredRequestNotice=Class.create({classname:"PBwiki.APIDeferredRequestNotice",initialize:function(){document.observe("api:deferred",this.requestWasDeferred.bind(this));document.observe("api:deferred_completed",this.deferredRequestWasCompleted.bind(this));document.observe("api:timed_out",this.requestedTimedOut.bind(this))},deferredRequestWasCompleted:function(){var A=$("api-deferred-notice");if(A){A.hide()}},requestedTimedOut:function(){var A=$("api-deferred-notice");if(A){A.hide()}},requestWasDeferred:function(){var A=$("api-deferred-notice");if(!A){A=new Element("div",{id:"api-deferred-notice"});A.update("Still working...");document.body.appendChild(A);A.show()}}});PBwiki.init(PBwiki.APIDeferredRequestNotice);PBwiki.GrowingTextArea=Class.create({classname:"PBwiki.GrowingTextArea",initialize:function(A){this.maximumHeight=200;this.element=$(A);this.defaultHeight=this.element.getHeight();this.element.setStyle({resize:"none"});this.element.observe("keyup",this.resizeIfNecessary.bindAsEventListener(this));this.element.observe("change",this.resizeIfNecessary.bindAsEventListener(this));this.resizeIfNecessary()},resizeIfNecessary:function(){var B,A;B=this.element.getHeight();this.element.setStyle({height:this.defaultHeight+"px"});A=this.element.scrollHeight;if(A>this.maximumHeight){A=this.maximumHeight;this.element.setStyle({overflow:"auto"})}else{this.element.setStyle({overflow:"hidden"})}if(this.element.getHeight()<A){this.element.setStyle({height:A+"px"})}if(this.element.getHeight()!==B){this.element.fire("growingtextarea:resize")}}});var InputText=Class.create({classname:"InputText",initialize:function(B){this.element=$(B);try{this.placeholder=this.element.getAttribute("placeholder");if(this.placeholder){this.placeholder=this.placeholder.strip()}if("placeholder" in document.createElement(this.element.tagName.toLowerCase())){this.nativeHTML5=true;return }if(this.placeholder&&!this.placeholder.empty()){this.element.observe("focus",this.onFocus.bind(this));this.element.observe("blur",this.onBlur.bind(this));this.element.observe("keypress",function(C){if(C.keyCode==Event.KEY_ESC){this.element.blur()}}.bind(this))}if(this.element.value.empty()||this.element.value==this.placeholder){this.clear()}this.element.observe("ui:clearfield",this.onBlur.bind(this))}catch(A){throw new UIException("InputText: error "+A.getMessage(),this.element,A)}},clear:function(){if(this.nativeHTML5){this.element.value="";return }this.placeholder=this.element.getAttribute("placeholder");if(this.placeholder&&!this.placeholder.empty()){this.placeholder=this.placeholder.strip();this.element.setStyle({color:"#999"});this.element.value=this.placeholder}else{this.element.value=""}this.isEmpty=true},setValue:function(A){if(!A||A.length==0){this.clear();return }this.element.value=A;this.element.setStyle({color:"#000"})},onFocus:function(A){this.element.setStyle({color:"#000"});if(this.isEmpty){this.element.value=""}},onBlur:function(){if(this.element.value.empty()||this.placeholder==this.element.value){this.clear()}else{this.isEmpty=false}}});InputText.initialize=function(){InputText.selector=".inputtext";try{$$(InputText.selector).each(function(B){(new InputText(B))})}catch(A){PBwiki.warn(A)}};PBwiki.init(InputText);PBwiki.Views={classname:"PBwiki.Views",debug:false,validViews:{page:true,loading:true,file:true},initialize:function(){if(PBinfo.CurrentPage&&PBinfo.CurrentPage.editor_v3){var B=PBwiki.feature("gui")?"main_editor.js":"editor.js";if(PBinfo.noStatics){this.validViews.edit=this.validViews.newpage=PBconst.kStaticDebugDirectory+"debug.php?manifest="+B+"&rand"+Math.random()}else{this.validViews.edit=this.validViews.newpage="/shared/statics/"+B}Event.observe(window,"load",function(){setTimeout(function(){if($("edit-tab")&&$("edit-tab").hasClassName("editpage")){PBwiki.ResourceLoader.load(this.validViews.edit)}}.bind(this),1000)}.bind(this))}this.initialView=this.getDefaultView();if(!this.initialView){return }this.historyManager=PBwiki.History;this.historyManager.getKey("view").observe("onChange",this.checkView.bind(this));this.historyManager.start();var A=this.getHistoryKey();if(this.isValidView(A)){this.initialView=A}document.observe("ui:changeview",function(D){if(Object.isString(D.memo)){this.selectView(D.memo)}else{var C=D.memo.view;delete D.memo.view;this.selectView(C,D.memo)}}.bind(this));this.selectView(this.initialView);if($("view-tab")&&$("edit-tab")){if(PBinfo.CurrentPage&&PBinfo.CurrentPage.editor_v3&&$("edit-tab").hasClassName("editpage")){$("edit-tab").observe("click",this.tabClick.bindAsEventListener(this,"edit"))}$("view-tab").observe("click",this.tabClick.bindAsEventListener(this,this.initialView))}if(PBwiki.feature("gui")&&$("page-edit")){$("page-edit").observe("click",function(C){C.stop();if(C.element().hasClassName("mustjoin")){(new PBwiki.DialogCommands.JoinWorkspace({action:"/w/session/join?ed=1"}));return }this.selectView("edit")}.bind(this))}},getDefaultView:function(){if(this.defaultView){return this.defaultView}var A=false;for(var B=0;B<this.findDefaultViewChecks.length;B++){A=this.findDefaultViewChecks[B]();if(A){break}}this.defaultView=A;if(this.debug){PBwiki.info("default view is "+A)}return A},findDefaultViewChecks:[function(){if(typeof PBinfo.CurrentFile!=="undefined"&&$("wikicontent")){return"file"}},function(){if((PBinfo.CurrentPage&&PBinfo.CurrentPage.editor_v3&&$("view-tab")&&$("edit-tab")&&$("edit-toolbar")&&!$("wikicontent"))||(PBwiki.feature("gui")&&$("wikicontent")&&$("wikicontent").hasClassName("page-new"))){return"newpage"}},function(){if(($("view-tab")&&$("wikicontent"))||(PBwiki.feature("gui")&&$("wikicontent")&&!$("wikicontent").hasClassName("page-new"))){return"page"}}],tabClick:function(C,B){if(C){C.stop();try{C.element().blur()}catch(A){}}if(this.debug){PBwiki.info("TAB CLICK = "+B)}this.selectView(B)},checkView:function(B){var A=B||this.getHistoryKey();if(!this.isValidView(A)||A==this.currentView){return }this.selectView(A,this.historyManager.getItems())},selectView:function(A,B){if(this.currentView==A||!this.isValidView(A)){return false}if(PBwiki.Views[A]){if(!this.switchView(A,B)){return false}return true}else{if(this.debug){PBwiki.info("LOADING "+A)}if(!this.switchView("loading",{view:A})){return false}this.loadView(A,function(){if(this.debug){PBwiki.info("LOADED "+A)}this.switchView(A,B)}.bind(this))}},loadView:function(B,A){if(PBwiki.Views[B]){A()}else{PBwiki.ResourceLoader.load(this.validViews[B],A)}},isValidView:function(A){return !!this.validViews[A]},setHistoryKey:function(A){if(!this.historyManager||A=="loading"){return false}var B=this.getHistoryKey();if(!B&&A==this.getDefaultView()){return false}if(B==A){return false}this.historyManager.setItems({view:A})},getHistoryKey:function(){var A;if(this.historyManager){A=this.historyManager.getKey("view").getValue()}if(!(PBinfo.CurrentPage&&PBinfo.CurrentPage.editor_v3)&&A=="edit"){return"page"}return A},switchView:function(A,B){if(this.debug){PBwiki.info("SWITCH VIEW = "+A)}if(this.view){var D=this.view.destroy();if(!D){return false}}delete this.view;delete PBwiki.currentView;try{this.view=PBwiki.currentView=new PBwiki.Views[A](B)}catch(C){PBwiki.warn(C,"views-init-"+A)}this.currentView=A;this.setHistoryKey(A);return true}};PBwiki.Views.base=Class.create({classname:"PBwiki.Views.base",chromeVisibility:false,setChromeVisibility:function(A){if(PBwiki.feature("gui")){A?document.body.addClassName("editing"):document.body.removeClassName("editing");return }if(A==(!$("wikicontent")||$("wikicontent").style.display=="none")){return }if($("wikicontent")){($("wikiedit").style.display=(A)?"block":"none");((!A)?$("wikicontent").show():$("wikicontent").hide());if($("comments")){$("comments").style.display=(!A)?"block":"none"}}$("page-bottom-toolbar").style.display=(!A)?"block":"none";$("expand-collapse-page").style.display=(!A)?"block":"none";if($("page-footer")&&$("page-footer").down(".content")){$("page-footer").down(".content").style.display=(!A)?"block":"none"}$("edit-toolbar").down(".iconbutton").style.position="relative";$("page-footer").setStyle({marginBottom:(A)?"4px":"9px"});if(A){UserPrefs.Manager.saveWidth();UserPrefs.Manager.goFullWidth()}else{UserPrefs.Manager.restoreWidth()}if(A){this.resizeChromeHeight()}else{$("page-col-2").setStyle({height:""})}if(!Prototype.Browser.IE){document.documentElement.style.overflowY=(A)?"auto":"scroll"}},lockInfoTemplates:{none:"",locked:'<a class="usercard_trigger" ui:uid="#{owner}" owner="#{owner}" href="/user/#{owner}">#{name}</a> is editing the page. <a class="edit-warning" href="#view=edit&steal=1">Steal lock</a>',locked_live:'<a class="usercard_trigger" ui:uid="#{owner}" owner="#{owner}" href="/user/#{owner}">#{name}</a> is editing the page. <a class="edit-warning" href="#view=edit&steal=1">Steal lock</a> or <a class="edit-warning" href="#view=liverequest">Request Live View</a>',locked_requested:'<a class="usercard_trigger" ui:uid="#{owner}" owner="#{owner}" href="/user/#{owner}">#{name}</a> is editing the page. <a class="edit-warning" href="#view=edit&steal=1">Steal lock</a> <strong id="live_edit_view" draft_id="#{draft_id}">Requesting Live View, please wait...</strong>',locked_editing:'<a class="usercard_trigger" ui:uid="#{owner}" owner="#{owner}" href="/user/#{owner}">#{name}</a> is editing the page. <a class="edit-warning" href="#view=edit&steal=1">Steal lock</a> or <strong><a id="live_edit_view" class="edit-warning" draft_id="#{draft_id}" href="#view=liveview">See changes live</a></strong>',live_viewing:'<a class="usercard_trigger" ui:uid="#{owner}" owner="#{owner}" href="/user/#{owner}">#{name}</a> is editing the page. <a class="edit-warning" href="#view=edit&steal=1">Steal lock</a> <strong id="live_edit_view" draft_id="#{draft_id}">Viewing live edits</strong>'},setLockInfo:function(A){if(!A||A.page!=PBwiki.getPageName()){return }var D={owner:A.owner,draft_id:A.draft_id,name:A.editname.escapeHTML()};var B=this.getLockInfoTemplateName(A);var C=((B=="none")?"":'<div class="edit-warning"><div class="content">'+(new Template(this.lockInfoTemplates[B]).evaluate(D))+"</div></div>");$("lockinfo").update(C);if($("read-only")){((B!="none")?$("read-only").hide():$("read-only").show())}if($("edit-tab")&&A.owner!=PBwiki.getUID()){$("edit-tab").addClassName("steal")}if(PBinfo.GetPage){PBinfo.GetPage.lockinfo=A}},getLockInfoTemplateName:function(A){if(!A){return"none"}if(A.owner==PBwiki.getUID()){return"none"}else{if(A["private"]&&!$("read-only")){return PBwiki.feature("live")&&!PBwiki.feature("gui")?"locked_live":"locked"}else{if(!A["private"]){return"locked_editing"}}}},removeLockInfo:function(){$("lockinfo").update("");if($("edit-tab")){$("edit-tab").removeClassName("steal")}if($("read-only")){$("read-only").show()}PBinfo.GetPage.lockinfo=false},getLockInfo:function(){if(PBinfo.GetPage&&PBinfo.GetPage.lockinfo){return PBinfo.GetPage.lockinfo}},resizeChromeHeight:function(){if(PBwiki.feature("gui")){return }$("page-col-2").setStyle({height:this.getChromeHeight()+"px"});if(Prototype.Browser.IE){$("saveButton").setStyle({display:"none"}).setStyle({display:"block"});$("saveAndContinue").setStyle({display:"none"}).setStyle({display:"block"})}},getChromeHeight:function(){return(window.innerHeight||document.documentElement.clientHeight)-this.getControlHeight()},getControlHeight:function(){if(PBwiki.feature("gui")){return $("editTitle").cumulativeOffset()[1]}if(!PBwiki.pageColHeight){PBwiki.pageColHeight=$("page-col-2").cumulativeOffset()[1]}if(!PBwiki.pageFooterHeight){PBwiki.pageFooterHeight=$("page-footer").getHeight()+parseInt($("page-footer").getStyle("marginBottom"),10)}var A=PBwiki.pageColHeight+PBwiki.pageFooterHeight;if($("notifications")&&$("notifications").style.display!="none"){A-=$("notifications").getHeight()}return A},getEditHeight:function(){return Math.max(310,this.getChromeHeight()-$("edit-toolbar-outer").getHeight()-45)},setEditLoading:function(A){if(A){$("editframe").show().addClassName("loading").setStyle({height:this.getEditHeight()+"px"})}else{$("editframe").removeClassName("loading")}},setActiveTab:function(A){if(PBwiki.feature("gui")){return }((A=="view")?$("view-tab").addClassName("active"):$("view-tab").removeClassName("active"));((A=="edit")?$("edit-tab").addClassName("active").addClassName("edit_active"):$("edit-tab").removeClassName("active").removeClassName("edit_active"))}});PBwiki.Views.page=Class.create(PBwiki.Views.base,{classname:"PBwiki.Views.page",debug:false,createPage:function(A){A.stop();new PBwiki.DialogCommands.CreateNewPage({noPreloadView:true,ajaxCreate:true,onCreate:function(B){var C=PBwiki.getEditURI(B,true,true);var F=this.dialog.down("select.newpagesecurity");var H=(F)?F.options[F.selectedIndex].value:"";var G=this.folderSelect.options[this.folderSelect.selectedIndex].value;var D=$("page-content-template-name");var E=(D&&D.options.length>0)?D.options[D.selectedIndex].value:false;var B=this.dialog.down("input.page_name").value.strip();if(H){C+="&security="+encodeURIComponent(H)}if(G){C+="&folder="+encodeURIComponent(G)}if(E&&$("page-content-template").checked){C+="&template="+encodeURIComponent(E)}window.location.href=C}})},initialize:function(A){if(PBwiki.feature("gui")||($("edit-tab")&&PBinfo.CurrentPage&&PBinfo.CurrentPage.editor_v3)){this.setActiveTab("view");this.setChromeVisibility(false)}this.lockInfoHandler=this.onLockInfo.bindAsEventListener(this);this.unlockHandler=this.onUnlock.bindAsEventListener(this);this.saveHandler=this.onPageSave.bindAsEventListener(this);if($("sidebar-createtask")){$("sidebar-createtask").observe("click",this.createTask)}if($("sidebar-users")){$("sidebar-users").observe("click",this.inviteUsers);$("sidebar-users").setAttribute("href","javascript:void(0)")}if($("sidebar-createpage")&&PBwiki.feature("ajaxcreate")){$("sidebar-createpage").observe("click",this.createPage)}this.uploadButton=$("sidebar-uploadfiles");if(this.uploadButton){this.uploadButton=new PBwiki.Upload({elm:this.uploadButton,onGetFolder:function(){return PBinfo.CurrentPage.folder}.bind(this),onUploaded:function(D,F,C){if(F){document.fire("ui:onNotifyUser",{mode:"error",message:F.escapeHTML()});return }var E="Uploaded "+D+" file"+(D>1?"s":"")+" successfully: ";for(var B=0;B<C.length;B++){E+='<strong><a href="/w/file/'+encodeURIComponent(C[B].name)+'">'+C[B].name.escapeHTML()+"</a></strong>";if(B!=C.length-1){E+=", "}if(C.length>1&&B==C.length-2){E+=" and "}}document.fire("ui:onNotifyUser",{mode:"success",message:E})}})}if($("notification-autosave")){$("editor-delete-autosave").onclick=function(){new PBwiki.APIRequest("DeleteAutosave",{page:PBwiki.getPageName()},{onSuccess:function(){Page.Notifications.findNotification($("notification-autosave")).remove()}});return false}}document.observe("live:locked",this.lockInfoHandler);document.observe("live:unlocked",this.unlockHandler);document.observe("live:mod",this.saveHandler);document.observe("live:connected",function(){if(PBwiki.Live.getLiveEditChatForCurrentPage()&&PBwiki.Views.currentView=="page"){document.fire("ui:changeview","liveview")}});this.initializeComments();this.wikipage=$("wikipage-inner");if(PBinfo.GetPage&&PBinfo.GetPage.lockinfo){this.setLockInfo(this.getLockInfo())}if(A&&A.refresh){this.refresh()}},initializeComments:function(){$$("a.commentdelete").each(function(C){var A=C.up("div.comment");if(!A){return }var D=A.id;if(D.indexOf("commentnum")!==0){return }var B=D.substring(10);C.observe("mousedown",this.commentDeleteHandler.bindAsEventListener(this,B))}.bind(this));if($("comments-delete-all")){$("comments-delete-all").observe("mousedown",this.commentDeleteAllHandler.bindAsEventListener(this))}if(PBwiki.feature("gui")){$$(".comment-reply").each(function(A){A.observe("click",function(C){var B=A.id.replace("comment-reply-","");$("commentnum"+B).appendChild($("comment-form-reply"));$("comment-form-reply").show();$("comment-form-reply-value").setAttribute("parent_ts",B);$("comment-form-reply-value").value="";$("comment-form-reply-value").style.backgroundColor="#eee";$("comment-form-reply-value").focus();$("parentcomment").value=B;C.stop()})})}$$(".add-comment-button").each(function(A){A.observe("click",this.onAddCommentButtonClicked.bind(this))}.bind(this));this.commentCounters=[];$$(".comment-form").each(function(A){this.commentCounters.push(new PBwiki.Components.CharacterCounter({parent:A,max:PBconst.kMaxCommentLength,target:A.down("textarea")}))}.bind(this))},unbindCommentEvents:function(){this.commentCounters.each(function(A){A.destroy()});$$("a.commentdelete").each(function(A){A.stopObserving("mousedown")}.bind(this));if($("comments-delete-all")){$("comments-delete-all").stopObserving("mousedown")}$$(".add-comment-button").each(function(A){A.stopObserving("click")}.bind(this))},onAddCommentButtonClicked:function(D){D.stop();var E=$(D.element()).up("form").down("textarea");if(E.value.length>PBconst.kMaxCommentLength){alert("Sorry, but your comment is too long. Comments must be fewer than "+PBconst.kMaxCommentLength+" characters.");return }var C=0;if(E.getAttribute("parent_ts")){C=E.getAttribute("parent_ts")}var B=$(D.element()).up("form").down(".add-comment-button");B.disabled=true;E.disabled=true;var A={text:E.value,parent_ts:C};if(typeof PBinfo.CurrentObject!=="undefined"){A.oid=PBinfo.CurrentObject}else{A.page=PBinfo.CurrentPage.page}new PBwiki.APIRequest("AddComment",A,{onSuccess:function(F){window.location.hash="#comment"+F.time;window.location.reload(true)},onFailure:function(F){alert("Sorry, an error has occurred.");B.value=C?"Add reply":"Add comment";B.disabled=false;E.disabled=false}})},inviteUsers:function(A){if(A&&A.stop){A.stop()}Util.tracking("f-wikipage-addusers_show");PBwiki.ResourceLoader.loadManifest("extras.js",function(){PBwiki.UsersPanel.showAddUsersDialog()})},commentDeleteAllHandler:function(C){if(C){C.stop()}var A={};var B="page";if(typeof PBinfo.CurrentObject!=="undefined"){A.oid=PBinfo.CurrentObject;B="file"}else{A.page=PBinfo.CurrentPage.page}var D=confirm("Are you sure you want to delete all comments on this "+B+"? This action cannot be undone.");if(!D){return }new PBwiki.APIRequest("DeleteAllComments",A,{onSuccess:function(E){$("comments-delete-all").remove();var F=$$("div.comment");if(typeof Effect!=="undefined"){Effect.multiple(F,Effect.BlindUp,{speed:0,duration:1,afterFinish:function(G){$(G.element.id).remove()}})}else{F.invoke("hide")}if($("comments-count")){$("comments-count").up("h3").update("Comments (0)")}},onFailure:function(E){alert(E)}})},commentDeleteHandler:function(F,D){if(F){F.stop()}var B=new Element("span",{id:"comment-delete-confirm-"+D});var A=new Element("strong");A.appendChild(document.createTextNode("Delete "));B.appendChild(A);B.appendChild(document.createTextNode("Are you sure?"));var G=new Element("a",{href:"javascript:void(0)",style:"margin: 0 0.3em;",id:"comment-delete-yes-"+D});G.appendChild(document.createTextNode("Yes"));G.observe("mousedown",this.doDeleteComment.bindAsEventListener(this,D));B.appendChild(G);var E=new Element("a",{href:"javascript:void(0)",style:"margin: 0 0.3em;",id:"comment-delete-no-"+D});E.appendChild(document.createTextNode("No"));E.observe("mousedown",this.cancelDeleteComment.bindAsEventListener(this,D));B.appendChild(E);var C=$("comment-delete-"+D);if(!C){return }C.replace(B)},doDeleteComment:function(C,B){if(C){C.stop()}var A={time:B};if(typeof PBinfo.CurrentObject!=="undefined"){A.oid=PBinfo.CurrentObject}else{A.page=PBinfo.CurrentPage.page}new PBwiki.APIRequest("DeleteComment",A,{onSuccess:function(G){var D=$("commentnum"+B);if(D){if(typeof Effect!=="undefined"){Effect.BlindUp(D,{duration:1,afterFinish:function(H){$(H.element.id).remove()}})}else{D.hide()}}if($("comments-count")){var E=$("comments-count");var F=Number(E.innerText?E.innerText:E.textContent);if(!isNaN(F)&&F>0){E.update(F-1)}}},onFailure:function(D){alert(D)}})},cancelDeleteComment:function(D,C){if(D){D.stop()}var B=new Element("a",{href:"#",className:"commentdelete",id:"comment-delete-"+C});B.appendChild(document.createTextNode("Delete"));B.observe("mousedown",this.commentDeleteHandler.bindAsEventListener(this,C));var A=$("comment-delete-confirm-"+C);if(!A){return }A.replace(B)},createTask:function(A){if(A){A.stop()}if(PBwiki.DialogCommands.NewAction){new PBwiki.DialogCommands.NewAction({quicktask:true})}else{PBwiki.ResourceLoader.loadManifest("extras.js",function(){new PBwiki.DialogCommands.NewAction({quicktask:true})})}},onLockInfo:function(B){var A=B.memo;if(!A.page||A.page!=PBwiki.getPageName()){return }this.setLockInfo(A);if(PBwiki.Views.currentView=="liveview"&&A["private"]){document.fire("ui:changeview","page")}},onUnlock:function(B){if(this.debug){PBwiki.info("GOT UNLOCKED");PBwiki.info(B)}var A=B.memo;if(!A.page||A.page!=PBwiki.getPageName()){return }if(A&&A.owner!=PBwiki.getUID()&&!Page.AjaxEdit.editMode){document.fire("ui:onNotifyUser",{mode:"success",message:"<strong>"+(A.editname||A.editemail).escapeHTML()+"</strong> stopped editing this page"})}this.removeLockInfo()},onPageSave:function(A){if(A.memo.title!=PBwiki.getPageName()||A.memo.user.uid==PBwiki.getUID()){return }document.fire("ui:onNotifyUser",{mode:"success",message:"<strong>"+Util.getAuthorNameFromObject(A.memo.user).escapeHTML()+"</strong> saved the page"});this.refresh()},setPageContent:function(A){if(this.wikipage){this.wikipage.innerHTML=A||""}},setPageAuthor:function(A){A.userClass="iconbutton usericon";$("page-editor").update(Util.authorLinkFromObject(A))},getPageContent:function(){return this.wikipage.innerHTML},getLockInfo:function(){if(PBinfo.GetPage.lockinfo){return PBinfo.GetPage.lockinfo}else{var A=this.lockInfoFromPage();PBinfo.GetPage.lockinfo=A;return A}},lockInfoFromPage:function(){if(!$("lockinfo")){return false}var A=$("lockinfo").down("a");if(!A){return false}return{editname:A.innerHTML.unescapeHTML(),draft_id:$("live_edit_view")?$("live_edit_view").getAttribute("draft_id"):"","private":!$("live_edit_view"),owner:A.getAttribute("owner"),page:PBwiki.getPageName()}},refresh:function(){var A=new PBwiki.APIRequest("GetPage",{page:PBwiki.getPageName(),verbose:true},{onSuccess:function(B){this.setPageContent(B.html);this.setPageAuthor(B.author);document.fire("ui:last_edited_update")}.bind(this)})},destroy:function(){document.stopObserving("live:locked",this.lockInfoHandler);document.stopObserving("live:unlocked",this.unlockHandler);document.stopObserving("live:mod",this.saveHandler);if($("sidebar-createtask")){$("sidebar-createtask").stopObserving("click",this.createTask)}$$("video,audio").invoke("pause");this.unbindCommentEvents();return true}});PBwiki.Views.loading=Class.create(PBwiki.Views.base,{classname:"PBwiki.Views.loading",initialize:function(A){if(A.view=="edit"||A.view=="newpage"){this.setActiveTab("edit");if($("notification-autosave")){$("notifications").hide()}this.setChromeVisibility(true);this.setEditLoading(true);this.resizeChromeHeight()}},destroy:function(){return true}});PBwiki.Views.file=Class.create(PBwiki.Views.page,{classname:"PBwiki.Views.file",initialize:function($super){$super();if(false&&PBinfo.CurrentFile.isUploader){(new PBwiki.Components.FileUploadButton({txt:"Upload new version",id:"upload_file_button",addTo:$("secondary-toolbar"),onUploaded:function(A,B){if(B){document.fire("objectbrowser:onNotifyUser",{message:"Error uploading files: "+B,mode:"error"})}else{if(A==0){document.fire("objectbrowser:onNotifyUser",{message:"Did not upload any files",mode:"error"})}else{document.fire("objectbrowser:onNotifyUser",{message:"Uploaded "+A+" file"+((A!=1)?"s":"")+" successfully"});document.fire("objectbrowser:upload_complete")}}}}));$("upload_file_button").down("span").addClassName("iconbutton "+Util.getFileIcon(PBinfo.CurrentFile.name))}}});PBwiki.init("PBwiki.Views",PBwiki.Views.initialize.bind(PBwiki.Views));PBwiki.init("pbwiki.networkbar.js",function(){if(!$("network-bar")){return }if($$("a.search-btn").length===0){return }if(!$("toolbar-search-left")||!$("toolbar-search-right")){return }var A=$$("a.search-btn")[0];A.observe("click",function(C){C.stop();$("toolbar-search").style.display="inline";$$(".user-bar-left, .user-bar-right").each(function(D){D.hide()});$("toolbar_q").focus()});$("toolbar-search-left").observe("click",function(C){C.stop();$("toolbar-search").style.display="none";$$(".user-bar-left, .user-bar-right").each(function(D){D.show()})});$("toolbar-search-right").observe("click",function(C){C.stop()});if($("new-features-bar")){var B=$("new-features-bar").down("a");if(B){B.observe("click",function(C){Util.tracking("new-feature-message-clicked")})}}});PBwiki.Components=PBwiki.Components||{};PBwiki.Components.Bubble=Class.create({classname:"PBwiki.Components.Bubble",initialize:function(A){this.options=A||{};if(this.showUserPref&&!PBwiki.UserPrefs.get(this.showUserPref)){return }if(this.bubbleID&&$(this.bubbleID)){return }this.options.className="bubble"+(this.options.className?" "+this.options.className:"");if(!this.hideFunction){this.hideFunction=this.hide}this.hideFunctionBound=this.hideFunction.bindAsEventListener(this);this.setUp()},getCoordinates:function(){return this.anchor.cumulativeOffset()},setUp:function(){this.show()},create:function(){if(this.anchorToID){this.anchor=$(this.anchorToID)}if($(this.bubbleID)){this.bubble=$(this.bubbleID);return }this.bubble=new Element("div",{"class":this.options.className,id:this.bubbleID});this.bubble.update('<div class="'+(this.arrowDirection=="left"?"bubble-arrow":"bubble-arrow-right")+'"></div>    <a class="close" href="#"></a>    <table cellspacing="0"><tr class="header"><td class="left"></td><td class="right"></td></tr><tr class="content"><td class="left"></td><td class="right">      <div class="inner-content">'+this.getContent()+"</div>    </td></tr></table>");document.body.appendChild(this.bubble);this.bubble.getElementsBySelector("a.close")[0].observe("click",function(A){A.stop();this.hideFunction(A);if(this.hideCheckbox){this.hidePermanently()}}.bind(this));if(this.hideCheckbox){$(this.hideCheckbox).observe("change",function(A){A.stop();this.hide();this.hidePermanently()}.bind(this))}},getContent:function(){},hide:function(A){if(!this.bubble){return }document.stopObserving("click",this.hideFunctionBound);document.stopObserving("ui:hideBubbles",this.hideFunctionBound);document.stopObserving("ui:changeview",this.hideFunctionBound);this.hideFunction=false;window.setTimeout(function(){this.bubble.hide();PBwiki.Components.Bubble.showingBubble=false}.bind(this),250)},reposition:function(){var A=this.getCoordinates();if(this.arrowDirection=="right"){A.left-=this.bubble.getWidth()+10}else{A.left+=this.anchor.getWidth()}A.top-=(this.bubble.getHeight()/2)-(this.anchor.getHeight()/2);this.bubble.setStyle({top:A.top+"px",left:A.left+"px"})},show:function(A){this.create();document.observe("click",this.hideFunctionBound);document.observe("ui:hideBubbles",this.hideFunctionBound);document.observe("ui:changeview",this.hideFunctionBound);this.bubble.show();this.reposition();PBwiki.Components.Bubble.showingBubble=true},hidePermanently:function(A){PBwiki.UserPrefs.set(this.showUserPref,false,"my",true)}});PBwiki.Components.StarBubble=Class.create(PBwiki.Components.Bubble,{classname:"PBwiki.Components.StarBubble",showUserPref:PBconst.kShowStarBubblePrefsKey,arrowDirection:"left",hideCheckbox:"dont_prompt_to_save_pages",anchorToID:"pb-page-star",setUp:function(){document.observe("ui:onCurrentPageSaved",function(A){if(!PBwiki.Components.Bubble.showingBubble){this.show()}}.bind(this));if(PBinfo.CurrentPage.saved&&!PBwiki.Components.Bubble.showingBubble){this.show()}},getContent:function(){var A;if(PBinfo.CurrentNetwork){A="<p>Changes made to starred pages will be emailed to you when they<br />        happen and always included in your network digests.</p>"}else{A='<p>You can choose to only receive email notifications of pages<br />        that are starred. <a href="/user/'+PBinfo.CheckPermissions.uid+'#preferences">Change your preferences here</a>.</p>'}return'<div class="top">          Click the star to mark this page as starred        </div>'+A+'<label for="dont_prompt_to_save_pages"><input type="checkbox" id="dont_prompt_to_save_pages" /> Don\'t show this message again</label>'}});PBwiki.Components.UnstarBubble=Class.create(PBwiki.Components.Bubble,{classname:"PBwiki.Components.UnstarBubble",bubbleID:"unstar-bubble",arrowDirection:"left",anchorToID:"pb-page-star",getContent:function(){return'<div class="top">          Click here to un-star this page        </div>        <p>If you un-star this page, you will stop receiving        <br />email alerts about changes made to it.</p>'}});PBwiki.Components.SendALinkBubble=Class.create(PBwiki.Components.Bubble,{classname:"PBwiki.Components.UnstarBubble",showUserPref:PBconst.kShowSendALinkBubblePrefsKey,arrowDirection:"right",hideCheckbox:"dont_prompt_send_a_link",anchorToID:"sendalink",bubbleID:"send-a-link-bubble",setUp:function(){var A=function(B){if(!PBwiki.Components.Bubble.showingBubble){this.show()}if(B&&B.eventName&&B.eventName==="objectbrowser:upload_complete"){$("sendalink-bubble-object-type").update("folder")}}.bind(this);document.observe("ui:onCurrentPageSaved",A);document.observe("objectbrowser:upload_complete",A);if(PBinfo.CurrentPage.saved&&!PBwiki.Components.Bubble.showingBubble){this.show()}},getContent:function(){return'<div class="top">        Let others know about this <span id="sendalink-bubble-object-type">page</span>        </div>        <p>Send a link to other people to let them know<br/>about your changes or to get feedback.</p>        <label for="dont_prompt_send_a_link"><input type="checkbox" id="dont_prompt_send_a_link" /> Don\'t show this tip again.</label>'}});PBwiki.Components.CreatePageBubble=Class.create(PBwiki.Components.Bubble,{classname:"PBwiki.Components.CreatePageBubble",showUserPref:PBconst.kShowCreatePageBubblePrefsKey,arrowDirection:"right",hideCheckbox:"dont_prompt_create_page",anchorToID:"sidebar-createpage",bubbleID:"create-page-bubble",setUp:function(){var A=$("sidebar-createpage");if(!A||!A.visible()||$("sidebar-createpage").hasClassName("disabled")||PBwiki.Views.currentView!="page"){return }if(!PBwiki.Components.Bubble.showingBubble){this.show();A.observe("click",this.hidePermanently.bindAsEventListener(this))}},getContent:function(){return'<div class="top">        Add a page to your workspace        </div>        <p>Start a new page from scratch, or create a page<br/>        from an existing file.</p>        <label for="dont_prompt_create_page"><input type="checkbox" id="dont_prompt_create_page" /> Don\'t show this tip again.</label>'}});PBwiki.Components.UploadBubble=Class.create(PBwiki.Components.Bubble,{classname:"PBwiki.Components.UploadBubble",arrowDirection:"right",anchorToID:"sidebar-uploadfiles",bubbleID:"upload-files-bubble",setUp:function(){var A=$("sidebar-uploadfiles");if(!PBinfo||!PBinfo.CurrentPage||!PBinfo.CurrentPage.gsv3_upload_bubble){return }if(!A||!A.visible()||$("sidebar-uploadfiles").hasClassName("disabled")||PBwiki.Views.currentView!="page"){return }if(!PBwiki.Components.Bubble.showingBubble){this.show();A.observe("click",this.hidePermanently.bindAsEventListener(this))}},getContent:function(){return'<div class="top">        Upload files to your workspace        </div>        <p>Post new files and share with people you<br/>        add to this workspace.</p>'}});PBwiki.Components.ImportFeedbackBubble=Class.create(PBwiki.Components.Bubble,{classname:"PBwiki.Components.ImportFeedbackBubble",arrowDirection:"left",anchorToID:"import-feedback-no",bubbleID:"import-feedback-bubble",getContent:function(){var A=Prototype.Browser.IE?90:100;return'<div class="top">          Tell us what\'s wrong:        </div>        <form action="/report.php" target="import-feedback-frame" method="POST">          <input type="hidden" name="convert_id" value="'+this.options.convertID+'" />          <textarea id="import-feedback-text" name="import-feedback" style="width: '+A+'%;"></textarea>          <input type="submit" id="import-feedback-submit" value="Send feedback" />        </form>        <iframe id="import-feedback-frame" name="import-feedback-frame" style="display:none;"></iframe>'},create:function($super){$super();$("import-feedback-submit").observe("click",function(A){this.hide();$("import-feedback").update('<div class="content">Thanks for your feedback.</div>')}.bind(this),true)},show:function($super){$super();$("import-feedback-text").focus()}});PBwiki.Components.UserCard=Class.create(PBwiki.Components.Bubble,{classname:"PBwiki.Components.UserCard",arrowDirection:"left",bubbleID:"user_card_1",getContent:function(){return this.loadingHtml},getUserCardContent:function(){var A=new Template(this.html);this.apiResponse.className=(PBinfo.CurrentNetwork)?"network":"standalone";if(this.apiResponse.email&&!this.apiResponse.email.endsWith("@...")){this.apiResponse.email='<a href="mailto:'+encodeURIComponent(this.apiResponse.email)+'" class="email">'+this.apiResponse.email+"</a>"}else{if(this.apiResponse.username){this.bubble.addClassName("noemail")}else{this.apiResponse.email="<em>Not shown at user request</em>"}}if(PBinfo.CurrentWiki&&(PBinfo.CheckPermissions.wikiperm=="admin"||PBinfo.CheckPermissions.network_perm=="admin")){this.bubble.addClassName("show-what-can-see");this.apiResponse.wcs_opts="{ user_id: '"+this.apiResponse.uid+"' }"}this.apiResponse.domain=(PBinfo.CurrentNetwork?PBinfo.CurrentNetwork.url:"/");if(!this.apiResponse.role){this.bubble.addClassName("norole")}if(!this.apiResponse.url){this.bubble.addClassName("nourl")}if(!this.apiResponse.location){this.bubble.addClassName("nolocation")}["name","company","title","phone_mobile","phone_work","location"].each(function(C){if(this.apiResponse[C]){this.apiResponse[C]=this.apiResponse[C].escapeHTML()}}.bind(this));if(!this.apiResponse.name||this.apiResponse.name.empty()){if(this.apiResponse.username){this.apiResponse.name=this.apiResponse.username.escapeHTML()}else{this.apiResponse.name="<em>No name set</em>"}}this.apiResponse.im_links="";["im_aim","im_icq","im_skype","im_yim"].each(function(D,C){if(this.apiResponse[D]){this.apiResponse.im_links+=PBwiki.Components.IMIconGenerator.getIconLink(this.apiResponse[D],D,this.apiResponse.uid)}}.bind(this));if(this.apiResponse.im_links.length==0){this.apiResponse.im_links="<em>No IM clients</em>"}if(this.apiResponse.phone_work){this.apiResponse.phone=this.apiResponse.phone_work+" <strong>work</strong>"}else{if(this.apiResponse.phone_mobile){this.apiResponse.phone=this.apiResponse.phone_mobile+" <strong>mobile</strong>"}else{this.apiResponse.phone="<em>No phone number</em>"}}if(!this.apiResponse.title||this.apiResponse.title.length<1){this.apiResponse.title="<em>No title</em>"}if(!this.apiResponse.image||this.apiResponse.image.length<1){this.apiResponse.image="/uimg/bread.png"}this.apiResponse.followClass=(this.isFollowing?"unfollowuser":"followuser");this.apiResponse.followText=(this.isFollowing?"Unfollow":"Follow user");this.apiResponse.trackClass=(this.isTracking?"untrackuser":"trackuser");this.apiResponse.trackText=(this.isTracking?"Stop tracking":"Track activity");this.apiResponse.isthisyouclass=(this.isSelf?"thisisyou":"");if(PBinfo.CheckPermissions.network_perm=="guest"){this.bubble.addClassName("isguest")}try{this.apiResponse.status={data:Util.linkify_text(this.statusUpdate.data.escapeHTML()),timestamp:Util.time_ago(PBwiki.getTimestamp()-this.statusUpdate.time)+" ago"}}catch(B){this.bubble.addClassName("nostatus")}if(this.userGroups&&this.userGroups.length>0&&this.apiResponse.perm!=="deny"){this.apiResponse.groups='<p class="row">&nbsp;</p>';if(this.userGroups.length>1){this.apiResponse.groups+="<h5>User Groups</h5>"}else{this.apiResponse.groups+="<h5>User Group</h5>"}this.userGroups.each(function(C){this.apiResponse.groups+='<p class="row">'+C.name.escapeHTML()+"</p>"}.bind(this))}else{this.apiResponse.groups=""}if(PBinfo.CurrentNetwork){this.apiResponse.profile_link=this.apiResponse.domain+"n/users/profile?uid="+this.apiResponse.uid}else{this.apiResponse.profile_link="/user/"+this.apiResponse.uid}return A.evaluate(this.apiResponse)},setupStatusReply:function(){var C=this.bubble.down("a.reply");var B=this.bubble.down("a.cancel");var A=(function(D){D.stop();this.bubble.toggleClassName("showstatusreply");this.bubble.down("textarea").focus()}).bind(this);C.observe("click",A);B.observe("click",A)},confirmCloseBubble:function(){return(this.bubble.hasClassName("showstatusreply")&&this.bubble.down("textarea").value.strip().length>0&&!confirm("Are you sure you wish to cancel your reply?"))},hideFunction:function(B){var A=B.findElement("a");if(!this.bubble||(A&&!A.hasClassName("close"))){return }B.stop();this.hideBubble()},hideBubble:function(){document.stopObserving("click",this.hideFunctionBound);document.stopObserving("ui:hideBubbles",this.hideFunctionBound);if(this.options.uid!=PBinfo.CheckPermissions.uid){document.stopObserving("usercard:togglefollow",this.toggleFollowingBound);document.stopObserving("usercard:toggletrack",this.toggleTrackingBound)}if(this.changedFollowed){document.fire("ui:refreshactivity")}this.bubble.innerHTML="";this.bubble.remove()},getCoordinates:function(){return{left:this.options.event.pageX,top:this.options.event.pageY}},reposition:function(){var A=this.getCoordinates();var C=document.body.cumulativeScrollOffset().top;A.top-=this.bubble.getHeight()/2;A.top+=C;A.top=Math.min(C+document.body.clientHeight-this.bubble.getHeight(),A.top);A.top=Math.max(0,A.top);var B=Math.min(document.documentElement.clientWidth-430,A.left);if(B<A.left){A.left-=this.bubble.getWidth()}A.left=Math.max(0,A.left);this.bubble.setStyle({top:A.top+"px",left:A.left+"px"})},setUp:function(){this.show();var A=new Array();A.push(["GetUserInfo",{uid:this.options.uid},{onSuccess:function(C){this.apiResponse=C}.bind(this)}]);if(PBinfo.CheckPermissions.network_perm!="guest"){A.push(["GetLastUpdate",{uid:this.options.uid},{onSuccess:function(C){this.statusUpdate=C.update}.bind(this)}])}if(PBinfo.CurrentWiki&&PBwiki.feature("workspace_user_groups")){A.push(["ListWorkspaceGroupsForUser",{user_id:this.options.uid},{onSuccess:function(C){this.userGroups=C.groups}.bind(this)}])}else{if(PBinfo.CurrentNetwork&&PBwiki.feature("network_user_groups")){A.push(["ListNetworkGroupsForUser",{user_id:this.options.uid},{onSuccess:function(C){this.userGroups=C.groups}.bind(this)}])}}this.isSelf=(this.options.uid==PBinfo.CheckPermissions.uid);if(!this.isSelf&&PBinfo.CheckPermissions.network_perm!="guest"){A.push(["GetFollowedUsers",{},{onSuccess:function(C){this.isFollowing=C.users.include(this.options.uid)}.bind(this)}]);A.push(["CanTrackUser",{uid:this.options.uid},{onSuccess:function(C){this.canTrack=C.can;this.isTracking=C.does}.bind(this)}])}else{this.canTrack=false;this.isTracking=false}var B=new PBwiki.MultiAPIRequest(A,{onAllComplete:this.showUserCard.bind(this)})},toggleTracking:function(D){D.stop();var B=$("usercard-toggle-track").down(".iconbutton");var A=B.hasClassName("trackuser");var E=A?"TrackUser":"UntrackUser";var C=new PBwiki.APIRequest(E,{uid:this.options.uid},{onSuccess:function(){if(!B){return }var G=B.hasClassName("trackuser")?"untrackuser":"trackuser";var F=B.hasClassName("trackuser")?"trackuser":"untrackuser";B.down("strong").update(A?"Tracked!":"No longer tracking");B.addClassName("success");B.up().addClassName("disabled");(function(){B.removeClassName("success");B.up().removeClassName("disabled");B.removeClassName(F);B.addClassName(G);B.down("strong").update(A?"Stop tracking":"Track activity")}).delay(3)}})},toggleFollowing:function(D){D.stop();this.toggleFollowBtn=$(D.memo);try{this.toggleFollowBtn.blur()}catch(D){}if(this.toggleFollowBtn.down().hasClassName("success")){return }var A=this.toggleFollowBtn.down().hasClassName("followuser");var C=this.followPrefix=(A?"F":"Unf");var E=C+"ollowUser";var B=new PBwiki.APIRequest(E,{user_id:this.options.uid},{onSuccess:function(){if(!this.toggleFollowBtn||!this.toggleFollowBtn.down()){return }var F=(this.toggleFollowBtn.down().hasClassName("followuser")?"unfollowuser":"followuser");this.toggleFollowBtn.innerHTML="<span class='iconbutton "+F+" success'><strong>"+this.followPrefix+"ollowed!</strong></span>";this.toggleFollowBtn.addClassName("disabled");this.changedFollowed=true;(function(){if(!this.toggleFollowBtn||!this.toggleFollowBtn.down()||!this.toggleFollowBtn.down().down()){return }this.toggleFollowBtn.down().removeClassName("success").down().innerHTML=(this.followPrefix=="F"?"Unfollow":"Follow user");this.toggleFollowBtn.removeClassName("disabled")}.bind(this)).delay(3)}.bind(this)})},showUserCard:function(){if(this.apiResponse.deleted){this.hideBubble();Util.alert("That user account has been removed.");return }if(this.options.uid!=PBinfo.CheckPermissions.uid){this.toggleFollowingBound=this.toggleFollowing.bind(this);document.observe("usercard:togglefollow",this.toggleFollowingBound)}this.bubble.removeClassName("usercard-loading");this.bubble.down(".loading").parentNode.innerHTML=this.getUserCardContent();if(this.canTrack){this.toggleTrackingBound=this.toggleTracking.bind(this);document.observe("usercard:toggletrack",this.toggleTrackingBound);$("usercard-toggle-track").show()}this.reposition();this.setupStatusReply();(new PBwiki.Components.ChatButton({uid:this.apiResponse.uid,onClick:function(){this.hideBubble()}.bind(this),addTo:this.bubble.down("div.profile-link")}))},loadingHtml:'<div class="loading"><div>LOADING</div></div>',html:'<div class="profile-summary clearfix outerpad #{className}">\n    <div class="button-bar secondarypagetoolbar #{isthisyouclass}" style="padding-top: 0px;">\n      <a href="#" class="button" id="usercard-toggle-follow" onclick="document.fire(\'usercard:togglefollow\', this); return false;"><span class="iconbutton #{followClass}"><strong>#{followText}</strong></span></a><br />\n      <a href="#" class="button" style="display: none; margin-top: 5px; clear:left;" id="usercard-toggle-track" onclick="document.fire(\'usercard:toggletrack\', this); return false;"><span class="iconbutton #{trackClass}"><strong>#{trackText}</strong></span></a>\n    </div>      \n    <div class="pic"><img height="48" width="48" alt="" src="#{image}"/></div>\n    <h3 class="#{isthisyouclass}">#{name} <span class="you">&nbsp;</span></h3><h4 class="title">#{title}</h4>\n  </div>\n  \n  <div class="profile-status #{className}">\n    <p>#{status.data}<span>#{status.timestamp}<span class="replyspan" style="display:none">&ndash; <a href="" class="reply">reply</a></span></span></p>\n    <div class="status-reply">\n      <textarea class="text"></textarea>\n      <div class="button-row"><input type="button" value="Post your reply" class="button primarybutton"/> <span>or <a href="" class="cancel">back to profile</a></span></div>\n    </div>\n  </div>\n  \n  <div class="profile-info clearfix #{className}">\n    <div class="cell">\n      <h5 class="email">Email</h5>\n      <p class="email row">#{email}</p>\n      <p class="email row">&nbsp;</p>\n      <h5 class="location">Location</h5>\n      <p class="row location">#{location}</p>\n      <h5 class="phone">Phone</h5>\n      <p class="row phone">#{phone}</p>\n    </div>\n    <div class="cell right">\n      <h5 class="im">IM Presence</h5>\n      <p class="row clearfix im">#{im_links}</p>\n      <p class="row im">&nbsp;</p>\n      <h5 class="url">Website</h5>\n      <p class="row url"><a class="url" href="#{url}">#{url}</a></p>\n      <h5 class="role">Workspace Role</h5>\n      <p class="row role">#{role} &ndash; <a class="activity" href="">activity on workspace</a></p>\n      #{groups}\n    </div>\n  </div>\n  <div class="profile-link button-bar clearfix secondarypagetoolbar #{className}">\n    <a href="#{profile_link}" class="button"><span><strong>View profile</strong></span></a>\n    <a href="javascript: void(0);" class="button what-can-see" onclick="new PBwiki.DialogCommands.WhatCanSee(#{wcs_opts}); return false;"><span><strong>What can this user see?</strong></span></a>\n</div>'});PBwiki.Components.IMIconGenerator={templateStrings:{im_aim:'<a href="aim:goim?screenname=#{username}" class="presence aim" title="Chat with #{username} on AIM"><img src="#{domain}#{base}/im-presence?screenname=#{username}&client=#{client}" alt="" hspace="3" vspace="3" height="16" width="16"/></a>',im_msn:'<a href="msnim:chat?contact=#{username}" class="presence msn" title="Chat with #{username} on MSN Messenger"><img src="#{domain}#{base}/im-presence?screenname=#{username}&client=#{client}" alt="" hspace="2" vspace="2" height="16" width="16"/></a>',im_yim:'<a href="ymsgr:sendim?ion_on" class="presence yim" title="Chat with #{username} on Yahoo Messenger"><img src="#{domain}#{base}/im-presence?screenname=#{username}&client=#{client}"  alt="" hspace="5" vspace="5" height="12" width="12"/></a>',im_skype:'<a href="skype:#{username}?call" class="presence skype" title="Chat with #{username} on Skype"><img src="#{domain}#{base}/im-presence?screenname=#{username}&client=#{client}" width="16" height="16" alt="" hspace="3" vspace="3"/></a>',im_icq:'<a href="http://people.icq.com/#{username}" class="presence icq" title="Chat with #{username} on ICQ"><img src="#{domain}#{base}/im-presence?screenname=#{username}&client=#{client}" width="13" height="13" alt="" hspace="4" vspace="4"/></a>'},templateObjects:{},getIconLink:function(A,C,B){var E=(PBinfo.CurrentNetwork?"n/users":"w");var F=(PBinfo.CurrentNetwork?PBinfo.CurrentNetwork.url:"/");var D=PBwiki.Components.IMIconGenerator;if(D.templateStrings[C]){if(!D.templateObjects[C]){D.templateObjects[C]=new Template(D.templateStrings[C])}return D.templateObjects[C].evaluate({username:escape(A),domain:F,base:E,uid:B,client:C})}return""}};PBwiki.Components.UserCard.intercept=function(D){var C=false;var E=null;var B=D.findElement("a");if(B&&B.hasClassName("usercard_trigger")&&B.hasAttribute("ui:uid")){C=true;E=B.getAttribute("ui:tracking")}else{B=D.findElement("img");if(B&&B.hasClassName("profile-img")&&B.up("div.comment")&&B.hasAttribute("ui:uid")){C=true}}if(!C){return }if(!PBinfo.CheckPermissions||!(PBinfo.CheckPermissions.wikiperm||PBinfo.CheckPermissions.network_perm)){return }D.stop();var A=B.getAttribute("ui:uid");new PBwiki.Components.UserCard({className:"usercard usercard-loading",event:D,uid:A});if(B&&B.getAttribute("ui:tracking")){Util.tracking(B.getAttribute("ui:tracking"))}};PBwiki.Components.PendingUsersBubble=Class.create(PBwiki.Components.Bubble,{classname:"PBwiki.Components.PendingUsersBubble",arrowDirection:"left",anchorToID:"users-chicklet-pending",bubbleID:"pending-users-bubble",setUp:function(){var A=$("users-chicklet-pending");if(!PBwiki.Components.Bubble.showingBubble){this.show();A.observe("click",this.hidePermanently.bindAsEventListener(this))}},getContent:function(){if(this.options.pending_count==1){return'<div class="top">Someone has requested access</div><p>Click this button to approve or deny their request.</p>'}else{return'<div class="top">'+this.options.pending_count+" people have requested access</div><p>Click this button to approve or deny their requests.</p>"}},hideFunction:function(A){if(A.element().tagName.toUpperCase()!="A"&&A.element().ancestors().indexOf($(this.bubbleID))>=0){PBwiki.UsersPanel.switchToView(PBwiki.UsersPanelView.Pending)}this.hide()}});PBwiki.init(PBwiki.Components.UploadBubble);PBwiki.init(PBwiki.Components.SendALinkBubble);PBwiki.init(PBwiki.Components.StarBubble);PBwiki.init(PBwiki.Components.CreatePageBubble);PBwiki.init("PBwiki.Components.UserCard.intercept.click",function(){document.observe("click",PBwiki.Components.UserCard.intercept)});var Droppables={drops:[],remove:function(A){this.drops=this.drops.reject(function(B){return B.element==$(A)})},removeAll:function(){this.drops=new Array()},add:function(B){B=$(B);var A=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});if(A.containment){A._containers=[];var C=A.containment;if(Object.isArray(C)){C.each(function(D){A._containers.push($(D))})}else{A._containers.push($(C))}}if(A.accept){A.accept=[A.accept].flatten()}A.element=B;this.drops.push(A)},findDeepestChild:function(A){deepest=A[0];for(i=1;i<A.length;++i){if(Element.isParent(A[i].element,deepest.element)){deepest=A[i]}}return deepest},isContained:function(B,A){var C;if(A.tree){C=B.treeNode}else{C=B.parentNode}return A._containers.detect(function(D){return C==D})},isAffected:function(A,C,B){return((B.element!=C)&&((!B._containers)||this.isContained(C,B))&&((!B.accept)||(Element.classNames(C).detect(function(D){return B.accept.include(D)})))&&Position.within(B.element,A[0],A[1]))},deactivate:function(A){if(A.hoverclass){Element.removeClassName(A.element,A.hoverclass)}this.last_active=null},activate:function(A){if(A.hoverclass){Element.addClassName(A.element,A.hoverclass)}this.last_active=A},show:function(A,C){if(!this.drops.length){return }var B,D=[];this.drops.each(function(E){if(Droppables.isAffected(A,C,E)){D.push(E)}});if(D.length>0){B=Droppables.findDeepestChild(D)}if(this.last_active&&this.last_active!=B){this.deactivate(this.last_active)}if(B){Position.within(B.element,A[0],A[1]);if(B.onHover){if(B.onHover(C,B.element,Position.overlap(B.overlap,B.element))===false){return }}if(B!=this.last_active){Droppables.activate(B)}}},fire:function(B,A){if(!this.last_active){return }Position.prepare();if(this.isAffected([Event.pointerX(B),Event.pointerY(B)],A,this.last_active)){if(this.last_active.onDrop){this.last_active.onDrop(A,this.last_active.element,B);return true}}},reset:function(){if(this.last_active){this.deactivate(this.last_active)}}};var Draggables={drags:[],observers:[],register:function(A){if(this.drags.length==0){this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.updateDrag.bindAsEventListener(this);this.eventKeypress=this.keyPress.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);Event.observe(document,"keypress",this.eventKeypress)}this.drags.push(A)},unregister:function(A){this.drags=this.drags.reject(function(B){return B==A});if(this.drags.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);Event.stopObserving(document,"keypress",this.eventKeypress)}},activate:function(A){if(A.options.delay){this._timeout=setTimeout(function(){Draggables._timeout=null;window.focus();Draggables.activeDraggable=A}.bind(this),A.options.delay)}else{try{window.focus()}catch(B){}this.activeDraggable=A}},deactivate:function(){this.activeDraggable=null},updateDrag:function(A){if(!this.activeDraggable){return }var B=[Event.pointerX(A),Event.pointerY(A)];if(this._lastPointer&&(this._lastPointer.inspect()==B.inspect())){return }this._lastPointer=B;this.activeDraggable.updateDrag(A,B)},endDrag:function(A){if(this._timeout){clearTimeout(this._timeout);this._timeout=null}if(!this.activeDraggable){return }this._lastPointer=null;this.activeDraggable.endDrag(A);this.activeDraggable=null},keyPress:function(A){if(this.activeDraggable){this.activeDraggable.keyPress(A)}},addObserver:function(A){this.observers.push(A);this._cacheObserverCallbacks()},removeObserver:function(A){this.observers=this.observers.reject(function(B){return B.element==A});this._cacheObserverCallbacks()},notify:function(B,A,C){if(this[B+"Count"]>0){this.observers.each(function(D){if(D[B]){D[B](B,A,C)}})}if(A.options[B]){A.options[B](A,C)}},_cacheObserverCallbacks:function(){["onStart","onEnd","onDrag"].each(function(A){Draggables[A+"Count"]=Draggables.observers.select(function(B){return B[A]}).length})}};var Draggable=Class.create({initialize:function(B){var C={handle:false,reverteffect:function(F,E,D){F.style.top=F.style.left=""},endeffect:function(E){var D=Object.isNumber(E._opacity)?E._opacity:1;E.setOpacity(1);Draggable._dragging[E]=false},zindex:1000,revert:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};if(!arguments[1]||Object.isUndefined(arguments[1].endeffect)){Object.extend(C,{starteffect:function(D){D._opacity=Element.getOpacity(D);Draggable._dragging[D]=true;D.setOpacity(0.9)}})}var A=Object.extend(C,arguments[1]||{});this.element=$(B);if(A.handle&&Object.isString(A.handle)){this.handle=this.element.down("."+A.handle,0)}if(!this.handle){this.handle=$(A.handle)}if(!this.handle){this.handle=this.element}if(A.scroll&&!A.scroll.scrollTo&&!A.scroll.outerHTML){A.scroll=$(A.scroll);this._isScrollChild=Element.childOf(this.element,A.scroll)}if(!A.proxy){Element.makePositioned(this.element)}this.options=A;this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this)},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);Draggables.unregister(this)},currentDelta:function(){return([parseInt(Element.getStyle(this.element,"left")||"0"),parseInt(Element.getStyle(this.element,"top")||"0")])},initDrag:function(A){if(!Object.isUndefined(Draggable._dragging[this.element])&&Draggable._dragging[this.element]){return }if(Event.isLeftClick(A)){var C=Event.element(A);if((tag_name=C.tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA")){return }var B=[Event.pointerX(A),Event.pointerY(A)];var D=Position.cumulativeOffset(this.element);this.offset=[0,1].map(function(E){return(B[E]-D[E])});Draggables.activate(this);Event.stop(A)}},startDrag:function(C){this.dragging=true;if(!this.delta&&!this.options.proxy){this.delta=this.currentDelta()}if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,"z-index")||0);this.element.style.zIndex=this.options.zindex}if(this.options.ghosting){this._clone=this.element.cloneNode(true);this.element._originallyAbsolute=(this.element.getStyle("position")=="absolute");if(!this.element._originallyAbsolute){Position.absolutize(this.element)}this.element.parentNode.insertBefore(this._clone,this.element)}if(this.options.proxy){this.oldElement=this.element;var B=new Element("div",{id:"proxy"}).setStyle({top:Event.pointerX(C)+"px",left:Event.pointerY(C)+"px",position:"absolute"}).addClassName("objectdragproxy").addClassName("pictures");B=this.options.proxy(B,this.oldElement);document.body.appendChild(B);this.element=B}if(this.options.scroll){if(this.options.scroll==window){var A=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=A.left;this.originalScrollTop=A.top}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop}}Draggables.notify("onStart",this,C);if(this.options.starteffect){this.options.starteffect(this.element)}},updateDrag:function(event,pointer){if(!this.dragging){this.startDrag(event)}if(!this.options.quiet){Position.prepare();Droppables.show(pointer,this.element)}Draggables.notify("onDrag",this,event);this.draw(pointer);if(this.options.change){this.options.change(this)}if(this.options.scroll){this.stopScrolling();var p;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){p=[left,top,left+width,top+height]}}else{p=Position.page(this.options.scroll);p[0]+=this.options.scroll.scrollLeft+Position.deltaX;p[1]+=this.options.scroll.scrollTop+Position.deltaY;p.push(p[0]+this.options.scroll.offsetWidth);p.push(p[1]+this.options.scroll.offsetHeight)}var speed=[0,0];if(pointer[0]<(p[0]+this.options.scrollSensitivity)){speed[0]=pointer[0]-(p[0]+this.options.scrollSensitivity)}if(pointer[1]<(p[1]+this.options.scrollSensitivity)){speed[1]=pointer[1]-(p[1]+this.options.scrollSensitivity)}if(pointer[0]>(p[2]-this.options.scrollSensitivity)){speed[0]=pointer[0]-(p[2]-this.options.scrollSensitivity)}if(pointer[1]>(p[3]-this.options.scrollSensitivity)){speed[1]=pointer[1]-(p[3]-this.options.scrollSensitivity)}this.startScrolling(speed)}if(Prototype.Browser.WebKit){window.scrollBy(0,0)}Event.stop(event)},finishDrag:function(B,E){this.dragging=false;if(this.options.quiet){Position.prepare();var D=[Event.pointerX(B),Event.pointerY(B)];Droppables.show(D,this.element)}if(this.options.ghosting){if(!this.element._originallyAbsolute){Position.relativize(this.element)}else{delete this.element._originallyAbsolute}Element.remove(this._clone);this._clone=null}if(this.options.proxy){this.element.remove();this.element=this.oldElement}var F=false;if(E){F=Droppables.fire(B,this.element);if(!F){F=false}}if(F&&this.options.onDropped){this.options.onDropped(this.element)}Draggables.notify("onEnd",this,B);var A=this.options.revert;if(A&&Object.isFunction(A)){A=A(this.element)}if(!this.options.proxy){var C=this.currentDelta()}if(A&&this.options.reverteffect){if(F==0||A!="failure"){this.options.reverteffect(this.element,C[1]-this.delta[1],C[0]-this.delta[0])}}else{this.delta=C}if(this.options.zindex){this.element.style.zIndex=this.originalZ}if(this.options.endeffect){this.options.endeffect(this.element)}Draggables.deactivate(this);Droppables.reset()},keyPress:function(A){if(A.keyCode!=Event.KEY_ESC){return }this.finishDrag(A,false);Event.stop(A)},endDrag:function(A){if(!this.dragging){return }this.stopScrolling();this.finishDrag(A,true);Event.stop(A)},draw:function(A){if(!this.options.proxy){var F=Position.cumulativeOffset(this.element);var E=this.currentDelta();F[0]-=E[0];F[1]-=E[1]}if(this.options.ghosting){var C=Position.realOffset(this.element);F[0]+=C[0]-Position.deltaX;F[1]+=C[1]-Position.deltaY}if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){F[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;F[1]-=this.options.scroll.scrollTop-this.originalScrollTop}if(!this.options.proxy){var D=[0,1].map(function(G){return(A[G]-F[G]-this.offset[G])}.bind(this))}else{var D=[A[0]+20,A[1]]}if(this.options.snap){if(Object.isFunction(this.options.snap)){D=this.options.snap(D[0],D[1],this)}else{if(Object.isArray(this.options.snap)){D=D.map(function(G,H){return(G/this.options.snap[H]).round()*this.options.snap[H]}.bind(this))}else{D=D.map(function(G){return(G/this.options.snap).round()*this.options.snap}.bind(this))}}}var B=this.element.style;if((!this.options.constraint)||(this.options.constraint=="horizontal")){B.left=D[0]+"px"}if((!this.options.constraint)||(this.options.constraint=="vertical")){B.top=D[1]+"px"}if(B.visibility=="hidden"){B.visibility=""}},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;Draggables._lastScrollPointer=null}},startScrolling:function(A){if(!(A[0]||A[1])){return }this.scrollSpeed=[A[0]*this.options.scrollSpeed,A[1]*this.options.scrollSpeed];this.lastScrolled=new Date();this.scrollInterval=setInterval(this.scroll.bind(this),10)},scroll:function(){var current=new Date();var delta=current-this.lastScrolled;this.lastScrolled=current;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){if(this.scrollSpeed[0]||this.scrollSpeed[1]){var d=delta/1000;this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1])}}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*delta/1000;this.options.scroll.scrollTop+=this.scrollSpeed[1]*delta/1000}Position.prepare();Droppables.show(Draggables._lastPointer,this.element);Draggables.notify("onDrag",this);if(this._isScrollChild){Draggables._lastScrollPointer=Draggables._lastScrollPointer||$A(Draggables._lastPointer);Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*delta/1000;Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*delta/1000;if(Draggables._lastScrollPointer[0]<0){Draggables._lastScrollPointer[0]=0}if(Draggables._lastScrollPointer[1]<0){Draggables._lastScrollPointer[1]=0}this.draw(Draggables._lastScrollPointer)}if(this.options.change){this.options.change(this)}},_getWindowScroll:function(w){var T,L,W,H;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft}else{if(w.document.body){T=body.scrollTop;L=body.scrollLeft}}if(w.innerWidth){W=w.innerWidth;H=w.innerHeight}else{if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight}else{W=body.offsetWidth;H=body.offsetHeight}}}return{top:T,left:L,width:W,height:H}}});Draggable._dragging={};var SortableObserver=Class.create({initialize:function(B,A){this.element=$(B);this.observer=A;this.lastValue=Sortable.serialize(this.element)},onStart:function(){this.lastValue=Sortable.serialize(this.element)},onEnd:function(){Sortable.unmark();if(this.lastValue!=Sortable.serialize(this.element)){this.observer(this.element)}}});var Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(A){while(A.tagName.toUpperCase()!="BODY"){if(A.id&&Sortable.sortables[A.id]){return A}A=A.parentNode}},options:function(A){A=Sortable._findRootElement($(A));if(!A){return }return Sortable.sortables[A.id]},destroy:function(A){var B=Sortable.options(A);if(B){Draggables.removeObserver(B.element);B.droppables.each(function(C){Droppables.remove(C)});B.draggables.invoke("destroy");delete Sortable.sortables[B.element.id]}},create:function(C){C=$(C);var B=Object.extend({element:C,tag:"li",dropOnEmpty:false,tree:false,treeTag:"ul",overlap:"vertical",constraint:"vertical",containment:C,handle:false,only:false,delay:0,hoverclass:null,ghosting:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:this.SERIALIZE_RULE,elements:false,handles:false,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{});this.destroy(C);var A={revert:true,quiet:B.quiet,scroll:B.scroll,scrollSpeed:B.scrollSpeed,scrollSensitivity:B.scrollSensitivity,delay:B.delay,ghosting:B.ghosting,constraint:B.constraint,handle:B.handle};if(B.starteffect){A.starteffect=B.starteffect}if(B.reverteffect){A.reverteffect=B.reverteffect}else{if(B.ghosting){A.reverteffect=function(F){F.style.top=0;F.style.left=0}}}if(B.endeffect){A.endeffect=B.endeffect}if(B.zindex){A.zindex=B.zindex}var D={overlap:B.overlap,containment:B.containment,tree:B.tree,hoverclass:B.hoverclass,onHover:Sortable.onHover};var E={onHover:Sortable.onEmptyHover,overlap:B.overlap,containment:B.containment,hoverclass:B.hoverclass};Element.cleanWhitespace(C);B.draggables=[];B.droppables=[];if(B.dropOnEmpty||B.tree){Droppables.add(C,E);B.droppables.push(C)}(B.elements||this.findElements(C,B)||[]).each(function(H,F){var G=B.handles?$(B.handles[F]):(B.handle?$(H).select("."+B.handle)[0]:H);B.draggables.push(new Draggable(H,Object.extend(A,{handle:G})));Droppables.add(H,D);if(B.tree){H.treeNode=C}B.droppables.push(H)});if(B.tree){(Sortable.findTreeElements(C,B)||[]).each(function(F){Droppables.add(F,E);F.treeNode=C;B.droppables.push(F)})}this.sortables[C.id]=B;Draggables.addObserver(new SortableObserver(C,B.onUpdate))},findElements:function(B,A){return Element.findChildren(B,A.only,A.tree?true:false,A.tag)},findTreeElements:function(B,A){return Element.findChildren(B,A.only,A.tree?true:false,A.treeTag)},onHover:function(E,D,A){if(Element.isParent(D,E)){return }if(A>0.33&&A<0.66&&Sortable.options(D).tree){return }else{if(A>0.5){Sortable.mark(D,"before");if(D.previousSibling!=E){var B=E.parentNode;E.style.visibility="hidden";D.parentNode.insertBefore(E,D);if(D.parentNode!=B){Sortable.options(B).onChange(E)}Sortable.options(D.parentNode).onChange(E)}}else{Sortable.mark(D,"after");var C=D.nextSibling||null;if(C!=E){var B=E.parentNode;E.style.visibility="hidden";D.parentNode.insertBefore(E,C);if(D.parentNode!=B){Sortable.options(B).onChange(E)}Sortable.options(D.parentNode).onChange(E)}}}},onEmptyHover:function(E,G,H){var I=E.parentNode;var A=Sortable.options(G);if(!Element.isParent(G,E)){var F;var C=Sortable.findElements(G,{tag:A.tag,only:A.only});var B=null;if(C){var D=Element.offsetSize(G,A.overlap)*(1-H);for(F=0;F<C.length;F+=1){if(D-Element.offsetSize(C[F],A.overlap)>=0){D-=Element.offsetSize(C[F],A.overlap)}else{if(D-(Element.offsetSize(C[F],A.overlap)/2)>=0){B=F+1<C.length?C[F+1]:null;break}else{B=C[F];break}}}}G.insertBefore(E,B);Sortable.options(I).onChange(E);A.onChange(E)}},unmark:function(){if(Sortable._marker){Sortable._marker.hide()}},mark:function(B,A){var D=Sortable.options(B.parentNode);if(D&&!D.ghosting){return }if(!Sortable._marker){Sortable._marker=($("dropmarker")||Element.extend(document.createElement("DIV"))).hide().addClassName("dropmarker").setStyle({position:"absolute"});document.getElementsByTagName("body").item(0).appendChild(Sortable._marker)}var C=Position.cumulativeOffset(B);Sortable._marker.setStyle({left:C[0]+"px",top:C[1]+"px"});if(A=="after"){if(D.overlap=="horizontal"){Sortable._marker.setStyle({left:(C[0]+B.clientWidth)+"px"})}else{Sortable._marker.setStyle({top:(C[1]+B.clientHeight)+"px"})}}Sortable._marker.show()},_tree:function(E,B,F){var D=Sortable.findElements(E,B)||[];for(var C=0;C<D.length;++C){var A=D[C].id.match(B.format);if(!A){continue}var G={id:encodeURIComponent(A?A[1]:null),element:E,parent:F,children:[],position:F.children.length,container:$(D[C]).down(B.treeTag)};if(G.container){this._tree(G.container,B,G)}F.children.push(G)}return F},tree:function(D){D=$(D);var C=this.options(D);var B=Object.extend({tag:C.tag,treeTag:C.treeTag,only:C.only,name:D.id,format:C.format},arguments[1]||{});var A={id:null,parent:null,children:[],container:D,position:0};return Sortable._tree(D,B,A)},_constructIndex:function(B){var A="";do{if(B.id){A="["+B.position+"]"+A}}while((B=B.parent)!=null);return A},sequence:function(B){B=$(B);var A=Object.extend(this.options(B),arguments[1]||{});return $(this.findElements(B,A)||[]).map(function(C){return C.id.match(A.format)?C.id.match(A.format)[1]:""})},setSequence:function(B,C){B=$(B);var A=Object.extend(this.options(B),arguments[2]||{});var D={};this.findElements(B,A).each(function(E){if(E.id.match(A.format)){D[E.id.match(A.format)[1]]=[E,E.parentNode]}E.parentNode.removeChild(E)});C.each(function(E){var F=D[E];if(F){F[1].appendChild(F[0]);delete D[E]}})},serialize:function(C){C=$(C);var B=Object.extend(Sortable.options(C),arguments[1]||{});var A=encodeURIComponent((arguments[1]&&arguments[1].name)?arguments[1].name:C.id);if(B.tree){return Sortable.tree(C,arguments[1]).children.map(function(D){return[A+Sortable._constructIndex(D)+"[id]="+encodeURIComponent(D.id)].concat(D.children.map(arguments.callee))}).flatten().join("&")}else{return Sortable.sequence(C,arguments[1]).map(function(D){return A+"[]="+encodeURIComponent(D)}).join("&")}}};Element.isParent=function(B,A){if(!B.parentNode||B==A){return false}if(B.parentNode==A){return true}return Element.isParent(B.parentNode,A)};Element.findChildren=function(D,B,A,C){if(!D.hasChildNodes()){return null}C=C.toUpperCase();if(B){B=[B].flatten()}var E=[];$A(D.childNodes).each(function(G){if(G.tagName&&G.tagName.toUpperCase()==C&&(!B||(Element.classNames(G).detect(function(H){return B.include(H)})))){E.push(G)}if(A){var F=Element.findChildren(G,B,A,C);if(F){E.push(F)}}});return(E.length>0?E.flatten():[])};Element.offsetSize=function(A,B){return A["offset"+((B=="vertical"||B=="height")?"Height":"Width")]};PBwiki.Components.Highlight={highlight:function(B,D){if(!D){return B}B=B.escapeHTML();var C=B.toLowerCase();var A=[];var E=D.toLowerCase().split(/\s/).without("");E.each(function(G){var I=-1;while(C.indexOf(G,I+1)!==-1){var H=C.indexOf(G,I+1);var F=H+G.length;A.push({start:H,end:F});I=F}});A=this.dedupeRanges(A);rv=this.highlightRanges(B,A);return rv},dedupeRanges:function(A){A=A.sort(function(F,E){if(F.start==E.start){return F.end-E.end}else{return F.start-E.start}});var D=[];var C=-1;var B=-1;A.each(function(E){if(E.start>B){if(C>-1){D.push({start:C,end:B})}C=E.start;B=E.end}else{if(E.end>B){B=E.end}}});D.push({start:C,end:B});return D},highlightRanges:function(B,A){var D="";var C=-1;A.each(function(E){if(C<E.start){D=D+B.substring(C,E.start)}D=D+"<em>"+B.substring(E.start,E.end)+"</em>";C=E.end});if(C<B.length){D=D+B.substring(C)}return D}};PBwiki.Components=PBwiki.Components||{};PBwiki.Components.Renderer=Class.create({options:{},initialize:function(A){this.options=Object.extend(this.options,A)}});Object.extend(PBwiki.Components.Renderer.prototype,PBwiki.Components.Highlight);PBwiki.Components=PBwiki.Components||{};PBwiki.Components.LegacyAutoComplete=Class.create({classname:"PBwiki.Components.LegacyAutoComplete",initialize:function(B){this.KEY_ENTER=13;this.KEY_COMMA=188;this.KEY_SPACE=32;this.options=B;this.elm=this.options.elm;this.container=B.container?B.container:new Element("div",{"class":"accontainer"});if(B.useAbsoluteContainer){document.body.appendChild(this.container);this.container.absolutize()}else{this.elm.insert({after:this.container})}this.hide();this.acout=new Element("div",{id:"acout"});this.container.appendChild(this.acout);this.content=new Element("div",{"class":"content"});this.acout.appendChild(this.content);this.header=new Element("div",{"class":"header"});this.content.appendChild(this.header);this.ul=new Element("ul",{"class":"ul"});this.content.appendChild(this.ul);this.footer=new Element("div",{"class":"footer"});this.content.appendChild(this.footer);this.elm.observe("focus",this.addKeyListener.bind(this));this.elm.observe("blur",this.removeKeyListener.bind(this));this.elm.observe("blur",this.hide.bind(this));var A=this.elm.up("form");if(A){A.observe("submit",this.onSearch.bind(this))}this.ignoreBlur=false},keyDown:function(G){if(this.elm.value==""){this.hide();return }var I=G.keyCode||G.charCode;var A=this.ul.down("li.active");if(A){if(I==this.KEY_ENTER){this.onSearch(G)}}else{var C=[this.KEY_COMMA,this.KEY_ENTER,this.KEY_SPACE];if(C.indexOf(I)>=0&&this.onComma){this.onComma(G)}}if(I==Event.KEY_DOWN||I==Event.KEY_UP||I==Event.KEY_TAB){if(A){A.removeClassName("active")}if(I==Event.KEY_UP){var H=(A)?A.previous():this.ul.lastChild;if(!H){H=this.ul.lastChild}}else{if(I==Event.KEY_DOWN||I==Event.KEY_TAB){var H=(A)?A.next():this.ul.down();if(!H){H=this.ul.down()}}}if(H){H.addClassName("active");if(this.maxHeight){var B=this.container.scrollTop;var D=B+this.container.clientHeight;var F=H.offsetTop;var E=H.offsetTop+H.clientHeight;if(D<E){this.container.scrollTop=E-this.container.clientHeight}else{if(B>F){this.container.scrollTop=F}}}}}else{this.keyPressed=this.drawAfterKeypress(this.elm.value);if(this.refreshTimer){clearTimeout(this.refreshTimer)}if(this.keyPressed){this.refreshTimer=setTimeout(this.doRefresh.bind(this),this.getRefreshTimeout())}}},doRefresh:function(){if(this.isLoading){return }this.isLoading=true;this.refreshTimer=null;this.drawLoading();var A=this.getFilterForAPICall();if(A){Object.extend(this.requestOptions,{filter:A})}this.filter=this.elm.value;this.request=new PBwiki.APIRequest(this.apiMethod,this.requestOptions,{onSuccess:function(B){this.isLoading=false;this.draw(this.elm.value,B)}.bind(this),onFailure:function(B){this.isLoading=false}.bind(this),method:"get",priority:PBwiki.Data.HIGH_PRIORITY,cacheability:this.apiCacheability})},drawLoading:function(){if(!this.shouldDisplayLoadingMessage()){return }this.resizePopover();var A=new Element("li").update("Loading...");this.ul.update("");this.ul.appendChild(A);this.show();this.footer.hide();if(this.content.clientHeight){this.container.style.height=this.content.clientHeight.toString()+"px"}else{if(this.content.scrollHeight){this.container.style.height=this.content.scrollHeight.toString()+"px"}}},addKeyListener:function(){if(!this.listener){this.listener=this.keyDown.bindAsEventListener(this);$(document).observe("keyup",this.listener)}var A=this.elm.getAttribute("placeholder");if(this.elm.value===A){this.elm.clear();this.elm.focus()}},removeKeyListener:function(A){if(A&&A.type=="blur"&&this.ignoreBlur){return }if(this.listener){$(document).stopObserving("keyup",this.listener);this.listener=null}},show:function(){this.container.show();PBwiki.DialogFactory.trapEsc=false},hide:function(A){if(A&&A.type=="blur"&&this.ignoreBlur){return }this.container.hide();window.setTimeout(function(){PBwiki.DialogFactory.trapEsc=true},10)}});PBwiki.Components.SearchAutoComplete=Class.create(PBwiki.Components.LegacyAutoComplete,{classname:"PBwiki.Components.SearchAutoComplete",apiMethod:"GetObjectsNOM",requestOptions:{sortby:"name",count:10,offset:0},onSearch:function(B){var A=this.ul.down("li.active");if(this.listener&&A){B.stop();window.location.href=A.down("a").getAttribute("href")}},draw:function(A,B){this.request=null;this.ul.update("");(B.objects.length==0)?this.ul.hide():this.ul.show();B.objects.each(function(G){var C=new Element("li",{"class":"tb"+G.type});C.dataObject=G;var F=Util.iconMap[Util.getFileExtension(G.name.toString())];var E=Util.getObjectLink(G);C.observe("mousedown",function(H){H.stop();if(this.onClick){return this.onClick(G)}window.location=E}.bind(this));Util.addObjectTooltip(C,G);var D=new Element("a",{href:E});C.appendChild(D);D.appendChild(new Element("span").addClassName("fileicon").addClassName(F));D.appendChild(new Element("div").setStyle({overflow:"hidden"}).update(G.name.toString().escapeHTML()));this.ul.appendChild(C)}.bind(this));if(B._total_count>10){this.footer.update("... and "+B._total_count+" more");this.footer.show()}else{this.footer.hide()}if(A!=this.elm.value&&!this.refreshTimer){this.refreshTimer=setTimeout(this.doRefresh.bind(this),10)}this.lastTxt=A;this.show()},drawAfterKeypress:function(A){this.header.update("");var C="/FindPage?SearchFor="+encodeURIComponent(this.elm.value);var B=new Element("a",{href:C}).update("or look in page content for: "+this.elm.value.escapeHTML()).observe("mousedown",function(D){D.stop();window.location=C});this.header.appendChild(B);this.header.show();return true},getFilterForAPICall:function(){return this.elm.value},getRefreshTimeout:function(){return 200},shouldDisplayLoadingMessage:function(){return false}});PBwiki.Components.QuickLinkAutoComplete=Class.create(PBwiki.Components.SearchAutoComplete,{classname:"PBwiki.Components.QuickLinkAutoComplete",requestOptions:{sortby:"name",count:6,offset:0},initialize:function($super,A){$super(A);if(PBinfo.CurrentNetwork){this.header.update("Results from "+PBinfo.CurrentWiki.title.truncate(30).escapeHTML())}else{this.header.hide()}},draw:function($super,A,B){$super(A,B);if(this.ul.childNodes.length==0){this.hide()}},drawAfterKeypress:function(A){return true},onClick:function(A){this.notify("onSelected",A)},onSearch:function(B){B.stop();var A=this.ul.down("li.active");this.notify("onSelected",A?A.dataObject:false)}});Object.Event.extend(PBwiki.Components.QuickLinkAutoComplete);PBwiki.Components.UserAutoComplete=Class.create(PBwiki.Components.LegacyAutoComplete,{classname:"PBwiki.Components.UserAutoComplete",apiCacheability:["permtime"],dataLoaded:false,maxHeight:200,ignoreUids:[],initialize:function(A){if(!Prototype.Browser.IE){A.useAbsoluteContainer=true}A.container=new Element("div",{"class":"accontainer user-autocomplete"});PBwiki.Components.LegacyAutoComplete.prototype.initialize.call(this,A);if(navigator&&navigator.userAgent.indexOf("Firefox/2")>-1){this.container.style.position="relative"}if(A.ignoreUids){this.ignoreUids=A.ignoreUids}this.apiMethod=A.apiMethod;this.requestOptions=A.requestOptions;this.serverSideFiltering=(PBinfo.CurrentWiki&&PBinfo.CurrentWiki.usercount>100);this.selectedUserList=new PBwiki.Components.UserAutoComplete.SelectedUserList(this,A.userList);this.userListContainer=A.userListContainer;this.elm.observe("blur",this.addSelectedUser.bind(this));this.container.observe("mousedown",this.mouseDown.bind(this));this.userListContainer.observe("click",function(B){this.userListContainer.down("input").focus()}.bind(this));this.onFindEmailsError=A.onFindEmailsError?A.onFindEmailsError:function(){};document.observe("dialog:recentered",this.resizePopover.bind(this))},keyDown:function($super,A){$super(A);this.userListContainer.scrollTop=this.userListContainer.scrollHeight},mouseDown:function(A){this.ignoreBlur=true;window.setTimeout(function(){this.ignoreBlur=false;this.elm.focus()}.bind(this),10);return },onSearch:function(C){C.stop();var B=this.ul.down("li.active");if(B){var A={uid:B.getAttribute("user:uid"),name:B.getAttribute("user:name"),email:B.getAttribute("user:email"),is_classroom_account:B.getAttribute("user:is_classroom_account"),is_raw_email:false};this.click(A)}},addSelectedUser:function(D){if(D&&D.type=="blur"&&this.ignoreBlur){return }var C=this.ul.down("li.active");if(C){var A={uid:C.getAttribute("user:uid"),name:C.getAttribute("user:name"),email:C.getAttribute("user:email"),is_classroom_account:C.getAttribute("user:is_classroom_account"),is_raw_email:false};var B=new PBwiki.Components.UserAutoComplete.SelectedUser(this,A);Util.executeUnlessEsc(function(E){this.selectedUserList.append(E)}.bind(this,B));this.hide();C.removeClassName("active")}else{if(this.options.allowEmails){this.checkForEmail()}}this.elm.value=""},draw:function(A,C){this.request=null;if(!this.serverSideFiltering){this.dataLoaded=true}if(A.blank()){this.lastTxt="";this.hide();return }this.header.hide();this.ul.update("");this.userEmailToUidMapping={};$(C.users).each(function(D){if(D.uid&&D.email){this.userEmailToUidMapping[D.email]={uid:D.uid,name:D.name,email:D.email,is_classroom_account:D.is_classroom_account,is_raw_email:false}}}.bind(this));var B=this.filterUsers(C.users,A);var B=this.setNames(B);B.sort(this.compareUsers.bind(this));B.each(this.userToElement.bind(this));selectedElm=this.ul.down("li");if(selectedElm){selectedElm.addClassName("active")}this.footer.hide();(B.length==0)?this.hide():this.show();this.container.scrollTop=0;this.resizePopover();this.lastTxt=A;if(A!=this.elm.value&&!this.refreshTimer){this.refreshTimer=setTimeout(this.doRefresh.bind(this),10)}},setNames:function(B){for(var A=0;A<B.length;A++){if(B[A].name.empty()&&!B[A].email.empty()){B[A].name=B[A].email}}return B},compareUsers:function(B,A){B=this.userToString(B).toLowerCase();A=this.userToString(A).toLowerCase();if(B==A){return 0}else{if(B<A){return -1}else{return 1}}},filterUsers:function(C,A){var B=A.toLowerCase().split(/\s+/);if(this.options.filter){C=C.filter(this.options.filter)}return C.filter(function(I){if(this.selectedUserList.contains(I.uid)){return false}if(this.ignoreUids.indexOf(I.uid)!=-1){return false}if(I.is_classroom_account){return false}var D=(I.name||"").toLowerCase();var K=(I.email||"").toLowerCase();var L=this.tokenize(D).concat(this.tokenize(K)).concat(K);for(var J=0;J<B.length;J++){var E=B[J];if(E.length==0){continue}var F=false;for(var H=0;H<L.length;H++){var G=L[H];if(G.startsWith(E)){F=true;break}}if(!F){return false}}return true}.bind(this))},tokenize:function(A){return A.split(/[^A-Za-z0-9]/).without("")},userToString:function(A){var B=A.name.toString();if(A.email&&!A.email.empty()&&A.email!=A.name){B+=" <"+A.email+">"}return B},userToElement:function(C){var A=new Element("li");A.setAttribute("user:uid",C.uid||"");A.setAttribute("user:name",C.name||"");A.setAttribute("user:email",C.email||"");A.setAttribute("user:is_classroom_account",C.is_classroom_account||false);A.setAttribute("user:is_raw_email",C.is_raw_email||false);A.observe("mousedown",function(E){E.stop();this.click(C)}.bind(this));var B=new Element("a",{href:"#"});A.appendChild(B);var D=new Element("span").addClassName("iconbutton").addClassName("usericon");D.appendChild(document.createTextNode(this.userToString(C)));B.appendChild(D);this.ul.appendChild(A)},click:function(A){var B=new PBwiki.Components.UserAutoComplete.SelectedUser(this,A);this.selectedUserList.append(B);this.hide();this.ul.update("");this.elm.value="";this.setFocus()},checkForEmail:function(){if(this.elm.value==this.elm.getAttribute("placeholder")){return }var D=Util.findEmails(this.elm.value,this.onFindEmailsError);for(var C=0;C<D.length;C++){if(this.userEmailToUidMapping[D[C]]){var A=this.userEmailToUidMapping[D[C]];if(this.ignoreUids.indexOf(A.uid)>=0){if(this.options.onIgnoredUserEmailEntered){this.options.onIgnoredUserEmailEntered(A)}}else{this.click(A)}return }var A={uid:D[C],name:D[C],email:D[C],is_classroom_account:false,is_raw_email:true};var B=new PBwiki.Components.UserAutoComplete.SelectedUser(this,A);this.selectedUserList.append(B)}if(D.length>0){this.hide();this.ul.update("");this.elm.value=""}},onComma:function(C){C.stop();var B=this.ul.down("li.active");if(B){var A={uid:B.getAttribute("user:uid"),name:B.getAttribute("user:name"),email:B.getAttribute("user:email"),is_classroom_account:B.getAttribute("user:is_classroom_account"),is_raw_email:false};this.click(A)}else{if(this.options.allowEmails){this.checkForEmail()}this.elm.value=""}},setFocus:function(){setTimeout(function(){var A=this.elm.up("div").parentNode;var B=A.scrollTop;this.elm.focus();if(Prototype.Browser.IE){setTimeout(function(){A.scrollTop=B},1)}else{A.scrollTop=B}}.bind(this),10)},resizePopover:function(){var A=300;if(this.container.clientHeight){A=this.header.clientHeight+this.ul.clientHeight+this.footer.clientHeight}if(this.container.scrollHeight){A=this.header.scrollHeight+this.ul.scrollHeight+this.footer.scrollHeight}this.container.style.overflowX="hidden";this.container.style.overflowY=(A>this.maxHeight)?"scroll":"hidden";A=Math.min(A,this.maxHeight).toString()+"px";this.container.style.height=A;this.container.style.maxHeight=A;var C=$(this.userListContainer).getDimensions().height;var D=$(this.userListContainer).down("div").getDimensions().height;if(D>C){this.container.style.marginTop=(0-((D-C)+30))+"px"}else{this.container.style.marginTop=0}if(Prototype.Browser.IE){baselineLeft=0-this.container.cumulativeOffset().left-5;if(parseInt(this.container.style.left)){baselineLeft+=parseInt(this.container.style.left)}baselineTop=0-this.container.cumulativeOffset().top;if(parseInt(this.container.style.top)){baselineTop+=parseInt(this.container.style.top)}baselineTop-=(this.elm.cumulativeScrollOffset().top);var B=document.documentElement.scrollTop||window.scrollY||0;baselineTop+=B}else{baselineLeft=0;baselineTop=0}this.container.style.left=(baselineLeft+this.userListContainer.cumulativeOffset().left+5)+"px";this.container.style.top=(baselineTop+this.elm.getDimensions().height+this.elm.cumulativeOffset().top+5)+"px"},resizeTextField:function(){var E=0;var C=this.textFieldMinWidth();var F=this.userListContainer.getWidth()-15;var D=F-E;this.elm.style.width=C.toString()+"px";var A=this.elm.offsetLeft-this.userListContainer.offsetLeft;var B;if(A+C>D){B=D}else{B=D-A}this.elm.style.width=B.toString()+"px"},textFieldMinWidth:function(){var D=10;var B=4;if(this.elm.value.blank()){return D}var A=new Element("span");A.setStyle({position:"absolute",top:0,left:0,whiteSpace:"nowrap",visibility:"hidden"});A.appendChild(document.createTextNode(this.elm.value));document.body.appendChild(A);var C=A.offsetWidth;document.body.removeChild(A);return Math.max(D,C+B)},drawAfterKeypress:function(A){if(this.elm.value.blank()){this.hide();return false}else{if(this.ul.childNodes==0){this.hide()}}this.resizeTextField();this.setFocus();return true},getFilterForAPICall:function(){return this.serverSideFiltering?this.elm.value:null},getRefreshTimeout:function(){return this.serverSideFiltering?200:10},shouldDisplayLoadingMessage:function(){if(this.serverSideFiltering){return true}else{return !this.dataLoaded}}});PBwiki.Components.UserAutoComplete.SelectedUserList=Class.create();Object.extend(PBwiki.Components.UserAutoComplete.SelectedUserList.prototype,Enumerable);Object.extend(PBwiki.Components.UserAutoComplete.SelectedUserList.prototype,{classname:"PBwiki.Components.UserAutoComplete.SelectedUserList",initialize:function(A,B){this.map=new Object();this.arr=new Array();this.autoComplete=A;this.elm=B;this.placeholderText=this.autoComplete.elm.attributes.placeholder.value},clear:function(){while(user=this.arr.pop()){delete this.map[user.uid]}this.draw()},empty:function(){return(this.arr.length===0)},_toString:function(){var A="";for(var C=0;C<this.arr.length;C++){var B=this.arr[C];A+=B.uid+","}A=A.substring(0,A.length-1);return A},getUIDs:function(){var A=[];for(var C=0;C<this.arr.length;C++){var B=this.arr[C];if(Util.is_valid_uid(B.uid)){A.push(B.uid)}}return A},getExtraEmails:function(){var A=[];for(var C=0;C<this.arr.length;C++){var B=this.arr[C];if(Util.is_valid_email(B.uid)===true){A.push(B.uid)}}return A},contains:function(A){return !!this.map[A]},append:function(B){if(this.map[B.uid]){this.remove(B.uid)}var A=new PBwiki.Components.UserAutoComplete.SelectedUser(this,B);this.map[B.uid]=A;this.arr.push(A);this.draw();document.fire("ui:autoCompleteListChange")},remove:function(A){if(this.map[A]){this.arr=this.arr.without(this.map[A]);delete this.map[A];this.draw();document.fire("ui:autoCompleteListChange")}},draw:function(){this.elm.update("");for(var A=0;A<this.arr.length;A++){this.elm.appendChild(this.arr[A].toElement());this.elm.appendChild(document.createTextNode(" "))}this.autoComplete.resizeTextField();this.updatePlaceholder()},updatePlaceholder:function(){if(this.arr.length>0){this.autoComplete.elm.attributes.placeholder.value=""}else{this.autoComplete.elm.attributes.placeholder.value=this.placeholderText}},_each:function(A){this.arr.each(A)}});PBwiki.Components.UserAutoComplete.SelectedUser=Class.create({classname:"PBwiki.Components.UserAutoComplete.SelectedUser",initialize:function(A,B){this.userList=A;this.uid=B.uid||"";this.name=B.name||"";this.email=B.email||"";this.is_classroom_account=B.is_classroom_account||false;this.is_raw_email=B.is_raw_email||false},toElement:function(){var C=new Element("span").addClassName("acuser");if(this.is_raw_email){C.addClassName("raw")}else{C.addClassName("iconbutton");C.addClassName("usericon")}C.id="user-"+this.uid.toString();var A=this.display_name||this.name||this.email||this.uid;C.appendChild(document.createTextNode(A.toString()+" "));var B=new Element("a").update("&nbsp;");B.href="";B.observe("click",this.clickRemove.bind(this));C.appendChild(B);return C},clickRemove:function(A){A.stop();this.userList.remove(this.uid);this.userList.autoComplete.setFocus()}});PBwiki.WorkspaceSearchRenderer=Class.create(PBwiki.Components.Renderer,{classname:"PBwiki.WorkspaceSearchRenderer",render:function(F){var C=F.container.down("ul");C.update("");var D=this.getSearchURL(F.filter);var A=new Element("li",{className:"page-content selected ellipses"});var E=new Element("a",{href:D});E.update("or look in page content for: "+F.filter.escapeHTML());A.appendChild(E);C.appendChild(A);for(var B=0;B<Math.min(F.total_count,10);B++){var A=new Element("li",{className:"ellipses"});var E=new Element("a",{href:Util.getObjectLink(F.data[B])});E.update(this.highlight(F.data[B].name,F.filter));A.appendChild(E);switch(F.data[B].type){case"page":A.addClassName("pageediticon");break;case"file":A.addClassName(Util.getFileIcon(F.data[B].name));break;case"folder":A.addClassName("foldericon");break}C.appendChild(A)}if(F.total_count>10){F.container.down("div.footer").update("... and "+(F.total_count-10)+" more").show()}else{F.container.down("div.footer").hide()}},getSearchURL:function(A){return"/w/search?q="+encodeURIComponent(A)}});PBwiki.init("Workspace Autocomplete",function(){if(!$("input-search")){return }var A=new PBwiki.Components.AutoComplete($("input-search"),{dataProvider:new PBwiki.DataProviders.NOMObjects(),renderer:new PBwiki.WorkspaceSearchRenderer()});$("input-search").observe("ui:autocomplete",function(C){var B=C.memo;if(B&&B.tagName&&B.tagName.toLowerCase()=="li"){document.location.href=B.down("a").getAttribute("href")}else{document.location.href="/w/search?q="+encodeURIComponent($("input-search").value)}})});PBwiki=PBwiki||parent.PBwiki;PBwiki.Components=PBwiki.Components||{};PBwiki.Components.Dialog=Class.create({classname:"PBwiki.Components.Dialog",previousActiveDialog:null,close:function(){this.onUnload();this.onClosed();this.remove();Util.fixIE6RelativeElems();if(this.window_event_handler){Event.stopObserving(window,"scroll",this.window_event_handler);Event.stopObserving(window,"resize",this.window_event_handler)}},IE6:
/*@cc_on @_jscript_version < 5.7 || @*/
false,displayIframe:function(A){this.resize(A.dimensions);this.renderMode=A.contentSource;this.originalSize=A.dimensions},display:function(A){document.body.appendChild(this);this.resize(A.dimensions);this.renderMode=A.contentSource;this.originalSize=A.dimensions;Util.fixIE6RelativeElems()},resize:function(C){var A={};A.width=(parseInt(C.width)?C.width+"px":"400px");A.height=(parseInt(C.height)?C.height+"px":"auto");var B=this.select(".modal_content").first();B.setStyle(A);this.setContainerSize(C)},setContainerSize:function(C){var B=(this.IE6?"absolute":"fixed");var A=(typeof C.height=="string"?"auto":(C.height+41)+"px");this.setStyle({height:A,width:(C.width+18)+"px",display:"block",position:B});this.recenter();this.redisplay();this.setStyle({visibility:"visible"});this.window_event_handler=this.redisplay.bind(this);Event.observe(window,"scroll",this.window_event_handler);Event.observe(window,"resize",this.window_event_handler)},redisplay:function(){PBwiki.DialogFactory.background.style.height=document.body.clientHeight;PBwiki.DialogFactory.background.style.width=document.documentElement.clientWidth;if(this.timeOut){clearTimeout(this.timeOut)}this.timeOut=setTimeout(this.recenter.bind(this),50)},setTitle:function(A){this.getElementsByTagName("h3")[0].innerHTML=A.escapeHTML()},recenter:function(){var D=document.documentElement.clientWidth;var A=document.documentElement.clientHeight;var C=document.documentElement.scrollLeft||window.scrollX||0;var B=document.documentElement.scrollTop||window.scrollY||0;var F=this.getDimensions()?this.getDimensions().width:0;var H=this.getDimensions()?this.getDimensions().height:0;var G,E;if(A>400&&H<(0.95*A)){G=B+((A-H)/2)}else{G=20}if(D>400&&F<(0.95*D)){E=C+((D-F)/2)}else{E=20}var I={position:"absolute",top:G.toString()+"px",left:E.toString()+"px"};this.setStyle(I);document.fire("dialog:recentered")},onUnload:function(){if(this.contentSourceElement){target=this.select(".modal_content").first();this.select("form").invoke("reset");$A(target.childNodes).each(function(A){this.contentSourceElement.appendChild(A)}.bind(this))}}});PBwiki.DialogFactory={classname:"PBwiki.DialogFactory",activeDialog:null,cache:{},background:new Element("div",{"class":"modalbg"}),defaultDimensions:{width:400,height:"auto"},trapEsc:true,html5video:null,resize:function(A){if(this.activeDialog){this.activeDialog.resize(Object.extend(PBwiki.DialogFactory.defaultDimensions,A))}},close:function(A){if(this.activeDialog){this.activeDialog.close(A);if(this.activeDialog.closeable==true){document.stopObserving("keydown",PBwiki.DialogFactory.trapKeyEsc)}this.activeDialog=this.previousActiveDialog?this.previousActiveDialog:null;document.fire("dialog:closed");if(this.previousActiveDialog){this.previousActiveDialog.style.zIndex=PBwiki.DialogFactory.background.style.zIndex+1}this.previousActiveDialog=null}if(!this.activeDialog){if(typeof (Effect)!=="undefined"&&(typeof A=="undefined"||typeof A.fade=="undefined"||A.fade)){Effect.Fade(PBwiki.DialogFactory.background,{duration:0.1})}else{PBwiki.DialogFactory.background.hide()}}},setTitle:function(A){if(PBwiki.DialogFactory.activeDialog){PBwiki.DialogFactory.activeDialog.setTitle(A)}},recenter:function(){if(PBwiki.DialogFactory.activeDialog){PBwiki.DialogFactory.activeDialog.recenter()}},showBackground:function(){if(PBwiki.DialogFactory.background.parentNode!=document.body){PBwiki.DialogFactory.background.innerHTML='<!--[if lte IE 6.5]><iframe src="/layout/common/templates/dialog/blank.html" class="iefix"></iframe><![endif]-->';document.body.appendChild(PBwiki.DialogFactory.background);PBwiki.DialogFactory.background.style.zIndex=1}if(!document.evaluate){PBwiki.DialogFactory.background.style.height=document.body.clientHeight;PBwiki.DialogFactory.background.style.width=document.documentElement.clientWidth}PBwiki.DialogFactory.background.setStyle({display:"block"});PBwiki.DialogFactory.background.setOpacity(0.3)},open:function(D,F,E,A){E=Object.extend({renderAs:"div",contentSource:"ajax",expireCache:true,dimensions:PBwiki.DialogFactory.defaultDimensions,closeable:true,reuseDialogs:true,onClosed:Prototype.emptyFunction,onOpened:Prototype.emptyFunction},E);F=F||"No Title";if(E.renderAs=="iframe"){E.contentSource=E.renderAs}else{if(E.renderAs=="div"&&!E.contentSource){E.contentSource="ajax"}}A=Object.extend({evalScripts:true,parameters:"",method:"post"},A);if(E.reuseDialogs&&this.activeDialog){E.contentSource=this.activeDialog.renderMode;E.dimensions=this.activeDialog.originalSize}document.fire("menu::hide");var C=E.contentSource;if(C){var B=("open-"+C.toLowerCase()).camelize();this[B](D,F,E,A)}if(E.closeable==true){document.observe("keydown",PBwiki.DialogFactory.trapKeyEsc)}if(this.previousActiveDialog){this.previousActiveDialog.style.zIndex=PBwiki.DialogFactory.background.style.zIndex-1}},trapKeyEsc:function(A){if(A.keyCode==Event.KEY_ESC){if(PBwiki.DialogFactory.trapEsc){document.fire("dialog:close")}else{document.fire("keypress:esc")}}},openPage:function(C,G,F,A){var E;var D=this.activeDialog;var B=F.dimensions.width;C=$(C);if(!D){D=new Element("div",{className:"modal"});D.appendChild(new Element("div",{className:"modal_title"}));D.firstChild.innerHTML="<h3>"+G.escapeHTML()+"</h3>";D.firstChild.innerHTML+=(F.closeable?'<a href="javascript:void(0);" onclick="PBwiki.DialogFactory.close(); return false;"></a>':"");E=new Element("div",{className:"modal_content"});D.appendChild(E);Object.extend(D,PBwiki.Components.Dialog.prototype);D.contentSourceElement=C;D.onClosed=F.onClosed;D.closeable=F.closeable;this.activeDialog=D}else{D.onUnload();E=D.getElementsByClassName("modal_content")[0]}this.showBackground();$A(C.childNodes).each(function(H){E.appendChild(H)});D.display(F)},openAjax:function(A,H,D,C){var F;var J=this.activeDialog;var I=D.dimensions.width;if(this.activeDialog&&!D.reuseDialogs){this.previousActiveDialog=this.activeDialog;J=false}if(A){var B=A.split("/").slice(-1)[0].split(".")[0]}if(!J){J=new Element("div",{className:"modal",id:"modal-"+(A?B.gsub(/[?&=]/,"-"):Math.round(Math.random()*1000))});var E=new Element("div",{className:"modal_title"});E.appendChild(new Element("h3").update(H.escapeHTML()));E.wrap(J);if(D.closeable){var G=new Element("a",{href:"javascript:void(0);"}).wrap(E);G.observe("click",function(K){K.stop();PBwiki.DialogFactory.close()})}F=new Element("div",{className:"modal_content"});F.wrap(J);Object.extend(J,PBwiki.Components.Dialog.prototype);J.onClosed=D.onClosed;this.activeDialog=J}else{F=J.getElementsByClassName("modal_content")[0]}this.showBackground();if(D.templateSrc){F.innerHTML=D.templateSrc;J.display(D);D.onOpened()}else{this.ajax=new Ajax.Updater(F,A,{onComplete:function(L){if(D.templateObject){var K=new Template(F.innerHTML);K.innerHTML=K.evaluate(D.templateObject)}J.display(D);D.onOpened()},method:"get"})}},openVideo:function(C,R,I,N){var Q,B,P,A=this.activeDialog,G=I.dimensions.width,O=N.video_height,H=N.poster,E=N.mp4,L=N.webm,D=N.ogg,J=N.autoplay;if(A){Q=this.activeDialog.down().first()}else{A=new Element("div",{className:"modal",id:"modal-lightbox"});lightbox_header=new Element("div",{className:"modal_title"});lightbox_header.wrap(A);if(I.closeable){var F=new Element("a",{href:"javascript:void(0);"}).wrap(lightbox_header);F.observe("click",function(S){S.stop();PBwiki.DialogFactory.close()})}Q=new Element("div",{className:"modal_content"});B=new Element("div",{className:"video-js-box vim-css"});P=new Element("video",{id:"modal_video","class":"video-js",width:G,height:O,preload:"preload",controls:"controls"});if(H){P.setAttribute("poster",H)}if(J){P.setAttribute("autoplay","autoplay")}var M="/shared/video/flash/player.swf";var K='<object id="flash-video-player" class="vjs-flash-fallback" type="application/x-shockwave-flash" data="'+M+'" width="'+G+'" height="'+O+'">';K+='<param name="movie" value="'+M+'" />';K+='<param name="allowFullScreen" value="true" />';K+='<param name="wmode" value="transparent" />';K+='<param name="flashvars" value="'+(J?"autostart=true&amp;":"")+"controlbar=over&amp;"+(H?"image="+H+"&amp;":"")+"file="+E+'"/>';if(H){K+='<img src="'+H+'" title="No video playback capabilities" />'}K+="</object>";P.update(K);new Element("source",{src:E,type:'video/mp4; codecs="avc1.42E01E, mp4a.40.2"'}).wrap(P);if(L){new Element("source",{src:L,type:'video/webm; codecs="vp8, vorbis"'}).wrap(P)}if(D){new Element("source",{src:D,type:'video/ogg; codecs="theora, vorbis"'}).wrap(P)}P.wrap(B);B.wrap(Q);Q.wrap(A);Object.extend(A,PBwiki.Components.Dialog.prototype);A.onClosed=I.onClosed;this.activeDialog=A}this.showBackground();A.display(I);if(!this.player){this.player=VideoJS.setup("modal_video")}I.onOpened()},openIframe:function(A,G,C,B){var E;var H;var F;var I=this.activeDialog;if(typeof B.parameters=="object"){B.parameters=$H(B.parameters)}if(!I){I=new Element("div",{className:"modal"});I.appendChild(new Element("div",{className:"modal_title"}));I.firstChild.innerHTML="<h3>"+G.escapeHTML()+"</h3>";I.firstChild.innerHTML+=(C.closeable?'<a href="javascript:void(0);" onclick="PBwiki.DialogFactory.close(); return false;"></a>':"");var D=new Element("div",{className:"modal_content"});E=new Element("iframe",{scrolling:"no",frameborder:"no",style:"width: 100%",allowTransparency:true,name:"__modal_iframe_target"});D.appendChild(E);I.style.display=Prototype.Browser.WebKit?"":"none";I.appendChild(D);Object.extend(I,PBwiki.Components.Dialog.prototype);I.onClosed=C.onClosed;this.activeDialog=I}else{E=this.activeDialog.childNodes[1].firstChild}switch(B.method){case"post":if(typeof B.parameters=="object"&&B.parameters.keys().length>0){H=this.buildIframeForm(A,B.parameters);F="javascript:void(0);";break}case"get":default:F=A+(typeof B.parameters=="object"?"?"+B.parameters.toQueryString():B.parameters)}document.body.appendChild(I);this.showBackground();E.src=F;Event.observe(E,"load",function(){I.displayIframe(C)});if(H){H.target="__modal_iframe_target";document.body.appendChild(H);H.id="_f1";H.submit();post.remove()}},buildIframeForm:function(B,C){var A=new Element("form",{action:B,method:"post"});$H(C).each(function(D){A.appendChild(new Element("input",{name:D.key,value:D.value}))});return A},cancelLoading:function(){this.ajax.transport.abort();this.activeDialog.remove();delete this.activeDialog;PBwiki.DialogFactory.background.hide()},initialize:function(){document.observe("dialog:close",PBwiki.DialogFactory.close.bind(PBwiki.DialogFactory))}};PBwiki.init(PBwiki.DialogFactory);PBwiki.DialogCommands={};PBwiki.DialogCommands._LoadOnDemand=function(B,A){if(PBwiki.DialogCommands._AttemptedLoad){return }PBwiki.ResourceLoader.loadManifest("dialogs.js",function(){PBwiki.DialogCommands._AttemptedLoad=true;new PBwiki.DialogCommands[B](A)})};["AddTemplate","AddUsersDialog","AddUsersWizard","CreateNewFolder","CreateNewPage","DeleteFolder","DocImportSuggestion","EmailImport","FolderSecurity","FolderSelector","GroupPermissions","InsertLink","InsertLink2","JoinWorkspace","LicenseExpired","MustJoinWorkspace","PreviewInvitationWizard","SecureCommunication","SecureStorage","SelectColor","UploadConfirmation","UploadProgress","WhatCanSee",].each(function(A){PBwiki.DialogCommands[A]=function(B){PBwiki.DialogCommands._LoadOnDemand(A,B)}});PBwiki.DialogCommands.TemplateDialog=Class.create({classname:"PBwiki.DialogCommands.TemplateDialog",dialogPath:"/layout/common/templates/dialog/",dialogOptions:{},initialize:function(A){this.options=A;this.dialogOptions={contentSource:"ajax",dimensions:Object.extend({width:400,height:"auto"},A.dimensions),onOpened:this.setupDialog.bind(this),onClosed:this.options.onClosed||Prototype.emptyFunction,templateSrc:this.templateSrc,templateObject:this.getTemplateObject()};if(A.closeable===false){this.dialogOptions.closeable=A.closeable}if(A.reuseDialogs===false){this.dialogOptions.reuseDialogs=A.reuseDialogs}PBwiki.DialogFactory.open(this.getTemplateURL(),this.title,this.dialogOptions)},getTemplateURL:function(){var A;if(this.templateName){if(this.templateName.startsWith("/")){A=this.templateName}else{A=this.dialogPath+this.templateName+".html?_bt="+PBwiki.getBuildTime()}}return A},setupDialog:function(){this.active=PBwiki.DialogFactory.activeDialog;this.dialog=this.active.down(".modal_content")},findInputs:function(){this.inputs={};var A=this.dialog.down("form");A.select("input").concat(A.select("select")).concat(A.select("textarea")).each(function(B){var C=B.getAttribute("name");if(C){this.inputs[C]=B}},this)},inputs:{},getInputs:function(){var A={};for(itm in this.inputs){if(this.inputs[itm].value&&this.inputs[itm].value!=this.inputs[itm].getAttribute("placeholder")){A[itm]=this.inputs[itm].value.strip()}}return A},getTemplateObject:function(){return false},setTitle:function(A){this.active.down("div.modal_title h3").update(A)},setWaitMsg:function(A){this.dialog.down("form").update('<p style="margin: 70px; background: transparent url(/images/spin_bw.gif) no-repeat scroll left center; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; padding-left: 20px;">'+A+"</p>")}});PBwiki.DialogCommands.APIDialog=Class.create(PBwiki.DialogCommands.TemplateDialog,{classname:"PBwiki.DialogCommands.APIDialog",setupDialog:function($super){$super();this.saveButton=this.dialog.down("input.primarybutton");this.cancelLink=this.dialog.down("a.cancel");if(this.cancelLink){this.cancelLink.observe("click",function(A){A.stop();document.fire("dialog:close")})}this.apiForm=this.dialog.down("form");this.apiForm.observe("submit",this.Execute.bind(this));this.saveButton.observe("click",this.Execute.bind(this));this.addInputTexts();this.findInputs()},addInputTexts:function(){this.apiForm.select(InputText.selector).each(function(A){new InputText(A)})},validate:function(A){return true},Execute:function(C){C.stop();var A=this.getInputs();var B=this.validate(A);if(B!==true){this.setError(B);return }this.saveButton.writeAttribute({disabled:true});this.doRequest(A)},doRequest:function(A){var B={};if(this.postable){this.postable.each(function(C){B[C]=A[C];delete A[C]})}new PBwiki.APIRequest(this.apiMethod,A,{onSuccess:function(C){if(!this.onSuccess(C)){this.saveButton.writeAttribute({disabled:false})}}.bind(this),onFailure:function(C){this.saveButton.writeAttribute({disabled:false});this.onFailure(C)}.bind(this),waitCursor:true,method:"post",parameters:B})},onSuccess:function(A){},onFailure:function(A){this.setError(A)},setError:function(A){var B=this.apiForm.down("span.err").update(A).show()},loadUsersList:function(A,C,B,D){new PBwiki.APIRequest("GetUsersInfos",C||{},{allowDefer:true,onSuccess:function(H){var J=H.uids;var E=A;var G="";for(var F=0;F<J.length;F++){if(J[F].uid==PBwiki.getUID()){G=Util.getAuthorNameFromObject(J[F]).escapeHTML()}}E.appendChild(new Element("option",{value:PBwiki.getUID()}).update("You ("+G+")"));if(D){E=new Element("optgroup",{label:"Users"});A.appendChild(E)}if(PBwiki.getUID()==B){A.selectedIndex=A.length-1}for(var F=0;F<J.length;F++){var I=new Element("option",{value:J[F].uid}).update(Util.getAuthorNameFromObject(J[F]).escapeHTML());if(J[F].uid==B){I.selected=true}E.appendChild(I)}}.bind(this),onFailure:function(E){this.setError(E)}.bind(this)})}});PBwiki.DialogCommands.WizardDialog=Class.create(PBwiki.DialogCommands.TemplateDialog,{classname:"PBwiki.DialogCommands.WizardDialog",nextButtonSelector:"input.nextbutton",prevButtonSelector:"input.prevbutton",finishButtonText:"Finish",steps:0,stepSections:{},initialize:function($super,A){$super(A)},setupDialog:function($super){$super();this.nextButton=this.dialog.down(this.nextButtonSelector);this.nextButton.observe("click",this.nextStep.bind(this));this.prevButton=this.dialog.down(this.prevButtonSelector);this.prevButton.observe("click",this.prevStep.bind(this));this.goToStep(1)},goToStep:function(A){this.currentStep=A;this.setTitle(this.title+" - Step "+A+" of "+this.steps);if(A==1){this.prevButton.hide();this.nextButton.show()}else{if(A==this.steps){this.prevButton.show()}else{this.prevButton.show();this.nextButton.show()}}if(A==this.steps){this.nextButton.value=this.finishButtonText}else{this.nextButton.value="Next »"}for(var B=1;B<=this.steps;B++){$(this.stepSections[B]).hide()}$(this.stepSections[A]).show()},nextStep:function(A){if(A){A.stop()}if(!this.validate()){return }if(this.currentStep==this.steps){return this.finish()}this.currentStep++;this.goToStep(this.currentStep)},prevStep:function(A){if(A){A.stop()}this.currentStep--;if(this.currentStep==0){this.currentStep=1}this.goToStep(this.currentStep)},validate:function(){return true},finish:function(){PBwiki.DialogFactory.close();return true}});PBwiki.DialogCommands.Alert=Class.create(PBwiki.DialogCommands.TemplateDialog,{templateName:"alert",title:"Alert",initialize:function($super,A){Object.extend(A,{closeable:false,reuseDialogs:false});this.title=A.title;$super(A)},setupDialog:function($super){$super();$("pbalert-content").innerHTML=this.options.html;if(this.options.type!=="spinner"){this.keydown_observer=this.keyObserver.bindAsEventListener(this);document.observe("keydown",this.keydown_observer);if(typeof (this.options.okButtonLabel)!=="undefined"&&$("pbalert-ok")){$("pbalert-ok").value=this.options.okButtonLabel}}switch(this.options.type){case"alert":return this.setupAlert();case"cancelable":return this.setupCancelable();case"confirm":return this.setupConfirm();case"prompt":return this.setupPrompt();case"spinner":return this.setupSpinner();case"success":return this.setupSuccess();default:throw new Exception("can't handle this type")}},setupAlert:function(){$("pbalert-prompt").hide();$("pbalert-cancel-link").hide();$("pbalert-cancel-button").hide();$("pbalert-ok").observe("click",this.onClose.bindAsEventListener(this));$("pbalert-ok").show();$("pbalert-ok").focus()},setupCancelable:function(){$("pbalert-prompt").hide();$("pbalert-cancel-link").hide();$("pbalert-cancel-button").hide();$("pbalert-ok").observe("click",this.onClose.bindAsEventListener(this));$("pbalert-ok").value="Cancel";$("pbalert-ok").show()},setupConfirm:function(){$("pbalert-prompt").hide();$("pbalert-cancel-link").hide();$("pbalert-ok").observe("click",this.onClose.bindAsEventListener(this,true));$("pbalert-cancel-button").down("input").observe("click",this.onClose.bindAsEventListener(this,false));$("pbalert-ok").show();$("pbalert-cancel-button").show();$("pbalert-ok").focus()},setupPrompt:function(){if(this.options.maxLength){$("pbalert-prompt-input").setAttribute("maxlength",this.options.maxLength)}$("pbalert-cancel-button").hide();$("pbalert-ok").observe("click",this.onClose.bindAsEventListener(this,true));$("pbalert-cancel-link").down("a").observe("click",this.onClose.bindAsEventListener(this,false));if(this.options.value){$("pbalert-prompt").down("input").value=this.options.value}$("pbalert-prompt").show();$("pbalert-ok").show();$("pbalert-cancel-link").show();$("pbalert-prompt").down("input").focus()},setupSpinner:function(){$("pbalert-prompt").hide();$("pbalert-ok").hide();$("pbalert-cancel-link").hide();$("pbalert-cancel-button").hide();$("pbalert-buttons").style.borderTop="0";$("modal-alert").addClassName("pbalert-spinner");$("modal-alert").down("div.modal_title").hide();this.close_observer=this.onSpinnerClose.bind(this);this.success_observer=this.onSpinnerSuccess.bind(this);document.observe("ui:spinner-close",this.close_observer);document.observe("ui:spinner-success",this.success_observer)},setupSuccess:function(){var A=(this.options.message&&this.options.message.length>0)?this.options.message.escapeHTML:"Success!";$("pbalert-prompt").hide();$("pbalert-ok").hide();$("pbalert-cancel-link").hide();$("pbalert-cancel-button").hide();$("pbalert-buttons").style.borderTop="0";$("modal-alert").addClassName("pbalert-spinner");$("modal-alert").addClassName("pbalert-spinner-success");$("pbalert-content").update(A);$("modal-alert").down("div.modal_title").hide();this.close_observer=this.onSpinnerClose.bind(this);document.observe("ui:spinner-close",this.close_observer)},keyObserver:function(B){if(B.keyCode==Event.KEY_RETURN||B.keyCode==Event.KEY_ESC){B.stop();var A=(B.keyCode==Event.KEY_RETURN);return this.onClose(B,A)}},onClose:function(C,B){if(this.keydown_observer){document.stopObserving("keydown",this.keydown_observer)}var A=$("pbalert-prompt").down("input").value;PBwiki.DialogFactory.close({fade:false});switch(this.options.type){case"alert":if(this.options.onConfirm){this.options.onConfirm()}break;case"confirm":if(B&&this.options.onConfirm){this.options.onConfirm()}else{if(!B&&this.options.onCancel){this.options.onCancel()}}break;case"prompt":if(B&&this.options.onConfirm){this.options.onConfirm(A)}else{if(!B&&this.options.onCancel){this.options.onCancel()}}break}},onSpinnerSuccess:function(B){if(this.success_observer){document.stopObserving("ui:spinner-success",this.success_observer)}var A;if(B.memo&&typeof B.memo=="string"){A=B.memo}else{A="Success!"}$("modal-alert").addClassName("pbalert-spinner-success");$("pbalert-content").update(A)},onSpinnerClose:function(A){if(this.close_observer){document.stopObserving("ui:spinner-close",this.close_observer)}if(this.success_observer){document.stopObserving("ui:spinner-success",this.success_observer)}PBwiki.DialogFactory.close({fade:true})}});PBwiki.ListBox=Class.create({classname:"PBwiki.ListBox",length:0,initialize:function(A){this.options=A;this.element=this.options.element;this.element.addClassName("pb-listbox");this.element.select("li").each(this.setUpItem.bind(this))},addItem:function(A){this.element.appendChild(A);this.setUpItem(A)},removeAll:function(){this.element.select("li").invoke("remove");this.length=0},setIsLoading:function(A){if(A){this.element.addClassName("pb-listbox-loading")}else{this.element.removeClassName("pb-listbox-loading")}},setUpItem:function(A){if(this.options.onItemClick){A.observe("click",this.onItemClick.bind(this));A.setStyle({cursor:"pointer"})}this.length++},onItemClick:function(B){var A=B.element();B.originalElement=B.element();if(typeof (A.up("li"))!="undefined"){B.element=function(){return A.up("li")}}this.notify("onItemClick",B)}});Object.Event.extend(PBwiki.ListBox);PBwiki.ScrollingListBox=Class.create(PBwiki.ListBox,{PAD_ELEMENTS:5,data:[],drawn:{},elementsDrawn:0,initialize:function($super,A){$super(A);if(!this.options.itemBuilder||!this.options.itemHeight){throw new Exception("ScrollingListBox requires parameters itemBuilder and itemHeight to work correctly.")}this.element.setStyle({position:"relative"});this.element.observe("scroll",this.drawViewableRegion.bind(this));if(this.options.data){this.appendData(this.options.data);delete this.options.data}},appendData:function(A){this.data=this.data.concat(A.compact());this.length=this.data.length;this.setHeight();this.drawViewableRegion()},modifyData:function(A){this.data=this.data.collect(A)},addItem:function($super,A){PBwiki.warn("Warning: called addItem on a ScrollingListBox");$super(A)},removeAll:function($super){$super();this.data=[];this.drawn=[];this.length=0;this.elementsDrawn=0;this.setHeight()},drawViewableRegion:function(){var D=this.getViewableRegion();var C=Math.max(0,D.start-this.PAD_ELEMENTS);var A=Math.min(this.length,D.end+this.PAD_ELEMENTS);for(var B=C;B<A;B++){if(!this.drawn[B]){this.drawItem(B)}}},setHeight:function(){if(!this.sizer){this.sizer=new Element("div");this.element.appendChild(this.sizer)}this.sizer.setStyle({height:(this.length*this.options.itemHeight)+"px"})},drawItem:function(A){if(this.drawn[A]){return }var B=this.options.itemBuilder(this.data[A]);B.setStyle({position:"absolute",top:(A*this.options.itemHeight)+"px"});if(this.options.onItemClick){B.observe("click",this.onItemClick.bind(this));B.setStyle({cursor:"pointer"})}this.element.appendChild(B);this.drawn[A]=true;this.elementsDrawn++},getViewableRegion:function(){var B=Math.floor(this.element.scrollTop/this.options.itemHeight);B=Math.max(0,B);var A=Math.ceil((this.element.scrollTop+this.element.getHeight())/this.options.itemHeight);A=Math.min(this.length,A);return{start:B,end:A}}});PBwiki.Project=PBwiki.Project||{};PBwiki.Project.ActionCheckbox=Class.create({initialize:function(A){this.options=A;this.elm=A.elm;this.elm.observe("click",this.onClick.bind(this))},onClick:function(A){try{this.elm.blur();A.stop()}catch(A){}this.toggle();this.onChanged(this.isChecked())},setChecked:function(A){if(A){this.elm.addClassName("actcomplete")}else{this.elm.removeClassName("actcomplete")}this.onChanged(A)},toggle:function(){this.elm.toggleClassName("actcomplete")},onChanged:function(A){if(this.options.onChanged){this.options.onChanged(A)}},isChecked:function(){return this.elm.hasClassName("actcomplete")}});PBwiki.Project.APICheckbox=Class.create(PBwiki.Project.ActionCheckbox,{onChanged:function($super,C){$super(C);var B=C?"complete":"incomplete";var A={state:B};A[this.id]=this.options[this.id];new PBwiki.APIRequest("Update"+this.type,A,{onSuccess:function(D){if(this.options.onSuccess){this.options.onSuccess(this.isChecked(),D)}}.bind(this),onFailure:function(D){document.fire("project:onNotifyUser",{message:"Failed to set "+this.type+" state. "+D,mode:"error"});this.toggle();if(this.options.onFailure){this.options.onFailure(this.isChecked())}$super(this.isChecked())}.bind(this)})}});PBwiki.Project.TaskCheckbox=Class.create(PBwiki.Project.APICheckbox,{type:"Task",id:"task_id"});PBwiki.Project.MilestoneCheckbox=Class.create(PBwiki.Project.APICheckbox,{type:"Milestone",id:"milestone_id",onClick:function($super,A){A.stop();if(!this.isChecked()){new PBwiki.APIRequest("GetTasks",{milestone_id:this.options.milestone_id,state:"incomplete"},{onSuccess:function(C){if(C.tasks.length==0){$super(A);return }var D=C.tasks.pluck("title").join("\n");var B=C.tasks.pluck("task_id");if(!confirm("The following tasks will also be marked complete:\n"+D)){return }B.each(function(F){var E=$$("tr[task_id="+F+"] a.note");if(E.length>0){E[0].innerHTML=parseInt(E[0].innerHTML,10)+1}});$super(A)},onFailure:function(B){document.fire("project:onNotifyUser",{message:"Failed to complete milestone "+B,mode:"error"})},method:"get",cacheability:["milestonetime"]})}else{$super(A)}}});PBwiki.UserPermissions={admin:"Administrator",mod:"Editor",write:"Writer",read:"Reader",page:"Page-level only"};PBwiki.DoneIconTimeouts={Default:1000,PendingUserApproved:5000};PBwiki.Components=PBwiki.Components||{};PBwiki.Components.AutoComplete=Class.create({MIN_FILTER:1,KEY_ENTER:13,initialize:function(B,A){this.element=B;this.element.observe("focus",this.onElemFocus.bindAsEventListener(this));this.element.observe("blur",this.onElemBlur.bindAsEventListener(this));this.element.observe("ui:autocomplete-open",this.onManualOpen.bindAsEventListener(this));this.element.observe("ui:autocomplete-close",this.onManualClose.bindAsEventListener(this));this.element.observe("ui:autocomplete-select",this.onManualSelect.bindAsEventListener(this));this.options=A||{};if(!this.options.dataProvider){throw"Must provide dataProvider option for AutoComplete component"}if(!this.options.renderer){throw"Must provide renderer option for AutoComplete component"}this.has_focus=false;this.has_seen_keyup=false;this.popup_visible=false;this.last_filter="";this.timeout_length=(typeof (this.options.data_length)!="undefined")?this.options.data_length:200},onElemFocus:function(A){if(this.has_focus){return }this.has_focus=true;this.keyup_observer=this.onKeyup.bindAsEventListener(this);this.resize_observer=this.onResize.bindAsEventListener(this);$(document).observe("keyup",this.keyup_observer);Event.observe(window,"resize",this.resize_observer);this.element.observe("change",this.keyup_observer);this.element.observe("paste",this.keyup_observer);this.element.observe("input",this.keyup_observer)},onElemBlur:function(A){if(this.mouseOverPopup&&(!A.explicitOriginalTarget||A.explicitOriginalTarget!==this.element)){return }else{if(!this.has_focus||!this.popup){return }}this.element.blur();$(document).stopObserving("keyup",this.keyup_observer);Event.stopObserving(window,"resize",this.resize_observer);Event.stopObserving(this.element,"change",this.keyup_observer);Event.stopObserving(this.element,"paste",this.keyup_observer);Event.stopObserving(this.element,"input",this.keyup_observer);this.has_focus=false;this.hidePopup()},onKeyup:function(D){var C=D.keyCode||D.charCode;var B;switch(C){case this.KEY_ENTER:D.stop();var A=null;if(this.popup&&this.popup_visible){A=this.popup.down("li.selected")}this.element.fire("ui:autocomplete",A);return ;case Event.KEY_DOWN:this.selectNext();return ;case Event.KEY_UP:this.selectPrevious();return ;case Event.KEY_ESC:delete this.mouseOverPopup;this.onElemBlur();return ;case Event.KEY_BACKSPACE:case Event.KEY_DELETE:this.has_seen_keyup=true;B=this.getFilterString();if(B.empty()){this.last_filter=B;this.hidePopup();return }}this.has_seen_keyup=true;B=this.getFilterString();if(this.last_filter==B){return }else{if(B.length<this.MIN_FILTER){this.last_filter=B;this.hidePopup()}else{this.last_filter=B;if(this.data_timeout){window.clearTimeout(this.data_timeout);delete this.data_timeout}this.data_timeout=window.setTimeout(this.invokeDataProvider.bind(this),this.timeout_length)}}},onResize:function(A){if(this.popup&&this.popup_visible){this.setupPopupLayout()}},onManualOpen:function(A){if(!this.has_focus){this.onElemFocus(A)}this.has_seen_keyup=true;this.last_filter=this.getFilterString();if(this.data_timeout){window.clearTimeout(this.data_timeout);delete this.data_timeout}this.invokeDataProvider()},onManualClose:function(A){this.onElemBlur(A)},onManualSelect:function(B){var A=null;if(this.popup&&this.popup_visible){A=this.popup.down("li.selected")}this.element.fire("ui:autocomplete",A)},getFilterString:function(){if(this.element.hasAttribute("placeholder")&&this.element.value==this.element.getAttribute("placeholder")){return""}else{if(this.has_seen_keyup){return this.element.value.strip()}else{return""}}},invokeDataProvider:function(){this.last_filter=this.getFilterString();if(this.options.dataProvider.getData){this.options.dataProvider.getData(this.getFilterString(),this.displayPopup.bind(this))}else{this.options.dataProvider(this.getFilterString(),this.displayPopup.bind(this))}},displayPopup:function(C,B){if(this.getFilterString().length<this.MIN_FILTER){return }if(this.popup){this.setupPopupLayout()}else{this.setupPopup()}var A={filter:this.getFilterString(),container:this.popup,data:C,total_count:B};if(this.options.renderer.render){this.options.renderer.render(A)}else{this.options.renderer(A)}if(this.list.childNodes.length>0){this.popup.show();this.popup_visible=true}else{this.hidePopup()}},hidePopup:function(){if(!this.popup_visible){return }this.popup.hide();this.popup_visible=false},setupPopup:function(){if(this.popup){return }this.popup=new Element("div",{className:"autocomplete",id:this.element.id+"-autocomplete"});this.setupPopupLayout();this.popup.observe("mouseover",this.onPopupMouseover.bindAsEventListener(this));this.popup.observe("mousemove",this.onPopupMouseover.bindAsEventListener(this));this.popup.observe("mouseout",this.onPopupMouseout.bindAsEventListener(this));this.popup.observe("click",this.onPopupClick.bindAsEventListener(this));document.body.appendChild(this.popup);this.header=new Element("div",{className:"header"});this.popup.appendChild(this.header);this.list=new Element("ul");this.popup.appendChild(this.list);this.footer=new Element("div",{className:"footer"});this.popup.appendChild(this.footer)},setupPopupLayout:function(){this.popup.setStyle({top:(this.element.cumulativeOffset().top+this.element.getDimensions().height)+"px",left:(this.element.cumulativeOffset().left+(this.options.offsetLeft||0)+2)+"px",width:(this.options.width||(this.element.getDimensions().width-1))+"px"})},selectNext:function(){if(!this.popup){return }var A=this.popup.down("li.selected");if(A){A.removeClassName("selected")}if(A&&A.next()){A.next().addClassName("selected")}else{this.popup.down("li").addClassName("selected")}},selectPrevious:function(){if(!this.popup){return }var A=this.popup.down("li.selected");if(A){A.removeClassName("selected")}if(A&&A.previous()){A.previous().addClassName("selected")}else{this.popup.select("li").last().addClassName("selected")}},onPopupMouseover:function(B){if(B.type=="mouseover"){this.mouseOverPopup=true}var A=B.target;if(A.tagName.toLowerCase()!=="li"){A=A.up("li")}if(!A||A.hasClassName("selected")){return }this.popup.down("li.selected").removeClassName("selected");A.addClassName("selected")},onPopupMouseout:function(A){this.mouseOverPopup=false},onPopupClick:function(B){var A=B.element();if(A.tagName.toLowerCase()=="li"&&A.hasClassName("selected")){B.stop();delete this.mouseOverPopup;this.onElemBlur();this.element.fire("ui:autocomplete",A);return }else{if(A.up("li.selected")){B.stop();delete this.mouseOverPopup;this.onElemBlur();this.element.fire("ui:autocomplete",A.up("li.selected"));return }}}});Object.Event.extend(PBwiki.Components.AutoComplete);PBwiki.Components.ComboBox=Class.create(PBwiki.Components.AutoComplete,{MIN_FILTER:0,ICON_WIDTH:16,initialize:function($super,B,A){$super(B,A);B.addClassName("combobox-parent");this.arrow=new Element("span",{className:"combobox-arrow"});this.arrow.update("&#9660;");this.arrow.observe("click",this.onArrowClick.bindAsEventListener(this));this.arrow.observe("mouseover",this.onArrowMouseover.bindAsEventListener(this));this.arrow.observe("mouseout",this.onArrowMouseout.bindAsEventListener(this));B.insert({after:this.arrow})},onArrowClick:function(A){A.stop();if(this.popup_visible){this.hidePopup()}else{this.invokeDataProvider()}},onArrowMouseover:function(A){this.mouseOverArrow=true},onArrowMouseout:function(A){this.mouseOverArrow=false},onElemBlur:function($super,A){if(!this.mouseOverArrow){$super(A)}},setupPopup:function($super){$super();this.popup.addClassName("combobox")}});PBwiki.Components.UserRenderer=Class.create(PBwiki.Components.Renderer,{SHOW_ALL:false,render:function(E){var D=E.container.down("ul");D.update("");var F=this.SHOW_ALL?E.total_count:Math.min(E.total_count,10);for(var C=0;C<F;C++){var B=new Element("li",{"data-uid":E.data[C].uid,className:"ellipses"});if(C==0){B.addClassName("selected")}var A=[E.data[C].name,E.data[C].email,E.data[C].username].compact();B.setAttribute("data-name",A[0]);A=A.join("\n");A=this.highlight(A,E.filter);A=A.replace("\n","<br>");B.update(A);D.appendChild(B)}var G=E.container.down("div.footer");if(F==0){G.update("<em>No users found</em>").show()}else{if(E.total_count>F){G.update("... and "+(E.total_count-F)+" more").show()}else{G.hide()}}}});PBwiki.Components.ChatButton=Class.create(PBwiki.Components.Button,{initialize:function($super,B){if(!PBinfo.live_enabled||!PBwiki.feature("chat")||B.uid===PBwiki.getUID()){return }var A=function(){if(!PBwiki.Live.isConnected||!PBwiki.Live.userIsOnline(B.uid)){return }if(typeof B.id==="undefined"){B.id="chatbutton-"+B.uid}B.txt="Chat with "+PBwiki.Live.Roster.nameForUser(B.uid);B.strong=true;$super(B)};if(PBwiki.Live.stillLoading){document.observe("live:roster",A.bindAsEventListener(this))}else{A()}},clicked:function($super){PBwiki.Live.createOrRestoreChat(this.options.uid);$super()}});PBwiki.Tooltip=Class.create({initialize:function(A){this.options=A;A.elm.observe("click",function(C){var B=!!this.tooltip;document.fire("menu::hide");if(!B){this.show()}C.stop()}.bind(this));this.hideObserver=this.hide.bind(this)},show:function(){document.observe("click",this.clickHandler);document.observe("menu::hide",this.hideObserver);var A=new Template(this.templateSource);this.tooltip=new Element("div",{"class":"tooltip "+this.tooltipClass});this.tooltip.innerHTML=A.evaluate(this.getTemplateOptions());this.tooltip.hide();document.body.appendChild(this.tooltip);var D=this.options.elm.cumulativeOffset();var C=D.top+this.options.elm.getHeight()+"px";var B=(D.left-this.tooltipOffset)+"px";this.tooltip.setStyle({top:C,left:B});document.body.appendChild(this.tooltip);this.tooltip.show();this.notify("onShow");this.setupTooltip()},setupTooltip:function(){},clickHandler:function(A){if(A.element().up("div.tooltip")){return }document.fire("menu::hide")},hide:function(){document.stopObserving("click",this.clickHandler);document.stopObserving("menu::hide",this.hideObserver);if(!this.tooltip){return }this.tooltip.remove();this.tooltip=null;this.notify("onHide")}});Object.Event.extend(PBwiki.Tooltip);PBwiki.DataProviders=PBwiki.DataProviders||{};PBwiki.DataProviders.Abstract=Class.create({MAX_DATA_FOR_SINGLE_REQUEST:200,initialize:function(){this.data={};this.requests_in_progress=[];this.last_filter=null;this.pending_callback=null},getData:function(C,E){var D=this.tokenize(C);if(this.hasApplicableData(D)){delete this.last_filter;delete this.pending_callback;var B=this.getApplicableData(D);var A=this.filterData(B,C);if(E){E(A,A.length)}return true}else{this.last_filter=C;if(E){this.pending_callback=E}else{delete this.pending_callback}if(!this.hasRequestInProcess(D)){this.requestData(C)}return false}},loadEntireDataset:function(){return this.total_data_count<=this.MAX_DATA_FOR_SINGLE_REQUEST},tokenize:function(A){if(typeof A=="string"){return A.toLowerCase().split(/\s/).without("")}else{if(typeof A=="array"){return A.without("")}else{return{}}}},hasRequestInProcess:function(C){if(this.requests_in_progress.indexOf("__UNFILTERED__")>-1){return true}if(!this.loadEntireDataset()){for(var A=0;A<C.length;A++){var B=C[A].substring(0,2);if(this.requests_in_progress.indexOf(B)>-1){return true}}}return false},hasApplicableData:function(D){if(this.data.__UNFILTERED__){return true}if(!this.loadEntireDataset()){for(var A=0;A<D.length;A++){var C=D[A].substring(0,1);var B=D[A].substring(0,2);if(this.data[C]||this.data[B]){return true}}}return false},getApplicableData:function(D){if(!this.loadEntireDataset()){for(var A=0;A<D.length;A++){var C=D[A].substring(0,1);var B=D[A].substring(0,2);if(this.data[B]){return this.data[B]}else{if(this.data[C]){return this.data[C]}}}}if(this.data.__UNFILTERED__){return this.data.__UNFILTERED__}return[]},requestData:function(B){var C=[];if(typeof B=="string"){C=this.tokenize(B)}var A=(C.length==0||this.loadEntireDataset())?null:C[0].substring(0,2);(new PBwiki.APIRequest(this.getAPIMethod(),this.getAPIArguments(B),{method:"get",onSuccess:this.onAPISuccess.bindAsEventListener(this,A),onFailure:this.onAPIFailure.bindAsEventListener(this)}))},onAPISuccess:function(B,A){if(A){this.data[A]=this.getAPIOutput(B);this.requests_in_progress=this.requests_in_progress.without(A)}else{this.data.__UNFILTERED__=this.getAPIOutput(B);this.requests_in_progress=this.requests_in_progress.without("__UNFILTERED__")}if(typeof this.last_filter=="undefined"){return }var C=this.tokenize(this.last_filter);if(this.hasApplicableData(C)){this.getData(this.last_filter,this.pending_callback)}},onAPIFailure:function(A){PBwiki.warn(A)}});
