var c={GetPage:["pagetime","foldertime","permtime"],GetPageUsers:["permtime"],SetPageLock:["pagetime"],GetChanges:["pagetime","filetime","permtime","foldertime","commenttime"],GetNetworkChanges:["pagetime","filetime","permtime","foldertime","commenttime","userupdatetime","milestonetime"],GetNetworkUsers:["permtime"],ListNetworkGroupUsers:["grouptime","permtime"],ListNetworkGroupsForUser:["grouptime","permtime"],ListNetworkUserGroups:["grouptime"],ListWorkspaceGroupUsers:["grouptime","permtime"],ListWorkspaceGroupsForUser:["grouptime","permtime"],ListWorkspaceUserGroups:["grouptime"],GetFileUsers:["permtime"],GetFolderUsers:["permtime"],GetObjectsNOM:["foldertime","pagetime","filetime","permtime"],Search:["pagetime","filetime","permtime","foldertime"],GetTags:["tagtime"]};var PBcacheability=PBcacheability||c;if(Object.extend){Object.extend(PBcacheability,c)}var pbBuildTime=1280439900;var c={kLinkifyRegex:'/(^|[^">])(http(s)?:(\\/\\/)([\\w]+(.[\\w]+))([\\w\\-\\.,@?^=%&:;\\/~\\+#]*[\\w\\-\\@?^=%&:;\\/~\\+#])?)/',kPolicyPageSizeWarning:51200,kPolicyValidEmailRegex:"/^([a-zA-Z0-9])+([a-zA-Z0-9\\._+&'-])*@([a-zA-Z0-9-])+\\.([a-zA-Z0-9\\.-]+)+$/",kPolicyValidUIDRegex:"/^([a-f0-9]){40}$/i",kPolicyConvertSupportedDocumentRegex:"/\\.(csv|doc|docx|ods|odt|rtf|txt|wpd|xls|xlsx)$/",kInvalidPageCharacters:".[]?&|/\\+#%",kMaxPageNameLength:100,kInvalidFileCharacters:"%$?\\/|`",kMaxFileNameLength:100,kInvalidFolderCharacters:".!@%&$#+\"'|",kMaxFolderNameLength:127,kMaxWikiNameLength:50,kMinWikiNameLength:4,kMaxPasswordLength:50,kMinPasswordLength:5,kMaxMilestoneLength:100,kMaxActionLength:100,kPolicyValidWikiNameRegex:"/(^[a-zA-Z0-9]$)|(^[a-zA-Z0-9]+[a-zA-Z0-9-]*[a-zA-Z0-9]$)/",kPolicySimpleTimeFormat:"%l:%M %p",kTrackingCookie:"pb_stat",kFoldersDefaultHeight:200,kRecentChangesNumber:7,kRecentChangesMax:12,kShowStarBubblePrefsKey:"prompt_to_star_on_save",kShowSendALinkBubblePrefsKey:"prompt_to_send_a_link",kShowCreatePageBubblePrefsKey:"prompt_to_create_page",kWorkspaceTreeOpenNodes:"workspace_open_folders",kScrollAreaBlockSize:50,kSideBarCollapsed:"sidebar_collapsed",kUploadMaxFiles:50,kUploadMaxSize:1073741824,kStaticDebugDirectory:"/shared/php/",kPerfmonCookie:"pb_perfmon",kSendALinkAllUsersWithAccess:"all-users-with-access",kAPIAllowDeferWhenBusy:"allow_defer",kAPIDidDefer:"did_defer",kAPIDeferRetryInterval:5000,kAPIMaxDeferRetries:5,kAPIAsyncRetryInterval:1000,kUserPref_UsersPanel_SortBy:"userspanel_sortby",kSendALinkType:{Page:"page",File:"file",Folder:"folder",Milestone:"milestone",Task:"task",Unknown:"item"}};var PBconst=PBconst||c;if(Object.extend){Object.extend(PBconst,c)}var Prototype={Version:"1.6.1",Browser:(function(){var B=navigator.userAgent;var A=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!A,Opera:A,WebKit:B.indexOf("AppleWebKit/")>-1,Gecko:B.indexOf("Gecko")>-1&&B.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(B)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var A=window.Element||window.HTMLElement;return !!(A&&A.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var C=document.createElement("div");var B=document.createElement("form");var A=false;if(C.__proto__&&(C.__proto__!==B.__proto__)){A=true}C=B=null;return A})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(A){return A}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Abstract={};var Try={these:function(){var C;for(var B=0,D=arguments.length;B<D;B++){var A=arguments[B];try{C=A();break}catch(E){}}return C}};var Class=(function(){function A(){}function B(){var G=null,F=$A(arguments);if(Object.isFunction(F[0])){G=F.shift()}function D(){this.initialize.apply(this,arguments)}Object.extend(D,Class.Methods);D.superclass=G;D.subclasses=[];if(G){A.prototype=G.prototype;D.prototype=new A;G.subclasses.push(D)}for(var E=0;E<F.length;E++){D.addMethods(F[E])}if(!D.prototype.initialize){D.prototype.initialize=Prototype.emptyFunction}D.prototype.constructor=D;return D}function C(J){var F=this.superclass&&this.superclass.prototype;var E=Object.keys(J);if(!Object.keys({toString:true}).length){if(J.toString!=Object.prototype.toString){E.push("toString")}if(J.valueOf!=Object.prototype.valueOf){E.push("valueOf")}}for(var D=0,G=E.length;D<G;D++){var I=E[D],H=J[I];if(F&&Object.isFunction(H)&&H.argumentNames().first()=="$super"){var K=H;H=(function(L){return function(){return F[L].apply(this,arguments)}})(I).wrap(K);H.valueOf=K.valueOf.bind(K);H.toString=K.toString.bind(K)}this.prototype[I]=H}return this}return{create:B,Methods:{addMethods:C}}})();(function(){var D=Object.prototype.toString;function I(Q,S){for(var R in S){Q[R]=S[R]}return Q}function L(Q){try{if(E(Q)){return"undefined"}if(Q===null){return"null"}return Q.inspect?Q.inspect():String(Q)}catch(R){if(R instanceof RangeError){return"..."}throw R}}function K(Q){var S=typeof Q;switch(S){case"undefined":case"function":case"unknown":return ;case"boolean":return Q.toString()}if(Q===null){return"null"}if(Q.toJSON){return Q.toJSON()}if(H(Q)){return }var R=[];for(var U in Q){var T=K(Q[U]);if(!E(T)){R.push(U.toJSON()+": "+T)}}return"{"+R.join(", ")+"}"}function C(Q){return $H(Q).toQueryString()}function F(Q){return Q&&Q.toHTML?Q.toHTML():String.interpret(Q)}function O(Q){var R=[];for(var S in Q){R.push(S)}return R}function M(Q){var R=[];for(var S in Q){R.push(Q[S])}return R}function J(Q){return I({},Q)}function H(Q){return !!(Q&&Q.nodeType==1)}function G(Q){return D.call(Q)=="[object Array]"}function P(Q){return Q instanceof Hash}function B(Q){return typeof Q==="function"}function A(Q){return D.call(Q)=="[object String]"}function N(Q){return D.call(Q)=="[object Number]"}function E(Q){return typeof Q==="undefined"}I(Object,{extend:I,inspect:L,toJSON:K,toQueryString:C,toHTML:F,keys:O,values:M,clone:J,isElement:H,isArray:G,isHash:P,isFunction:B,isString:A,isNumber:N,isUndefined:E})})();Object.extend(Function.prototype,(function(){var K=Array.prototype.slice;function D(O,L){var N=O.length,M=L.length;while(M--){O[N+M]=L[M]}return O}function I(M,L){M=K.call(M,0);return D(M,L)}function G(){var L=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return L.length==1&&!L[0]?[]:L}function H(N){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var L=this,M=K.call(arguments,1);return function(){var O=I(M,arguments);return L.apply(N,O)}}function F(N){var L=this,M=K.call(arguments,1);return function(P){var O=D([P||window.event],M);return L.apply(N,O)}}function J(){if(!arguments.length){return this}var L=this,M=K.call(arguments,0);return function(){var N=I(M,arguments);return L.apply(this,N)}}function E(N){var L=this,M=K.call(arguments,1);N=N*1000;return window.setTimeout(function(){return L.apply(L,M)},N)}function A(){var L=D([0.01],arguments);return this.delay.apply(this,L)}function C(M){var L=this;return function(){var N=D([L.bind(this)],arguments);return M.apply(this,N)}}function B(){if(this._methodized){return this._methodized}var L=this;return this._methodized=function(){var M=D([this],arguments);return L.apply(null,M)}}return{argumentNames:G,bind:H,bindAsEventListener:F,curry:J,delay:E,defer:A,wrap:C,methodize:B}})());Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+'Z"'};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(A){return String(A).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(B,A){this.callback=B;this.frequency=A;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer){return }clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=false}catch(A){this.currentlyExecuting=false;throw A}}}});Object.extend(String,{interpret:function(A){return A==null?"":String(A)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,(function(){function prepareReplacement(replacement){if(Object.isFunction(replacement)){return replacement}var template=new Template(replacement);return function(match){return template.evaluate(match)}}function gsub(pattern,replacement){var result="",source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern)){pattern=RegExp.escape(pattern)}if(!(pattern.length||pattern.source)){replacement=replacement("");return replacement+source.split("").join(replacement)+replacement}while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length)}else{result+=source,source=""}}return result}function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0){return match[0]}return replacement(match)})}function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this)}function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?"...":truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this)}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"")}function stripScripts(){if(this.indexOf("<script")==-1){return this}return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,"img");var matchOne=new RegExp(Prototype.ScriptFragment,"im");return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||["",""])[1]})}function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}function escapeHTML(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function unescapeHTML(){return this.stripTags().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match){return{}}return match[1].split(separator||"&").inject({},function(hash,pair){if((pair=pair.split("="))[0]){var key=decodeURIComponent(pair.shift());var value=pair.length>1?pair.join("="):pair[0];if(value!=undefined){value=decodeURIComponent(value)}if(key in hash){if(!Object.isArray(hash[key])){hash[key]=[hash[key]]}hash[key].push(value)}else{hash[key]=value}}return hash})}function toArray(){return this.split("")}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function times(count){return count<1?"":new Array(count+1).join(this)}function camelize(){var parts=this.split("-"),len=parts.length;if(len==1){return parts[0]}var camelized=this.charAt(0)=="-"?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++){camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1)}return camelized}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function underscore(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()}function dasherize(){return this.replace(/_/g,"-")}function inspect(useDoubleQuotes){var escapedString=this.replace(/[\x00-\x1f\\]/g,function(character){if(character in String.specialChar){return String.specialChar[character]}return"\\u00"+character.charCodeAt().toPaddedString(2,16)});if(useDoubleQuotes){return'"'+escapedString.replace(/"/g,'\\"')+'"'}return"'"+escapedString.replace(/'/g,"\\'")+"'"}function toJSON(){return this.inspect(true)}function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,"$1")}function isJSON(){var str=this;if(str.blank()){return false}str=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern){return this.indexOf(pattern)===0}function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===d}function empty(){return this==""}function blank(){return/^\s*$/.test(this)}function interpolate(object,pattern){return new Template(this,pattern).evaluate(object)}return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim?String.prototype.trim:strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,toJSON:toJSON,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate}})());var Template=Class.create({initialize:function(A,B){this.template=A.toString();this.pattern=B||Template.Pattern},evaluate:function(A){if(A&&Object.isFunction(A.toTemplateReplacements)){A=A.toTemplateReplacements()}return this.template.gsub(this.pattern,function(D){if(A==null){return(D[1]+"")}var F=D[1]||"";if(F=="\\"){return D[2]}var B=A,G=D[3];var E=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;D=E.exec(G);if(D==null){return F}while(D!=null){var C=D[1].startsWith("[")?D[2].replace(/\\\\]/g,"]"):D[1];B=B[C];if(null==B||""==D[3]){break}G=G.substring("["==D[3]?D[1].length:D[0].length);D=E.exec(G)}return F+String.interpret(B)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function C(Y,X){var W=0;try{this._each(function(a){Y.call(X,a,W++)})}catch(Z){if(Z!=$break){throw Z}}return this}function R(Z,Y,X){var W=-Z,a=[],b=this.toArray();if(Z<1){return b}while((W+=Z)<b.length){a.push(b.slice(W,W+Z))}return a.collect(Y,X)}function B(Y,X){Y=Y||Prototype.K;var W=true;this.each(function(a,Z){W=W&&!!Y.call(X,a,Z);if(!W){throw $break}});return W}function I(Y,X){Y=Y||Prototype.K;var W=false;this.each(function(a,Z){if(W=!!Y.call(X,a,Z)){throw $break}});return W}function J(Y,X){Y=Y||Prototype.K;var W=[];this.each(function(a,Z){W.push(Y.call(X,a,Z))});return W}function T(Y,X){var W;this.each(function(a,Z){if(Y.call(X,a,Z)){W=a;throw $break}});return W}function H(Y,X){var W=[];this.each(function(a,Z){if(Y.call(X,a,Z)){W.push(a)}});return W}function G(Z,Y,X){Y=Y||Prototype.K;var W=[];if(Object.isString(Z)){Z=new RegExp(RegExp.escape(Z))}this.each(function(b,a){if(Z.match(b)){W.push(Y.call(X,b,a))}});return W}function A(W){if(Object.isFunction(this.indexOf)){if(this.indexOf(W)!=-1){return true}}var X=false;this.each(function(Y){if(Y==W){X=true;throw $break}});return X}function Q(X,W){W=Object.isUndefined(W)?null:W;return this.eachSlice(X,function(Y){while(Y.length<X){Y.push(W)}return Y})}function L(W,Y,X){this.each(function(a,Z){W=Y.call(X,W,a,Z)});return W}function V(X){var W=$A(arguments).slice(1);return this.map(function(Y){return Y[X].apply(Y,W)})}function P(Y,X){Y=Y||Prototype.K;var W;this.each(function(a,Z){a=Y.call(X,a,Z);if(W==null||a>=W){W=a}});return W}function N(Y,X){Y=Y||Prototype.K;var W;this.each(function(a,Z){a=Y.call(X,a,Z);if(W==null||a<W){W=a}});return W}function E(Z,X){Z=Z||Prototype.K;var Y=[],W=[];this.each(function(b,a){(Z.call(X,b,a)?Y:W).push(b)});return[Y,W]}function F(X){var W=[];this.each(function(Y){W.push(Y[X])});return W}function D(Y,X){var W=[];this.each(function(a,Z){if(!Y.call(X,a,Z)){W.push(a)}});return W}function M(X,W){return this.map(function(Z,Y){return{value:Z,criteria:X.call(W,Z,Y)}}).sort(function(f,e){var Z=f.criteria,Y=e.criteria;return Z<Y?-1:Z>Y?1:0}).pluck("value")}function O(){return this.map()}function S(){var X=Prototype.K,W=$A(arguments);if(Object.isFunction(W.last())){X=W.pop()}var Y=[this].concat(W).map($A);return this.map(function(a,Z){return X(Y.pluck(Z))})}function K(){return this.toArray().length}function U(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:C,eachSlice:R,all:B,every:B,any:I,some:I,collect:J,map:J,detect:T,findAll:H,select:H,filter:H,grep:G,include:A,member:A,inGroupsOf:Q,inject:L,invoke:V,max:P,min:N,partition:E,pluck:F,reject:D,sortBy:M,toArray:O,entries:O,zip:S,size:K,inspect:U,find:T}})();function $A(C){if(!C){return[]}if("toArray" in Object(C)){return C.toArray()}var B=C.length||0,A=new Array(B);while(B--){A[B]=C[B]}return A}function $w(A){if(!Object.isString(A)){return[]}A=A.strip();return A?A.split(/\s+/):[]}Array.from=$A;(function(){var S=Array.prototype,M=S.slice,O=S.forEach;function B(W){for(var V=0,X=this.length;V<X;V++){W(this[V])}}if(!O){O=B}function L(){this.length=0;return this}function D(){return this[0]}function G(){return this[this.length-1]}function I(){return this.select(function(V){return V!=null})}function U(){return this.inject([],function(W,V){if(Object.isArray(V)){return W.concat(V.flatten())}W.push(V);return W})}function H(){var V=M.call(arguments,0);return this.select(function(W){return !V.include(W)})}function F(V){return(V!==false?this:this.toArray())._reverse()}function K(V){return this.inject([],function(Y,X,W){if(0==W||(V?Y.last()!=X:!Y.include(X))){Y.push(X)}return Y})}function P(V){return this.uniq().findAll(function(W){return V.detect(function(X){return W===X})})}function Q(){return M.call(this,0)}function J(){return this.length}function T(){return"["+this.map(Object.inspect).join(", ")+"]"}function R(){var V=[];this.each(function(W){var X=Object.toJSON(W);if(!Object.isUndefined(X)){V.push(X)}});return"["+V.join(", ")+"]"}function A(X,V){V||(V=0);var W=this.length;if(V<0){V=W+V}for(;V<W;V++){if(this[V]===X){return V}}return -1}function N(W,V){V=isNaN(V)?this.length:(V<0?this.length+V:V)+1;var X=this.slice(0,V).reverse().indexOf(W);return(X<0)?X:V-X-1}function C(){var a=M.call(this,0),Y;for(var W=0,X=arguments.length;W<X;W++){Y=arguments[W];if(Object.isArray(Y)&&!("callee" in Y)){for(var V=0,Z=Y.length;V<Z;V++){a.push(Y[V])}}else{a.push(Y)}}return a}Object.extend(S,Enumerable);if(!S._reverse){S._reverse=S.reverse}Object.extend(S,{_each:O,clear:L,first:D,last:G,compact:I,flatten:U,without:H,reverse:F,uniq:K,intersect:P,clone:Q,toArray:Q,size:J,inspect:T,toJSON:R});var E=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(E){S.concat=C}if(!S.indexOf){S.indexOf=A}if(!S.lastIndexOf){S.lastIndexOf=N}})();function $H(A){return new Hash(A)}var Hash=Class.create(Enumerable,(function(){function E(Q){this._object=Object.isHash(Q)?Q.toObject():Object.clone(Q)}function F(R){for(var Q in this._object){var S=this._object[Q],T=[Q,S];T.key=Q;T.value=S;R(T)}}function K(Q,R){return this._object[Q]=R}function C(Q){if(this._object[Q]!==Object.prototype[Q]){return this._object[Q]}}function N(Q){var R=this._object[Q];delete this._object[Q];return R}function P(){return Object.clone(this._object)}function O(){return this.pluck("key")}function M(){return this.pluck("value")}function G(R){var Q=this.detect(function(S){return S.value===R});return Q&&Q.key}function I(Q){return this.clone().update(Q)}function D(Q){return new Hash(Q).inject(this,function(R,S){R.set(S.key,S.value);return R})}function B(Q,R){if(Object.isUndefined(R)){return Q}return Q+"="+encodeURIComponent(String.interpret(R))}function A(){return this.inject([],function(S,T){var R=encodeURIComponent(T.key),Q=T.value;if(Q&&typeof Q=="object"){if(Object.isArray(Q)){return S.concat(Q.map(B.curry(R)))}}else{S.push(B(R,Q))}return S}).join("&")}function L(){return"#<Hash:{"+this.map(function(Q){return Q.map(Object.inspect).join(": ")}).join(", ")+"}>"}function J(){return Object.toJSON(this.toObject())}function H(){return new Hash(this)}return{initialize:E,_each:F,set:K,get:C,unset:N,toObject:P,toTemplateReplacements:P,keys:O,values:M,index:G,merge:I,update:D,toQueryString:A,inspect:L,toJSON:J,clone:H}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function D(){return this.toPaddedString(2,16)}function E(){return this+1}function A(K,J){$R(0,this,true).each(K,J);return this}function B(L,K){var J=this.toString(K||10);return"0".times(L-J.length)+J}function F(){return isFinite(this)?this.toString():"null"}function I(){return Math.abs(this)}function H(){return Math.round(this)}function G(){return Math.ceil(this)}function C(){return Math.floor(this)}return{toColorPart:D,succ:E,times:A,toPaddedString:B,toJSON:F,abs:I,round:H,ceil:G,floor:C}})());function $R(C,A,B){return new ObjectRange(C,A,B)}var ObjectRange=Class.create(Enumerable,(function(){function B(F,D,E){this.start=F;this.end=D;this.exclusive=E}function C(D){var E=this.start;while(this.include(E)){D(E);E=E.succ()}}function A(D){if(D<this.start){return false}if(this.exclusive){return D<this.end}return D<=this.end}return{initialize:B,_each:C,include:A}})());var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(A){this.responders._each(A)},register:function(A){if(!this.include(A)){this.responders.push(A)}},unregister:function(A){this.responders=this.responders.without(A)},dispatch:function(D,B,C,A){this.each(function(E){if(Object.isFunction(E[D])){try{E[D].apply(E,[B,C,A])}catch(F){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(A){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,A||{});this.options.method=this.options.method.toLowerCase();if(Object.isString(this.options.parameters)){this.options.parameters=this.options.parameters.toQueryParams()}else{if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()}}}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,B,A){$super(A);this.transport=Ajax.getTransport();this.request(B)},request:function(B){this.url=B;this.method=this.options.method;var D=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){D._method=this.method;this.method="post"}this.parameters=D;if(D=Object.toQueryString(D)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+D}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){D+="&_="}}}try{var A=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(A)}Ajax.Responders.dispatch("onCreate",this,A);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||D):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(C){this.dispatchException(C)}},onStateChange:function(){var A=this.transport.readyState;if(A>1&&!((A==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var E={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){E["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){E.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var C=this.options.requestHeaders;if(Object.isFunction(C.push)){for(var B=0,D=C.length;B<D;B+=2){E[C[B]]=C[B+1]}}else{$H(C).each(function(F){E[F.key]=F.value})}}for(var A in E){this.transport.setRequestHeader(A,E[A])}},success:function(){var A=this.getStatus();return !A||(A>=200&&A<300)},getStatus:function(){try{return this.transport.status||0}catch(A){return 0}},respondToReadyState:function(A){var C=Ajax.Request.Events[A],B=new Ajax.Response(this);if(C=="Complete"){try{this._complete=true;(this.options["on"+B.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(B,B.headerJSON)}catch(D){this.dispatchException(D)}var E=B.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&E&&E.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+C]||Prototype.emptyFunction)(B,B.headerJSON);Ajax.Responders.dispatch("on"+C,this,B,B.headerJSON)}catch(D){this.dispatchException(D)}if(C=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var A=this.url.match(/^\s*https?:\/\/[^\/]*/);return !A||(A[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))},getHeader:function(A){try{return this.transport.getResponseHeader(A)||null}catch(B){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(A){(this.options.onException||Prototype.emptyFunction)(this,A);Ajax.Responders.dispatch("onException",this,A)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(C){this.request=C;var D=this.transport=C.transport,A=this.readyState=D.readyState;if((A>2&&!Prototype.Browser.IE)||A==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(D.responseText);this.headerJSON=this._getHeaderJSON()}if(A==4){var B=D.responseXML;this.responseXML=Object.isUndefined(B)?null:B;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(A){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(A){return null}},getResponseHeader:function(A){return this.transport.getResponseHeader(A)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var A=this.getHeader("X-JSON");if(!A){return null}A=decodeURIComponent(escape(A));try{return A.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(B){this.request.dispatchException(B)}},_getResponseJSON:function(){var A=this.request.options;if(!A.evalJSON||(A.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(A.sanitizeJSON||!this.request.isSameOrigin())}catch(B){this.request.dispatchException(B)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,A,C,B){this.container={success:(A.success||A),failure:(A.failure||(A.success?null:A))};B=Object.clone(B);var D=B.onComplete;B.onComplete=(function(E,F){this.updateContent(E.responseText);if(Object.isFunction(D)){D(E,F)}}).bind(this);$super(C,B)},updateContent:function(D){var C=this.container[this.success()?"success":"failure"],A=this.options;if(!A.evalScripts){D=D.stripScripts()}if(C=$(C)){if(A.insertion){if(Object.isString(A.insertion)){var B={};B[A.insertion]=D;C.insert(B)}else{A.insertion(C,D)}}else{C.update(D)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,A,C,B){$super(B);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=A;this.url=C;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},updateComplete:function(A){if(this.options.decay){this.decay=(A.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=A.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(B){if(arguments.length>1){for(var A=0,D=[],C=arguments.length;A<C;A++){D.push($(arguments[A]))}return D}if(Object.isString(B)){B=document.getElementById(B)}return Element.extend(B)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(F,A){var C=[];var E=document.evaluate(F,$(A)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var B=0,D=E.snapshotLength;B<D;B++){C.push(Element.extend(E.snapshotItem(B)))}return C}}if(!window.Node){var Node={}}if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}(function(C){var B=(function(){var F=document.createElement("form");var E=document.createElement("input");var D=document.documentElement;E.setAttribute("name","test");F.appendChild(E);D.appendChild(F);var G=F.elements?(typeof F.elements.test=="undefined"):null;D.removeChild(F);F=E=null;return G})();var A=C.Element;C.Element=function(F,E){E=E||{};F=F.toLowerCase();var D=Element.cache;if(B&&E.name){F="<"+F+' name="'+E.name+'">';delete E.name;return Element.writeAttribute(document.createElement(F),E)}if(!D[F]){D[F]=Element.extend(document.createElement(F))}return Element.writeAttribute(D[F].cloneNode(false),E)};Object.extend(C.Element,A||{});if(A){C.Element.prototype=A.prototype}})(this);Element.cache={};Element.idCounter=1;Element.Methods={visible:function(A){return $(A).style.display!="none"},toggle:function(A){A=$(A);Element[Element.visible(A)?"hide":"show"](A);return A},hide:function(A){A=$(A);A.style.display="none";return A},show:function(A){A=$(A);A.style.display="";return A},remove:function(A){A=$(A);A.parentNode.removeChild(A);return A},update:(function(){var B=(function(){var E=document.createElement("select"),F=true;E.innerHTML='<option value="test">test</option>';if(E.options&&E.options[0]){F=E.options[0].nodeName.toUpperCase()!=="OPTION"}E=null;return F})();var A=(function(){try{var E=document.createElement("table");if(E&&E.tBodies){E.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var G=typeof E.tBodies[0]=="undefined";E=null;return G}}catch(F){return true}})();var D=(function(){var E=document.createElement("script"),G=false;try{E.appendChild(document.createTextNode(""));G=!E.firstChild||E.firstChild&&E.firstChild.nodeType!==3}catch(F){G=true}E=null;return G})();function C(F,G){F=$(F);if(G&&G.toElement){G=G.toElement()}if(Object.isElement(G)){return F.update().insert(G)}G=Object.toHTML(G);var E=F.tagName.toUpperCase();if(E==="SCRIPT"&&D){F.text=G;return F}if(B||A){if(E in Element._insertionTranslations.tags){while(F.firstChild){F.removeChild(F.firstChild)}Element._getContentFromAnonymousElement(E,G.stripScripts()).each(function(H){F.appendChild(H)})}else{F.innerHTML=G.stripScripts()}}else{F.innerHTML=G.stripScripts()}G.evalScripts.bind(G).defer();return F}return C})(),replace:function(B,C){B=$(B);if(C&&C.toElement){C=C.toElement()}else{if(!Object.isElement(C)){C=Object.toHTML(C);var A=B.ownerDocument.createRange();A.selectNode(B);C.evalScripts.bind(C).defer();C=A.createContextualFragment(C.stripScripts())}}B.parentNode.replaceChild(C,B);return B},insert:function(C,E){C=$(C);if(Object.isString(E)||Object.isNumber(E)||Object.isElement(E)||(E&&(E.toElement||E.toHTML))){E={bottom:E}}var D,F,B,G;for(var A in E){D=E[A];A=A.toLowerCase();F=Element._insertionTranslations[A];if(D&&D.toElement){D=D.toElement()}if(Object.isElement(D)){F(C,D);continue}D=Object.toHTML(D);B=((A=="before"||A=="after")?C.parentNode:C).tagName.toUpperCase();G=Element._getContentFromAnonymousElement(B,D.stripScripts());if(A=="top"||A=="after"){G.reverse()}G.each(F.curry(C));D.evalScripts.bind(D).defer()}return C},wrap:function(B,C,A){B=$(B);if(Object.isElement(C)){$(C).writeAttribute(A||{})}else{if(Object.isString(C)){C=new Element(C,A)}else{C=new Element("div",C)}}if(B.parentNode){B.parentNode.replaceChild(C,B)}C.appendChild(B);return C},inspect:function(B){B=$(B);var A="<"+B.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(F){var E=F.first(),C=F.last();var D=(B[E]||"").toString();if(D){A+=" "+C+"="+D.inspect(true)}});return A+">"},recursivelyCollect:function(A,C){A=$(A);var B=[];while(A=A[C]){if(A.nodeType==1){B.push(Element.extend(A))}}return B},ancestors:function(A){return Element.recursivelyCollect(A,"parentNode")},descendants:function(A){return Element.select(A,"*")},firstDescendant:function(A){A=$(A).firstChild;while(A&&A.nodeType!=1){A=A.nextSibling}return $(A)},immediateDescendants:function(A){if(!(A=$(A).firstChild)){return[]}while(A&&A.nodeType!=1){A=A.nextSibling}if(A){return[A].concat($(A).nextSiblings())}return[]},previousSiblings:function(A){return Element.recursivelyCollect(A,"previousSibling")},nextSiblings:function(A){return Element.recursivelyCollect(A,"nextSibling")},siblings:function(A){A=$(A);return Element.previousSiblings(A).reverse().concat(Element.nextSiblings(A))},match:function(B,A){if(Object.isString(A)){A=new Selector(A)}return A.match($(B))},up:function(B,D,A){B=$(B);if(arguments.length==1){return $(B.parentNode)}var C=Element.ancestors(B);return Object.isNumber(D)?C[D]:Selector.findElement(C,D,A)},down:function(B,C,A){B=$(B);if(arguments.length==1){return Element.firstDescendant(B)}return Object.isNumber(C)?Element.descendants(B)[C]:Element.select(B,C)[A||0]},previous:function(B,D,A){B=$(B);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(B))}var C=Element.previousSiblings(B);return Object.isNumber(D)?C[D]:Selector.findElement(C,D,A)},next:function(C,D,B){C=$(C);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(C))}var A=Element.nextSiblings(C);return Object.isNumber(D)?A[D]:Selector.findElement(A,D,B)},select:function(B){var A=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(B,A)},adjacent:function(B){var A=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(B.parentNode,A).without(B)},identify:function(A){A=$(A);var B=Element.readAttribute(A,"id");if(B){return B}do{B="anonymous_element_"+Element.idCounter++}while($(B));Element.writeAttribute(A,"id",B);return B},readAttribute:function(C,A){C=$(C);if(Prototype.Browser.IE){var B=Element._attributeTranslations.read;if(B.values[A]){return B.values[A](C,A)}if(B.names[A]){A=B.names[A]}if(A.include(":")){return(!C.attributes||!C.attributes[A])?null:C.attributes[A].value}}return C.getAttribute(A)},writeAttribute:function(E,C,F){E=$(E);var B={},D=Element._attributeTranslations.write;if(typeof C=="object"){B=C}else{B[C]=Object.isUndefined(F)?true:F}for(var A in B){C=D.names[A]||A;F=B[A];if(D.values[A]){C=D.values[A](E,F)}if(F===false||F===null){E.removeAttribute(C)}else{if(F===true){E.setAttribute(C,C)}else{E.setAttribute(C,F)}}}return E},getHeight:function(A){return Element.getDimensions(A).height},getWidth:function(A){return Element.getDimensions(A).width},classNames:function(A){return new Element.ClassNames(A)},hasClassName:function(A,B){if(!(A=$(A))){return }var C=A.className;return(C.length>0&&(C==B||new RegExp("(^|\\s)"+B+"(\\s|$)").test(C)))},addClassName:function(A,B){if(!(A=$(A))){return }if(!Element.hasClassName(A,B)){A.className+=(A.className?" ":"")+B}return A},removeClassName:function(A,B){if(!(A=$(A))){return }A.className=A.className.replace(new RegExp("(^|\\s+)"+B+"(\\s+|$)")," ").strip();return A},toggleClassName:function(A,B){if(!(A=$(A))){return }return Element[Element.hasClassName(A,B)?"removeClassName":"addClassName"](A,B)},cleanWhitespace:function(B){B=$(B);var C=B.firstChild;while(C){var A=C.nextSibling;if(C.nodeType==3&&!/\S/.test(C.nodeValue)){B.removeChild(C)}C=A}return B},empty:function(A){return $(A).innerHTML.blank()},descendantOf:function(B,A){B=$(B),A=$(A);if(B.compareDocumentPosition){return(B.compareDocumentPosition(A)&8)===8}if(A.contains){return A.contains(B)&&A!==B}while(B=B.parentNode){if(B==A){return true}}return false},scrollTo:function(A){A=$(A);var B=Element.cumulativeOffset(A);window.scrollTo(B[0],B[1]);return A},getStyle:function(B,C){B=$(B);C=C=="float"?"cssFloat":C.camelize();var D=B.style[C];if(!D||D=="auto"){var A=document.defaultView.getComputedStyle(B,null);D=A?A[C]:null}if(C=="opacity"){return D?parseFloat(D):1}return D=="auto"?null:D},getOpacity:function(A){return $(A).getStyle("opacity")},setStyle:function(B,C){B=$(B);var E=B.style,A;if(Object.isString(C)){B.style.cssText+=";"+C;return C.include("opacity")?B.setOpacity(C.match(/opacity:\s*(\d?\.?\d*)/)[1]):B}for(var D in C){if(D=="opacity"){B.setOpacity(C[D])}else{E[(D=="float"||D=="cssFloat")?(Object.isUndefined(E.styleFloat)?"cssFloat":"styleFloat"):D]=C[D]}}return B},setOpacity:function(A,B){A=$(A);A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;return A},getDimensions:function(C){C=$(C);var G=Element.getStyle(C,"display");if(G!="none"&&G!=null){return{width:C.offsetWidth,height:C.offsetHeight}}var B=C.style;var F=B.visibility;var D=B.position;var A=B.display;B.visibility="hidden";if(D!="fixed"){B.position="absolute"}B.display="block";var H=C.clientWidth;var E=C.clientHeight;B.display=A;B.position=D;B.visibility=F;return{width:H,height:E}},makePositioned:function(A){A=$(A);var B=Element.getStyle(A,"position");if(B=="static"||!B){A._madePositioned=true;A.style.position="relative";if(Prototype.Browser.Opera){A.style.top=0;A.style.left=0}}return A},undoPositioned:function(A){A=$(A);if(A._madePositioned){A._madePositioned=undefined;A.style.position=A.style.top=A.style.left=A.style.bottom=A.style.right=""}return A},makeClipping:function(A){A=$(A);if(A._overflow){return A}A._overflow=Element.getStyle(A,"overflow")||"auto";if(A._overflow!=="hidden"){A.style.overflow="hidden"}return A},undoClipping:function(A){A=$(A);if(!A._overflow){return A}A.style.overflow=A._overflow=="auto"?"":A._overflow;A._overflow=null;return A},cumulativeOffset:function(B){var A=0,C=0;do{A+=B.offsetTop||0;C+=B.offsetLeft||0;B=B.offsetParent}while(B);return Element._returnOffset(C,A)},positionedOffset:function(B){var A=0,D=0;do{A+=B.offsetTop||0;D+=B.offsetLeft||0;B=B.offsetParent;if(B){if(B.tagName.toUpperCase()=="BODY"){break}var C=Element.getStyle(B,"position");if(C!=="static"){break}}}while(B);return Element._returnOffset(D,A)},absolutize:function(B){B=$(B);if(Element.getStyle(B,"position")=="absolute"){return B}var D=Element.positionedOffset(B);var F=D[1];var E=D[0];var C=B.clientWidth;var A=B.clientHeight;B._originalLeft=E-parseFloat(B.style.left||0);B._originalTop=F-parseFloat(B.style.top||0);B._originalWidth=B.style.width;B._originalHeight=B.style.height;B.style.position="absolute";B.style.top=F+"px";B.style.left=E+"px";B.style.width=C+"px";B.style.height=A+"px";return B},relativize:function(A){A=$(A);if(Element.getStyle(A,"position")=="relative"){return A}A.style.position="relative";var C=parseFloat(A.style.top||0)-(A._originalTop||0);var B=parseFloat(A.style.left||0)-(A._originalLeft||0);A.style.top=C+"px";A.style.left=B+"px";A.style.height=A._originalHeight;A.style.width=A._originalWidth;return A},cumulativeScrollOffset:function(B){var A=0,C=0;do{A+=B.scrollTop||0;C+=B.scrollLeft||0;B=B.parentNode}while(B);return Element._returnOffset(C,A)},getOffsetParent:function(A){if(A.offsetParent){return $(A.offsetParent)}if(A==document.body){return $(A)}while((A=A.parentNode)&&A!=document.body){if(Element.getStyle(A,"position")!="static"){return $(A)}}return $(document.body)},viewportOffset:function(D){var A=0,C=0;var B=D;do{A+=B.offsetTop||0;C+=B.offsetLeft||0;if(B.offsetParent==document.body&&Element.getStyle(B,"position")=="absolute"){break}}while(B=B.offsetParent);B=D;do{if(!Prototype.Browser.Opera||(B.tagName&&(B.tagName.toUpperCase()=="BODY"))){A-=B.scrollTop||0;C-=B.scrollLeft||0}}while(B=B.parentNode);return Element._returnOffset(C,A)},clonePosition:function(B,D){var A=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});D=$(D);var E=Element.viewportOffset(D);B=$(B);var F=[0,0];var C=null;if(Element.getStyle(B,"position")=="absolute"){C=Element.getOffsetParent(B);F=Element.viewportOffset(C)}if(C==document.body){F[0]-=document.body.offsetLeft;F[1]-=document.body.offsetTop}if(A.setLeft){B.style.left=(E[0]-F[0]+A.offsetLeft)+"px"}if(A.setTop){B.style.top=(E[1]-F[1]+A.offsetTop)+"px"}if(A.setWidth){B.style.width=D.offsetWidth+"px"}if(A.setHeight){B.style.height=D.offsetHeight+"px"}return B}};Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(D,B,C){switch(C){case"left":case"top":case"right":case"bottom":if(D(B,"position")==="static"){return null}case"height":case"width":if(!Element.visible(B)){return null}var E=parseInt(D(B,C),10);if(E!==B["offset"+C.capitalize()]){return E+"px"}var A;if(C==="height"){A=["border-top-width","padding-top","padding-bottom","border-bottom-width"]}else{A=["border-left-width","padding-left","padding-right","border-right-width"]}return A.inject(E,function(F,G){var H=D(B,G);return H===null?F:F-parseInt(H,10)})+"px";default:return D(B,C)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(C,A,B){if(B==="title"){return A.title}return C(A,B)})}else{if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(C,B){B=$(B);try{B.offsetParent}catch(E){return $(document.body)}var A=B.getStyle("position");if(A!=="static"){return C(B)}B.setStyle({position:"relative"});var D=C(B);B.setStyle({position:A});return D});$w("positionedOffset viewportOffset").each(function(A){Element.Methods[A]=Element.Methods[A].wrap(function(E,C){C=$(C);try{C.offsetParent}catch(G){return Element._returnOffset(0,0)}var B=C.getStyle("position");if(B!=="static"){return E(C)}var D=C.getOffsetParent();if(D&&D.getStyle("position")==="fixed"){D.setStyle({zoom:1})}C.setStyle({position:"relative"});var F=E(C);C.setStyle({position:B});return F})});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(B,A){try{A.offsetParent}catch(C){return Element._returnOffset(0,0)}return B(A)});Element.Methods.getStyle=function(A,B){A=$(A);B=(B=="float"||B=="cssFloat")?"styleFloat":B.camelize();var C=A.style[B];if(!C&&A.currentStyle){C=A.currentStyle[B]}if(B=="opacity"){if(C=(A.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(C[1]){return parseFloat(C[1])/100}}return 1}if(C=="auto"){if((B=="width"||B=="height")&&(A.getStyle("display")!="none")){return A["offset"+B.capitalize()]+"px"}return null}return C};Element.Methods.setOpacity=function(B,E){function F(G){return G.replace(/alpha\([^\)]*\)/gi,"")}B=$(B);var A=B.currentStyle;if((A&&!A.hasLayout)||(!A&&B.style.zoom=="normal")){B.style.zoom=1}var D=B.getStyle("filter"),C=B.style;if(E==1||E===""){(D=F(D))?C.filter=D:C.removeAttribute("filter");return B}else{if(E<0.00001){E=0}}C.filter=F(D)+"alpha(opacity="+(E*100)+")";return B};Element._attributeTranslations=(function(){var B="className";var A="for";var C=document.createElement("div");C.setAttribute(B,"x");if(C.className!=="x"){C.setAttribute("class","x");if(C.className==="x"){B="class"}}C=null;C=document.createElement("label");C.setAttribute(A,"x");if(C.htmlFor!=="x"){C.setAttribute("htmlFor","x");if(C.htmlFor==="x"){A="htmlFor"}}C=null;return{read:{names:{"class":B,className:B,"for":A,htmlFor:A},values:{_getAttr:function(D,E){return D.getAttribute(E)},_getAttr2:function(D,E){return D.getAttribute(E,2)},_getAttrNode:function(D,F){var E=D.getAttributeNode(F);return E?E.value:""},_getEv:(function(){var D=document.createElement("div");D.onclick=Prototype.emptyFunction;var F=D.getAttribute("onclick");var E;if(String(F).indexOf("{")>-1){E=function(G,H){H=G.getAttribute(H);if(!H){return null}H=H.toString();H=H.split("{")[1];H=H.split("}")[0];return H.strip()}}else{if(F===""){E=function(G,H){H=G.getAttribute(H);if(!H){return null}return H.strip()}}}D=null;return E})(),_flag:function(D,E){return $(D).hasAttribute(E)?E:null},style:function(D){return D.style.cssText.toLowerCase()},title:function(D){return D.title}}}}})();Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(A,B){A.checked=!!B},style:function(A,B){A.style.cssText=B?B:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(A){Element._attributeTranslations.write.names[A.toLowerCase()]=A;Element._attributeTranslations.has[A.toLowerCase()]=A});(function(A){Object.extend(A,{href:A._getAttr2,src:A._getAttr2,type:A._getAttr,action:A._getAttrNode,disabled:A._flag,checked:A._flag,readonly:A._flag,multiple:A._flag,onload:A._getEv,onunload:A._getEv,onclick:A._getEv,ondblclick:A._getEv,onmousedown:A._getEv,onmouseup:A._getEv,onmouseover:A._getEv,onmousemove:A._getEv,onmouseout:A._getEv,onfocus:A._getEv,onblur:A._getEv,onkeypress:A._getEv,onkeydown:A._getEv,onkeyup:A._getEv,onsubmit:A._getEv,onreset:A._getEv,onselect:A._getEv,onchange:A._getEv})})(Element._attributeTranslations.read.values);if(Prototype.BrowserFeatures.ElementExtensions){(function(){function A(E){var B=E.getElementsByTagName("*"),D=[];for(var C=0,F;F=B[C];C++){if(F.tagName!=="!"){D.push(F)}}return D}Element.Methods.down=function(C,D,B){C=$(C);if(arguments.length==1){return C.firstDescendant()}return Object.isNumber(D)?A(C)[D]:Element.select(C,D)[B||0]}})()}}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(A,B){A=$(A);A.style.opacity=(B==1)?0.999999:(B==="")?"":(B<0.00001)?0:B;return A}}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(A,B){A=$(A);A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;if(B==1){if(A.tagName.toUpperCase()=="IMG"&&A.width){A.width++;A.width--}else{try{var D=document.createTextNode(" ");A.appendChild(D);A.removeChild(D)}catch(C){}}}return A};Element.Methods.cumulativeOffset=function(B){var A=0,C=0;do{A+=B.offsetTop||0;C+=B.offsetLeft||0;if(B.offsetParent==document.body){if(Element.getStyle(B,"position")=="absolute"){break}}B=B.offsetParent}while(B);return Element._returnOffset(C,A)}}}}}if("outerHTML" in document.documentElement){Element.Methods.replace=function(C,E){C=$(C);if(E&&E.toElement){E=E.toElement()}if(Object.isElement(E)){C.parentNode.replaceChild(E,C);return C}E=Object.toHTML(E);var D=C.parentNode,B=D.tagName.toUpperCase();if(Element._insertionTranslations.tags[B]){var F=C.next();var A=Element._getContentFromAnonymousElement(B,E.stripScripts());D.removeChild(C);if(F){A.each(function(G){D.insertBefore(G,F)})}else{A.each(function(G){D.appendChild(G)})}}else{C.outerHTML=E.stripScripts()}E.evalScripts.bind(E).defer();return C}}Element._returnOffset=function(B,C){var A=[B,C];A.left=B;A.top=C;return A};Element._getContentFromAnonymousElement=function(C,B){var D=new Element("div"),A=Element._insertionTranslations.tags[C];if(A){D.innerHTML=A[0]+B+A[1];A[2].times(function(){D=D.firstChild})}else{D.innerHTML=B}return $A(D.childNodes)};Element._insertionTranslations={before:function(A,B){A.parentNode.insertBefore(B,A)},top:function(A,B){A.insertBefore(B,A.firstChild)},bottom:function(A,B){A.appendChild(B)},after:function(A,B){A.parentNode.insertBefore(B,A.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};(function(){var A=Element._insertionTranslations.tags;Object.extend(A,{THEAD:A.TBODY,TFOOT:A.TBODY,TH:A.TD})})();Element.Methods.Simulated={hasAttribute:function(A,C){C=Element._attributeTranslations.has[C]||C;var B=$(A).getAttributeNode(C);return !!(B&&B.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(A){if(!Prototype.BrowserFeatures.ElementExtensions&&A.__proto__){window.HTMLElement={};window.HTMLElement.prototype=A.__proto__;Prototype.BrowserFeatures.ElementExtensions=true}A=null})(document.createElement("div"));Element.extend=(function(){function C(G){if(typeof window.Element!="undefined"){var I=window.Element.prototype;if(I){var K="_"+(Math.random()+"").slice(2);var H=document.createElement(G);I[K]="x";var J=(H[K]!=="x");delete I[K];H=null;return J}}return false}function B(H,G){for(var J in G){var I=G[J];if(Object.isFunction(I)&&!(J in H)){H[J]=I.methodize()}}}var D=C("object");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(D){return function(H){if(H&&typeof H._extendedByPrototype=="undefined"){var G=H.tagName;if(G&&(/^(?:object|applet|embed)$/i.test(G))){B(H,Element.Methods);B(H,Element.Methods.Simulated);B(H,Element.Methods.ByTag[G.toUpperCase()])}}return H}}return Prototype.K}var A={},E=Element.Methods.ByTag;var F=Object.extend(function(I){if(!I||typeof I._extendedByPrototype!="undefined"||I.nodeType!=1||I==window){return I}var G=Object.clone(A),H=I.tagName.toUpperCase();if(E[H]){Object.extend(G,E[H])}B(I,G);I._extendedByPrototype=Prototype.emptyFunction;return I},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(A,Element.Methods);Object.extend(A,Element.Methods.Simulated)}}});F.refresh();return F})();Element.hasAttribute=function(A,B){if(A.hasAttribute){return A.hasAttribute(B)}return Element.Methods.Simulated.hasAttribute(A,B)};Element.addMethods=function(C){var J=Prototype.BrowserFeatures,D=Element.Methods.ByTag;if(!C){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods)})}if(arguments.length==2){var B=C;C=arguments[1]}if(!B){Object.extend(Element.Methods,C||{})}else{if(Object.isArray(B)){B.each(H)}else{H(B)}}function H(F){F=F.toUpperCase();if(!Element.Methods.ByTag[F]){Element.Methods.ByTag[F]={}}Object.extend(Element.Methods.ByTag[F],C)}function A(M,L,F){F=F||false;for(var O in M){var N=M[O];if(!Object.isFunction(N)){continue}if(!F||!(O in L)){L[O]=N.methodize()}}}function E(N){var F;var M={OPTGROUP:"OptGroup",TEXTAREA:"TextArea",P:"Paragraph",FIELDSET:"FieldSet",UL:"UList",OL:"OList",DL:"DList",DIR:"Directory",H1:"Heading",H2:"Heading",H3:"Heading",H4:"Heading",H5:"Heading",H6:"Heading",Q:"Quote",INS:"Mod",DEL:"Mod",A:"Anchor",IMG:"Image",CAPTION:"TableCaption",COL:"TableCol",COLGROUP:"TableCol",THEAD:"TableSection",TFOOT:"TableSection",TBODY:"TableSection",TR:"TableRow",TH:"TableCell",TD:"TableCell",FRAMESET:"FrameSet",IFRAME:"IFrame"};if(M[N]){F="HTML"+M[N]+"Element"}if(window[F]){return window[F]}F="HTML"+N+"Element";if(window[F]){return window[F]}F="HTML"+N.capitalize()+"Element";if(window[F]){return window[F]}var L=document.createElement(N);var O=L.__proto__||L.constructor.prototype;L=null;return O}var I=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(J.ElementExtensions){A(Element.Methods,I);A(Element.Methods.Simulated,I,true)}if(J.SpecificElementExtensions){for(var K in Element.Methods.ByTag){var G=E(K);if(Object.isUndefined(G)){continue}A(D[K],G.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){return{width:this.getWidth(),height:this.getHeight()}},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};(function(C){var H=Prototype.Browser,F=document,D,E={};function A(){if(H.WebKit&&!F.evaluate){return document}if(H.Opera&&window.parseFloat(window.opera.version())<9.5){return document.body}return document.documentElement}function G(B){if(!D){D=A()}E[B]="client"+B;C["get"+B]=function(){return D[E[B]]};return C["get"+B]()}C.getWidth=G.curry("Width");C.getHeight=G.curry("Height")})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:function(B){if(!(B=$(B))){return }var A;if(B===window){A=0}else{if(typeof B._prototypeUID==="undefined"){B._prototypeUID=[Element.Storage.UID++]}A=B._prototypeUID[0]}if(!Element.Storage[A]){Element.Storage[A]=$H()}return Element.Storage[A]},store:function(B,A,C){if(!(B=$(B))){return }if(arguments.length===2){Element.getStorage(B).update(A)}else{Element.getStorage(B).set(A,C)}return B},retrieve:function(C,B,A){if(!(C=$(C))){return }var E=Element.getStorage(C),D=E.get(B);if(Object.isUndefined(D)){E.set(B,A);D=A}return D},clone:function(C,A){if(!(C=$(C))){return }var E=C.cloneNode(A);E._prototypeUID=void 0;if(A){var D=Element.select(E,"*"),B=D.length;while(B--){D[B]._prototypeUID=void 0}}return Element.extend(E)}});var Selector=Class.create({initialize:function(A){this.expression=A.strip();if(this.shouldUseSelectorsAPI()){this.mode="selectorsAPI"}else{if(this.shouldUseXPath()){this.mode="xpath";this.compileXPathMatcher()}else{this.mode="normal";this.compileMatcher()}}},shouldUseXPath:(function(){var A=(function(){var E=false;if(document.evaluate&&window.XPathResult){var D=document.createElement("div");D.innerHTML="<ul><li></li></ul><div><ul><li></li></ul></div>";var C=".//*[local-name()='ul' or local-name()='UL']//*[local-name()='li' or local-name()='LI']";var B=document.evaluate(C,D,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);E=(B.snapshotLength!==2);D=null}return E})();return function(){if(!Prototype.BrowserFeatures.XPath){return false}var B=this.expression;if(Prototype.Browser.WebKit&&(B.include("-of-type")||B.include(":empty"))){return false}if((/(\[[\w-]*?:|:checked)/).test(B)){return false}if(A){return false}return true}})(),shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI){return false}if(Selector.CASE_INSENSITIVE_CLASS_NAMES){return false}if(!Selector._div){Selector._div=new Element("div")}try{Selector._div.querySelector(this.expression)}catch(A){return false}return true},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m,len=ps.length,name;if(Selector._cache[e]){this.matcher=Selector._cache[e];return }this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i=0;i<len;i++){p=ps[i].re;name=ps[i].name;if(m=e.match(p)){this.matcher.push(Object.isFunction(c[name])?c[name](m):new Template(c[name]).evaluate(m));e=e.replace(m[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher},compileXPathMatcher:function(){var G=this.expression,H=Selector.patterns,C=Selector.xpath,F,B,A=H.length,D;if(Selector._cache[G]){this.xpath=Selector._cache[G];return }this.matcher=[".//*"];while(G&&F!=G&&(/\S/).test(G)){F=G;for(var E=0;E<A;E++){D=H[E].name;if(B=G.match(H[E].re)){this.matcher.push(Object.isFunction(C[D])?C[D](B):new Template(C[D]).evaluate(B));G=G.replace(B[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(A){A=A||document;var C=this.expression,B;switch(this.mode){case"selectorsAPI":if(A!==document){var D=A.id,E=$(A).identify();E=E.replace(/([\.:])/g,"\\$1");C="#"+E+" "+C}B=$A(A.querySelectorAll(C)).map(Element.extend);A.id=D;return B;case"xpath":return document._getElementsByXPath(this.xpath,A);default:return this.matcher(A)}},match:function(I){this.tokens=[];var M=this.expression,A=Selector.patterns,E=Selector.assertions;var B,D,F,L=A.length,C;while(M&&B!==M&&(/\S/).test(M)){B=M;for(var H=0;H<L;H++){D=A[H].re;C=A[H].name;if(F=M.match(D)){if(E[C]){this.tokens.push([C,Object.clone(F)]);M=M.replace(F[0],"")}else{return this.findElements(document).include(I)}}}}var K=true,C,J;for(var H=0,G;G=this.tokens[H];H++){C=G[0],J=G[1];if(!Selector.assertions[C](I,J)){K=false;break}}return K},toString:function(){return this.expression},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"}});if(Prototype.BrowserFeatures.SelectorsAPI&&document.compatMode==="BackCompat"){Selector.CASE_INSENSITIVE_CLASS_NAMES=(function(){var C=document.createElement("div"),A=document.createElement("span");C.id="prototype_test_id";A.className="Test";C.appendChild(A);var B=(C.querySelector("#prototype_test_id .test")!==null);C=A=null;return B})()}Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(A){if(A[1]=="*"){return""}return"[local-name()='"+A[1].toLowerCase()+"' or local-name()='"+A[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(A){A[1]=A[1].toLowerCase();return new Template("[@#{1}]").evaluate(A)},attr:function(A){A[1]=A[1].toLowerCase();A[3]=A[5]||A[6];return new Template(Selector.xpath.operators[A[2]]).evaluate(A)},pseudo:function(A){var B=Selector.xpath.pseudos[A[1]];if(!B){return""}if(Object.isFunction(B)){return B(A)}return new Template(Selector.xpath.pseudos[A[1]]).evaluate(A)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0)]",checked:"[@checked]",disabled:"[(@disabled) and (@type!='hidden')]",enabled:"[not(@disabled) and (@type!='hidden')]",not:function(E){var H=E[6],C=Selector.patterns,I=Selector.xpath,A,J,G=C.length,B;var D=[];while(H&&A!=H&&(/\S/).test(H)){A=H;for(var F=0;F<G;F++){B=C[F].name;if(E=H.match(C[F].re)){J=Object.isFunction(I[B])?I[B](E):new Template(I[B]).evaluate(E);D.push("("+J.substring(1,J.length-1)+")");H=H.replace(E[0],"");break}}}return"[not("+D.join(" and ")+")]"},"nth-child":function(A){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",A)},"nth-last-child":function(A){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",A)},"nth-of-type":function(A){return Selector.xpath.pseudos.nth("position() ",A)},"nth-last-of-type":function(A){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",A)},"first-of-type":function(A){A[6]="1";return Selector.xpath.pseudos["nth-of-type"](A)},"last-of-type":function(A){A[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](A)},"only-of-type":function(A){var B=Selector.xpath.pseudos;return B["first-of-type"](A)+B["last-of-type"](A)},nth:function(E,C){var F,G=C[6],B;if(G=="even"){G="2n+0"}if(G=="odd"){G="2n+1"}if(F=G.match(/^(\d+)$/)){return"["+E+"= "+F[1]+"]"}if(F=G.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(F[1]=="-"){F[1]=-1}var D=F[1]?Number(F[1]):1;var A=F[2]?Number(F[2]):0;B="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(B).evaluate({fragment:E,a:D,b:A})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(A){A[3]=(A[5]||A[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(A)},pseudo:function(A){if(A[6]){A[6]=A[6].replace(/"/g,'\\"')}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(A)},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:[{name:"laterSibling",re:/^\s*~\s*/},{name:"child",re:/^\s*>\s*/},{name:"adjacent",re:/^\s*\+\s*/},{name:"descendant",re:/^\s/},{name:"tagName",re:/^\s*(\*|[\w\-]+)(\b|$)?/},{name:"id",re:/^#([\w\-\*]+)(\b|$)/},{name:"className",re:/^\.([\w\-\*]+)(\b|$)/},{name:"pseudo",re:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/},{name:"attrPresence",re:/^\[((?:[\w-]+:)?[\w-]+)\]/},{name:"attr",re:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/}],assertions:{tagName:function(A,B){return B[1].toUpperCase()==A.tagName.toUpperCase()},className:function(A,B){return Element.hasClassName(A,B[1])},id:function(A,B){return A.id===B[1]},attrPresence:function(A,B){return Element.hasAttribute(A,B[1])},attr:function(B,C){var A=Element.readAttribute(B,C[1]);return A&&Selector.operators[C[2]](A,C[5]||C[6])}},handlers:{concat:function(B,A){for(var C=0,D;D=A[C];C++){B.push(D)}return B},mark:function(A){var D=Prototype.emptyFunction;for(var B=0,C;C=A[B];B++){C._countedByPrototype=D}return A},unmark:(function(){var A=(function(){var B=document.createElement("div"),E=false,D="_countedByPrototype",C="x";B[D]=C;E=(B.getAttribute(D)===C);B=null;return E})();return A?function(B){for(var C=0,D;D=B[C];C++){D.removeAttribute("_countedByPrototype")}return B}:function(B){for(var C=0,D;D=B[C];C++){D._countedByPrototype=void 0}return B}})(),index:function(A,D,G){A._countedByPrototype=Prototype.emptyFunction;if(D){for(var B=A.childNodes,E=B.length-1,C=1;E>=0;E--){var F=B[E];if(F.nodeType==1&&(!G||F._countedByPrototype)){F.nodeIndex=C++}}}else{for(var E=0,C=1,B=A.childNodes;F=B[E];E++){if(F.nodeType==1&&(!G||F._countedByPrototype)){F.nodeIndex=C++}}}},unique:function(B){if(B.length==0){return B}var D=[],E;for(var C=0,A=B.length;C<A;C++){if(typeof (E=B[C])._countedByPrototype=="undefined"){E._countedByPrototype=Prototype.emptyFunction;D.push(Element.extend(E))}}return Selector.handlers.unmark(D)},descendant:function(A){var D=Selector.handlers;for(var C=0,B=[],E;E=A[C];C++){D.concat(B,E.getElementsByTagName("*"))}return B},child:function(A){var E=Selector.handlers;for(var D=0,C=[],F;F=A[D];D++){for(var B=0,G;G=F.childNodes[B];B++){if(G.nodeType==1&&G.tagName!="!"){C.push(G)}}}return C},adjacent:function(A){for(var C=0,B=[],E;E=A[C];C++){var D=this.nextElementSibling(E);if(D){B.push(D)}}return B},laterSibling:function(A){var D=Selector.handlers;for(var C=0,B=[],E;E=A[C];C++){D.concat(B,Element.nextSiblings(E))}return B},nextElementSibling:function(A){while(A=A.nextSibling){if(A.nodeType==1){return A}}return null},previousElementSibling:function(A){while(A=A.previousSibling){if(A.nodeType==1){return A}}return null},tagName:function(A,H,C,B){var I=C.toUpperCase();var E=[],G=Selector.handlers;if(A){if(B){if(B=="descendant"){for(var F=0,D;D=A[F];F++){G.concat(E,D.getElementsByTagName(C))}return E}else{A=this[B](A)}if(C=="*"){return A}}for(var F=0,D;D=A[F];F++){if(D.tagName.toUpperCase()===I){E.push(D)}}return E}else{return H.getElementsByTagName(C)}},id:function(A,I,B,C){var H=$(B),G=Selector.handlers;if(I==document){if(!H){return[]}if(!A){return[H]}}else{if(!I.sourceIndex||I.sourceIndex<1){var A=I.getElementsByTagName("*");for(var E=0,D;D=A[E];E++){if(D.id===B){return[D]}}}}if(A){if(C){if(C=="child"){for(var F=0,D;D=A[F];F++){if(H.parentNode==D){return[H]}}}else{if(C=="descendant"){for(var F=0,D;D=A[F];F++){if(Element.descendantOf(H,D)){return[H]}}}else{if(C=="adjacent"){for(var F=0,D;D=A[F];F++){if(Selector.handlers.previousElementSibling(H)==D){return[H]}}}else{A=G[C](A)}}}}for(var F=0,D;D=A[F];F++){if(D==H){return[H]}}return[]}return(H&&Element.descendantOf(H,I))?[H]:[]},className:function(B,A,C,D){if(B&&D){B=this[D](B)}return Selector.handlers.byClassName(B,A,C)},byClassName:function(C,B,F){if(!C){C=Selector.handlers.descendant([B])}var H=" "+F+" ";for(var E=0,D=[],G,A;G=C[E];E++){A=G.className;if(A.length==0){continue}if(A==F||(" "+A+" ").include(H)){D.push(G)}}return D},attrPresence:function(C,B,A,G){if(!C){C=B.getElementsByTagName("*")}if(C&&G){C=this[G](C)}var E=[];for(var D=0,F;F=C[D];D++){if(Element.hasAttribute(F,A)){E.push(F)}}return E},attr:function(A,I,H,J,C,B){if(!A){A=I.getElementsByTagName("*")}if(A&&B){A=this[B](A)}var K=Selector.operators[C],F=[];for(var E=0,D;D=A[E];E++){var G=Element.readAttribute(D,H);if(G===null){continue}if(K(G,J)){F.push(D)}}return F},pseudo:function(B,C,E,A,D){if(B&&D){B=this[D](B)}if(!B){B=A.getElementsByTagName("*")}return Selector.pseudos[C](B,E,A)}},pseudos:{"first-child":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(Selector.handlers.previousElementSibling(E)){continue}C.push(E)}return C},"last-child":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(Selector.handlers.nextElementSibling(E)){continue}C.push(E)}return C},"only-child":function(B,G,A){var E=Selector.handlers;for(var D=0,C=[],F;F=B[D];D++){if(!E.previousElementSibling(F)&&!E.nextElementSibling(F)){C.push(F)}}return C},"nth-child":function(B,C,A){return Selector.pseudos.nth(B,C,A)},"nth-last-child":function(B,C,A){return Selector.pseudos.nth(B,C,A,true)},"nth-of-type":function(B,C,A){return Selector.pseudos.nth(B,C,A,false,true)},"nth-last-of-type":function(B,C,A){return Selector.pseudos.nth(B,C,A,true,true)},"first-of-type":function(B,C,A){return Selector.pseudos.nth(B,"1",A,false,true)},"last-of-type":function(B,C,A){return Selector.pseudos.nth(B,"1",A,true,true)},"only-of-type":function(B,D,A){var C=Selector.pseudos;return C["last-of-type"](C["first-of-type"](B,D,A),D,A)},getIndices:function(B,A,C){if(B==0){return A>0?[A]:[]}return $R(1,C).inject([],function(D,E){if(0==(E-A)%B&&(E-A)/B>=0){D.push(E)}return D})},nth:function(A,L,N,K,C){if(A.length==0){return[]}if(L=="even"){L="2n+0"}if(L=="odd"){L="2n+1"}var J=Selector.handlers,I=[],B=[],E;J.mark(A);for(var H=0,D;D=A[H];H++){if(!D.parentNode._countedByPrototype){J.index(D.parentNode,K,C);B.push(D.parentNode)}}if(L.match(/^\d+$/)){L=Number(L);for(var H=0,D;D=A[H];H++){if(D.nodeIndex==L){I.push(D)}}}else{if(E=L.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(E[1]=="-"){E[1]=-1}var O=E[1]?Number(E[1]):1;var M=E[2]?Number(E[2]):0;var P=Selector.pseudos.getIndices(O,M,A.length);for(var H=0,D,F=P.length;D=A[H];H++){for(var G=0;G<F;G++){if(D.nodeIndex==P[G]){I.push(D)}}}}}J.unmark(A);J.unmark(B);return I},empty:function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(E.tagName=="!"||E.firstChild){continue}C.push(E)}return C},not:function(A,D,I){var G=Selector.handlers,J,C;var H=new Selector(D).findElements(I);G.mark(H);for(var F=0,E=[],B;B=A[F];F++){if(!B._countedByPrototype){E.push(B)}}G.unmark(H);return E},enabled:function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(!E.disabled&&(!E.type||E.type!=="hidden")){C.push(E)}}return C},disabled:function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(E.disabled){C.push(E)}}return C},checked:function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(E.checked){C.push(E)}}return C}},operators:{"=":function(B,A){return B==A},"!=":function(B,A){return B!=A},"^=":function(B,A){return B==A||B&&B.startsWith(A)},"$=":function(B,A){return B==A||B&&B.endsWith(A)},"*=":function(B,A){return B==A||B&&B.include(A)},"~=":function(B,A){return(" "+B+" ").include(" "+A+" ")},"|=":function(B,A){return("-"+(B||"").toUpperCase()+"-").include("-"+(A||"").toUpperCase()+"-")}},split:function(B){var A=[];B.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(C){A.push(C[1].strip())});return A},matchElements:function(F,G){var E=$$(G),D=Selector.handlers;D.mark(E);for(var C=0,B=[],A;A=F[C];C++){if(A._countedByPrototype){B.push(A)}}D.unmark(E);return B},findElement:function(B,C,A){if(Object.isNumber(C)){A=C;C=false}return Selector.matchElements(B,C||"*")[A||0]},findChildElements:function(E,G){G=Selector.split(G.join(","));var D=[],F=Selector.handlers;for(var C=0,B=G.length,A;C<B;C++){A=new Selector(G[C].strip());F.concat(D,A.findElements(E))}return(B>1)?F.unique(D):D}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(B,A){for(var C=0,D;D=A[C];C++){if(D.tagName!=="!"){B.push(D)}}return B}})}function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(A){A=$(A);A.reset();return A},serializeElements:function(G,B){if(typeof B!="object"){B={hash:!!B}}else{if(Object.isUndefined(B.hash)){B.hash=true}}var C,F,A=false,E=B.submit;var D=G.inject({},function(H,I){if(!I.disabled&&I.name){C=I.name;F=$(I).getValue();if(F!=null&&I.type!="file"&&(I.type!="submit"||(!A&&E!==false&&(!E||C==E)&&(A=true)))){if(C in H){if(!Object.isArray(H[C])){H[C]=[H[C]]}H[C].push(F)}else{H[C]=F}}}return H});return B.hash?D:Object.toQueryString(D)}};Form.Methods={serialize:function(B,A){return Form.serializeElements(Form.getElements(B),A)},getElements:function(E){var F=$(E).getElementsByTagName("*"),D,A=[],C=Form.Element.Serializers;for(var B=0;D=F[B];B++){A.push(D)}return A.inject([],function(G,H){if(C[H.tagName.toLowerCase()]){G.push(Element.extend(H))}return G})},getInputs:function(G,C,D){G=$(G);var A=G.getElementsByTagName("input");if(!C&&!D){return $A(A).map(Element.extend)}for(var E=0,H=[],F=A.length;E<F;E++){var B=A[E];if((C&&B.type!=C)||(D&&B.name!=D)){continue}H.push(Element.extend(B))}return H},disable:function(A){A=$(A);Form.getElements(A).invoke("disable");return A},enable:function(A){A=$(A);Form.getElements(A).invoke("enable");return A},findFirstElement:function(B){var C=$(B).getElements().findAll(function(D){return"hidden"!=D.type&&!D.disabled});var A=C.findAll(function(D){return D.hasAttribute("tabIndex")&&D.tabIndex>=0}).sortBy(function(D){return D.tabIndex}).first();return A?A:C.find(function(D){return/^(?:input|select|textarea)$/i.test(D.tagName)})},focusFirstElement:function(A){A=$(A);A.findFirstElement().activate();return A},request:function(B,A){B=$(B),A=Object.clone(A||{});var D=A.parameters,C=B.readAttribute("action")||"";if(C.blank()){C=window.location.href}A.parameters=B.serialize(true);if(D){if(Object.isString(D)){D=D.toQueryParams()}Object.extend(A.parameters,D)}if(B.hasAttribute("method")&&!A.method){A.method=B.method}return new Ajax.Request(C,A)}};Form.Element={focus:function(A){$(A).focus();return A},select:function(A){$(A).select();return A}};Form.Element.Methods={serialize:function(A){A=$(A);if(!A.disabled&&A.name){var B=A.getValue();if(B!=undefined){var C={};C[A.name]=B;return Object.toQueryString(C)}}return""},getValue:function(A){A=$(A);var B=A.tagName.toLowerCase();return Form.Element.Serializers[B](A)},setValue:function(A,B){A=$(A);var C=A.tagName.toLowerCase();Form.Element.Serializers[C](A,B);return A},clear:function(A){$(A).value="";return A},present:function(A){return $(A).value!=""},activate:function(A){A=$(A);try{A.focus();if(A.select&&(A.tagName.toLowerCase()!="input"||!(/^(?:button|reset|submit)$/i.test(A.type)))){A.select()}}catch(B){}return A},disable:function(A){A=$(A);A.disabled=true;return A},enable:function(A){A=$(A);A.disabled=false;return A}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(A,B){switch(A.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(A,B);default:return Form.Element.Serializers.textarea(A,B)}},inputSelector:function(A,B){if(Object.isUndefined(B)){return A.checked?A.value:null}else{A.checked=!!B}},textarea:function(A,B){if(Object.isUndefined(B)){return A.value}else{A.value=B}},select:function(C,F){if(Object.isUndefined(F)){return this[C.type=="select-one"?"selectOne":"selectMany"](C)}else{var B,D,G=!Object.isArray(F);for(var A=0,E=C.length;A<E;A++){B=C.options[A];D=this.optionValue(B);if(G){if(D==F){B.selected=true;return }}else{B.selected=F.include(D)}}}},selectOne:function(B){var A=B.selectedIndex;return A>=0?this.optionValue(B.options[A]):null},selectMany:function(D){var A,E=D.length;if(!E){return null}for(var C=0,A=[];C<E;C++){var B=D.options[C];if(B.selected){A.push(this.optionValue(B))}}return A},optionValue:function(A){return Element.extend(A).hasAttribute("value")?A.value:A.text}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,A,B,C){$super(C,B);this.element=$(A);this.lastValue=this.getValue()},execute:function(){var A=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(A)?this.lastValue!=A:String(this.lastValue)!=String(A)){this.callback(this.element,A);this.lastValue=A}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({initialize:function(A,B){this.element=$(A);this.callback=B;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var A=this.getValue();if(this.lastValue!=A){this.callback(this.element,A);this.lastValue=A}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(A){if(A.type){switch(A.type.toLowerCase()){case"checkbox":case"radio":Event.observe(A,"click",this.onElementEvent.bind(this));break;default:Event.observe(A,"change",this.onElementEvent.bind(this));break}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});(function(){var V={KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{}};var E=document.documentElement;var W="onmouseenter" in E&&"onmouseleave" in E;var O;if(Prototype.Browser.IE){var H={0:1,1:4,2:2};O=function(Y,X){return Y.button===H[X]}}else{if(Prototype.Browser.WebKit){O=function(Y,X){switch(X){case 0:return Y.which==1&&!Y.metaKey;case 1:return Y.which==1&&Y.metaKey;default:return false}}}else{O=function(Y,X){return Y.which?(Y.which===X+1):(Y.button===X)}}}function R(X){return O(X,0)}function Q(X){return O(X,1)}function K(X){return O(X,2)}function C(Z){Z=V.extend(Z);var Y=Z.target,X=Z.type,a=Z.currentTarget;if(a&&a.tagName){if(X==="load"||X==="error"||(X==="click"&&a.tagName.toLowerCase()==="input"&&a.type==="radio")){Y=a}}if(Y.nodeType==Node.TEXT_NODE){Y=Y.parentNode}return Element.extend(Y)}function M(Y,a){var X=V.element(Y);if(!a){return X}var Z=[X].concat(X.ancestors());return Selector.findElement(Z,a,0)}function P(X){return{x:B(X),y:A(X)}}function B(Z){var Y=document.documentElement,X=document.body||{scrollLeft:0};return Z.pageX||(Z.clientX+(Y.scrollLeft||X.scrollLeft)-(Y.clientLeft||0))}function A(Z){var Y=document.documentElement,X=document.body||{scrollTop:0};return Z.pageY||(Z.clientY+(Y.scrollTop||X.scrollTop)-(Y.clientTop||0))}function N(X){V.extend(X);X.preventDefault();X.stopPropagation();X.stopped=true}V.Methods={isLeftClick:R,isMiddleClick:Q,isRightClick:K,element:C,findElement:M,pointer:P,pointerX:B,pointerY:A,stop:N};var T=Object.keys(V.Methods).inject({},function(X,Y){X[Y]=V.Methods[Y].methodize();return X});if(Prototype.Browser.IE){function G(Y){var X;switch(Y.type){case"mouseover":X=Y.fromElement;break;case"mouseout":X=Y.toElement;break;default:return null}return Element.extend(X)}Object.extend(T,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});V.extend=function(Y,X){if(!Y){return false}if(Y._extendedByPrototype){return Y}Y._extendedByPrototype=Prototype.emptyFunction;var Z=V.pointer(Y);Object.extend(Y,{target:Y.srcElement||X,relatedTarget:G(Y),pageX:Z.x,pageY:Z.y});return Object.extend(Y,T)}}else{V.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(V.prototype,T);V.extend=Prototype.K}function L(b,a,e){var Z=Element.retrieve(b,"prototype_event_registry");if(Object.isUndefined(Z)){D.push(b);Z=Element.retrieve(b,"prototype_event_registry",$H())}var X=Z.get(a);if(Object.isUndefined(X)){X=[];Z.set(a,X)}if(X.pluck("handler").include(e)){return false}var Y;if(a.include(":")){Y=function(f){if(Object.isUndefined(f.eventName)){return false}if(f.eventName!==a){return false}V.extend(f,b);e.call(b,f)}}else{if(!W&&(a==="mouseenter"||a==="mouseleave")){if(a==="mouseenter"||a==="mouseleave"){Y=function(g){V.extend(g,b);var f=g.relatedTarget;while(f&&f!==b){try{f=f.parentNode}catch(h){f=b}}if(f===b){return }e.call(b,g)}}}else{Y=function(f){V.extend(f,b);e.call(b,f)}}}Y.handler=e;X.push(Y);return Y}function F(){for(var X=0,Y=D.length;X<Y;X++){V.stopObserving(D[X]);D[X]=null}}var D=[];if(Prototype.Browser.IE){window.attachEvent("onunload",F)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}var J=Prototype.K;if(!W){J=function(Y){var X={mouseenter:"mouseover",mouseleave:"mouseout"};return Y in X?X[Y]:Y}}function S(a,Z,b){a=$(a);var Y=L(a,Z,b);if(!Y){return a}if(Z.include(":")){if(a.addEventListener){a.addEventListener("dataavailable",Y,false)}else{a.attachEvent("ondataavailable",Y);a.attachEvent("onfilterchange",Y)}}else{var X=J(Z);if(a.addEventListener){a.addEventListener(X,Y,false)}else{a.attachEvent("on"+X,Y)}}return a}function I(e,a,f){e=$(e);var Z=Element.retrieve(e,"prototype_event_registry");if(Object.isUndefined(Z)){return e}if(a&&!f){var b=Z.get(a);if(Object.isUndefined(b)){return e}b.each(function(g){Element.stopObserving(e,a,g.handler)});return e}else{if(!a){Z.each(function(j){var g=j.key,h=j.value;h.each(function(k){Element.stopObserving(e,g,k.handler)})});return e}}var b=Z.get(a);if(!b){return }var Y=b.find(function(g){return g.handler===f});if(!Y){return e}var X=J(a);if(a.include(":")){if(e.removeEventListener){e.removeEventListener("dataavailable",Y,false)}else{e.detachEvent("ondataavailable",Y);e.detachEvent("onfilterchange",Y)}}else{if(e.removeEventListener){e.removeEventListener(X,Y,false)}else{e.detachEvent("on"+X,Y)}}Z.set(a,b.without(Y));return e}function U(a,Z,Y,X){a=$(a);if(Object.isUndefined(X)){X=true}if(a==document&&document.createEvent&&!a.dispatchEvent){a=document.documentElement}var b;if(document.createEvent){b=document.createEvent("HTMLEvents");b.initEvent("dataavailable",true,true)}else{b=document.createEventObject();b.eventType=X?"ondataavailable":"onfilterchange"}b.eventName=Z;b.memo=Y||{};if(document.createEvent){a.dispatchEvent(b)}else{a.fireEvent(b.eventType,b)}return V.extend(b)}Object.extend(V,V.Methods);Object.extend(V,{fire:U,observe:S,stopObserving:I});Element.addMethods({fire:U,observe:S,stopObserving:I});Object.extend(document,{fire:U.methodize(),observe:S.methodize(),stopObserving:I.methodize(),loaded:false});if(window.Event){Object.extend(window.Event,V)}else{window.Event=V}})();(function(){var D;function A(){if(document.loaded){return }if(D){window.clearTimeout(D)}document.loaded=true;document.fire("dom:loaded")}function C(){if(document.readyState==="complete"){document.stopObserving("readystatechange",C);A()}}function B(){try{document.documentElement.doScroll("left")}catch(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);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({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)}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(){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){B.stop();B.element().blur();if(B.element().disabled){return }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"});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(){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({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={alert:function(B,A){if(!A){A={}}if(!A.title){A.title="Alert"}A.type="alert";A.html=B;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)}},isInternetExplorer6:function(){return Prototype.Browser.IE&&(navigator.userAgent.indexOf("MSIE 6")>0)},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 then "+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 then "+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 then "+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 then "+PBconst.kMaxActionLength+" characters"}return true},is_valid_email:function(v){if(!eval(PBconst.kPolicyValidEmailRegex).test(v)){return"The address "+v+" isn't a proper email address."}return true},is_valid_domain_object_name:function(o,obj_type){o=o.strip();if(o.length<PBconst.kMinWikiNameLength){return obj_type+" names must be at least "+PBconst.kMinWikiNameLength+" characters."}if(o.length>PBconst.kMaxWikiNameLength){return obj_type+" names must be no more than "+PBconst.kMaxWikiNameLength+" characters."}if(!eval(PBconst.kPolicyValidWikiNameRegex).test(o)){return obj_type+" 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(u){return !!eval(PBconst.kPolicyValidUIDRegex).test(u)},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,"-")}A=encodeURIComponent(A);A=A.replace(/%20/g,"+");return A},undashified_link:function(A){var B=A.indexOf("+")==-1;A=decodeURIComponent(A);A=A.replace(/\+/g," ");if(B&&A.indexOf("-")!=-1){A=A.replace(/-/g," ")}return A},getFolderLink:function(A){if(A){return"/browse/#view=ViewFolder&param="+encodeURIComponent(A)}else{return"/browse/#view=ViewAllObjects"}},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;if(B.indexOf("/folder.php?folder=")===0){A={type:"folder",txt:B.replace("/folder.php?folder=","").replace(/\+/g," ")}}else{if(B.substr(0,7)=="mailto:"){A={type:"email",txt:B.replace("mailto:","")}}else{if(B.substr(0,3)=="/f/"){A={type:"file",txt:decodeURIComponent(B.substr(3)).replace(/\+/g," ")}}else{if(B.charAt(0)=="/"){A={type:"page",txt:Util.undashified_link(B.substr(1))}}else{A={type:"url",txt:B}}}}}A.url=B;return A},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",txt:"ob_item_txt",css:"ob_item_txt",mp3:"ob_item_audio",htm:"ob_item_html",html:"ob_item_html"},addObjectTooltip:function(F,E){if(E.type!=="page"&&Util.isPreviewable(E.name)){var B="/f/"+E.mtime+"-180p/"+encodeURIComponent(E.name);if(E.wiki&&E.wiki!=PBinfo.CurrentWiki.name){B=Util.URLRelativeToContext(B,{wiki:E.wiki})}var D="img-"+Math.round(Math.random()*1000000);var A='<span id="'+D+'"><img src="/images/loadingSmaller.gif"></span>';var C="try { $('"+D+"').remove(); } catch(e) { }";new Tooltip(F,{txt:'<div style="width: 180px;"><img src="'+B+'" alt="Loading preview image..." width="180" onload="'+C+'" />'+A+"</div>"})}},isPreviewable:function(A){return["png","gif","jpg","jpeg","pdf","ps","bmp"].indexOf(Util.getFileExtension(A))!=-1},isImageFile:function(A){return["png","gif","jpg","jpeg"].indexOf(Util.getFileExtension(A))!=-1},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:"");if(PBwiki.feature("usercard")){D.userClass+=" usercard_trigger"}if(B){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(txt){return txt.replace(eval(PBconst.kLinkifyRegex+"gi"),function(link){return'<a href="'+link+'" rel="nofollow">'+link+"</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}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}};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()}});MiniTabSwitcher=Class.create({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={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={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(){for(var A=0;A<this.initFunctions.length;A++){try{this.initFunctions[A]()}catch(B){PBwiki.warn(B,"init-error")}}document.fire("pbwiki:init");PBwiki.debug("PBwiki : init complete")},logHandler:function(C,B,A){PBwiki.log_history.push(B);if(PBwiki.log_history.length>10){PBwiki.log_history.shift()}if(C<PBwiki.ERROR_LEVEL.warn&&!PBwiki.jsDebugSent){(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.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},addInitFunction:function(B,A){this.initFunctions.push(function(){B.apply(null,A)})},initFunctions:[function(){$H(PBwiki.ERROR_LEVEL).each(function(A){PBwiki[A.key]=PBwiki.logHandler.bind(PBwiki.logHandler,A.value)});window.onerror=function(C,B,A){PBwiki.warn({message:C,url:B,lineNumber:A},"js-uncaught-error")}}],init:function(){var A=Array.prototype.shift.call(arguments);if(A.initialize){this.addInitFunction(A.initialize,arguments)}else{if(A.prototype){this.addInitFunction(function(B){(new A(B))},arguments)}else{if(Object.isFunction(A)){this.addInitFunction(A,arguments)}}}},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{if(PBwiki.feature("ajaxedit")){return"/"+Util.dashified_link(B.toString())+((A)?"?referer="+encodeURIComponent(window.location):"")+"#view=edit"}else{return"/"+encodeURIComponent(B.toString())+"?edit=1"+((A)?"&referer="+encodeURIComponent(window.location):"")}}},getSessCookie:function(){var C=PBinfo.CurrentPage.sessCookie;var B={};var A=Cookie.get(C);if(A){B[C]=A}return B},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)},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="/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({initialize:function(){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=$("page-toolbar");if(A){A.parentNode.insertBefore(B,A)}},displayError:function(A){if(!this.errMsg){this.errMsg=new Element("div",{"class":"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){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({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(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")}});PBwiki.init(PBwiki.UINotification);PBHistory=Class.create({initialize:function(A){var B={checkTime:100};Object.extend(B,A);this.options=B;this.keyList={};for(itm in this.options.items){this.keyList[itm]=new PBHistory.Key(this.options.items[itm])}},start:function(){this.timer=setInterval(this.check.bind(this),this.options.checkTime);return this},stop:function(){if(this.timer){this.timer.stop();this.timer=null}},getItems:function(){var B=location.hash;if(B.charAt(0)=="#"&&B.indexOf("=")!=-1){var A=B.substr(1).toQueryParams();for(itm in A){A[itm]=decodeURIComponent(A[itm])}return A}else{return{}}},setItems:function(B){for(itm in B){B[itm]=encodeURIComponent(B[itm])}var A=Object.toQueryString(B);if(A.length===0&&window.scrollY!==0){A="n"}if(A!=location.hash){location.hash=A}},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]},removeKey:function(B){var A=this.getItems();if(A[B]){delete A[B];this.setItems(A)}},setValues:function(B){var A=this.getItems();var C=false;for(itm in B){if(A[itm]&&(B[itm]==undefined||B[itm]==null)){delete A[itm];this.getKey(itm).lastVal=null;continue}if(A[itm]==B[itm]){continue}C=true;this.getKey(itm).lastVal=B[itm];A[itm]=B[itm]}if(C){this.setItems(A)}},getValue:function(B){var A=this.getItems();return A[B]}});Object.Event.extend(PBHistory);PBHistory.Key=Class.create({initialize:function(A){this.options=A||{}},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(function(){PBwiki.History=new PBHistory()});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,C){if(PBinfo.noStatics){var A=PBconst.kStaticDebugDirectory+"debug.php?manifest="+B+"&rand"+Math.random()}else{var A="/shared/statics/"+B}PBwiki.ResourceLoader.load(A,C)},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){var D=window.location.host.substr(window.location.host.indexOf(".")+1);return window.location.protocol+"//vs1."+D+B.replace("."+A,"-v"+pbBuildTime+"."+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({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({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").update(this.options.txt);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){var A=new Element("strong");A.appendChild(this.span);this.elm.appendChild(A)}else{this.elm.appendChild(this.span)}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,{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,{create:function($super){$super();this.placeholder=new Element("div",{id:this.options.id+"_placeholder"});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(A){A.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:PBwiki.ResourceLoader.getStaticURI("/swf/swfupload.swf"),prevent_swf_caching:false,custom_settings:{progressTarget:"fsUploadProgress1"},debug:true};this.swf=new SWFUpload(A)},debug:function(A){}});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(function(){if(/MSIE/.test(navigator.userAgent)&&$$("div.button-bar").length>0){Event.observe(window,"resize",PBwiki.Components.IEButtonFix)}});var Tooltip=Class.create();Tooltip.setup=function(){document.observe("mousemove",function(A){this.xCord=Event.pointerX(A);this.yCord=Event.pointerY(A)}.bind(Tooltip))};var Tooltips={addLinkTooltips:function(A){A.select("a.preview").each(function(B){var C=B.getAttribute("href");if(!C||C.indexOf("/f/")==-1||!Util.isPreviewable(C)||!B.getAttribute("time")||B.hasTooltip){return }var D="/f/"+B.getAttribute("time")+"-180p/"+encodeURIComponent(C.substr(C.lastIndexOf("/")+1));if(B.getAttribute("wiki")){D=Util.URLRelativeToContext(D,{wiki:B.getAttribute("wiki")})}new Tooltip(B,{txt:'<div style="width: 180px;"><img src="'+D+'" alt="Loading preview image..." width="180" /></div>'});B.hasTooltip=true})}};Tooltip.prototype={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.xCord=Event.pointerX(A);this.yCord=Event.pointerY(A);if(!this.initialized){this.timeout=window.setTimeout(this.appear.bind(this),this.options.delay)}},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()}}this._clearTimeout(this.timeout);this.initialized=false},update:function(A){this.xCord=Event.pointerX(A);this.yCord=Event.pointerY(A);this.setup()},updateCoords:function(){this.xCord=Tooltip.xCord;this.yCord=Tooltip.yCord},checkNode:function(){if(!this.el||!this.el.up("body")){this.hide()}else{if(this.initialized){setTimeout(this.checkNode.bind(this),1000)}}},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.tooltip.childNodes[1].innerHTML=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.xCord+this.options.width>=Element.getWidth(document.body)){this.options.align="right";this.xCord=this.xCord-this.options.width+20}this.tooltip.style.left=this.xCord-7+"px";this.tooltip.style.top=this.yCord+22+"px"},_clearTimeout:function(A){clearTimeout(A);clearInterval(A);return null}};PBMenu=Class.create({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)}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(){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){B.stop();B.element().blur();if(B.element().disabled){return }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"});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(){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({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);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={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(A){new PBwiki.APIRequest("SetObjectStarred",{name:A.name,starred:A.starred},A);if(PBinfo.GetUserPrefs){if(!A.starred){PBinfo.GetUserPrefs.starred=PBinfo.GetUserPrefs.starred.without(A.name)}else{PBinfo.GetUserPrefs.starred.push(A.name)}}if(PBinfo.CurrentPage.page==A.name){PBinfo.CurrentPage.starred=A.starred}document.fire("data:objectStarred",A)}};var UserPrefs={};UserPrefs.Manager={initialize:function(){var A=$("expand-collapse-page-link");if(!A){return }if(PBwiki.UserPrefs.get(PBconst.kSideBarCollapsed)){this.setCollapsed(true)}A.observe("click",function(B){try{B.stop();B.element().blur()}catch(B){}try{this.setCollapsed(!this.isCollapsed());if(PBwiki.getUID()){PBwiki.UserPrefs.set(PBconst.kSideBarCollapsed,this.isCollapsed())}}catch(B){alert(B.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.initialize.bind(UserPrefs.Manager));PBwiki.APIRequest=Class.create({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){if(PBinfo.GetTimes[G]){F[G]=PBinfo.GetTimes[G]}});Object.extend(C,F);C._bt=pbBuildTime}if(this.options.method=="get"&&this.options.allowDefer){this.args[PBconst.kAPIAllowDeferWhenBusy]=Math.random();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,B){B.op=A;return"/api_v2/?"+Object.toQueryString(B)},abortRequest:function(){this.setWaitCursor(false);try{this.apiRequest.transport.abort()}catch(A){}this.isAborted=true},dispatchError:function(B,A){this.setWaitCursor(false);if(this.options.onFailure){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.args[PBconst.kAPIAllowDeferWhenBusy]=Math.random();this.apiUrl=this.buildUri(this.m,this.args);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){PBwiki.error(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,{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={enabledLayers:["LocalCache","DOMObjectListNonVerbose"],initialize:function(){PBwiki.Data.Instances=[];if(PBwiki.feature("object_storage")){PBwiki.Data.enabledLayers.push("DOMObjectListNOM")}PBwiki.Data.enabledLayers.each(function(A){PBwiki.Data.Instances.push(new PBwiki.Data.Layers[A])})},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({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}PBwiki.info("HAS DATA");if(this.methods.indexOf(A)==-1){return false}PBwiki.info("METHOD MATCHES");if(!this.checkTimes()){return false}return true},filter:function(A,D,J,B,L){A=A.objects;var H=A.length,J=Object.clone(J),M=[],K={};switch(D){case"GetPages":J.type="page";break;case"GetFiles":J.type="file";break;case"GetObjectsNOM":try{J.parent_id=J.folder?this._foldernameToID(A,J.folder):0;M=J.parent_id?this.getParents(A,J.parent_id):[]}catch(I){}break}if(J.type||J.filter||typeof (J.folder)!="undefined"||typeof (J.parent_id)!="undefined"){var C=[];for(var G=0;G<A.length;G++){if(typeof (J.parent_id)=="undefined"&&typeof (J.folder)!="undefined"&&J.folder!=A[G].folder&&!(J.folder==""&&!A[G].folder)){continue}if(typeof (J.parent_id)!="undefined"){if(!A[G].parent_id){A[G].parent_id=0}if(J.parent_id!=A[G].parent_id){continue}K["_total_"+A[G].type]=!K["_total_"+A[G].type]?1:K["_total_"+A[G].type]+1}if(J.type&&A[G].type!=J.type){continue}if(J.object_types&&J.object_types.indexOf(A[G].type)==-1){continue}if(J.filter&&A[G].name.toLowerCase().indexOf(J.filter.toLowerCase())===-1){continue}C.push(A[G])}A=C;H=C.length}if(J.anchor){for(var G=0;G<A.length;G++){if(J.anchor==A[G].name){var F=G;var E=Math.floor(G/J.count);J.offset=E*J.count;break}}if(!F){J.offset=0}}if(J.sortby&&J.sortby!="name"){A=A.sort(function(O,N){if(O.type=="folder"&&N.type!="folder"){return -1}else{if(N.type=="folder"&&O.type!="folder"){return 1}}return(O[J.sortby]<N[J.sortby])?-1:(O[J.sortby]>N[J.sortby])});delete this.list}if(J.reverse){A=A.reverse();delete this.list}if(J.count||J.offset){A=A.slice(J.offset,J.offset+J.count)}var C={_total_count:H,_args:J,_used_dom_storage:true};if(F){C._anchor=F;C._block=E}if(D=="GetObjects"||D=="GetObjectsNOM"){C.objects=A}else{if(D=="GetPages"){C.pages=A}else{if(D=="GetFiles"){C.files=A}}}if(D=="GetObjectsNOM"){C.parents=M;Object.extend(C,K)}return C},getParents:function(C,D){var A=[];var B=this._objectAttrs(C,D);if(B){B=this._objectAttrs(C,B.parent_id)}while(B){A.push(Object.clone(B));B=this._objectAttrs(C,B.parent_id)}return A},_objectAttrs:function(B,A){return B.find(function(C){return C.oid==A})},_foldernameToID:function(A,B){return A.find(function(C){return C.type=="folder"&&C.name==B}).oid},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.DOMObjectListNonVerbose=Class.create(PBwiki.Data.Layers.DOMStorageCache,{fetchMethod:"GetObjects",methods:["GetObjects","GetPages","GetFiles"],cacheTimes:["page_list_time","filetime","permtime","foldertime"],storageKey:"objListNonVerbose_v2",check:function($super,A,B,D,C){if(this.methods.indexOf(A)==-1||B.verbose==false||B.detail!="partial"||D.priority==PBwiki.Data.NO_CACHE){return }var E=false;if($super(A,B,D,C)){if(!this.list){this.list=this.getData(this.storageKey).evalJSON()}E=this.filter(this.list,A,B,D,C)}if(!E){this.checkFetch(A,B,D)}return E},checkFetch:function(A,C,E){if(this.isFetching){return }var D=E.priority||PBwiki.Data.MED_PRIORITY;var B=PBinfo.CurrentWiki.pagecount+PBinfo.CurrentWiki.filecount>1000;if(!this.hasDOMStorage()){if(!D==PBwiki.Data.HIGH_PRIORITY&&!B){return }}if(D==PBwiki.Data.LOW_PRIORITY||B&&D<PBwiki.Data.HIGH_PRIORITY){return }if(!this.checkStorage()){return }if(this.timeout){clearTimeout(this.timeout)}this.timeout=setTimeout(this.doRequest.bind(this),300)},doRequest:function(){if(this.isFetching){return }this.isFetching=true;new PBwiki.APIRequest(this.fetchMethod,{verbose:true,detail:"partial",sortby:"name"},{onSuccess:function(A){this.storeData(this.storageKey,A);this.storeData(this.storageKey+"-times",Object.toJSON({_perm_cache_times:Object.clone(PBinfo.GetTimes),_uid:PBwiki.getUID()}));document.fire("data:nonVerboseListLoaded");this.isFetching=false}.bind(this),method:"get",priority:PBwiki.Data.NO_CACHE,cacheability:this.cacheTimes,raw:true})}});PBwiki.Data.Layers.DOMObjectListNOM=Class.create(PBwiki.Data.Layers.DOMStorageCache,{fetchMethod:"GetObjectsNOM",methods:["GetObjectsNOM"],cacheTimes:["foldertime","pagetime","filetime","permtime"],storageKey:"objListNOM_v2",check:function($super,A,B,D,C){if(this.methods.indexOf(A)==-1||B.recursive||D.priority==PBwiki.Data.NO_CACHE){return }var F=false;if($super(A,B,D,C)){try{if(!this.list){this.list=this.getData(this.storageKey).evalJSON()}if(this.list&&this.list.objects&&this.list.objects.length>0){F=this.filter(this.list,A,B,D,C)}}catch(E){}}if(!F){this.checkFetch(A,B,D)}return F},checkFetch:function(A,C,E){if(this.isFetching){return }var D=E.priority||PBwiki.Data.MED_PRIORITY;var B=PBinfo.CurrentWiki.pagecount+PBinfo.CurrentWiki.filecount>1000;if(!this.hasDOMStorage()){if(!D==PBwiki.Data.HIGH_PRIORITY&&!B){return }}if(D==PBwiki.Data.LOW_PRIORITY||B&&D<PBwiki.Data.HIGH_PRIORITY){return }if(!this.checkStorage()){return }if(this.timeout){clearTimeout(this.timeout)}this.timeout=setTimeout(this.doRequest.bind(this),300)},doRequest:function(){if(this.isFetching){return }this.isFetching=true;new PBwiki.APIRequest(this.fetchMethod,{sortby:"name"},{onSuccess:function(A){this.storeData(this.storageKey,A);this.storeData(this.storageKey+"-times",Object.toJSON({_perm_cache_times:Object.clone(PBinfo.GetTimes),_uid:PBwiki.getUID()}));document.fire("data:nomListLoaded");this.isFetching=false}.bind(this),method:"get",priority:PBwiki.Data.NO_CACHE,cacheability:this.cacheTimes,raw:true})}});PBwiki.Data.Layers.LocalCache=Class.create({check:function(F,D,E){if(E.cacheability&&PBinfo.GetTimes){var C=E.key||F;if(!PBinfo[C]){return }var A=Object.clone(D);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())){return false}if(Object.toJSON(A.values().sort())!=Object.toJSON(B.values().sort())){return false}return PBinfo[C]}return false}});PBwiki.APIDeferredRequestNotice=Class.create({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.Components=PBwiki.Components||{};PBwiki.Components.ScrollArea=Class.create({initialize:function(A){this.options=Object.extend({distanceThreshold:1,blockSize:PBconst.kScrollAreaBlockSize,scrollInterval:300,endInterval:200},A);try{this.setup(A.count,A.itm)}catch(B){this.options.elm.update(B.message+" "+B.line)}},onScroll:function(A){if(this.endTimeout){clearTimeout(this.endTimeout);delete this.endTimeout}this.endTimeout=setTimeout(this.checkAddBlocks.bind(this),this.options.endInterval);if(!this.scrollTimeout&&this.doScrollLoading){this.scrollTimeout=setTimeout(function(){delete this.scrollTimeout;this.checkAddBlocks()}.bind(this),this.options.scrollInterval)}},posToNodeNumber:function(A){return Math.round(A/this.options.height)+Math.round(this.numVisible/2)},nodeNumToBlockNum:function(A){return(A>this.options.count)?Math.floor(this.options.count/this.options.blockSize):Math.floor(A/this.options.blockSize)},posToBlockNum:function(A){return this.nodeNumToBlockNum(this.posToNodeNumber(A))},checkAddBlocks:function(){var A=Math.max(0,this.options.elm.scrollTop-(this.options.visibleHeight*this.options.distanceThreshold));var B=Math.min(this.totalHeight,this.options.elm.scrollTop+this.options.visibleHeight+(this.options.visibleHeight*this.options.distanceThreshold));var C=$R(this.posToBlockNum(A),this.posToBlockNum(B));C.each(function(D){if(this.blocks[D]){return }this.loadBlock(D)},this)},loadBlock:function(C,B){var A=Object.clone(this.options.args);if(B){A.anchor=B;delete A.offset}else{A.offset=C*this.options.blockSize}A.count=this.options.blockSize;new PBwiki.APIRequest(this.options.op,A,{onSuccess:this.blockLoaded.bind(this,C),cacheability:this.options.cacheTimes,key:this.options.key})},blockLoaded:function(B,E){var A=E._block||B;var D=A*this.options.blockSize;this.blocks[A]=true;this.lastAPIResult=E;if(E._total_count!==this.options.count){this.setCount(E._total_count)}if(!this.firstBlockLoaded){this.firstBlockLoaded=true;this.notify("onFirstBlock",E)}if(E._anchor){var F=E._anchor*this.options.height;this.options.elm.setAttribute("_scrollTop",F);this.options.elm.scrollTop=F}for(var C=0;C<E[this.options.dataKey].length;C++){this.loadNode(D+C,E[this.options.dataKey][C])}if(!E._total_count){this.setEmptyMsg();return }this.setLoadingStatus(false)},loadNode:function(B,A){if(this.nodes[B]){return }this.nodes[B]=new Element("div").addClassName(this.options.nodeClass).setStyle({zoom:1,position:"absolute",top:(B*this.options.height)+"px"});if(B%2==1){this.nodes[B].addClassName("alternate")}this.container.appendChild(this.nodes[B]);this.notify("onRowRender",this.nodes[B],A,null,B)},setup:function(A,B){this.nodes={};this.blocks={};this.options.count=A;if(A===0){return this.setEmptyMsg()}if(!this.container){this.container=new Element("div");this.options.elm.appendChild(this.container);this.scrollHandler=this.onScroll.bind(this);this.options.elm.observe("scroll",this.scrollHandler);this.setLoadingStatus(true)}this.setVisibleHeight();this.doScrollLoading=PBwiki.Data.getInstance("DOMObjectListNonVerbose").hasData();this.notify("onLoaded");if(A){this.setCount(A)}else{this.totalHeight=this.options.height}if(B){this.loadBlock(false,B)}else{this.checkAddBlocks()}},setLoadingStatus:function(A){if(A&&!this.loading){this.loading=new Element("div",{"class":"loading"}).setStyle({position:"absolute",left:"33%"}).update("Loading&hellip;");this.container.appendChild(this.loading)}else{if(!A&&this.loading){try{this.container.removeChild(this.loading)}catch(B){}}}},setEmptyMsg:function(){this.clear();if(!this.options.hideEmptyMsg){this.options.elm.appendChild(new Element("span").update(this.options.emptyMsg).addClassName("empty"))}this.notify("onLoaded")},setCount:function(A){this.totalHeight=A*this.options.height;this.container.setStyle({position:"relative",height:this.totalHeight+"px"});this.notify("onRowCount",this.lastAPIResult)},setVisibleHeight:function(A){if(A){this.options.visibleHeight=A}this.numVisible=Math.round(this.options.visibleHeight/this.options.height);this.options.elm.setStyle({height:this.options.visibleHeight+"px"})},clear:function(){if(this.container){this.options.elm.update("");this.options.elm.stopObserving("scroll",this.scrollHandler)}this.nodes={}}});Object.Event.extend(PBwiki.Components.ScrollArea);PBwiki.SideBar={itemList:{},initialize:function(){if(!$("sidebarModules")){return }$("sidebarModules").select("div.sidebox").each(function(D){if(D.id.indexOf("-")==-1){return }var C=D.id.split("-");var A=C[1];var E=PBwiki.SideBar[A.capitalize()+"Item"];try{if(E){PBwiki.SideBar.itemList[A]=new E(D,Object.clone(PBinfo.GetUserPrefs.sidebar[A]||{}))}}catch(B){PBwiki.error(B);PBinfo.CurrentWiki.debug=true;PBwiki.jsDebug(B.message)}});Sortable.SERIALIZE_RULE=/^[^_\-](?:[A-Za-z0-9\-\_]*)[-](.*)$/;Sortable.create("sidebarModules",{tag:"div",handle:"header",onUpdate:function(){Util.tracking("sidebar-reorder");PBwiki.SideBar.saveState()}})},saveState:function(){if(!PBwiki.getUID()){return }var A={};Sortable.sequence("sidebarModules").each(function(B){if(B){A[B]=PBwiki.SideBar.itemList[B].getValidOptions()}});PBwiki.UserPrefs.set("sidebar",A)},navigatorRoot:function(){return"NestedFolderView"}};PBwiki.SideBar.Module=Class.create({validOptions:["collapsed","ysize","numChanges"],initialize:function(C,A){this.elm=C;this.title=C.down("h3");this.closeToggle=C.down("a.togglemodule");this.header=C.down("div.header");this.content=C.down("div.content");this.footer=C.down("div.footer");this.options=A;try{this.init();if(!this.options.collapsed){this.refresh()}}catch(B){this.content.update(B.message);PBinfo.CurrentWiki.debug=true;PBwiki.jsDebug(B.message)}if(this.closeToggle){this.closeToggle.observe("mousedown",this.toggle.bind(this))}this.header.observe("dblclick",this.toggle.bind(this))},loading:function(){this.content.setStyle({height:this.getModuleHeight()+"px"});this.content.update("");this.content.appendChild(new Element("div",{"class":"loading"}).update("Loading&hellip;"))},getModuleHeight:function(){return this.options.ysize},setupModuleResize:function(A){this.clearModuleResize();this.resizeOpts=A;this.footer.addClassName("resizeable");this.resizeDownFunction=this.resizeDown.bind(this);this.footer.observe("mousedown",this.resizeDownFunction)},resizeDown:function(A){A.stop();this.startY=Event.pointerY(A);this.resizeMoveFunction=this.resizeMove.bind(this);document.observe("mousemove",this.resizeMoveFunction);this.resizeUpFunction=this.resizeUp.bind(this);document.observe("mouseup",this.resizeUpFunction);document.onselectstart=function(){return false};Element.setStyle(document.body,{cursor:"row-resize"});this.resizeOpts.onStart()},resizeUp:function(B){document.stopObserving("mousemove",this.resizeMoveFunction);document.stopObserving("mouseup",this.resizeUpFunction);B.stop();var A=Event.pointerY(B);var C=A-this.startY;document.onselectstart=null;Element.setStyle(document.body,{cursor:"default"});this.resizeOpts.onSize(C);this.resizeOpts.onFinish(C)},resizeMove:function(B){B.stop();var A=Event.pointerY(B);var C=A-this.startY;this.resizeOpts.onSize(C)},clearModuleResize:function(){this.footer.removeClassName("resizeable");this.footer.stopObserving("mousedown",this.resizeDownFunction)},toggle:function(A){A.stop();if(this.elm.hasClassName("minimized")){this.elm.removeClassName("minimized");delete this.options.collapsed;this.onMaximized()}else{this.elm.addClassName("minimized");this.options.collapsed=true;this.onMinimized()}Util.tracking("sidebar-toggle");PBwiki.SideBar.saveState()},getValidOptions:function(){var A={};for(itm in this.options){if(this.validOptions.indexOf(itm)!=-1){A[itm]=this.options[itm]}}return A},init:function(){},refresh:function(){},onMinimized:function(){this.content.hide()},onMaximized:function(){this.content.show()}});PBwiki.SideBar.FoldersItem=Class.create(PBwiki.SideBar.Module,{name:"folders",title:"Navigator",minResizeHeight:100,init:function(){this.elm.addClassName("minibrowser")},selectView:function(B,A){if(this.view&&this.view.isLoading){return }delete this.view;this.view=new PBwiki.SideBar.FoldersItem[B](A,this).refresh()},getFolderObjectCount:function(B,D){if(!B||B==""){var A=0;D.split(",").each(function(E){A+=PBinfo.GetFolders["unfiled_"+E+"count"]});return A}var C=PBinfo.GetFolders.folders.find(function(E){return E.name==B});var A=0;D.split(",").each(function(E){if(C){A+=C[E+"count"]}});return A},getModuleHeight:function(){return(this.options.ysize||PBconst.kFoldersDefaultHeight)},refresh:function(){if(this.view){this.view.refresh()}else{this.selectView(PBwiki.SideBar.navigatorRoot(),{slide:false,folder:PBinfo.CurrentPage.folder||""})}this.setupNavigatorResize()},setupNavigatorResize:function(){this.setupModuleResize({onStart:function(){if(!this.view||this.view.isLoading){return }this.startHeight=this.getModuleHeight()-this.view.getControlHeight()}.bind(this),onSize:function(B){if(!this.view||this.view.isLoading){return }var A=this.startHeight+B;if(A+this.view.getControlHeight()<100){A=100-this.view.getControlHeight()}this.view.setHeight(A)}.bind(this),onFinish:function(A){if(!this.view||this.view.isLoading){return }this.options.ysize=this.view.newContent.getHeight();PBwiki.SideBar.saveState()}.bind(this)})},onMinimized:function(){this.clearModuleResize();this.content.hide()},onMaximized:function(){if(this.view){this.content.show();this.setupNavigatorResize()}else{this.refresh()}}});PBwiki.SideBar.FoldersItem.ObjectView=Class.create({requestOpts:{},objectHeight:27,controlHeight:28,initialize:function(B,A){this.mb=A;this.content=A.content;this.isLoading=true;this.effectsActive=(typeof document.body.style.maxHeight!="undefined");this.visibleHeight=(this.mb.options.ysize||PBconst.kFoldersDefaultHeight);this.newContent=new Element("div",{"class":"content"});this.newList=new Element("div",{"class":"mblist"});this.newContent.appendChild(this.newList);this.setHeight();this.param=B;return this},refresh:function(){if(this.param.slide&&this.effectsActive){new PBEffect.SlideLeft({elm:this.content,onFinish:function(){this.isLoading=false}.bind(this),newElm:this.newContent,reverse:this.param.reverse})}else{this.content.parentNode.replaceChild(this.newContent,this.content);this.isLoading=false}return this},onLoaded:function(){var A=this.newContent.down("div.mblist");if(A){A.scrollTop=A.getAttribute("_scrollTop")||0;if(Prototype.Browser.IE){setTimeout(function(){A.setStyle({position:"relative"})},50)}}this.mb.content=this.newContent},setHeight:function(A){if(!A){A=this.visibleHeight-this.getControlHeight()}this.newList.setStyle({height:A+"px"})},createFolderHeading:function(D){this.heading=new Element("div",{"class":"heading"});var B=(D.length>28)?D.toString().substring(0,28).escapeHTML()+"&hellip;":D.toString().escapeHTML();this.folderTitle=new Element("a",{"class":(D=="")?"iconbutton unfiled":"iconbutton folder",href:Util.getFolderLink(D)}).update(B||"Unfiled Items");var C,A;this.backButton=new Element("span",{"class":"folder_back"}).update("&nbsp;").observe("click",this.backLink.bind(this));this.heading.appendChild(this.backButton);this.heading.appendChild(this.folderTitle);this.newContent.insertBefore(this.heading,this.newContent.firstChild)},backLink:function(){backDestination="NestedFolderView";backOptions={folder:this.param.parent_folder,object_types:this.param.object_types,slide:true,reverse:true};this.mb.selectView(backDestination,backOptions)},createTabs:function(D,B){this.tabs=new Element("div",{"class":"tabs"});var C=new Element("a",{"class":"pages-tab"}).addClassName("filter_link").update("Pages");var A=new Element("a",{"class":"files-tab"}).addClassName("filter_link").update("Files");C.observe("click",this.selectTab.bindAsEventListener(this,"NestedFolderView",{parent_folder:this.param.parent_folder,object_types:"folder,page",slide:true}));A.observe("click",this.selectTab.bindAsEventListener(this,"NestedFolderView",{parent_folder:this.param.parent_folder,object_types:"folder,file",slide:true}));C.href=A.href="";(D=="pages")?C.addClassName("active"):A.addClassName("active");this.optionsLink=new Element("a",{"class":"folder_properties",href:B||Util.getFolderLink(this.param.folder)});this.optionsLink.appendChild(new Element("span"));this.optionsLink.appendChild(document.createTextNode("options"));this.tabs.appendChild(this.optionsLink);if(D){this.tabs.appendChild(C);this.tabs.appendChild(A)}this.newContent.appendChild(this.tabs)},getControlHeight:function(){var A=0;if(this.tabs){A+=this.controlHeight}if(this.heading){A+=this.controlHeight}return A},renderObjectRow:function(E,C,A,F){if(!A){A=C.type||this.type}E.className="mb"+A;if(F%2==(this.param.folder?1:0)){E.addClassName("alternate")}if(A=="folder"){E.observe("click",this.folderLink.bind(this,C));E.appendChild(new Element("a",{href:"javascript:void(0);","class":"iconbutton folder"}).update(C.name.toString().escapeHTML()))}else{if(A=="page"){var D=new Element("a",{href:"/"+Util.dashified_link(C.name.toString())}).update(C.name.toString().escapeHTML());E.appendChild(D);if(PBinfo.CurrentPage.page==C.name){D.setStyle({fontWeight:"bold"})}if(this.starredPages&&this.starredPages.indexOf(C.name)!==-1){E.addClassName("starred")}}else{if(A=="file"){var B=Util.iconMap[Util.getFileExtension(C.name.toString())];E.appendChild(new Element("a",{href:encodeURI("/f/"+C.name)}).addClassName("iconbutton").addClassName(B).update(C.name.toString().escapeHTML()));Util.addObjectTooltip(E,C)}}}return E},setupScrollableArea:function(){this.requestOpts.folder=this.param.folder;this.scrollable=new PBwiki.Components.ScrollArea({visibleHeight:this.visibleHeight-this.getControlHeight(),elm:this.newList,height:this.objectHeight,count:this.getObjectCount(),op:this.apiMethod,args:this.getRequestOpts(),dataKey:this.dataKey||this.type+"s",cacheTimes:this.cacheTimes,nodeClass:"mb"+this.type,onRowRender:this.renderObjectRow.bind(this),onLoaded:this.onLoaded.bind(this),emptyMsg:"No "+this.type+"s",itm:(this.param.folder==PBinfo.CurrentPage.folder)?PBinfo.CurrentPage.page:false,key:this.key})},selectTab:function(C,A,B){C.stop();Object.extend(B,{folder:this.param.folder,slide:false});this.mb.selectView.bind(this.mb,A,B)()},getRequestOpts:function(){return this.requestOpts}});PBwiki.SideBar.FoldersItem.NestedFolderView=Class.create(PBwiki.SideBar.FoldersItem.ObjectView,{apiMethod:"GetObjectsNOM",dataKey:"objects",requestOpts:{sortby:"name",object_types:"folder,page"},cacheTimes:["foldertime","filetime","pagetime","permtime"],folderLink:function(A){this.mb.selectView.bind(this.mb,"NestedFolderView",{parent_folder:this.param.folder,object_types:this.param.object_types,folder:A.name,count:A.count,slide:true})()},starredLink:function(){this.mb.selectView.bind(this.mb,"StarredView",{slide:true})()},refresh:function($super){$super();if(this.param.folder){this.createFolderHeading(this.param.folder)}PBwiki.UserPrefs.Stars.get_starred_objects(function(C){this.starredPages=C}.bind(this));if(PBwiki.getUID()&&!this.param.folder){var B=new Element("div").setStyle({position:"relative",height:"27px"});var A=new Element("div",{"class":"mbfolder"}).observe("click",this.starredLink.bind(this,{name:""}));A.setStyle({position:"absolute",top:0});A.appendChild(new Element("a",{href:"javascript:void(0);","class":"iconbutton starred"}).update("Starred Pages"));B.appendChild(A);this.newList.appendChild(B)}this.newContent.appendChild(this.newList);this.createTabs(this.param.object_types=="folder,file"?"files":"pages");this.setupScrollableArea();this.setHeight();return this},setupScrollableArea:function(){this.requestOpts.folder=this.param.folder;this.scrollable=new PBwiki.Components.ScrollArea({visibleHeight:this.visibleHeight-this.getControlHeight(),elm:this.newList,height:this.objectHeight,op:this.apiMethod,args:this.getRequestOpts(),dataKey:this.dataKey||this.type+"s",cacheTimes:this.cacheTimes,onRowRender:this.renderObjectRow.bind(this),onLoaded:this.onLoaded.bind(this),onFirstBlock:function(A){if(A.parents&&A.parents.length>0){this.param.parent_folder=A.parents[0].name}if(this.newContent.down("a.files-tab")){this.newContent.down("a.files-tab").update(A._total_file?"Files":"No Files")}}.bind(this),emptyMsg:"No "+(this.param.object_types=="folder,file"?"files":"pages"),itm:(this.param.folder==PBinfo.CurrentPage.folder)?PBinfo.CurrentPage.page:false,key:this.key})},getRequestOpts:function(){if(this.param.object_types){this.requestOpts.object_types=this.param.object_types}return Object.extend(this.requestOpts,{folder:this.param.folder})},getObjectCount:function(){return this.mb.getFolderObjectCount(this.param.folder,this.param.object_types||"folder,page")}});PBwiki.SideBar.FoldersItem.StarredView=Class.create(PBwiki.SideBar.FoldersItem.ObjectView,{type:"page",createStarredHeading:function(){this.heading=new Element("div",{"class":"heading"});this.starredTitle=new Element("a",{"class":"iconbutton starred",href:""}).update("Starred Pages");this.backButton=new Element("span",{"class":"folder_back"}).update("&nbsp;").observe("click",this.mb.selectView.bind(this.mb,PBwiki.SideBar.navigatorRoot(),{folder:"",slide:true,reverse:true})).update(" ");this.heading.appendChild(this.backButton);this.heading.appendChild(this.starredTitle);this.newContent.insertBefore(this.heading,this.newContent.firstChild)},refresh:function($super){$super();PBwiki.UserPrefs.Stars.get_starred_objects(function(A){this.createStarredHeading();this.starredPages=A;A.each(function(B){this.newList.appendChild(this.renderObjectRow(new Element("div",{"class":"mbpage"}),{name:B}))}.bind(this));if(A.length==0){this.newList.appendChild(new Element("span").update("No Starred Items").addClassName("empty"))}if(PBwiki.getUID()){this.createTabs(false,"/user/"+PBwiki.getUID())}this.setHeight();this.onLoaded()}.bind(this));return this},getObjectCount:function(){return PBinfo.CurrentWiki.starredcount}});PBwiki.SideBar.SidebarItem=Class.create(PBwiki.SideBar.Module,{name:"sidebar"});PBwiki.SideBar.RecentactivityItem=Class.create(PBwiki.SideBar.Module,{name:"recentactivity",title:"Recent Activity",cacheTimes:["pagetime","filetime","permtime","foldertime","commenttime"],changeOpIcons:{added:"createpage","added via email":"emailicon",removed:"pageremovedicon","revision removed":"revisionremoved",deleted:"revisionremoved",changed:"pageediticon",edited:"pageediticon",completed:"pageediticon",reverted:"reverticon",uploaded:"uploadfiles","commented on":"commenticon"},template:'<ul id="recentactivity">#{changeItems}</ul><a class="moreactivity" href="/changes.php">More activity...</a>',row:'<li class="#{icon}"><a class="ellipses preview" time="#{time}" href="#{url}">#{escapedName}</a>#{op_word} by #{userLink}</li>',rowUserUpdate:'<li class="#{icon} user_update">#{userLink} &#8220;<span class="user_update">#{updateMessage}</span>&#8221;</li>',init:function(){document.observe("event:_list",this.mergeNewEvents.bindAsEventListener(this));document.observe("live:changelist",this.liveChangeListener.bindAsEventListener(this));if(!this.options){this.options={}}if(!this.options.ysize){this.options.ysize=90}if($("new-recent-activity-refresh")){$("new-recent-activity-refresh").observe("click",function(A){if(A){A.stop()}$("new-recent-activity").hide();this.loading();this.refresh()}.bindAsEventListener(this))}},liveChangeListener:function(A){if(PBinfo.CurrentWiki&&A.memo&&A.memo.context&&A.memo.context.wiki===PBinfo.CurrentWiki.name&&!this.alreadyInChanges(A.memo)){this.checkNewActivityCount()}},alreadyInChanges:function(A){if(!this.changes||!A.change||!A.change.hash){return true}return this.changes.pluck("hash").include(A.change.hash)},checkNewActivityCount:function(){if(!this.changes||!this.changes.length>0){return }new PBwiki.APIRequest("GetChanges",{after_hash:this.changes.pluck("hash")[0]},{onSuccess:function(A){this.setNewRecentActivityCount(A.changes.length)}.bind(this),onFailure:this.setNewRecentActivityCount.bind(this,0)})},setNewRecentActivityCount:function(A){if(this.options.collapsed){return }if(A>0){$("new-recent-activity-count").update(A);if(A==1){$("new-recent-activity-plural").update("")}else{$("new-recent-activity-plural").update("s")}$("new-recent-activity").show()}else{$("new-recent-activity").hide();$("new-recent-activity-count").update(A)}},refresh:function(){new PBwiki.APIRequest("GetChanges",{count:this.getNumberChanges()},{cacheability:this.cacheTimes,onSuccess:this.update.bind(this),onFailure:this.showNoChanges.bind(this)})},getNumberChanges:function(){return(parseInt(this.options.numChanges)||PBconst.kRecentChangesNumber)},mergeNewEvents:function(B){if(B.memo.length>0){var A=B.memo.reverse();var C=0;var D=this.changes[0].toJSON();A.each(function(E){if(E.toJSON()===D){throw $break}else{C++}});this.changes.splice(-C);this.update({changes:A.splice(0,C).concat(this.changes)})}},update:function(F){$("new-recent-activity").hide();$("new-recent-activity-count").update("0");var B="";var E=new Template(this.row);var D=new Template(this.rowUserUpdate);var C=0;this.changes=F.changes;F.changes.each(function(H){try{if(H.type=="userupdate"){H.icon="pageicon";H.updateMessage=H.data.escapeHTML();H.userClass="user";H.userLink=Util.authorLinkFromObject(H);B+=D.evaluate(H)}else{H.icon=this.changeOpIcons[H.op_word]||"pageicon";if(H.type=="folder"){H.icon="foldericon"}H.escapedName=H.title.toString().escapeHTML();H.userClass="user";H.userLink=Util.authorLinkFromObject(H);B+=E.evaluate(H)}}catch(G){PBwiki.error(G)}C++;if(C==this.getNumberChanges()){throw $break}}.bind(this));if(F.changes.length==0){this.showNoChanges()}else{this.content.update(new Template(this.template).evaluate({changeItems:B}))}Tooltips.addLinkTooltips(this.content);this.currentChanges=this.content.down("ul");this.content.setStyle({height:""});var A=(this.content.down("a"))?this.content.down("a").getHeight():0;this.currentHeight=this.content.getHeight()-(parseInt(this.content.getStyle("paddingTop"))*2)-A;this.clearModuleResize();this.setupModuleResize({onStart:function(){this.currentChanges.setStyle({position:"relative",overflow:"hidden",marginBottom:"5px"})}.bind(this),onSize:function(G){this.currentChanges.setStyle({height:(this.currentHeight+G)+"px"})}.bind(this),onFinish:function(H){this.options.numChanges=Math.round((this.currentHeight+H)/52);if(this.options.numChanges>PBconst.kRecentChangesMax){this.options.numChanges=PBconst.kRecentChangesMax}var G=(this.content.down("a"))?this.content.down("a").getHeight():0;this.content.setStyle({height:(this.options.numChanges*52)+G+"px",position:"static",overflow:"",marginBottom:""});this.refresh();PBwiki.SideBar.saveState()}.bind(this)})},showNoChanges:function(){this.content.update("There are no recent changes on this workspace.")},onMinimized:function(){this.content.update("");$("new-recent-activity").hide();this.clearModuleResize()},onMaximized:function(){this.refresh()}});PBwiki.SideBar.AddusersItem=Class.create(PBwiki.SideBar.Module,{name:"addusers",refresh:function(){this.errMsg=this.content.down("p.validation-error");this.email=this.content.down(".add_user_email");new InputText(this.email);this.content.down(".add_user_form").observe("submit",function(C){C.stop();var A=this.email.value;if(this.email.value==this.email.getAttribute("ui:placeholder")){this.doErrorMessage("Please enter an email address");return }var B=Util.is_valid_email(A);if(B!==true){this.doErrorMessage(B);return }new PBwiki.APIRequest("AddUser",{email:A,perm:"write",invite:true,demote:false},{onSuccess:this.addUserSuccess.bind(this),onFailure:this.doErrorMessage.bind(this)});Util.tracking("share-this-workspace")}.bind(this))},doErrorMessage:function(A){this.errMsg.update(A).show();if(this.errTimer){clearTimeout(this.errTimer)}this.errTimer=setTimeout(function(){this.errMsg.hide();this.errTimer=null}.bind(this),5000)},addUserSuccess:function(A){if(A.info=="added"||A.info=="created"||A.info=="accepted"){this.appendToAddList("Added "+A.email)}else{this.appendToAddList(A.email+" already exists")}this.email.value="";this.email.focus();this.errMsg.hide()},appendToAddList:function(B){if(!this.emailList){this.emailList=new Element("ul",{className:"added-emails"});this.errMsg.insert({after:this.emailList})}var A=new Element("li",{className:"iconbutton accepticon"}).update(B);this.emailList.appendChild(A);setTimeout(function(){A.style.display="none"},4000)},onMaximized:function(){this.refresh()}});PBwiki.init(PBwiki.SideBar);if(typeof (PBEffect)=="undefined"){var PBEffect={}}PBEffect.SlideLeft=Class.create({step:40,initialize:function(B){this.options=B;this.elm=B.elm;this.newElm=B.newElm;this.width=this.end=this.elm.getWidth();this.height=this.elm.getHeight();this.reverse=B.reverse;var A=this.elm.down("div.mblist");var C=(A)?A.scrollTop:0;this.container=new Element("div").setStyle({position:"relative",overflow:"hidden",width:this.width+"px",height:this.height+"px"});this.wrapper=new Element("div").setStyle({position:"relative"});this.elm.parentNode.insertBefore(this.container,this.elm);this.wrapper.appendChild(this.elm);this.wrapper.appendChild(this.newElm);this.container.appendChild(this.wrapper);this.elm.setStyle({position:"absolute",top:"0px",left:"0px",width:this.width+"px"});this.newElm.setStyle({position:"absolute",top:"0px",width:this.width+"px",left:(((this.reverse)?-1:1)*this.width)+"px"});if(A){if(Prototype.Browser.Gecko){A.setStyle({overflow:"hidden"})}A.scrollTop=C}this.duration=B.duration||300;this.time=0;this.effectTimer=setInterval(this.slide.bind(this),this.step)},checkListFix:function(){if(this.listFixed){return }var A=this.newElm.down("div.mblist");if(A){A.setStyle({overflow:"hidden"});this.listFixed=true}},slide:function(){if(this.time<this.duration){var C=this.time/this.duration;var D=(-Math.cos(C*Math.PI)/2)+0.5;var B=D*this.width;this.wrapper.setStyle({left:(((this.reverse)?1:-1)*B)+"px"});if(Prototype.Browser.Gecko){this.checkListFix()}this.time+=this.step}else{clearInterval(this.effectTimer);this.newElm.setStyle({position:"",left:0});this.wrapper.parentNode.replaceChild(this.newElm,this.wrapper);this.container.parentNode.replaceChild(this.newElm,this.container);this.elm.remove();var A=this.newElm.down("div.mblist");if(A){A.setStyle({overflow:""});A.scrollTop=A.getAttribute("_scrollTop")}this.notify("onFinish",this.height)}}});Object.Event.extend(PBEffect.SlideLeft);var Page={};Page.AccessKeys=Class.create({functions:{searchfocus:function(A){$("input-search").focus();$("input-search").fire("focus");PBwiki.debug("focus on search");Event.stop(A)},edit:function(B){if(PBinfo.CurrentPage.editor_v3){document.fire("ui:changeview",{view:"edit",offset:document.documentElement.scrollTop-$("wikicontent").cumulativeOffset()[1]})}else{if(!Page.AjaxEdit.modeEnabled){var A=$$("#edit-tab a");if(A[0]){Event.stop(B);window.location=A[0].href;PBwiki.debug("editing")}}else{document.fire("ui:editview")}}},newtask:function(A){if(PBinfo.CurrentWiki){PBwiki.ResourceLoader.loadManifest("extras.js",function(){new PBwiki.DialogCommands.NewAction({on_empty_create_milestone:true})})}}},map:{},initialize:function(){this.addShortCut("¿",this.functions.searchfocus);this.addShortCut("e",this.functions.edit);if(PBwiki.userCanCreateTask()){this.addShortCut("k",this.functions.newtask)}},addShortCut:function(A,B){if(A.length==1){this.map[A]=B}}});Page.absolutizeUserContextSection=function(){if(!$("top-content")){return }document.body.appendChild($("top-content").addClassName("abs"))};Page.EditPage={cancel:false,FCKeditor:null,isLoaded:false,onFCKComplete:function(B){var A=B.memo.editorInstance;Page.EditPage.startEdit(A)},getEditor:function(){if(typeof (FCKeditorAPI)!="undefined"){return FCKeditorAPI.GetInstance("content")}},startEdit:function(A){PBwiki.debug("Page.EditPage: fck complete");$$("#edit-toolbar input, #edit-toolbar button, #edit-toolbar a").each(function(B){B.disabled=false;B.removeClassName("disabled")});Page.EditPage.handleTagEdit();$("edit-toolbar-outer").show();Event.observe(window,"resize",Page.EditPage.resizeContentPanel2);Page.EditPage.resizeContentPanel2()},resizeContentPanel2:function(){var C=$("content___Frame");var D=$("page-footer");var B=D?D.offsetTop+D.scrollHeight+parseInt(D.getStyle("marginBottom")):0;var A=C.clientHeight+document.documentElement.clientHeight-B;A=(A<310?310:A);C.style.height=A+"px";$("edit-toolbar").down(".iconbutton").style.position="relative";if(C.contentWindow.onresize){C.contentWindow.onresize()}},resizeContentPanel:function(){try{var E=$("page-col-2");var D=$("page-side-toolbar");var A=D.clientHeight+D.offsetTop-$("inner-page").offsetTop;var B=$$(".inlinepage.")[0];B.style.minHeight=A+"px"}catch(C){}},handleTagEdit:function(){if(window.location.hash=="#tags"&&$("tagfield")){$("tagfield").focus();var A=$("tag-settings").cumulativeOffset().top;window.scrollTo(0,A)}},initialize:function(){if(PBwiki.feature("ajaxedit")&&window.location.search.toString().indexOf("edit=")==-1){return }if($("content___Frame")){Page.EditPage.isLoaded=true;Event.observe(window,"resize",Page.EditPage.resizeContentPanel);document.observe("ui:fckeditor_oncomplete",Page.EditPage.onFCKComplete);Page.EditPage.resizeContentPanel();Page.EditPage.handleTagEdit();Page.setDefaultInputFocus();Page.EditPage.Tags.initialize();Page.Thingbar.doLoad();Page.EditPage.AutoSave.start();if(!Page.AjaxEdit.modeEnabled){window.onbeforeunload=Page.EditPage.beforeUnload;UserPrefs.Manager.goFullWidth()}}else{}},beforeUnload:function(A){A=A||window.event;try{if(!Page.EditPage.cancel){var C="You have unsaved changes. Continue and discard those changes?";A.returnValue=C;return C}}catch(B){}}};Page.EditPage.AutoSave={defaultSaveInterval:45,saveInterval:45,maxSaveInterval:150,pbSpelling:false,numWords:0,stop:function(){if(this.apiRequest){this.apiRequest.abortRequest()}if(this.timer){clearTimeout(this.timer);delete this.timer}if(this.reportTimer){clearTimeout(this.reportTimer);delete this.reportTimer}document.stopObserving("ui:autosaveTrigger",this.trigger);this.enabled=false},start:function(A){if(this.enabled){return }if(!A){A={}}this.useDrafts=!!A.draft;if(this.useDrafts){this.draft=A.draft;this.saveInterval=A.saveInterval}else{this.saveInterval=this.defaultSaveInterval}this.enabled=true;this.reportTimer=setInterval(this.report.bind(this),this.saveInterval*1000);this.enableEdit();this.timer=setTimeout(this.autoSaveTrigger.bind(this),this.saveInterval*1000);this.trigger=this.autoSaveTrigger.bind(this);document.observe("ui:autosaveTrigger",this.trigger)},autoSaveTrigger:function(){if(!Page.EditPage.AutoSave.enabled||(Page.AjaxEdit.modeEnabled&&!Page.AjaxEdit.editMode)){return }delete this.timer;PBwiki.debug("AutoSave: autosaving...");var A=Page.EditPage.getEditor().GetHTML();if(this.lastHTML&&this.saveTime&&this.lastHTML==A&&PBwiki.getTimestamp()-(this.saveTime.getTime()/1000)<this.maxSaveInterval&&!this.pbSpelling){this.refresh();return }if(this.useDrafts&&!this.pbSpelling){this.saveToDraft(A)}else{this.saveToAutosave(A)}},saveToAutosave:function(B){var C={onSuccess:this.onSuccess.bind(this,B),onFailure:this.autosaveFailure.bind(this)};var A={page:PBwiki.getPageName()};var D="PutAutosave";Page.AjaxEdit.checkSizeWarning(B.length);if(this.lastHTML&&this.lastHTML==B&&!this.pbSpelling){D="SetPageLock"}else{A.spellcheck=this.pbSpelling;C.parameters={html:B}}this.apiRequest=new PBwiki.APIRequest(D,A,C)},saveToDraft:function(D,A){var E={onSuccess:this.onSuccess.bind(this,D),onFailure:this.draftFailure.bind(this)};var C={draft_id:this.draft.draft_id,page:PBwiki.getPageName()};var F="PutDraft";if(!A){var B=new diff_match_patch();E.parameters={delta:B.diff_toDelta(B.diff_main(this.lastHTML,D)),version:this.draft.v}}else{E.parameters={html:D}}this.apiRequest=new PBwiki.APIRequest(F,C,E)},draftFailure:function(B,A){if(A===600){this.saveToDraft(Page.EditPage.getEditor().GetHTML(),true);return }else{}if(!this.enabled){return }this.report();this.refresh()},refresh:function(){if(!this.timer){this.timer=setTimeout(this.autoSaveTrigger.bind(this),this.saveInterval*1000)}},pageChanged:function(){return Page.EditPage.getEditor().IsDirty()},onSuccess:function(A,B){this.lastHTML=A;if(B.spellcheck){this.spellcheck=B.spellcheck;Page.EditPage.AutoSave.pbSpelling=false;document.fire("spellcheck:update",this.spellcheck)}if(B.draft){this.draft=B.draft}if(!B.lockinfo.hasLock){document.fire("ui:edit_lock_stolen",B.lockinfo)}else{this.saveTime=new Date();if(B.wordcount){this.numWords=B.wordcount}this.report();document.fire("ui:autosaveSuccess");this.refresh()}},autosaveFailure:function(A){if(!this.enabled){return }document.fire("ui:autosaveFailure",A);this.report();this.refresh()},disableEdit:function(){var A=$$("#edit-toolbar a.button")[0];A.addClassName("disabled");A.onclick=null;A.setAttribute("href","javascript:void(0);");$("cancelButton").onclick=null;$("cancelButton").addClassName("disabled");Page.EditPage.cancel=true},enableEdit:function(){var A=$$("#edit-toolbar a.button")[0];if(A.hasClassName("disabled")){A.removeClassName("disabled");$("cancelButton").removeClassName("disabled");Page.EditPage.cancel=false}},report:function(){if(!this.saveTime){return }var A=((new Date()-this.saveTime)/1000/60).toFixed();if(this.numWords){var B="Saved "+this.numWords+" word"+((this.numWords>1)?"s":"")+" at "}else{var B="Draft saved "}B+=new Date(this.saveTime).strftime(PBconst.kPolicySimpleTimeFormat);B+=" ("+((A==0)?"less than a ":A);B+=" minute"+((A>1)?"s":"")+" ago)";$("autosave_msg").innerHTML=B}};Page.WikiPage=Class.create({initialize:function(){this.initAccessKeys();this.initStar();this.accessKeyFunctions=new Page.AccessKeys();if(PBwiki.feature("event_polling")){this.lastUpdate=PBwiki.getTimestamp();document.observe("event:mod",this.notifyOfEdit.bindAsEventListener(this));document.observe("event:com",this.notifyOfComment.bindAsEventListener(this));this.changePoller=new PeriodicalExecuter(this.pollForChanges.bind(this),60)}},initAccessKeys:function(){document.observe("keydown",function(B){var A=String.fromCharCode(B.charCode?B.charCode:B.keyCode).toLowerCase();if(B.ctrlKey&&this.accessKeyFunctions.map[A]){this.accessKeyFunctions.map[A](B);B.stop()}}.bind(this),true)},onStarClick:function(A){if(A){A.stop()}this.toggleStarState();$("pb-page-star").addClassName("working");PBwiki.UserPrefs.Stars.set_object_starred({name:PBinfo.CurrentPage.page,starred:this.starred,onFailure:this.starPageError.bind(this),onSuccess:this.didStarPage.bind(this)})},onUnstarFromLink:function(){var A=new PBwiki.Components.UnstarBubble();A.show()},initStar:function(){if(!$("pb-page-star")){return }this.starred=$("pb-page-star").hasClassName("starred");Event.observe("pb-page-star","click",this.onStarClick.bind(this));document.observe("data:objectStarred",function(A){if(A.memo){this.starred=A.memo.starred;this.updateVisualState()}}.bind(this));if(PBwiki.History.getKey("unstar").getValue()){PBwiki.History.removeKey("unstar");if(this.starred){window.setTimeout(this.onUnstarFromLink.bind(this),500)}}},didStarPage:function(A){$("pb-page-star").removeClassName("working")},starPageError:function(A){this.toggleStarState()},toggleStarState:function(A){this.starred=!this.starred;this.updateVisualState()},updateVisualState:function(){if(this.starred){$("pb-page-star").addClassName("starred")}else{$("pb-page-star").removeClassName("starred")}document.fire("ui:hideBubbles")},pollForChanges:function(){new PBwiki.APIRequest("GetChanges",{after:this.lastUpdate,reverse:false},{onSuccess:function(A){A.changes.each(function(B){document.fire("event:"+B.op,B)});document.fire("event:_list",A.changes)}});this.lastUpdate=PBwiki.getTimestamp()},notifyOfComment:function(B){if(B.memo.title!==PBwiki.getPageName()){return }var D=$("comments").down("h3");var A=D.down("a");if(!A){var C=' &mdash; <a href="#" class="reload">New comments available</a>';D.insert(C);D.down("a").observe("click",function(E){window.location.reload()})}},notifyOfEdit:function(A){if(A.memo.title!==PBwiki.getPageName()){return }if($("new-revision-available")){var B='<a href="#" class="reload">New revision available as of '+Util.time_ago(PBwiki.getTimestamp()-A.memo.time-PBwiki.timeOffset)+" ago</a>";$("new-revision-available").update(B);$("new-revision-available").show();$("new-revision-available").down("a").observe("click",function(C){window.location.reload()})}}});Page.setDefaultInputFocus=function(){$$("input[type=text], input[type=password]").each(function(A){if(A.getAttribute("ui:defaultfocus")){A.focus()}})};PBwiki.init(function(){$$("a.pb-delete-revision").invoke("observe","click",function(){if(!confirm("Are you sure you want to delete the revision?")){return }(new PBwiki.APIRequest("DeletePage",{page:this.getAttribute("page"),revision:this.getAttribute("rev")},{onSuccess:function(A){if(A.revcount==0){window.location.href="/browse/"}else{window.location.reload()}},onFailure:function(A){alert(A)},waitCursor:true,method:"post"}))})});PBwiki.init(function(){if($$("ul.searchlist").length>0){Tooltips.addLinkTooltips($$("ul.searchlist")[0])}});Page.EditPage.Tags={tagCloud:null,tagField:null,getTagObject:function(A){if(!Page.EditPage.Tags.tagObj||A){var B=Page.EditPage.Tags.tagField.value.strip().gsub(/(\s*,\s*)+/,",");B=B.gsub(/,\s*$|^,\s*/,"");Page.EditPage.Tags.tagObj=(B.blank()?[]:B.split(","))}return Page.EditPage.Tags.tagObj},writeTagObject:function(){Page.EditPage.Tags.tagField.value=Page.EditPage.Tags.getTagObject().join(", ")},initialize:function(){this.tagCloud=$("tagcloud");if(!this.tagCloud){return }this.tagField=$("tagfield");this.editTags=$("edit_tags");Page.EditPage.Tags.initialValue=$("tagfield").value;this.editTags.observe("click",function(A){A.stop();if(!PBinfo.CurrentPage.editor_v3){this.editTags.hide();$("tag-settings").show()}this.loadAllTags()}.bind(this))},IsDirty:function(){return(Page.EditPage.Tags.initialValue!=$("tagfield").value)},loadAllTags:function(){new PBwiki.APIRequest("GetTags",{},{cacheability:["tagtime"],onSuccess:this.onLoaded.bind(this)})},onLoaded:function(A){this.tagCloud.update("");if(A.tags&&!Object.isArray(A.tags)){$H(A.tags).each(function(B){this.tagCloud.appendChild(new Element("a",{href:"#"}).update(B.key.escapeHTML()));this.tagCloud.appendChild(document.createTextNode(",  "))}.bind(this));if(PBinfo.CurrentPage.editor_v3){PBwiki.currentView.resizeChromeHeight()}else{Page.AjaxEdit.resizeContentPanel()}}this.start()},start:function(){Page.EditPage.Tags.writeTagObject();Page.EditPage.Tags.unselectedLinks=$A(Page.EditPage.Tags.tagCloud.getElementsByTagName("a"));Page.EditPage.Tags.unselectedLinks.each(function(A){A=$(A);A.observe("click",Page.EditPage.Tags.handleTagClick);A.addClassName("unselected")});Page.EditPage.Tags.tagField.observe("keyup",Page.EditPage.Tags.handleFieldChange);Page.EditPage.Tags.tagField.observe("keydown",function(A){if(A.keyCode==13){Event.stop(A)}});Page.EditPage.Tags.handleFieldChange()},handleFieldChange:function(C){var D="#"+Page.EditPage.Tags.tagCloud.id+" a";var A=$$(D);var B=Page.EditPage.Tags.getTagObject(true);A.each(function(E){E.className="unselected";B.each(function(F){linkText=E.innerHTML;if(linkText==F){E.className="selected"}})})},addTag:function(A){Page.EditPage.Tags.tagObj.push(A)},removeTag:function(A){Page.EditPage.Tags.tagObj=Page.EditPage.Tags.tagObj.without(A)},handleTagClick:function(D){var C=Event.element(D);var A=C.firstChild.textContent||C.innerText;var B=Page.EditPage.Tags.getTagObject();(B.include(A)?Page.EditPage.Tags.removeTag(A):Page.EditPage.Tags.addTag(A));C.toggleClassName("selected").toggleClassName("unselected").blur();Page.EditPage.Tags.writeTagObject();Event.stop(D)}};Page.EditBubble={initialize:function(){var A=$("edit-tab");Page.EditBubble.bubble=editBubble=$("edit-button-bubble");if(!A||!editBubble||!A.hasClassName("logintoedit")){return false}editBubble.getElementsBySelector("a.close")[0].observe("click",function(B){editBubble.hide();B.stop()});A.down().observe("click",Page.EditBubble.show);document.observe("click",function(){Page.EditBubble.bubble.hide()})},reposition:function(){var D=$("edit-tab");var B=D.cumulativeOffset();var C=D.getWidth();var A=(Page.EditBubble.bubble.getHeight()/2)-(D.getHeight()/2);B.left+=C;B.top-=A;Page.EditBubble.bubble.setStyle({top:B.top+"px",left:B.left+"px"})},show:function(A){Page.EditBubble.reposition();Page.EditBubble.bubble.show();Event.stop(A)}};Page.ImportFeedback={initialize:function(){if(!$("import-feedback")){return }$("import-feedback-close").observe("click",function(A){A.stop();$("import-feedback").hide()}.bind(this),true);$("import-feedback-no").observe("click",function(A){A.stop();new PBwiki.Components.ImportFeedbackBubble({convertID:$("import-feedback").readAttribute("ui:convert-id")})})}};Page.LastEditedDisplay=Class.create({updateInterval:60,initialize:function(){if(!$("page-history-ago")||!PBinfo.GetPage||!PBinfo.GetPage.mtime){return }PBwiki.timeOffset=Math.round(PBwiki.getTimestamp()-PBinfo.CurrentPage.requesttime);setInterval(this.update.bind(this),this.updateInterval*1000);document.observe("ui:last_edited_update",this.update.bind(this))},update:function(){$("page-history-ago").update(Util.time_ago(PBwiki.getTimestamp()-PBinfo.GetPage.mtime-PBwiki.timeOffset)+" ago")}});Page.FixIPMPositioning=Class.create({initialize:function(){if(!$("notifications")||!$("main-tools")){return }$("main-tools").style.minHeight=$("notifications").getDimensions().height+"px"}});PBwiki.init(Page.WikiPage);PBwiki.init(Page.EditPage);PBwiki.init(Page.setDefaultInputFocus);PBwiki.init(Page.EditBubble);PBwiki.init(Page.ImportFeedback.initialize.bind(Page.ImportFeedback));PBwiki.init(Page.LastEditedDisplay);PBwiki.init(Page.FixIPMPositioning);PBwiki.CustomSecurity=Class.create({roles:[{index:0,value:"read",text:"Reader"},{index:1,value:"write",text:"Writer"},{index:2,value:"edit",text:"Editor"}],initialize:function(){if(!this.form){return }this.show_user_cards=true;this.user_map=new Object();this.group_roles=new Object();this.group_users=new Object();this.removed_users=new Array();this.removed_groups=new Array();this.api_requests_outstanding=0;this.unsaved_changes=false;this.unsaved_user_ids=new Array();this.unsaved_group_ids=new Array();this.table.style.visibility="hidden";this.loading_div.show();this.markAPIRequestStarted();new PBwiki.APIRequest("GetUsersInfos",{perm:"admin"},{allowDefer:true,method:"get",cacheability:["permtime"],onSuccess:this.adminsReceived.bind(this),onFailure:function(B){alert(B);this.markAPIRequestReceived()}});var A=$$("form#"+this.form.id+" div.radio-container").first();new RadioButtonSelector(A);if(this.add_user_button){this.add_user_button.observe("click",this.addUserListener.bindAsEventListener(this))}if(this.add_group_button){this.add_group_button.observe("click",this.addGroupListener.bindAsEventListener(this))}this.save_button.observe("click",this.submitHandler.bindAsEventListener(this));if(this.starting_user_rules){this.starting_user_rules.each(this.addUser.bind(this))}if(this.starting_group_rules){this.starting_group_rules.each(function(B){var C=PBwiki.feature("network_user_groups")?"ListNetworkGroupUsers":"ListWorkspaceGroupUsers";this.markAPIRequestStarted();new PBwiki.APIRequest(C,{group_id:B.group_id},{method:"get",cacheability:["grouptime","permtime"],onSuccess:this.groupDataReceived.bind(this,B,B.role),onFailure:function(D){alert(D);this.markAPIRequestReceived()}})}.bind(this))}$$("a.security-warn").invoke("observe","click",this.linkListener.bindAsEventListener(this));$$("input[name=securitymode]").invoke("observe","click",this.radioListener.bindAsEventListener(this))},adminsReceived:function(A){this.admins=new Array();A.uids.each(function(C){this.admins.push(C.uid);var B=this.user_map[C.uid];if(!B){return }if(B.standalone&&$("user-"+C.uid)){this.changeToAdmin($("user-"+C.uid))}B.groups.each(function(D){this.changeToAdmin($("group-user-"+D+"-"+C.uid))}.bind(this))}.bind(this));this.markAPIRequestReceived()},changeToAdmin:function(B){B.select("select, input, a").each(function(C){C.up("td").remove(C)});var A=B.select("td");A[1].update("Administrator");if(A.length>2){A[2].update("&nbsp;")}},disableForm:function(){this.form_disabled=true;this.form.select("input, select").each(function(A){A.disabled=true})},enableForm:function(){this.form_disabled=false;this.form.select("input, select").each(function(A){A.disabled=false})},submitHandler:function(B){if(B){B.stop()}this.disableForm();var A=this.getSubmitAPIReqs();new PBwiki.MultiAPIRequest(A,{onAllComplete:this.submitComplete.bind(this)})},cancelHandler:function(A){if(A&&this.form_disabled){A.stop()}},radioListener:function(A){this.unsaved_changes=true},linkListener:function(A){if(!A||!this.unsaved_changes){return }var B=window.confirm("You have unsaved changes. Are you sure you want to leave this page?");if(!B){A.stop()}},addUserListener:function(C){var A=this.users_select;var B={uid:A.getValue(),username:A.options[A.selectedIndex].text,role:"read"};if(this.userHasPerms(B.uid)){alert(B.username+" is already in the table");return }this.addUser(B);this.unsaved_user_ids.push(B.uid);this.unsaved_changes=true},removeUserListener:function(B,A){B.stop();this.removeUser(A);this.unsaved_user_ids.push(A);this.unsaved_changes=true},addUser:function(A){var B=this.createTableRow({id:A.uid,name:A.username,role:this.userIsAdmin(A.uid)?"admin":A.role,remove_listener:this.removeUserListener.bindAsEventListener(this,A.uid),role_listener:this.userRoleListener.bindAsEventListener(this,A.uid),usercard:true,uid:A.uid});B.id="user-"+A.uid;this.table.down("tbody.users").appendChild(B);if(!this.user_map[A.uid]){this.user_map[A.uid]={standalone:false,groups:new Array()}}this.user_map[A.uid].standalone=true;this.removed_users=this.removed_users.without(A.uid)},removeUser:function(A){var B=$("user-"+A);if(!B){return }B.remove();this.updateRowColors();if(this.user_map[A]){this.user_map[A].standalone=false}this.removed_users.push(A)},updateRowColors:function(){var A=0;var B=this.table.select("tbody tr");B.each(function(C){C.className=(A%2?"even":"odd");A++})},userRoleListener:function(D,A){if(PBwiki.feature("network_user_groups")){var C=D.element();if(C.tagName.toLowerCase()!=="select"){C=C.up("select")}var B=C.options[C.selectedIndex].value;this.synchronizeUserPermission(A,B)}this.unsaved_user_ids.push(A);this.unsaved_changes=true},synchronizeUserPermission:function(B,A){var C=$$("table#securitytable select").findAll(function(E){return(E.id.indexOf(B)>-1)});if(C.length==0){return }var D="read";C.each(function(E){var G=E.id.split("-");if(G.length!==3){return }var I=G[1];var H=$("select-"+I);var F=H.options[H.selectedIndex].value;D=this.maxRole(D,F)}.bind(this));C.each(function(E){this.resetSelectOptions(E,D,A)}.bind(this))},resetSelectOptions:function(A,B,D){A.options.length=0;var C=0;this.roles.each(function(E){if(this.roleCmp(B,E.value)===-1){return }A.options[A.options.length]=new Option(E.text,E.value);if(D===E.value){C=A.options.length-1}}.bind(this));A.selectedIndex=C},addGroupListener:function(C){var A=this.groups_select;var E={group_id:A.getValue(),name:A.options[A.selectedIndex].text};var D=$("group-"+E.group_id);if(D){alert(E.name+" is already in the table");return }var B="read";this.addGroup(E,B);this.unsaved_group_ids.push(E.group_id);this.unsaved_changes=true},removeGroupListener:function(B,A){if(B){B.stop()}this.removeGroup(A);this.unsaved_group_ids.push(A);this.unsaved_changes=true;this.group_users[A].each(function(C){this.synchronizeUserPermission(C.uid,null)}.bind(this))},groupDataReceived:function(C,B,A){this.group_users[C.group_id]=A.users;this.addGroup(C,B);this.markAPIRequestReceived()},addGroup:function(B,D){if(!this.group_users[B.group_id]){var C=PBwiki.feature("network_user_groups")?"ListNetworkGroupUsers":"ListWorkspaceGroupUsers";this.markAPIRequestStarted();new PBwiki.APIRequest(C,{group_id:B.group_id},{method:"get",cacheability:["grouptime","permtime"],onSuccess:this.groupDataReceived.bind(this,B,D),onFailure:function(E){alert(E);this.markAPIRequestReceived()}});return }var A=this.createTableRow({id:B.group_id,name:B.name,role:D,remove_listener:this.removeGroupListener.bindAsEventListener(this,B.group_id),role_listener:this.groupRoleListener.bindAsEventListener(this,B.group_id)});A.id="group-"+B.group_id;this.table.down("tbody.groups").appendChild(A);this.group_users[B.group_id].each(function(H){var G=D;var F=$("select-"+H.uid);var E=F?F.options[F.selectedIndex].value:false;if(PBwiki.feature("network_user_groups")){$$("table#securitytable select").each(function(J){if(J.id.indexOf(H.uid)==-1){return }E=this.maxRole(E,J.options[J.selectedIndex].value);var L=J.id.split("-")[1];var K=$("select-"+L);G=this.maxRole(G,K.options[K.selectedIndex].value)}.bind(this))}var I=this.maxRole(E,D);this.appendGroupUserRow(B,H,I,G)}.bind(this));this.group_roles[B.group_id]=D;this.removed_groups=this.removed_groups.without(B.group_id)},appendGroupUserRow:function(E,C,F,B){if($("user-"+C.uid)){var A=$("user-"+C.uid);A.remove();this.user_map[C.uid].standalone=false}var D=this.createTableRow({id:E.group_id+"-"+C.uid,name:C.name||C.email||C.username,role:this.userIsAdmin(C.uid)?"admin":F,role_listener:this.userRoleListener.bindAsEventListener(this,C.uid),minimum_role:B,usercard:true,uid:C.uid,indent:"20px"});D.id="group-user-"+E.group_id+"-"+C.uid;this.table.down("tbody.groups").appendChild(D);if(!this.user_map[C.uid]){this.user_map[C.uid]={standalone:false,groups:new Array()}}this.user_map[C.uid].groups.push(E.group_id);this.removed_users=this.removed_users.without(C.uid)},groupRoleListener:function(D,C){var B=$("select-"+C);var E=B.options[B.selectedIndex].value;var A=this.group_roles[C];this.group_users[C].each(function(I){if(this.userIsAdmin(I.uid)){return }var G=$("select-"+C+"-"+I.uid);var F=G.options[G.selectedIndex].value;var H;if(this.maxRole(A,E)==E){H=this.maxRole(E,F)}else{if(F==A){H=E}else{H=F}}this.resetSelectOptions(G,E,H);this.synchronizeUserPermission(I.uid,H)}.bind(this));this.group_roles[C]=E;this.unsaved_group_ids.push(C);this.unsaved_changes=true},removeGroup:function(A){var B=$("group-"+A);if(!B){return }B.remove();this.removed_groups.push(A);this.updateRowColors();this.group_users[A].each(function(D){var C=D.uid;$("group-user-"+A+"-"+C).remove();this.user_map[C].groups=this.user_map[C].groups.without(A)}.bind(this));delete this.group_roles[A]},markAPIRequestStarted:function(){this.api_requests_outstanding++;if(!this.form_disabled){this.disableForm()}},markAPIRequestReceived:function(){this.api_requests_outstanding--;if(this.api_requests_outstanding===0){this.enableForm();this.loading_div.hide();this.table.style.visibility="visible"}},userHasPerms:function(A){return this.user_map[A]&&(this.user_map[A].standalone||this.user_map[A].groups.length>0)},maxRole:function(B,A){return(this.roleCmp(B,A)===-1)?B:A},roleCmp:function(D,C){var B=this.roles.find(function(G){return G.value===D});var A=this.roles.find(function(G){return G.value===C});var F=(B)?B.index:0;var E=(A)?A.index:0;return(F>E)?-1:(F<E)?1:0},createTableRow:function(B){if(!B.minimum_role){B.minimum_role="read"}var G=new Element("td");if(this.show_user_cards&&B.usercard&&B.uid){var C=new Element("a",{className:"usercard_trigger securitytable-username","ui:uid":B.uid,href:"javascript:void(0)"});C.update(B.name.escapeHTML());G.appendChild(C)}else{G.appendChild(document.createTextNode(B.name))}if(B.indent){G.style.paddingLeft=B.indent}var E=new Element("td");if(B.role==="admin"){E.appendChild(document.createTextNode("Administrator"))}else{var F=new Element("select",{name:"select-"+B.id,id:"select-"+B.id});var H=0;this.resetSelectOptions(F,B.minimum_role,B.role);if(B.role_listener){F.observe("change",B.role_listener)}E.appendChild(F)}var D=new Element("td");if(B.remove_listener){var A=new Element("a",{className:"iconbutton deleteicon",href:"javascript:void(0);",onclick:"void(0)"}).update("&nbsp;");A.observe("click",B.remove_listener)}else{var A=document.createTextNode(" ")}D.appendChild(A);var I=new Element("tr");I.appendChild(G);I.appendChild(E);I.appendChild(D);return I},userIsAdmin:function(A){if(this.admins){return(this.admins.indexOf(A)>-1)}else{return false}},getCustomAPIReqs:function(){var B=new Array();var A=new Array();this.table.select("tr").each(function(I){if(!I.down("select")){return }var C=I.down("select");var F=C.options[C.selectedIndex].value;if(I.id.startsWith("group-user-")){var H=I.id.substring(11,I.id.length-41);var E=I.id.substring(I.id.length-40);var G=$("group-"+H).down("select");var D=G.options[G.selectedIndex].value;if(F!==D&&this.unsaved_user_ids.indexOf(E)!==-1){A.push(this.getUserAPIRequest(E,F))}}else{if(I.id.startsWith("user-")){var E=I.id.substring(I.id.length-40);if(this.unsaved_user_ids.indexOf(E)!==-1){A.push(this.getUserAPIRequest(E,F))}}else{if(I.id.startsWith("group-")){var H=I.id.substring(6);if(this.unsaved_group_ids.indexOf(H)!==-1){B.push(this.getGroupAPIRequest(H,F))}}}}}.bind(this));B=this.removed_groups.map(function(C){return this.getGroupAPIRequest(C,"deny")}.bind(this)).concat(B);A=this.removed_users.map(function(C){return this.getUserAPIRequest(C,"deny")}.bind(this)).concat(A);return B.concat(A)}});PBwiki.PageSecurity=Class.create(PBwiki.CustomSecurity,{initialize:function($super){if(!PBwiki.feature("page_security")){return }if(!$("foldersecurityform")){return }this.page=PBinfo.CurrentPage.page;this.form=$("foldersecurityform");this.table=$("securitytable");this.loading_div=$("securitytable-loading");this.users_select=$("foldersecurityusers");this.add_user_button=$("securityadduserbutton");this.groups_select=$("foldersecuritygroups");this.add_group_button=$("securityaddgroupbutton");this.save_button=$("security-save");this.cancel_button=$("security-cancel");if(window.user_security_rules){this.starting_user_rules=window.user_security_rules}else{this.starting_user_rules=new Array()}if(window.group_security_rules){this.starting_group_rules=window.group_security_rules}else{this.starting_group_rules=new Array()}$super()},getSubmitAPIReqs:function(){var B=this.form.select("input[type=radio]");var C=B.find(function(F){return F.checked});var E=C.value;var A=new Array();var D={page:this.page,securitytype:E};if($("published")){D.published=$("published").checked}if(PBwiki.feature("additive_custom_security")&&E=="custom"){D.default_perm=$("default_perm").value}A.push(["SetPageSecurityType",D,{onFailure:function(F){alert(F);this.enableForm()}.bind(this)}]);if(E=="custom"){A=A.concat(this.getCustomAPIReqs())}return A},getUserAPIRequest:function(A,B){return["SetPageUserPermission",{page:this.page,uid:A,perm:B},{onFailure:function(C){alert(C);this.enableForm()}.bind(this)}]},getGroupAPIRequest:function(B,A){return["SetPageGroupPermission",{page:this.page,group_id:B,perm:A},{onFailure:function(C){alert(C);this.enableForm()}.bind(this)}]},submitComplete:function(){if(this.form_disabled){document.location.href="/"+Util.dashified_link(this.page)+"?securitymsg=true"}}});PBwiki.FolderSecurity=Class.create(PBwiki.CustomSecurity,{initialize:function($super,A){if(!PBwiki.feature("folder_security")){return }if(!$("foldersecurityform")){return }this.options=A;this.form=$("foldersecurityform");this.table=$("securitytable");this.loading_div=$("securitytable-loading");this.users_select=$("foldersecurityusers");this.add_user_button=$("securityadduserbutton");this.groups_select=$("foldersecuritygroups");this.add_group_button=$("securityaddgroupbutton");this.save_button=$("foldersecuritysubmit");this.cancel_button=$("security-cancel");$super();this.show_user_cards=false},getSubmitAPIReqs:function(){var B=this.form.select("input[type=radio]");var C=B.find(function(E){return E.checked});var D=C.value;var A=new Array();A.push(["SetFolderHasCustomSecurity",{folder:this.options.folder,enabled:(D=="custom")},{onFailure:function(E){alert(E);this.enableForm()}.bind(this)}]);A.push(["SetFolderPublic",{folder:this.options.folder,"public":$("foldersecuritypublished").checked},{onFailure:function(E){alert(E);this.enableForm()}.bind(this)}]);if(D=="custom"){A=A.concat(this.getCustomAPIReqs())}return A},getUserAPIRequest:function(A,B){return["SetFolderUserPermission",{folder:this.options.folder,uid:A,perm:B},{onFailure:function(C){alert(C);this.enableForm()}.bind(this)}]},getGroupAPIRequest:function(B,A){return["SetFolderGroupPermission",{folder:this.options.folder,group_id:B,perm:A},{onFailure:function(C){alert(C);this.enableForm()}.bind(this)}]},submitComplete:function(){if(this.form_disabled){if(this.options.onSaveComplete){this.options.onSaveComplete()}PBwiki.DialogFactory.close()}}});PBwiki.WhoCanSee=Class.create({kMaxUsers:500,initialize:function(B){if(B&&B.page){this.page=B.page}else{if(B&&B.folder){this.folder=B.folder}else{if(!PBinfo||!PBinfo.CurrentPage){return }this.page=PBinfo.CurrentPage.page}}var A=$$("div.who-can-see div.expand a");if(A.length===0){return }A.each(function(E){var C=E.up("div.who-can-see");var D=C.id.substring(12);E.observe("click",this.expandHandler.bindAsEventListener(this,D))}.bind(this));if(this.page&&$("published")){$("published").observe("click",this.publishedHandler.bindAsEventListener(this));this.publishedHandler()}else{if(this.folder&&$("foldersecuritypublished")){$("foldersecuritypublished").observe("click",this.folderPublishedHandler.bindAsEventListener(this));this.folderPublishedHandler()}}$$("div.selectrow").each(function(C){var D=C.down("div.who-can-see div.content");if(!D){return }C.observe("ui:select",function(){D.scrollTop=0;var E=D.down("ul.rolehelp");if(E){E.hide()}}.bind(this))}.bind(this));if(this.folder&&$("who-can-see-default-public")&&$("who-can-see-default-publicedit")){if(PBinfo.CurrentWiki.isPublic){$("who-can-see-default-public").show();if(PBinfo.CurrentWiki.publicedit){$("who-can-see-default-publicedit").show()}}}},publishedHandler:function(A){if($("published").checked){if($("who-can-see-default-folder-published")){$("who-can-see-default-folder-published").hide()}if($("who-can-see-locked-folder-published")){$("who-can-see-locked-folder-published").hide()}if($("who-can-see-default-page-published")){$("who-can-see-default-page-published").show()}if($("who-can-see-locked-page-published")){$("who-can-see-locked-page-published").show()}if($("who-can-see-custom-page-published")){$("who-can-see-custom-page-published").show()}}else{if($("who-can-see-default-page-published")){$("who-can-see-default-page-published").hide()}if($("who-can-see-locked-page-published")){$("who-can-see-locked-page-published").hide()}if($("who-can-see-custom-page-published")){$("who-can-see-custom-page-published").hide()}if($("who-can-see-default-folder-published")){$("who-can-see-default-folder-published").show()}if($("who-can-see-locked-folder-published")){$("who-can-see-locked-folder-published").show()}}},folderPublishedHandler:function(A){if($("foldersecuritypublished").checked&&!PBinfo.CurrentWiki.isPublic){if($("who-can-see-default-folder-published")){$("who-can-see-default-folder-published").show()}if($("who-can-see-custom-folder-published")){$("who-can-see-custom-folder-published").show()}}else{if($("who-can-see-default-folder-published")){$("who-can-see-default-folder-published").hide()}if($("who-can-see-custom-folder-published")){$("who-can-see-custom-folder-published").hide()}}},expandHandler:function(B,A){if(B){B.stop()}var C;if(this.page){C={security_type:A,page:this.page}}else{if(this.folder){C={security_type:A,folder:this.folder}}else{PBwiki.error("Neither page nor folder present");return }}new PBwiki.APIRequest("GetHypotheticalUsers",C,{method:"get",cacheability:["permtime","changed_visibility_time","foldertime"],onSuccess:this.dataHandler.bind(this,A),onFailure:function(D){alert(D)}})},dataHandler:function(B,C){var A=$("who-can-see-"+B);if(C.users.length>this.kMaxUsers){this.drawText(A.down("table"),C)}else{this.drawTable(A.down("table"),C)}if(this.page){if(C.folder_published){A.addClassName("folder-published")}else{A.removeClassName("folder-published")}}A.down("div.expand").hide();A.down("div.content").scrollTop=0;A.down("div.content").show();PBwiki.DialogFactory.recenter()},drawTable:function(L,F){var B=L.id.substring(0,L.id.length-5);var G;var I=0;var A=0;var H=L.down("tbody");H.update("");F.users.each(function(M){var N;if(M.name&&!M.name.empty()){N=M.name}else{if(M.email&&!M.email.empty()){N=M.email}else{if(M.username&&!M.username.empty()){N=M.username}else{N="Anonymous user"}}}var P=new Element("td",{style:"padding-left: 10px;"});P.appendChild(document.createTextNode(N));var O=new Element("td");O.appendChild(document.createTextNode(M.role));var Q=new Element("tr",{id:B+M.uid});if(!M.wiki_perm){Q.hide();Q.addClassName("network-user");P.style.paddingLeft="25px";if(M.network_perm==="admin"){A++}else{I++}if(!G){G=Q}}Q.appendChild(P);Q.appendChild(O);H.appendChild(Q)}.bind(this));if(I+A>0){var E=new Element("td",{style:"padding-left: 10px;"});var D=new Element("a",{href:"javascript: void(0);",className:"who-can-see-show-all"});D.update("show all");D.observe("click",this.showNetworkUsers.bindAsEventListener(this,H));var K=(I+A)+" additional network "+(I>0?"users":"administrators")+" (";E.appendChild(document.createTextNode(K));E.appendChild(D);E.appendChild(document.createTextNode(")"));var C=new Element("td",{className:"who-can-see-show-all-role"});C.appendChild(document.createTextNode(I>0?"Reader":"Administrator"));var J=new Element("tr");J.appendChild(E);J.appendChild(C);H.insertBefore(J,G)}},showNetworkUsers:function(B,A){if(B){B.stop()}if(this.showing_all){A.select("tr.network-user").invoke("hide");A.down("a.who-can-see-show-all").update("show all");A.down("td.who-can-see-show-all-role").update("Reader");delete this.showing_all}else{A.select("tr.network-user").invoke("show");A.down("a.who-can-see-show-all").update("hide");A.down("td.who-can-see-show-all-role").update("");this.showing_all=true}},drawText:function(C,D){var F="";var A="";var G=0;var B=0;D.users.each(function(H){if(!H.wiki_perm){if(H.network_perm==="admin"){G++}else{B++}return }if(H.role!==A){A=H.role;if(F.length>0){F=F+"\n"}F=F+"Page "+H.role+"s:\n"}var I=(H.name&&!H.name.empty())?H.name:(H.email&&!H.email.empty())?H.email:"Anonymous user";F=F+"    "+I+"\n"});if(G>0&&B==0){F=F+"\n"+G+" administrators of your network will also have access,\nbecause the workspace is open to the network."}else{if(G+B>0){F=F+"\n"+(B+G)+" additional members of your network will also have access,\nbecause the workspace is open to the network."}}var E=new Element("pre");E.appendChild(document.createTextNode(F));C.replace(E)}});PBwiki.RoleHelp=Class.create({initialize:function(A){if(A){this.options=A}else{this.options={}}$$("a.rolehelp").each(function(B){var C;if(B.hasClassName("rolehelp-default")){C=$("rolehelp-default")}else{if(B.hasClassName("rolehelp-locked")){C=$("rolehelp-locked")}else{if(B.hasClassName("rolehelp-hidden")){C=$("rolehelp-hidden")}else{if(B.hasClassName("rolehelp-custom")){C=$("rolehelp-custom")}}}}if(!C){return }B.observe("click",this.clickHandler.bindAsEventListener(this,C))}.bind(this))},clickHandler:function(B,A){if(B){if(this.options.never_follow_links){B.stop()}else{if(A.up("div.content")){B.stop()}else{if(A.up("table")&&A.up("table").down("tbody")&&A.up("table").down("tbody").childElementCount<=5){B.stop()}}}}A.up("div.selectrow").select("a.rolehelp.hide-when-opened").invoke("hide");A.show()}});PBwiki.init(PBwiki.PageSecurity);PBwiki.init(PBwiki.WhoCanSee);PBwiki.init(PBwiki.RoleHelp);PBwiki.Settings={initialize:function(){this.Panels.each(function(A){A.value.initialize.bind(this.Panels.get(A.key))()}.bind(this))},Panels:new Hash({Security:{initialize:function(){if(!$("securitysettings_publicrow")||$("welcome_wiki_viewers_anyone")){return }this.selections={};try{$w("viewers editors").each(function(C){this[C]={anyone:{},invitees:{}};this[C].anyone.radio=$("wiki_"+C+"_anyone");this[C].invitees.radio=$("wiki_"+C+"_invitees");try{this[C].anyone.label=$$("label[for="+this[C].anyone.radio.id+"]").first();this[C].invitees.label=$$("label[for="+this[C].invitees.radio.id+"]").first()}catch(B){}this[C].radioGroup=$$("input[name=whocan"+C.substr(0,4)+"]");this[C].getValue=function(){return this.radioGroup.find(function(D){return D.checked}).value}.bind(this[C])}.bind(this.selections))}catch(A){return }this.selections.requestAccessCheckbox=$("requestaccess_enabled");this.selections.requestAccessLabel=this.selections.requestAccessCheckbox.up().down("label");this.selections.inviteesLabelText=["Only people I invite","or approve"];if(this.requestAccessCheckbox=$("requestaccess_enabled")){(onRequestAccessChange=function(){var B=(this.requestAccessCheckbox.checked?this.selections.inviteesLabelText.join(" "):this.selections.inviteesLabelText.first());try{this.selections.viewers.invitees.label.innerHTML=B;this.selections.editors.invitees.label.innerHTML=B}catch(C){}}.bind(this))();$("requestaccess_enabled").observe("click",onRequestAccessChange)}[this.selections.viewers.radioGroup,this.selections.editors.radioGroup].flatten().each(function(B){B.observe("click",function(){document.fire("viewersecurity:changed")}.bind(this))}.bind(this.selections));(this.selections.editors.onViewSettingChanged=function(C){var B=this.editors.anyone;if(parseInt(this.viewers.getValue())){B.radio.enable();B.label.removeClassName("aux");if(this.editors.getValue()==1){this.requestAccessCheckbox.disabled=true;this.requestAccessLabel.addClassName("aux")}else{this.requestAccessLabel.removeClassName("aux");this.requestAccessCheckbox.disabled=false}}else{B.radio.disable();B.label.addClassName("aux");this.editors.invitees.radio.checked=true;this.requestAccessCheckbox.disabled=false;this.requestAccessLabel.removeClassName("aux")}}.bind(this.selections))();document.observe("viewersecurity:changed",this.selections.editors.onViewSettingChanged)}}})};PBwiki.init(PBwiki.Settings.initialize.bind(PBwiki.Settings));var FolderSelector=Class.create({initialize:function(A){this.element=$(A);if(!this.element){return }this.link=this.element.down("a");this.selector=this.element.down("select");this.startLength=this.selector.length;this.link.observe("click",this.linkOnclick.bind(this));this.selector.observe("change",this.selectChanged.bind(this));this.element.observe("ui:folderchanged",this.folderChanged.bind(this))},linkOnclick:function(A){Event.stop(A);this.link.update("Choose a folder:").blur();this.loadFolderList();this.selector.show()},loadFolderList:function(){this.selector.length=this.startLength;new PBwiki.APIRequest("GetFolders",{verbose:true},{cacheability:["foldertime","filetime","pagetime","permtime"],onSuccess:function(A){if(A.folders){A.folders=PBwiki.APIRequest.sortResultObjectByParents(A.folders);A.folders.each(function(C){var D=!C.indent?C.name:"&nbsp;".times(C.indent*3)+C.name;var B=new Element("option",{value:C.name}).update(D);this.selector.appendChild(B);if(C.name==PBinfo.CurrentPage.folder){B.selected=true}},this)}}.bind(this)})},selectChanged:function(B){var A=$F(this.selector);if(A.startsWith("Create")){this.handleCreateFolder()}else{this.selector.fire("ui:folderchanged",A)}},handleCreateFolder:function(){var B="Folder name";var A="Please name your folder";while(folderName=prompt(A,B)){if(!folderName){continue}var A=Util.is_valid_folder_name(folderName);if(A===true){break}}folderName=folderName.strip();if(folderName){this.selector.fire("ui:folderchanged",folderName)}else{this.selector.selectedIndex=this.selector.oldIndex}},folderChanged:function(B){if(typeof B.memo!="string"){B.memo=""}var A={page:PBinfo.CurrentPage.page,create_if_missing:true};if(B.memo){A.folder=B.memo}else{A.remove=true}new PBwiki.APIRequest("SetPageFolder",A,{incUsess:true,onSuccess:function(C){setTimeout(function(){window.location.reload()},1000)},onFailure:function(D,C){document.fire("ui:onNotifyUser",{message:"Failed to set page folder: "+D,mode:"error"})}})}});PBwiki.init(FolderSelector,"folderselector");PBwiki.GrowingTextArea=Class.create({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")}}});Page.Tags={editorActive:false,placeHolderTxt:"e.g. report, new release",initialize:function(){if($("edittags")){$("edittags").observe("click",Page.Tags.toggleEditor.bind(Page.Tags));Page.Tags.tagMsg=$("ajaxtags").down(".tagsmsg");Page.Tags.tagError=$("ajaxtags").down(".validation-error")}},toggleEditor:function(B){if(B){Event.stop(B)}if(this.isToggling){return }this.isToggling=true;var D=$("tagList");if(!this.editorActive){this.tagInput=new Element("input",{id:"input-tags"});this.tagInput.setAttribute("type","text");this.tagInput.setAttribute("ui:placeholder",Page.Tags.placeHolderTxt);this.tagInput.className="text";this.tagInput.style.width="165px";this.tagInput.observe("blur",this.toggleEditor.bind(this));this.tagInput.observe("keypress",this.keyDown.bind(this));var F=D.getElementsByTagName("A");this.savedTagStr=D.innerHTML;var I=this.getTagStr();this.tagInput.value=I;this.tagButton=new Element("input");this.tagButton.setAttribute("type","button");this.tagButton.setAttribute("value","OK");this.tagButton.style.marginLeft="2px";this.tagButton.observe("click",this.toggleEditor.bind(this));D.innerHTML="";D.appendChild(this.tagInput);D.appendChild(this.tagButton);new InputText(this.tagInput);this.editorActive=true;this.isToggling=false}else{var J=this.tagInput.value;if(J==Page.Tags.placeHolderTxt){J=""}var E=J.split(",");var G=false;D.innerHTML="";for(var A=0;A<E.length;A++){var H=E[A].strip();if(H==""){continue}if(G){D.appendChild(document.createTextNode(", "))}var C=new Element("a");C.setAttribute("href","tags.php?ptag="+H);C.appendChild(document.createTextNode(H));D.appendChild(C);G=true}if(G){$("edittags").innerHTML="Edit Tags:"}else{$("edittags").innerHTML="Add Tags"}this.updateTags();this.editorActive=false}},getTagStr:function(){var A=$("tagList").getElementsByTagName("A");var C="";for(var B=0;B<A.length;B++){if(B!=0){C+=","}C+=A[B].firstChild.nodeValue}return C},keyDown:function(A){if(!A){A=window.event}if(A.keyCode==13){this.toggleEditor()}},updateTags:function(){var A=this.getTagStr();new PBwiki.APIRequest("SetPageTags",{page:PBwiki.getPageName(),tags:A},{incUsess:true,onSuccess:this.tagSuccess.bind(this),onFailure:this.tagFail.bind(this),onComplete:function(){this.isToggling=false}.bind(this)});if($("tagfield")){$("tagfield").value=A}},tagFail:function(A){$("tagList").innerHTML=this.savedTagStr;this.tagError.innerHTML=A;this.tagError.style.display="block";setTimeout(function(){this.tagError.style.display="none"}.bind(this),30000)},tagSuccess:function(){this.tagMsg.style.display="block";setTimeout(function(){this.tagMsg.style.display="none"}.bind(this),5000)}};PBwiki.init(Page.Tags.initialize);FormPost={post:function(D,A){var B=Object.extend({action:"",validate:function(){return true},method:"post"},A);if(B.validate()){var C=FormPost.constructForm(D);C.method=B.method;C.action=B.action;document.body.appendChild(C);C.submit()}},constructForm:function(B){var A=new Element("form");$H(B).each(function(D){PBwiki.debug("creating hidden input for %s:%s",D.key,D.value);var C=new Element("input",{type:"hidden",name:D.key,value:D.value,style:"display:none"});A.appendChild(C)});return A}};var PostCommand=Class.create({initialize:function(A){this.element=$(A);this.element.observe("click",this.onclick.bind(this))},onclick:function(F){var G=this.element.getAttribute("ui:validation");var E=this.element.getAttribute("ui:action")||this.element.href;var C=this.element.getAttribute("ui:query");var B=this.element.getAttribute("ui:confirm");var D=Util.parseQueryString(C);var A={action:E};if(G){A.validate=window[G]}PBwiki.debug(A);Event.stop(F);if(B==""||confirm(B)){FormPost.post(D,A)}}});PostCommand.initialize=function(){PostCommand.selector=".postcommand";try{$$(PostCommand.selector).each(function(B){new PostCommand(B)})}catch(A){PBwiki.warn("PostCommand: error: "+A)}};PBwiki.AddUserBehavior=Class.create({initialize:function(A){return },handleEnterOnEmailField:function(A){if(A.keyCode==Event.KEY_RETURN){this.sendAddRequest();Event.stop(A)}},sendAddRequest:function(){var A=$F(this.emailInput);var D=this.emailInput.getAttribute("ui:placeholder");if(A!=D){var E=this.emailInput.name;var C=this.permInput.name;var B=Util.is_valid_email(A);if(B!==true){this.doErrorMessage(B);return }new PBwiki.APIRequest("AddUser",{email:A,perm:this.permInput.value,invite:true,demote:false},{onSuccess:this.addUserSuccess.bind(this),incUsess:true,onFailure:this.doErrorMessage.bind(this)});this.errMsg.hide()}},addUserSuccess:function(A){if(A.info=="added"||A.info=="created"||A.info=="accepted"){this.appendToAddList("Added "+A.email)}else{this.appendToAddList(A.email+" already exists")}this.emailInput.value="";this.emailInput.focus();this.errMsg.hide()},doErrorMessage:function(A){this.emailInput.focus();this.emailInput.select();this.errMsg.innerHTML=A;this.errMsg.style.display="block";setTimeout(function(){this.errMsg.hide()}.bind(this),5000)},appendToAddList:function(B){if(!this.emailList){this.emailList=new Element("ul",{className:"added-emails"});this.errMsg.insert({after:this.emailList})}var A=new Element("li",{className:"iconbutton accepticon"});A.innerHTML=B;this.emailList.appendChild(A);setTimeout(function(){A.style.display="none"},4000)}});var InputText=Class.create({initialize:function(B){this.element=$(B);try{this.placeholder=this.element.getAttribute("ui:placeholder");if(this.placeholder){this.placeholder=this.placeholder.strip()}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.setElementToEmptyStyle()}this.element.observe("ui:clearfield",this.onBlur.bind(this))}catch(A){throw new UIException("InputText: error "+A.getMessage(),this.element,A)}},setElementToEmptyStyle:function(){this.placeholder=this.element.getAttribute("ui:placeholder");if(this.placeholder){this.placeholder=this.placeholder.strip();this.element.setStyle({color:"#999"});this.element.value=this.placeholder}else{this.element.value=""}this.isEmpty=true},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.setElementToEmptyStyle()}else{this.isEmpty=false}}});InputText.initialize=function(){InputText.selector=".inputtext";try{$$(InputText.selector).each(function(B){new InputText(B)})}catch(A){PBwiki.warn(A)}};RadioButtonSelector=Class.create({initialize:function(B){this.element=$(B);this.selectrows=this.element.getElementsBySelector(".selectrow");this.selectors=this.element.getElementsBySelector("label, input[type=radio]");this.selectrows.invoke("observe","ui:select",this.selectEvent);var A=this.selectors.invoke("observe","click",this.fireSelectEvent.bind(this)).find(function(C){return C.checked});this.fireSelectEvent(A)},selectEvent:function(A){if(A.memo.descendantOf(this)){this.addClassName("selected");this.down("input").checked=true}else{this.removeClassName("selected")}},fireSelectEvent:function(A){this.selectrows.invoke("fire","ui:select",(A.element?A.element():A))}});CommentValidator={initialize:function(){if(!$("comment-form")){return }$("comment-form").observe("submit",CommentValidator.validate)},validate:function(A){if(Page.HTMLComments&&Page.HTMLComments.started){return }maxlength=2000;var B=$("comment-form-value");val=B.value;if(val.length>=maxlength){alert("Your comments must be "+maxlength+" characters or less. This comment is "+val.length+" characters.");B.focus();A.stop()}else{if(val.length==0){alert("Your comment cannot be empty.");B.focus();A.stop()}}$$("#comment-form .primarybutton").each(function(C){C.disable()})}};PBwiki.init(InputText);PBwiki.init(PostCommand);PBwiki.init(CommentValidator);PBwiki.init(PBwiki.AddUserBehavior,"module:addusers");function insert_sig(){var A=FCKeditorAPI.GetInstance("content");var D=new Date();var E=D.getMonth()+1;var B=D.getDate();var C=D.getYear()-100;A.InsertHtml("-- Brian Kirchoff "+E+"/"+B+"/"+C)}function insert_file_into_editor(D,C,B){var A=FCKeditorAPI.GetInstance("content");var E=insert_get_selection();if(E==""){E='<img border="0" src="'+C+'" /></a>&nbsp;<a href="'+D+'">'+B}A.InsertHtml('<a href="'+D+'">'+E+"</a>");return false}function insert_newlink_into_editor(){document.fire("ui:insertlink")}function insert_newimage_into_editor(){var A=prompt("Enter the URL of the image to insert into the editor");if(A){insert_image_into_editor(A)}}function insert_image_into_editor(B){var C='<img src="'+B+'" />';if(typeof (FCKeditorAPI)!="undefined"){var A=FCKeditorAPI.GetInstance("content");A.InsertHtml(C)}else{PBwiki.currentEditor.editor.execCommand("mceInsertContent",false,C)}return false}function tagCloudToggle(B){var A=$("tagcloud");if(A.getStyle("display")=="none"){A.setStyle({display:"block"});B.innerHTML="Hide all tags"}else{A.setStyle({display:"none"});B.innerHTML="Show all tags"}}var g_pb_Enable_focus_changes=true;function insert_pagelink_into_editor(E,D){if(typeof D=="undefined"){D=E}var A=FCKeditorAPI.GetInstance("content");var C=insert_get_selection();if(C==""){C=D}var B=g_pb_Enable_focus_changes;g_pb_Enable_focus_changes=false;A.InsertHtml('<a href="/'+E+'" >'+C+"</a>");g_pb_Enable_focus_changes=B}function insert_get_selection(){var B=FCKeditorAPI.GetInstance("content");var A=B.Selection;if(A.GetType()=="Text"){if(document.all){return B.EditorDocument.selection.createRange().text}else{return B.EditorWindow.getSelection()}}return""}function load_real_thumbnail(B,A){var C=B.getAttribute("realsrc");if(C){B.setAttribute("src",C)}A.onmouseover=null}function load_all_files(){new Ajax.Updater("thingbarfiles","/api_v2/op/GetFileListAsHtml/_type/html")}function load_all_pages(){new Ajax.Updater("thingbarpages","/api_v2/op/GetPageListAsHtml/_type/html")}document.observe("ui:fckeditor_oncomplete",function(B){var A=B.memo.editorInstance;if(g_pb_Enable_focus_changes){A.Events.AttachEvent("OnSelectionChange",CheckFocusForNbsp)}});function CheckFocusForNbsp(C){if(!g_pb_Enable_focus_changes){return }var D=C.Selection.GetBoundaryParentElement();var E=C.Selection.GetSelection();if(!D||!E){return }var A=(E.createRange)?E.createRange().text:E.toString();if((!A||A=="")&&(D.innerHTML.length>0&&D.innerHTML.replace("&nbsp;","")==""||encodeURIComponent(D.innerHTML)=="%C2%A0")){if(C.EditorWindow.getSelection){E.collapse(D,false)}else{var B=E.createRange();B.moveToElementText(D);B.collapse(true);B.select()}}}Page.Notifications={cookieName:"pbNotifications",notificationList:[],initialize:function(){if(!$("notifications")||!$("notifications").hasClassName("ipm")){return }var C=$("notifications").select("li");var A=C.id;this.notificationList=new Array();for(var B=0;B<C.length;B++){this.notificationList.push(new Notification(C[B]))}this.updateDisplay()},addNotification:function(A){var B=this.findNotification($("notification-"+A.id));if(!B){this.notificationList.push(new Notification(null,A))}this.updateDisplay()},addError:function(B){var A={icon:"interstitial"};Object.extend(A,B);this.addNotification(A)},removeNotification:function(A){this.notificationList=$A(this.notificationList).without(A);this.updateDisplay()},findNotification:function(B){for(var A=0;A<this.notificationList.length;A++){if(this.notificationList[A].elm==B){return this.notificationList[A]}}},updateDisplay:function(){if(this.notificationList.length==0){$("notifications").style.display="none"}var B=$("notifications").select("li");for(var A=0;A<B.length;A++){if(A==B.length-1){B[A].addClassName("last")}else{B[A].removeClassName("last")}}}};var Notification=Class.create({initialize:function(B,A){if(B){if(B.hasClassName("dismiss")){this.dismissControl=B.down(".dismisscontrol");this.dismissControl.observe("click",this.dismiss.bind(this))}this.elm=B;this.contentElm=$(this.elm.childNodes[2]);this.id=B.id.replace("notification-","")}else{this.elm=new Element("li").addClassName("notification");if(A.dismiss){this.dismissControl=new Element("div").addClassName("dismisscontrol");this.elm.addClassName("dismiss");this.elm.appendChild(this.dismissControl)}if(A.icon){this.elm.addClassName("page-"+A.icon)}this.contentElm=new Element("p");if(A.html){this.contentElm.innerHTML=A.html}this.elm.appendChild(this.contentElm);$("notifications").appendChild(this.elm)}},setMessage:function(A){this.contentElm.innerHTML=A},remove:function(){this.elm.remove();Page.Notifications.removeNotification(this)},dismiss:function(){Messaging.Link({id:this.id,dismiss:1});this.remove()}});var Messaging={url:"/messaging.php?",Link:function(D){var C={mId:D.id};if(D.dismiss&&D.dismiss!="no"){C.dismiss=1;var B=Messaging.url+Object.toQueryString(C);new Ajax.Request(B);var A=$("notification-"+D.id);var E=Page.Notifications.findNotification(A);Page.Notifications.removeNotification(E)}if(D.url){C.url=D.url;var B=Messaging.url+Object.toQueryString(C);if(D.target=="_blank"){window.open(B)}else{window.location.href=B}}}};PBwiki.init(Page.Notifications.initialize.bind(Page.Notifications));PBwiki=PBwiki||parent.PBwiki;PBwiki.Components=PBwiki.Components||{};PBwiki.Components.Dialog=Class.create({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({width:(C.width+18)+"px",height:A,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={activeDialog:null,cache:{},background:new Element("div",{"class":"modalbg"}),defaultDimensions:{width:400,height:"auto"},trapEsc:true,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(B,D,C,A){C=Object.extend({renderAs:"div",contentSource:"ajax",expireCache:true,dimensions:PBwiki.DialogFactory.defaultDimensions,closeable:true,reuseDialogs:true,onClosed:Prototype.emptyFunction,onOpened:Prototype.emptyFunction},C);D=D||"No Title";if(C.renderAs=="iframe"){C.contentSource=C.renderAs}else{if(C.renderAs=="div"&&!C.contentSource){C.contentSource="ajax"}}A=Object.extend({evalScripts:true,parameters:"",method:"post"},A);if(C.reuseDialogs&&this.activeDialog){C.contentSource=this.activeDialog.renderMode;C.dimensions=this.activeDialog.originalSize}this[("open-"+C.contentSource.toLowerCase()).camelize()](B,D,C,A);if(C.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(C,G,F,A){var E;var D=this.activeDialog;var B=F.dimensions.width;if(this.activeDialog&&!F.reuseDialogs){this.previousActiveDialog=this.activeDialog;D=false}if(C){var H=C.split("/").slice(-1)[0].split(".")[0]}if(!D){D=new Element("div",{className:"modal",id:"modal-"+(C?H.gsub(/[?&=]/,"-"):Math.round(Math.random()*1000))});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.onClosed=F.onClosed;this.activeDialog=D}else{E=D.getElementsByClassName("modal_content")[0]}this.showBackground();if(F.templateSrc){E.innerHTML=F.templateSrc;D.display(F);F.onOpened()}else{this.ajax=new Ajax.Updater(E,C,{onComplete:function(J){if(F.templateObject){var I=new Template(E.innerHTML);I.innerHTML=I.evaluate(F.templateObject)}D.display(F);F.onOpened()},method:"get"})}},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);var SWFUpload;if(SWFUpload==undefined){SWFUpload=function(A){this.initSWFUpload(A)}}SWFUpload.prototype.initSWFUpload=function(B){try{this.customSettings={};this.settings=B;this.eventQueue=[];this.movieName="SWFUpload_"+SWFUpload.movieCount++;this.movieElement=null;SWFUpload.instances[this.movieName]=this;this.initSettings();this.loadFlash();this.displayDebugInfo()}catch(A){delete SWFUpload.instances[this.movieName];throw A}};SWFUpload.instances={};SWFUpload.movieCount=0;SWFUpload.version="2.2.0 2009-03-25";SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130};SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290};SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5};SWFUpload.BUTTON_ACTION={SELECT_FILE:-100,SELECT_FILES:-110,START_UPLOAD:-120};SWFUpload.CURSOR={ARROW:-1,HAND:-2};SWFUpload.WINDOW_MODE={WINDOW:"window",TRANSPARENT:"transparent",OPAQUE:"opaque"};SWFUpload.completeURL=function(A){if(typeof (A)!=="string"||A.match(/^https?:\/\//i)||A.match(/^\//)){return A}var C=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"");var B=window.location.pathname.lastIndexOf("/");if(B<=0){path="/"}else{path=window.location.pathname.substr(0,B)+"/"}return path+A};SWFUpload.prototype.initSettings=function(){this.ensureDefault=function(B,A){this.settings[B]=(this.settings[B]==undefined)?A:this.settings[B]};this.ensureDefault("upload_url","");this.ensureDefault("preserve_relative_urls",false);this.ensureDefault("file_post_name","Filedata");this.ensureDefault("post_params",{});this.ensureDefault("use_query_string",false);this.ensureDefault("requeue_on_error",false);this.ensureDefault("http_success",[]);this.ensureDefault("assume_success_timeout",0);this.ensureDefault("file_types","*.*");this.ensureDefault("file_types_description","All Files");this.ensureDefault("file_size_limit",0);this.ensureDefault("file_upload_limit",0);this.ensureDefault("file_queue_limit",0);this.ensureDefault("flash_url","swfupload.swf");this.ensureDefault("prevent_swf_caching",true);this.ensureDefault("button_image_url","");this.ensureDefault("button_width",1);this.ensureDefault("button_height",1);this.ensureDefault("button_text","");this.ensureDefault("button_text_style","color: #000000; font-size: 16pt;");this.ensureDefault("button_text_top_padding",0);this.ensureDefault("button_text_left_padding",0);this.ensureDefault("button_action",SWFUpload.BUTTON_ACTION.SELECT_FILES);this.ensureDefault("button_disabled",false);this.ensureDefault("button_placeholder_id","");this.ensureDefault("button_placeholder",null);this.ensureDefault("button_cursor",SWFUpload.CURSOR.ARROW);this.ensureDefault("button_window_mode",SWFUpload.WINDOW_MODE.WINDOW);this.ensureDefault("debug",false);this.settings.debug_enabled=this.settings.debug;this.settings.return_upload_start_handler=this.returnUploadStart;this.ensureDefault("swfupload_loaded_handler",null);this.ensureDefault("file_dialog_start_handler",null);this.ensureDefault("file_queued_handler",null);this.ensureDefault("file_queue_error_handler",null);this.ensureDefault("file_dialog_complete_handler",null);this.ensureDefault("upload_start_handler",null);this.ensureDefault("upload_progress_handler",null);this.ensureDefault("upload_error_handler",null);this.ensureDefault("upload_success_handler",null);this.ensureDefault("upload_complete_handler",null);this.ensureDefault("debug_handler",this.debugMessage);this.ensureDefault("custom_settings",{});this.customSettings=this.settings.custom_settings;if(!!this.settings.prevent_swf_caching){this.settings.flash_url=this.settings.flash_url+(this.settings.flash_url.indexOf("?")<0?"?":"&")+"preventswfcaching="+new Date().getTime()}if(!this.settings.preserve_relative_urls){this.settings.upload_url=SWFUpload.completeURL(this.settings.upload_url);this.settings.button_image_url=SWFUpload.completeURL(this.settings.button_image_url)}delete this.ensureDefault};SWFUpload.prototype.loadFlash=function(){var A,B;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added"}A=document.getElementById(this.settings.button_placeholder_id)||this.settings.button_placeholder;if(A==undefined){throw"Could not find the placeholder element: "+this.settings.button_placeholder_id}B=document.createElement("div");B.innerHTML=this.getFlashHTML();A.parentNode.replaceChild(B.firstChild,A);if(window[this.movieName]==undefined){window[this.movieName]=this.getMovieElement()}};SWFUpload.prototype.getFlashHTML=function(){return['<object id="',this.movieName,'" type="application/x-shockwave-flash" data="',this.settings.flash_url,'" width="',this.settings.button_width,'" height="',this.settings.button_height,'" class="swfupload">','<param name="wmode" value="',this.settings.button_window_mode,'" />','<param name="movie" value="',this.settings.flash_url,'" />','<param name="quality" value="high" />','<param name="menu" value="false" />','<param name="allowScriptAccess" value="always" />','<param name="flashvars" value="'+this.getFlashVars()+'" />',"</object>"].join("")};SWFUpload.prototype.getFlashVars=function(){var B=this.buildParamString();var A=this.settings.http_success.join(",");return["movieName=",encodeURIComponent(this.movieName),"&amp;uploadURL=",encodeURIComponent(this.settings.upload_url),"&amp;useQueryString=",encodeURIComponent(this.settings.use_query_string),"&amp;requeueOnError=",encodeURIComponent(this.settings.requeue_on_error),"&amp;httpSuccess=",encodeURIComponent(A),"&amp;assumeSuccessTimeout=",encodeURIComponent(this.settings.assume_success_timeout),"&amp;params=",encodeURIComponent(B),"&amp;filePostName=",encodeURIComponent(this.settings.file_post_name),"&amp;fileTypes=",encodeURIComponent(this.settings.file_types),"&amp;fileTypesDescription=",encodeURIComponent(this.settings.file_types_description),"&amp;fileSizeLimit=",encodeURIComponent(this.settings.file_size_limit),"&amp;fileUploadLimit=",encodeURIComponent(this.settings.file_upload_limit),"&amp;fileQueueLimit=",encodeURIComponent(this.settings.file_queue_limit),"&amp;debugEnabled=",encodeURIComponent(this.settings.debug_enabled),"&amp;buttonImageURL=",encodeURIComponent(this.settings.button_image_url),"&amp;buttonWidth=",encodeURIComponent(this.settings.button_width),"&amp;buttonHeight=",encodeURIComponent(this.settings.button_height),"&amp;buttonText=",encodeURIComponent(this.settings.button_text),"&amp;buttonTextTopPadding=",encodeURIComponent(this.settings.button_text_top_padding),"&amp;buttonTextLeftPadding=",encodeURIComponent(this.settings.button_text_left_padding),"&amp;buttonTextStyle=",encodeURIComponent(this.settings.button_text_style),"&amp;buttonAction=",encodeURIComponent(this.settings.button_action),"&amp;buttonDisabled=",encodeURIComponent(this.settings.button_disabled),"&amp;buttonCursor=",encodeURIComponent(this.settings.button_cursor)].join("")};SWFUpload.prototype.getMovieElement=function(){if(this.movieElement==undefined){this.movieElement=document.getElementById(this.movieName)}if(this.movieElement===null){throw"Could not find Flash element"}return this.movieElement};SWFUpload.prototype.buildParamString=function(){var C=this.settings.post_params;var B=[];if(typeof (C)==="object"){for(var A in C){if(C.hasOwnProperty(A)){B.push(encodeURIComponent(A.toString())+"="+encodeURIComponent(C[A].toString()))}}}return B.join("&amp;")};SWFUpload.prototype.destroy=function(){try{this.cancelUpload(null,false);var A=null;A=this.getMovieElement();if(A&&typeof (A.CallFunction)==="unknown"){for(var C in A){try{if(typeof (A[C])==="function"){A[C]=null}}catch(E){}}try{A.parentNode.removeChild(A)}catch(B){}}window[this.movieName]=null;SWFUpload.instances[this.movieName]=null;delete SWFUpload.instances[this.movieName];this.movieElement=null;this.settings=null;this.customSettings=null;this.eventQueue=null;this.movieName=null;return true}catch(D){return false}};SWFUpload.prototype.displayDebugInfo=function(){this.debug(["---SWFUpload Instance Info---\n","Version: ",SWFUpload.version,"\n","Movie Name: ",this.movieName,"\n","Settings:\n","\t","upload_url:               ",this.settings.upload_url,"\n","\t","flash_url:                ",this.settings.flash_url,"\n","\t","use_query_string:         ",this.settings.use_query_string.toString(),"\n","\t","requeue_on_error:         ",this.settings.requeue_on_error.toString(),"\n","\t","http_success:             ",this.settings.http_success.join(", "),"\n","\t","assume_success_timeout:   ",this.settings.assume_success_timeout,"\n","\t","file_post_name:           ",this.settings.file_post_name,"\n","\t","post_params:              ",this.settings.post_params.toString(),"\n","\t","file_types:               ",this.settings.file_types,"\n","\t","file_types_description:   ",this.settings.file_types_description,"\n","\t","file_size_limit:          ",this.settings.file_size_limit,"\n","\t","file_upload_limit:        ",this.settings.file_upload_limit,"\n","\t","file_queue_limit:         ",this.settings.file_queue_limit,"\n","\t","debug:                    ",this.settings.debug.toString(),"\n","\t","prevent_swf_caching:      ",this.settings.prevent_swf_caching.toString(),"\n","\t","button_placeholder_id:    ",this.settings.button_placeholder_id.toString(),"\n","\t","button_placeholder:       ",(this.settings.button_placeholder?"Set":"Not Set"),"\n","\t","button_image_url:         ",this.settings.button_image_url.toString(),"\n","\t","button_width:             ",this.settings.button_width.toString(),"\n","\t","button_height:            ",this.settings.button_height.toString(),"\n","\t","button_text:              ",this.settings.button_text.toString(),"\n","\t","button_text_style:        ",this.settings.button_text_style.toString(),"\n","\t","button_text_top_padding:  ",this.settings.button_text_top_padding.toString(),"\n","\t","button_text_left_padding: ",this.settings.button_text_left_padding.toString(),"\n","\t","button_action:            ",this.settings.button_action.toString(),"\n","\t","button_disabled:          ",this.settings.button_disabled.toString(),"\n","\t","custom_settings:          ",this.settings.custom_settings.toString(),"\n","Event Handlers:\n","\t","swfupload_loaded_handler assigned:  ",(typeof this.settings.swfupload_loaded_handler==="function").toString(),"\n","\t","file_dialog_start_handler assigned: ",(typeof this.settings.file_dialog_start_handler==="function").toString(),"\n","\t","file_queued_handler assigned:       ",(typeof this.settings.file_queued_handler==="function").toString(),"\n","\t","file_queue_error_handler assigned:  ",(typeof this.settings.file_queue_error_handler==="function").toString(),"\n","\t","upload_start_handler assigned:      ",(typeof this.settings.upload_start_handler==="function").toString(),"\n","\t","upload_progress_handler assigned:   ",(typeof this.settings.upload_progress_handler==="function").toString(),"\n","\t","upload_error_handler assigned:      ",(typeof this.settings.upload_error_handler==="function").toString(),"\n","\t","upload_success_handler assigned:    ",(typeof this.settings.upload_success_handler==="function").toString(),"\n","\t","upload_complete_handler assigned:   ",(typeof this.settings.upload_complete_handler==="function").toString(),"\n","\t","debug_handler assigned:             ",(typeof this.settings.debug_handler==="function").toString(),"\n"].join(""))};SWFUpload.prototype.addSetting=function(B,C,A){if(C==undefined){return(this.settings[B]=A)}else{return(this.settings[B]=C)}};SWFUpload.prototype.getSetting=function(A){if(this.settings[A]!=undefined){return this.settings[A]}return""};SWFUpload.prototype.callFlash=function(functionName,argumentArray){argumentArray=argumentArray||[];var movieElement=this.getMovieElement();var returnValue,returnString;try{returnString=movieElement.CallFunction('<invoke name="'+functionName+'" returntype="javascript">'+__flash__argumentsToXML(argumentArray,0)+"</invoke>");returnValue=eval(returnString)}catch(ex){throw"Call to "+functionName+" failed"}if(returnValue!=undefined&&typeof returnValue.post==="object"){returnValue=this.unescapeFilePostParams(returnValue)}return returnValue};SWFUpload.prototype.selectFile=function(){this.callFlash("SelectFile")};SWFUpload.prototype.selectFiles=function(){this.callFlash("SelectFiles")};SWFUpload.prototype.startUpload=function(A){this.callFlash("StartUpload",[A])};SWFUpload.prototype.cancelUpload=function(A,B){if(B!==false){B=true}this.callFlash("CancelUpload",[A,B])};SWFUpload.prototype.stopUpload=function(){this.callFlash("StopUpload")};SWFUpload.prototype.getStats=function(){return this.callFlash("GetStats")};SWFUpload.prototype.setStats=function(A){this.callFlash("SetStats",[A])};SWFUpload.prototype.getFile=function(A){if(typeof (A)==="number"){return this.callFlash("GetFileByIndex",[A])}else{return this.callFlash("GetFile",[A])}};SWFUpload.prototype.addFileParam=function(A,B,C){return this.callFlash("AddFileParam",[A,B,C])};SWFUpload.prototype.removeFileParam=function(A,B){this.callFlash("RemoveFileParam",[A,B])};SWFUpload.prototype.setUploadURL=function(A){this.settings.upload_url=A.toString();this.callFlash("SetUploadURL",[A])};SWFUpload.prototype.setPostParams=function(A){this.settings.post_params=A;this.callFlash("SetPostParams",[A])};SWFUpload.prototype.addPostParam=function(A,B){this.settings.post_params[A]=B;this.callFlash("SetPostParams",[this.settings.post_params])};SWFUpload.prototype.removePostParam=function(A){delete this.settings.post_params[A];this.callFlash("SetPostParams",[this.settings.post_params])};SWFUpload.prototype.setFileTypes=function(A,B){this.settings.file_types=A;this.settings.file_types_description=B;this.callFlash("SetFileTypes",[A,B])};SWFUpload.prototype.setFileSizeLimit=function(A){this.settings.file_size_limit=A;this.callFlash("SetFileSizeLimit",[A])};SWFUpload.prototype.setFileUploadLimit=function(A){this.settings.file_upload_limit=A;this.callFlash("SetFileUploadLimit",[A])};SWFUpload.prototype.setFileQueueLimit=function(A){this.settings.file_queue_limit=A;this.callFlash("SetFileQueueLimit",[A])};SWFUpload.prototype.setFilePostName=function(A){this.settings.file_post_name=A;this.callFlash("SetFilePostName",[A])};SWFUpload.prototype.setUseQueryString=function(A){this.settings.use_query_string=A;this.callFlash("SetUseQueryString",[A])};SWFUpload.prototype.setRequeueOnError=function(A){this.settings.requeue_on_error=A;this.callFlash("SetRequeueOnError",[A])};SWFUpload.prototype.setHTTPSuccess=function(A){if(typeof A==="string"){A=A.replace(" ","").split(",")}this.settings.http_success=A;this.callFlash("SetHTTPSuccess",[A])};SWFUpload.prototype.setAssumeSuccessTimeout=function(A){this.settings.assume_success_timeout=A;this.callFlash("SetAssumeSuccessTimeout",[A])};SWFUpload.prototype.setDebugEnabled=function(A){this.settings.debug_enabled=A;this.callFlash("SetDebugEnabled",[A])};SWFUpload.prototype.setButtonImageURL=function(A){if(A==undefined){A=""}this.settings.button_image_url=A;this.callFlash("SetButtonImageURL",[A])};SWFUpload.prototype.setButtonDimensions=function(C,A){this.settings.button_width=C;this.settings.button_height=A;var B=this.getMovieElement();if(B!=undefined){B.style.width=C+"px";B.style.height=A+"px"}this.callFlash("SetButtonDimensions",[C,A])};SWFUpload.prototype.setButtonText=function(A){this.settings.button_text=A;this.callFlash("SetButtonText",[A])};SWFUpload.prototype.setButtonTextPadding=function(B,A){this.settings.button_text_top_padding=A;this.settings.button_text_left_padding=B;this.callFlash("SetButtonTextPadding",[B,A])};SWFUpload.prototype.setButtonTextStyle=function(A){this.settings.button_text_style=A;this.callFlash("SetButtonTextStyle",[A])};SWFUpload.prototype.setButtonDisabled=function(A){this.settings.button_disabled=A;this.callFlash("SetButtonDisabled",[A])};SWFUpload.prototype.setButtonAction=function(A){this.settings.button_action=A;this.callFlash("SetButtonAction",[A])};SWFUpload.prototype.setButtonCursor=function(A){this.settings.button_cursor=A;this.callFlash("SetButtonCursor",[A])};SWFUpload.prototype.queueEvent=function(B,C){if(C==undefined){C=[]}else{if(!(C instanceof Array)){C=[C]}}var A=this;if(typeof this.settings[B]==="function"){this.eventQueue.push(function(){this.settings[B].apply(this,C)});setTimeout(function(){A.executeNextEvent()},0)}else{if(this.settings[B]!==null){throw"Event handler "+B+" is unknown or is not a function"}}};SWFUpload.prototype.executeNextEvent=function(){var A=this.eventQueue?this.eventQueue.shift():null;if(typeof (A)==="function"){A.apply(this)}};SWFUpload.prototype.unescapeFilePostParams=function(C){var E=/[$]([0-9a-f]{4})/i;var F={};var D;if(C!=undefined){for(var A in C.post){if(C.post.hasOwnProperty(A)){D=A;var B;while((B=E.exec(D))!==null){D=D.replace(B[0],String.fromCharCode(parseInt("0x"+B[1],16)))}F[D]=C.post[A]}}C.post=F}return C};SWFUpload.prototype.testExternalInterface=function(){try{return this.callFlash("TestExternalInterface")}catch(A){return false}};SWFUpload.prototype.flashReady=function(){var A=this.getMovieElement();if(!A){this.debug("Flash called back ready but the flash movie can't be found.");return }this.cleanUp(A);this.queueEvent("swfupload_loaded_handler")};SWFUpload.prototype.cleanUp=function(A){try{if(this.movieElement&&typeof (A.CallFunction)==="unknown"){this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");for(var C in A){try{if(typeof (A[C])==="function"){A[C]=null}}catch(B){}}}}catch(D){}window.__flash__removeCallback=function(E,F){try{if(E){E[F]=null}}catch(G){}}};SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler")};SWFUpload.prototype.fileQueued=function(A){A=this.unescapeFilePostParams(A);this.queueEvent("file_queued_handler",A)};SWFUpload.prototype.fileQueueError=function(A,C,B){A=this.unescapeFilePostParams(A);this.queueEvent("file_queue_error_handler",[A,C,B])};SWFUpload.prototype.fileDialogComplete=function(B,C,A){this.queueEvent("file_dialog_complete_handler",[B,C,A])};SWFUpload.prototype.uploadStart=function(A){A=this.unescapeFilePostParams(A);this.queueEvent("return_upload_start_handler",A)};SWFUpload.prototype.returnUploadStart=function(A){var B;if(typeof this.settings.upload_start_handler==="function"){A=this.unescapeFilePostParams(A);B=this.settings.upload_start_handler.call(this,A)}else{if(this.settings.upload_start_handler!=undefined){throw"upload_start_handler must be a function"}}if(B===undefined){B=true}B=!!B;this.callFlash("ReturnUploadStart",[B])};SWFUpload.prototype.uploadProgress=function(A,C,B){A=this.unescapeFilePostParams(A);this.queueEvent("upload_progress_handler",[A,C,B])};SWFUpload.prototype.uploadError=function(A,C,B){A=this.unescapeFilePostParams(A);this.queueEvent("upload_error_handler",[A,C,B])};SWFUpload.prototype.uploadSuccess=function(B,A,C){B=this.unescapeFilePostParams(B);this.queueEvent("upload_success_handler",[B,A,C])};SWFUpload.prototype.uploadComplete=function(A){A=this.unescapeFilePostParams(A);this.queueEvent("upload_complete_handler",A)};SWFUpload.prototype.debug=function(A){this.queueEvent("debug_handler",A)};SWFUpload.prototype.debugMessage=function(C){if(this.settings.debug){var A,D=[];if(typeof C==="object"&&typeof C.name==="string"&&typeof C.message==="string"){for(var B in C){if(C.hasOwnProperty(B)){D.push(B+": "+C[B])}}A=D.join("\n")||"";D=A.split("\n");A="EXCEPTION: "+D.join("\nEXCEPTION: ");SWFUpload.Console.writeLine(A)}else{SWFUpload.Console.writeLine(C)}}};SWFUpload.Console={};SWFUpload.Console.writeLine=function(D){var B,A;try{B=document.getElementById("SWFUpload_Console");if(!B){A=document.createElement("form");document.getElementsByTagName("body")[0].appendChild(A);B=document.createElement("textarea");B.id="SWFUpload_Console";B.style.fontFamily="monospace";B.setAttribute("wrap","off");B.wrap="off";B.style.overflow="auto";B.style.width="700px";B.style.height="350px";B.style.margin="5px";A.appendChild(B)}B.value+=D+"\n";B.scrollTop=B.scrollHeight-B.clientHeight}catch(C){alert("Exception: "+C.name+" Message: "+C.message)}};SWFUpload.GetSwfVer=function(){var G=-1;if(navigator.plugins!=null&&navigator.plugins.length>0){if(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]){var F=navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"";var A=navigator.plugins["Shockwave Flash"+F].description;var E=A.split(" ");var C=E[2].split(".");var H=C[0];var B=C[1];var D=E[3];if(D==""){D=E[4]}if(D[0]=="d"){D=D.substring(1)}else{if(D[0]=="r"){D=D.substring(1);if(D.indexOf("d")>0){D=D.substring(0,D.indexOf("d"))}}}var G=H+"."+B+"."+D}}else{if(Prototype.Browser.IE&&(navigator.appVersion.toLowerCase().indexOf("win")!=-1)&&!Prototype.Browser.Opera){G=SWFUpload.ControlVersion()}}return G};SWFUpload.DetectFlashVer=function(F,D,C){versionStr=SWFUpload.GetSwfVer();if(versionStr==-1){return false}else{if(versionStr!=0){if(Prototype.Browser.IE&&(navigator.appVersion.toLowerCase().indexOf("win")!=-1)&&!Prototype.Browser.Opera){tempArray=versionStr.split(" ");tempString=tempArray[1];versionArray=tempString.split(",")}else{versionArray=versionStr.split(".")}var E=versionArray[0];var A=versionArray[1];var B=versionArray[2];if(E>parseFloat(F)){return true}else{if(E==parseFloat(F)){if(A>parseFloat(D)){return true}else{if(A==parseFloat(D)){if(B>=parseFloat(C)){return true}}}}}return false}}};SWFUpload.ControlVersion=function(){var A=-1;var B;var C;try{B=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");A=B.GetVariable("$version")}catch(C){}if(!A){try{B=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");A="WIN 6,0,21,0";B.AllowScriptAccess="always";A=B.GetVariable("$version")}catch(C){}}return A};PBwiki.Components=PBwiki.Components||{};PBwiki.Components.TreeView=Class.create({idKey:"oid",parentIdKey:"parent_id",noParentId:0,rootParentId:0,open:[],setData:function(B,A){this.data=B;if(A){this.open=A}this.computeLookups();this.nodes=this.computeTree(this.rootParentId,[],[])},setOpenNodes:function(A){this.open=A;this.nodes=this.computeTree(this.rootParentId,[],[])},isOpen:function(A){return this.open.indexOf(A)!=-1},expand:function(A){if(this.open.indexOf(A)==-1){this.open.push(A);this.setOpenNodes(this.open)}},collapse:function(A){this.setOpenNodes(this.open.without(A))},openParentNodes:function(C){var A=C,B;while(A&&A!=this.rootParentId){if(!this.isOpen(A)){this.expand(A);B=true}if(!this.indexes[A]){break}A=this.data[this.indexes[A]][this.parentIdKey]}return B},toggle:function(A){return this.isOpen(A)?this.collapse(A):this.expand(A)},computeLookups:function(){this.children={};this.indexes={};this.parents={};for(var A=0;A<this.data.length;A++){if(!this.data[A][this.parentIdKey]){this.data[A][this.parentIdKey]=this.noParentId}this.indexes[this.data[A][this.idKey]]=A;this.parents[this.data[A][this.idKey]]=this.data[A][this.parentIdKey];if(!this.children[this.data[A][this.parentIdKey]]){this.children[this.data[A][this.parentIdKey]]=[]}this.children[this.data[A][this.parentIdKey]].push(this.data[A][this.idKey])}},computeTree:function(C,A,D){if(this.children[C]){var G,E;for(var B=0;B<this.children[C].length;B++){G=this.children[C][B];E=D.clone();E.push(B!=this.children[C].length-1);var F={key:G,index:this.indexes[G],levels:E,parent_id:C};if(this.children[G]){F.hc=true}if(B==this.children[C].length-1){F.last=true}A.push(F);if(this.children[G]&&this.isOpen(G)){A.concat(A,this.computeTree(G,A,E))}}}return A},getData:function(E,A){if(!E){E=0}if(!A){A=this.nodes.length}var B=this.nodes.slice(E,A);var D=[];for(var C=0;C<B.length;C++){D[C+E]=Object.extend(Object.clone(this.data[B[C].index]),Object.clone(B[C]))}return D}});PBwiki.Components.APITreeView=Class.create(PBwiki.Components.TreeView,{apiMethod:"GetObjectsNOM",apiOpts:{},apiKey:"objects",initialize:function(A){this.options=A;this.refresh()},refresh:function(){(new PBwiki.APIRequest(this.apiMethod,this.apiOpts,{onSuccess:this.onLoad.bind(this)}))},onLoad:function(A){this.setData(A[this.apiKey],this.getOpenFromPref());this.onAfterLoad()},onAfterLoad:function(){this.redraw()},getOpenFromPref:function(){var C=PBwiki.UserPrefs.get(this.prefKey);if(!C){return[]}var A=C.toString().split(",");for(var B=0;B<A.length;B++){A[B]=parseInt(A[B],10)}return A},redraw:function(){this.options.elm.update("");delete this.selectedRow;this.getData().each(function(C){try{var A=this.onRenderRow(C);this.options.elm.appendChild(A);if(this.options.selectedObject&&C.oid==this.options.selectedObject.oid){this.selectedRow=A}}catch(B){PBwiki.error(B)}},this)},setOpenNodes:function($super,A){var B=[];A.each(function(D){if(typeof (this.indexes[D])!="undefined"){B.push(D)}},this);var C=B.join(",");PBwiki.UserPrefs.set(this.prefKey,C);$super(B)}});PBwiki.Components.ScrollingAPITreeView=Class.create(PBwiki.Components.APITreeView,{initialize:function($super,A){$super(A)},onAfterLoad:function($super){$super();this.options.elm.observe("scroll",this.onScroll.bind(this))},redraw:function(){this.options.elm.update("");this.loadedRows={};delete this.selectedRow;this.options.elm.setStyle({position:"relative"});var A=new Element("div").setStyle({height:this.nodes.length*this.rowHeight+"px"});this.options.elm.appendChild(A);this.onScroll()},onScroll:function(){var A=this.getVisibleRows(),D;for(var B=A.start;B<A.end;B++){if(this.loadedRows[B]){continue}if(!D){D=this.getData(A.start,A.end)}var E=D[B];var C=this.onRenderRow(E);C.setStyle({position:"absolute",top:B*this.rowHeight+"px"});this.options.elm.appendChild(C);if(this.options.selectedObject&&E.oid==this.options.selectedObject.oid){this.selectedRow=C}this.loadedRows[B]=true}},getVisibleRows:function(){var B=Math.floor(this.options.elm.scrollTop/this.rowHeight);B=Math.max(0,B-5);var A=Math.ceil((this.options.elm.scrollTop+this.options.elm.getHeight())/this.rowHeight);A=Math.min(this.nodes.length,A+5);return{start:B,end:A}}});PBwiki.Components.WorkspaceObjectTreeView=Class.create(PBwiki.Components.ScrollingAPITreeView,{prefKey:PBconst.kWorkspaceTreeOpenNodes,rowHeight:22,apiOpts:{},initialize:function($super,A){this.apiOpts={sortby:"name",recursive:true};if(A.object_types){this.apiOpts.object_types=A.object_types}if(A.workspace){this.apiOpts.wiki=A.workspace}if(typeof (A.includeEmptyFolders)!="undefined"){this.includeEmptyFolders=A.includeEmptyFolders}if(!A.scrollElm){A.scrollElm=A.elm}$super(A)},refresh:function($super){$super();this.options.elm.addClassName("loading")},clearSelectedObject:function(){this.options.selectedObject=null;this.redraw()},onAfterLoad:function($super){this.options.elm.removeClassName("loading");if(this.options.selectedObject){this.openParentNodes(this.options.selectedObject[this.idKey])}$super();if(this.selectedRow){var A=this.selectedRow.cumulativeOffset().top-this.options.scrollElm.cumulativeOffset().top;A-=(this.options.scrollElm.getHeight()/2)-(this.selectedRow.getHeight()/2);this.options.scrollElm.scrollTop=A}this.notify("onLoad")},onRenderRow:function(L,D){var G=new Element("div").addClassName("row");var C=390;C-=21;var I=function(M){this.toggle(L.oid);this.redraw();M.stop()}.bind(this);var A=function(M){M.stop();this.options.selectedObject=L;this.redraw();this.notify("onSelected",L)}.bind(this);if(this.options.show_network_indent){G.appendChild(new Element("div",{"class":"spacer line"}));C-=15}for(var E=0;E<L.levels.length;E++){var H=new Element("div").addClassName("spacer");if(E<L.levels.length-1){if(L.levels[E]){H.addClassName("line")}}else{H.addClassName(L.last?"ln":"tn");if(L.type=="folder"&&L.hc){var K=new Element("div",{"class":"spacer"}).addClassName(this.isOpen(L.oid)?"contract":"expand");K.observe("click",I);H.appendChild(K)}}G.appendChild(H);C-=15}if(this.options.selectedObject&&L.oid==this.options.selectedObject.oid){G.addClassName("active")}if(L.type=="folder"){var B=new Element("a",{"class":"iconbutton folder",href:"#"});C-=20;if(this.options.selectable_folder_objects){B.observe("click",A)}else{B.addClassName("expandable");B.observe("click",I);var F=this.isOpen(L.oid)?"contract_hover":"expand_hover";B.observe("mouseover",function(){if(K){K.addClassName(F)}});B.observe("mouseout",function(){if(K){K.removeClassName(F)}})}B.setStyle({width:C+"px"});B.innerHTML=L.name.escapeHTML();G.appendChild(B)}else{var J=new Element("a",{href:"#","class":"iconbutton ellipses"});C-=20;J.setStyle({width:C+"px"});J.innerHTML=L.name.escapeHTML();if(L.type=="page"){J.addClassName("pageicon")}else{J.addClassName(Util.getFileIcon(L.name));if(this.options.workspace){L.wiki=this.options.workspace}Util.addObjectTooltip(J,L)}J.observe("click",A);G.appendChild(J)}return G}});Object.Event.extend(PBwiki.Components.WorkspaceObjectTreeView);PBwiki.Components.NetworkObjectTreeView=Class.create({initialize:function(A){this.options=A;this.options.elm.addClassName("network");this.load();if(this.options.selectedWorkspace){this.scrollToSelectedWorkspace()}this.toggle(this.options.selectedWorkspace,function(){if(!this.options.workspaceOpts.selectedObject&&this.options.selectedWorkspace){this.scrollToSelectedWorkspace()}}.bind(this))},scrollToSelectedWorkspace:function(){var A=this.treeRows[this.options.selectedWorkspace].cumulativeOffset().top-this.options.elm.cumulativeOffset().top;this.options.elm.scrollTop=A-22},redraw:function(){},load:function(){this.options.elm.innerHTML="";this.treeRows={};this.trees={};this.workspaceRows={};for(var B=0;B<this.options.workspaces.length;B++){var A=this.options.workspaces[B];if(B==this.options.workspaces.length-1){A.last=true}this.options.elm.appendChild(this.onRenderRow(A));this.options.elm.appendChild(this.onRenderTree(A))}},toggle:function(C,B){var A=this.trees[C];var F=this.treeRows[C];var E;if(!A){var D=Object.clone(this.options.workspaceOpts);D.workspace=C;D.elm=this.treeRows[C];D.show_network_indent=true;D.scrollElm=this.options.elm;A=this.trees[C]=new PBwiki.Components.WorkspaceObjectTreeView(D);if(B){A.observe("onLoad",B)}A.observe("onSelected",function(H){H.workspace=C;for(w in this.trees){if(w==C){continue}this.trees[w].clearSelectedObject()}this.notify("onSelected",H)}.bind(this));E=true}else{if(!F.visible()){F.show();if(B){B()}E=true}else{F.hide();if(B){B()}E=false}}var G=this.workspaceRows[C].down("div.expander");G.addClassName(E?"contract":"expand").removeClassName(E?"expand":"contract");return G},onRenderTree:function(A){this.treeRows[A.name]=new Element("div",{"class":"tree"});return this.treeRows[A.name]},onOverRow:function(A){var B=this.workspaceRows[A].down("div.expander");if(B){B.removeClassName("contract_hover").removeClassName("expand_hover");B.addClassName(B.hasClassName("contract")?"contract_hover":"expand_hover")}},onOutRow:function(A){var B=this.workspaceRows[A].down("div.expander");if(B){B.removeClassName("contract_hover").removeClassName("expand_hover")}},onRenderRow:function(A){var B=function(G){G.stop();this.toggle(A.name);this.onOverRow(A.name)}.bind(this);var E=new Element("div").addClassName("workspace");var D=new Element("div").addClassName("spacer");D.addClassName(A.last?"ln":"tn");var F=new Element("div",{"class":"spacer expander"}).addClassName("expand");F.observe("click",B);D.appendChild(F);E.appendChild(D);var C=new Element("a",{href:"#","class":"expandable iconbutton world ellipses"});C.observe("click",B);C.innerHTML=A.title.escapeHTML();C.observe("mouseover",this.onOverRow.bind(this,A.name));C.observe("mouseout",this.onOutRow.bind(this,A.name));E.appendChild(C);this.workspaceRows[A.name]=E;return E}});Object.Event.extend(PBwiki.Components.NetworkObjectTreeView);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)})};["AddNetworkGroup","NetworkGroupRole","NetworkGroupDel","NetworkGroupWorkspace","AddUsersDialog","CreateNewPage","FolderSelector","CreateNewFolder","FolderSecurity","DocImportSuggestion","FlashUploader","LegacyUploader","RateLimited","SecureStorage","SecureCommunication","JoinWorkspace","DeleteFolder","WhatCanSee","InsertLink","InsertLink2","EditTemplateVariable","AddUsersWizard","PreviewInvitationWizard"].each(function(A){PBwiki.DialogCommands[A]=function(B){PBwiki.DialogCommands._LoadOnDemand(A,B)}});PBwiki.DialogCommands.TemplateDialog=Class.create({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="+pbBuildTime}}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("ui: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,{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||{},{cacheability:["permtime"],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,{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)}switch(this.options.type){case"alert":return this.setupAlert();case"confirm":return this.setupConfirm();case"prompt":return this.setupPrompt();case"spinner":return this.setupSpinner();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()},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(){$("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();$("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)},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})}});Page.AjaxEdit={editMode:false,sizeWarned:false,partialLoadEditor:false,initialize:function(){if(!PBwiki.feature("ajaxedit")||PBinfo.CurrentPage.editor_v3){return }if(window.location.search.toString().indexOf("edit=")!=-1){return }if($("edit-tab")&&$("edit-toolbar")&&$("view-tab")&&!$("edit-tab").hasClassName("logintoedit")){Page.AjaxEdit.start.bind(Page.AjaxEdit)()}},start:function(){this.partialLoadEditor=true;this.modeEnabled=true;if(window.location.hash=="#pbedit"){window.location.hash="#view=edit"}this.historyManager=PBwiki.History;this.historyManager.getKey("view").observe("onChange",function(D){if(["page","edit"].indexOf(D)!=-1){this.onViewChanged((D=="edit"))}}.bind(this));if(this.historyManager.getKey("view").getValue()=="edit"){if($("edit-tab").hasClassName("steal")){this.historyManager.setValues({view:"page"})}else{if($("wikicontent")){$("wikicontent").hide()}this.onViewChanged(true)}}if(PBinfo.CurrentPage.saved){document.fire("ui:onCurrentPageSaved",{})}this.frameTimer=setTimeout(this.loadFirstStage.bind(this),(window.location.hash=="#view=edit")?0:1000);document.observe("ui:fckeditor_oncomplete",function(){this.secondStage=true;this.resizeContentPanel()}.bind(this));document.observe("ui:editview",function(){this.onViewChanged(true)}.bind(this));document.observe("ui:fullscreen",this.setFullscreenMode.bind(this,true));document.observe("ui:nofullscreen",this.setFullscreenMode.bind(this,false));document.observe("ui:edit_lock_stolen",this.onEditLockStolen.bind(this));document.observe("live:locked",function(E){if(!this.editMode){return }var D=E.memo;if(!D.page||D.page!=PBwiki.getPageName()){return }if(D.owner!=PBwiki.getUID()){document.fire("ui:edit_lock_stolen",D)}}.bind(this));$("edit-tab").observe("mouseover",this.loadSecondStage.bind(this));$("view-tab").observe("click",this.tabClick.bindAsEventListener(this,false));$("edit-tab").observe("click",this.tabClick.bindAsEventListener(this,true));var A=$("edit-tab").down("a");if(A){A.onclick=null}var C=$("edit-toolbar").down(".button");$("cancelButton").observe("click",this.cancelEdit.bind(this));if(this.ajaxSave){C.observe("click",this.saveContent.bind(this));C.setAttribute("onclick","")}if(PBwiki.feature("ajaxcreate")){var B=$("main-tools").down("a.createpage");if(B&&!B.hasClassName("disabled")){B.observe("click",this.createPage.bind(this))}}Page.EditPage.Tags.initialize();if($("live_edit_toggle")){$("live_edit_toggle").observe("click",this.startLiveEdit.bind(this));document.observe("live:start_live_editing",this.onLiveEditStart.bind(this));document.observe("live:end_live_editing",this.onLiveEditEnd.bind(this));document.observe("live:deny_edit_request",this.onLiveEditDenyRequest.bind(this))}this.historyManager.start()},tabClick:function(B,A){if(B){B.stop();try{B.element().blur()}catch(B){}}this.onViewChanged(A)},onViewChanged:function(A){if(this.editMode==A){return }if(!A&&this.IsDirty()){if(!confirm("You have unsaved changes. Continue and discard those changes?")){this.historyManager.setValues({view:(this.editMode)?"edit":"page"});return }}if(A&&$("edit-tab").hasClassName("steal")){if(!confirm("This page is being edited by "+$("lockinfo").down("a").innerHTML+". Are you sure you wish to steal the lock?")){this.setMode(false);return }}this.setMode(A)},setMode:function(B){if(this.editMode==B){return }this.editMode=B;this.historyManager.setValues({view:(B)?"edit":"page"});try{if(B){this.loadSecondStage();Page.Thingbar.doLoad();var A=[];A.push(["SetPageLock",{page:PBwiki.getPageName(),steal:$("edit-tab").hasClassName("steal")},{onSuccess:function(E){this.handleLockinfo(E.lockinfo)}.bind(this)}]);if($("notification-autosave")){var D=Page.Notifications.findNotification($("notification-autosave"));if(!D){D=$("notification-autosave")}D.remove();A.push(["GetAutosave",{page:PBwiki.getPageName()},{onSuccess:this.handleAutosave.bind(this)}])}else{A.push(["GetPage",{page:PBwiki.getPageName(),raw:true},{onSuccess:this.handleGetPage.bind(this)}])}new PBwiki.MultiAPIRequest(A,{incUsess:true,onAllComplete:function(E){if(E.lastError){document.fire("ui:onNotifyUser",{message:E.lastError});this.setMode(false)}}.bind(this),onFailure:function(E){document.fire("ui:onNotifyUser",{message:E});this.setMode(false)}.bind(this)})}else{new PBwiki.APIRequest("UnlockPage",{page:PBwiki.getPageName()},{})}this.setChromeVisibility(B);this.setModeEvents(B)}catch(C){document.fire("ui:onNotifyUser",{message:"Failed to enter edit mode: "+C.message});return }if(!B&&this.secondStage&&this.IsDirty()){this.setContent(this.initialContent)}},IsDirty:function(){var A=this.getEditor();return((A)?A.IsDirty():false)||Page.EditPage.Tags.IsDirty()},handleGetPage:function(A){if(A.html!=this.initialContent){this.initialContent=A.html;this.setContent(A.html)}},handleAutosave:function(A){if(A.autosave){this.setContent(A.autosave.DATA)}},handleLockinfo:function(B){if(!B.hasLock){var A='<div class="edit-warning"><div class="content">';A+='This page is being edited by <a href="/user/'+B.owner+'">'+B.editname.escapeHTML()+"</a>.";A+='<a class="edit-warning" href="#view=edit">Steal lock</a></div></div>';$("lockinfo").update(A);$("edit-tab").addClassName("steal");this.onViewChanged("view");return }else{$("edit-tab").removeClassName("steal");$("lockinfo").update("")}},setChromeVisibility:function(A){(!A)?$("view-tab").addClassName("active"):$("view-tab").removeClassName("active");(A)?$("edit-tab").addClassName("active"):$("edit-tab").removeClassName("active");(!A)?$("wikicontent").show():$("wikicontent").hide();$("wikiedit").style.display=(A)?"block":"none";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";if(A){UserPrefs.Manager.saveWidth();UserPrefs.Manager.goFullWidth()}else{UserPrefs.Manager.restoreWidth()}if(A){this.resizeContentPanel()}},setFullscreenMode:function(A){(A)?$("editwikipage").addClassName("fullscreen"):$("editwikipage").removeClassName("fullscreen");$("editwikipage").setStyle({width:""});if($("top-content")){$("top-content").style.display=(A)?"none":"block"}$("editor-column").style.display=(A)?"none":"block";$("show_tags").style.display=(A)?"none":"block";var D=$("content___Frame");if(D&&D.contentWindow){var B=D.contentWindow.document.getElementById("xToolbar");for(var C=0;C<B.childNodes.length;C++){if(B.childNodes[C].nodeName.toUpperCase()=="DIV"){B.childNodes[C].style.display=(A)?"none":"block";break}}}this.isFullscreen=A;this.resizeContentPanel()},setModeEvents:function(A){window.onresize=(A)?this.resizeContentPanel.bind(this):null;window.onbeforeunload=(A)?this.beforeUnload.bind(this):null;if(A){Page.EditPage.AutoSave.start.bind(Page.EditPage.AutoSave)()}else{Page.EditPage.AutoSave.stop.bind(Page.EditPage.AutoSave)()}},cancelEdit:function(A){A.stop();if(this.isFullscreen){document.fire("ui:nofullscreen")}this.setMode(false)},resetDirty:function(){if(this.secondStage){var A=this.getEditor();if(A&&A.ResetIsDirty){A.ResetIsDirty()}}},doDeleteAutosave:function(){new PBwiki.APIRequest("DeleteAutosave",{page:PBwiki.getPageName()},{onSuccess:function(){Page.Notifications.findNotification($("notification-autosave")).remove()}})},setEditorFocus:function(){$("autosave_msg").update($("autosave_msg").innerHTML);var A=this.getEditor();if(A&&this.secondStage){A.Focus()}},setContent:function(C){var A=this.getEditor();try{Page.EditPage.AutoSave.lastHTML=C;A.SetHTML(C,true);A.Focus()}catch(B){}$("content").value=C;this.checkSizeWarning(C.length)},checkSizeWarning:function(B){var A=Math.round(B/1024);var C=PBconst.kPolicyPageSizeWarning/1024;if(A>C&&!this.sizeWarned){document.fire("ui:onNotifyUser",{mode:"warning",message:"Warning: This page is "+A+'KB. We <a target="doc" href="https://usermanual.pbworks.com/Best-Practices#Addingnewpages">recommend splitting pages</a> larger than '+C+"KB up into several smaller pages for easier readability and best performance."});this.sizeWarned=true}},getEditor:function(){if(typeof (FCKeditorAPI)!="undefined"){return FCKeditorAPI.GetInstance("content")}},loadSecondStage:function(){if(this.secondStage||this.secondLoading){return }this.secondLoading=true;this.partialLoadEditor=false;this.loadFirstStage();if(!PBinfo.GetPage.hasPlugins&&$$(".searchhilitepage").length==0){this.editContent=$("wikipage-inner")?$("wikipage-inner").innerHTML:""}var A=$("content___Frame");if(A&&A.contentWindow&&A.contentWindow.SecondStage){A.contentWindow.SecondStage()}},loadFirstStage:function(){if(this.firstStage||this.firstLoading){return }this.firstLoading=true;if($("content")){return }var B=$("wikiedit");var C=(Prototype.Browser.IE)?"ie":"gecko";var A='<iframe id="content___Frame" src="/FCKeditor/build-fck/editor/'+C+"-"+PBinfo.CurrentPage.editorVersion+(PBinfo.CurrentWiki.debug?"/debug":"");A+='" width="100%" height="'+this.getResizeHeight()+'" frameborder="0" scrolling="no"></iframe>';A+='<input type="hidden" id="content___Config" value="ToolbarStartExpanded=true&amp;SkinPath=/FCKeditor/build-fck/editor/skins/silver/" style="display:none" />';var E=new Element("textarea");E.setAttribute("id","content");E.setAttribute("name","content");E.style.display="none";E.value="";var D=this.getContentFromPage();if(D){E.value=this.initialContent=D}$("editframe").innerHTML=A;$("editframe").appendChild(E);if(PBinfo.CurrentWiki.debug){$("content___Frame").contentWindow.onerror=PBwiki.jsDebug}},firstStageLoaded:function(){this.firstStage=true;this.firstLoading=false;document.fire("ui:fckeditor_preloaded")},getResizeHeight:function(){var C=$("content___Frame");var B=(C&&C.cumulativeOffset)?C.cumulativeOffset()[1]:$("editwikipage").cumulativeOffset()[1];if($("page-footer")&&!this.isFullscreen){B+=$("page-footer").getHeight()+parseInt($("page-footer").getStyle("marginBottom"))}B+=$("edit-toolbar-outer").getHeight()+parseInt($("edit-toolbar-outer").getStyle("marginBottom"));var A=document.documentElement.clientHeight-(B+2);A=(A<310?310:A);return A},resizeContentPanel:function(){var A=$("content___Frame");if(!A){return }A.style.height=this.getResizeHeight()+"px";if(A.contentWindow.onresize){A.contentWindow.onresize()}if(this.editMode){this.setEditorFocus()}if(this.isFullscreen){$("editwikipage").setStyle({width:Math.max(document.documentElement.clientWidth,$("main-content").getWidth())+"px"})}},beforeUnload:function(A){A=A||window.event;try{if(this.IsDirty()&&!Page.EditPage.cancel){var C="You have unsaved changes. Continue and discard those changes?";A.returnValue=C;return C}}catch(B){}},startLiveEdit:function(A){A.stop();(new PBwiki.DialogCommands.FindUsers({title:"Invite users to Live View",isLiveEdit:true,isLiveEditor:true,showGroupChats:true,onSelect:function(B){document.fire("live:start_live_editing",B)}.bind(this)}))},onLiveEditStart:function(A){(new PBwiki.APIRequest("SetPageLock",{page:PBwiki.getPageName(),"private":false},{onSuccess:function(B){PBinfo.GetPage.lockinfo=B.lockinfo;Page.EditPage.AutoSave.stop();Page.EditPage.AutoSave.start({draft:{draft_id:B.lockinfo.draft_id,v:0},saveInterval:2});Page.EditPage.AutoSave.lastHTML="";var E=A.memo;var D={wiki:PBinfo.CurrentWiki.name};var C={request_wiki_name:PBinfo.CurrentWiki.name,link:Util.URLRelativeToContext("/"+PBwiki.getPageName()+"#view=liveview",D)};E.each(function(G){C.live_edit_link_for_user=Strophe.getNodeFromJid(G);var H=$J.message({to:G,type:"chat"}).c("body",{unique:PBwiki.Live.randomString()}).c("link-to-page",C).t(PBwiki.getPageName());PBwiki.Live.connection.send(H)});var F=PBwiki.Live.getLiveEditChatForCurrentPage();if(!F){F=new PBwiki.Live.ChatBox(PBwiki.getUID(),true,true);F.show(true)}}}))},onLiveEditDenyRequest:function(F){var D=F.memo;var C=D+"@"+PBwiki.Live.basedomain;var B={wiki:PBinfo.CurrentWiki.name};var A={request_wiki_name:PBinfo.CurrentWiki.name,live_edit_request_deny_for_user:D,link:Util.URLRelativeToContext("/"+PBwiki.getPageName()+"#view=liveview",B)};var E=$J.message({to:C,type:"chat"}).c("body",{unique:PBwiki.Live.randomString()}).c("link-to-page",A).t(PBwiki.getPageName());PBwiki.Live.connection.send(E)},onLiveEditEnd:function(){(new PBwiki.APIRequest("SetPageLock",{page:PBwiki.getPageName(),"private":true},{onSuccess:function(A){PBinfo.GetPage.lockinfo=A.lockinfo;Page.EditPage.AutoSave.stop();Page.EditPage.AutoSave.start()}}))},onEditLockStolen:function(B){var A=B.memo;PBinfo.GetPage.lockinfo=A;alert(((A.editname)?A.editname:"Somebody")+" has stolen your lock on this page.  You will no longer be able to save changes.");Page.EditPage.AutoSave.stop();document.fire("ui:disablesave")},getContentFromPage:function(){if(!$("wikipage-inner")||PBinfo.GetPage.hasPlugins||$$(".searchhilitepage").length>0||$$("table.pbSortable").length>0){return }return $("wikipage-inner").innerHTML},createPage:function(A){A.stop();new PBwiki.DialogCommands.CreateNewPage({noPreloadView:true,onCreate:function(B){window.location.href=PBwiki.getEditURI(B)}})}};Page.Thingbar={pageOpts:{verbose:true,detail:"partial",count:10,offset:0,sortby:"mtime",reverse:true},fileOpts:{verbose:true,detail:"partial",count:10,offset:0,sortby:"mtime",reverse:true},doLoad:function(){if(!$("thingbarLoadIcon")){return true}new MiniTabSwitcher({"linkselectab-pages":"thingbar-pages","linkselectab-images":"thingbar-images"});this.loadPages();$("linkselectab-images").observe("ui:tabswitched",this.filesTab.bind(this));if(!Prototype.Browser.IE){$("linkselectab-images").observe("ui:tabswitched",this.changeTipMessage.bind(this,true));$("linkselectab-pages").observe("ui:tabswitched",this.changeTipMessage.bind(this,false))}},changeTipMessage:function(B){var A=B?"Drag and drop images or files from your desktop to add them to this workspace page.":"To turn text into a link, highlight the text, then click on a page or file from the list above.";$("editor-tip").update("<strong>Tip:&nbsp;</strong> "+A)},showPageLoadIcon:function(){this.pageList.update('<img src="/images/spin_bw.gif" /> Loading '+((!this.pageOpts.count)?"All ":"")+"Pages...")},showFileLoadIcon:function(){this.fileList.update('<img src="/images/spin_bw.gif" /> Loading '+((!this.fileOpts.count)?"All ":"")+"Files...")},loadPages:function(){this.pageList=$("thingbarpages");this.showPageLoadIcon();new PBwiki.APIRequest("GetPages",this.pageOpts,{cacheability:["pagetime","foldertime","permtime"],onSuccess:function(A){this.pageList.update("");A.pages.each(function(C){var B=new Element("li").addClassName("tbpage");B.appendChild(new Element("span"));B.appendChild(new Element("a",{unselectable:"on"}).update(C.name.toString().escapeHTML()).observe("mousedown",function(D){D.stop();this.pageLink(Util.dashified_link(C.name.toString()),C.name.toString());return false}.bind(this)));this.pageList.appendChild(B)}.bind(this));if(this.pageOpts.count&&A._total_count>A.pages.length){if(this.allPagesLink){this.allPagesLink.remove()}this.allPagesLink=new Element("a",{href:"javascript:void(0);"}).update("Show all "+A._total_count+" pages").observe("mousedown",function(B){B.stop();delete this.pageOpts.count;delete this.pageOpts.offset;this.loadPages()}.bind(this));this.pageList.parentNode.appendChild(this.allPagesLink)}if(!this.pageOpts.count&&this.allPagesLink){this.allPagesLink.remove()}}.bind(this),priority:PBwiki.Data.LOW_PRIORITY})},filesTab:function(){this.loadFiles();if(!$("file_upload_button")){if(!$("thingbar-upload")){return }$("thingbar-upload").update("");new PBwiki.Components.FileUploadButton({txt:"Upload files",id:"file_upload_button",addTo:$("thingbar-upload"),folder:PBinfo.CurrentPage.folder?PBinfo.CurrentPage.folder:"",onUploaded:function(){new PBwiki.APIRequest("GetTimes",{},{onSuccess:function(){this.loadFiles();this.loadPages()}.bind(this),method:"get"})}.bind(this)});$("file_upload_button").down("span").setStyle({textDecoration:"underline",cursor:"pointer"})}},loadFiles:function(){this.fileList=$("thingbarfiles");delete this.fileOpts.type;this.showFileLoadIcon();new PBwiki.APIRequest("GetFiles",this.fileOpts,{cacheability:["filetime","foldertime","permtime"],onSuccess:function(A){this.fileList.update("");A.files.each(function(C){var B=new Element("li").addClassName("tbfile");var D=Util.iconMap[Util.getFileExtension(C.name.toString())];B.appendChild(new Element("span").addClassName("fileicon").addClassName(D));B.appendChild(new Element("a",{unselectable:"on"}).update(C.name.toString().escapeHTML()).observe("mousedown",function(E){E.stop();this.fileLink(C.name.toString(),Util.isImageFile(C.name.toString()));return false}.bind(this)));this.fileList.appendChild(B);Util.addObjectTooltip(B,C)}.bind(this));if(this.fileOpts.count&&A._total_count>A.files.length){if(this.allFilesLink){this.allFilesLink.remove()}this.allFilesLink=new Element("a",{href:"javascript:void(0);"}).update("Show all "+A._total_count+" files").observe("mousedown",function(B){B.stop();delete this.fileOpts.count;delete this.fileOpts.offset;this.loadFiles()}.bind(this));this.fileList.parentNode.insertBefore(this.allFilesLink,this.fileList.nextSibling)}else{if(A._total_count==0){this.fileList.update("No recent files")}}if(!this.fileOpts.count&&this.allFilesLink){this.allFilesLink.remove()}}.bind(this),priority:PBwiki.Data.LOW_PRIORITY})},getSelectedText:function(){var A=Page.AjaxEdit.getEditor().Selection.GetSelection();return(A.createRange)?A.createRange().text:A.toString()},pageLink:function(B,D){Util.tracking("editor-linking-tb-page");if(PBinfo.CurrentPage.editor_v3){try{PBwiki.currentEditor.setSelectedLink({href:"/"+B,txt:D,type:"page"})}catch(C){}return }var A=Page.AjaxEdit.getEditor();var E=A.EditorDocument.createElement("a");E.setAttribute("href","/"+B);E.innerHTML=this.getSelectedText()||D.escapeHTML();A.InsertElement(E);A.Focus()},fileLink:function(A,E){Util.tracking("editor-linking-tb-file");if(PBinfo.CurrentPage.editor_v3){try{PBwiki.currentEditor.setSelectedLink({href:"/f/"+encodeURIComponent(A),txt:A,type:"file"})}catch(C){alert(C.message)}return }var B=Page.AjaxEdit.getEditor();E=E&&this.getSelectedText()=="";var D=B.EditorDocument.createElement(E?"img":"a");D.setAttribute((E)?"src":"href","/f/"+encodeURIComponent(A));if(!E){D.innerHTML=this.getSelectedText()||A}B.InsertElement(D)}};Page.InsertLink=Class.create({initialize:function(){document.observe("ui:insertlink",this.insertLink.bind(this))},getEditorSelection:function(){try{var A=Page.AjaxEdit.getEditor();A.Selection.Save();var D=A.Selection.MoveToAncestorNode("A");if(D){return{url:D.getAttribute("href",2),txt:D.innerHTML,newWin:(D.getAttribute("target")=="_blank")}}else{var B=Page.AjaxEdit.getEditor().Selection.GetSelection();return{txt:((B.createRange)?B.createRange().text:B.toString()).strip()}}}catch(C){return{txt:""}}},applyEditorLink:function(A){var F=Page.AjaxEdit.getEditor();F.Selection.Restore();var G=F.Selection.MoveToAncestorNode("A");if(G){G.href=A.href;G.setAttribute("href",A.href);G.setAttribute("target",A.newWin?"_blank":null);G.setAttribute("_fcksavedurl",A.href)}else{var E=this.getEditorSelection();var F=Page.AjaxEdit.getEditor();if(A.type=="file"&&Util.isImageFile(A.txt)){Page.Thingbar.fileLink(A.txt,true);return }var D=F.CreateLink(A.href,true);if(D.length==0){var C=F.InsertElement("a");C.setAttribute("href",A.href);C.innerHTML=E.txt.strip().escapeHTML()||A.txt.escapeHTML();D=[C]}for(var B=0;B<D.length;B++){(A.newWin)?D[B].setAttribute("target","_blank"):D[B].removeAttribute("target")}F.Focus()}},insertLink:function(){if(PBinfo.CurrentPage.editor_v3){return }var A=this.getEditorSelection();A.onSelect=this.applyEditorLink.bind(this);new PBwiki.DialogCommands.InsertLink(A)}});PBwiki.init(function(){var A=$("editor_v3_toggle");if(A){A.observe("click",function(B){B.stop();PBwiki.UserPrefs.set(PBconst.kEditorV3PrefsKey,PBinfo.CurrentPage.editor_v3?false:1);setTimeout(function(){window.location.reload()},1000)})}});PBwiki.init(Page.InsertLink);PBwiki.init(Page.AjaxEdit);Page.NewPage={changeContentSource:function(B){var A=B.element();$$(".content-controller").each(function(D){if(D.getAttribute("ui:sister")){var C=(A==D)?"block":"none";$(D.getAttribute("ui:sister")).setStyle({display:C})}})},checkConvertStatus:function(){var A=$("convert_id").value;new PBwiki.APIRequest("GetImportStatus",{convert_id:A},{onSuccess:function(B){if(B.status=="finished"){window.location="/"+Util.dashified_link(B.page)+"?imported=1"}else{if(B.status=="error"){window.location="/newpage.php?convert_id=error"}else{window.setTimeout(Page.NewPage.checkConvertStatus,2000)}}},onFailure:function(B){window.setTimeout(Page.NewPage.checkConvertStatus,2000)},method:"post"})},fileWasSelected:function(e){var fileName=$("file_data").value.toLowerCase();if(!eval(PBconst.kPolicyConvertSupportedDocumentRegex).test(fileName)){$("file_data").value="";if($("page_name").value==$("page_name").getAttribute("ui:inferred_filename")){$("page_name").value=""}alert("PBworks cannot import that type of file.\n\nSupported document types:\n- Comma-separated values (.csv)\n- Microsoft Word (.doc)\n- OpenDocument Spreadsheet (.ods)\n- OpenDocument Text (.odt)\n- WordPerfect (.wpd)\n- Microsoft Excel (.xls)");return }if($("page_name").value!==""&&$("page_name").value!=$("page_name").getAttribute("ui:inferred_filename")){alet("User has already entered a page name; don't infer one based on filename\n\ncurrent name = "+$("page_name").value+"\ninferred name = "+$("page_name").getAttribute("ui:inferred_filename"));return }var inferred_filename=Page.NewPage.fileNameToPageName(fileName);$("page_name").value=inferred_filename;$("page_name").setAttribute("ui:inferred_filename",inferred_filename)},fileNameToPageName:function(A){if(A[0]=="."){A=A.substring(1)}if(A.lastIndexOf(".")>=0){A=A.substring(0,A.lastIndexOf("."))}if(A.lastIndexOf("\\")>=0){A=A.substr(A.lastIndexOf("\\")+1)}A=Util.strToPageName(A);return A},initialize:function(){if($("convert_id")){return Page.NewPage.initializeConversionStatus()}else{if($("createpageform")){return Page.NewPage.initializeCreatePageForm()}}},initializeConversionStatus:function(){window.setTimeout(Page.NewPage.checkConvertStatus,1000)},initializeCreatePageForm:function(){if($("tipmoreoptions")){Event.observe("tipmoreoptions","click",Page.NewPage.toggleMoreOptions.bind(this))}Event.observe("page_name","keydown",Page.NewPage.isCharacterValid.bind(this));if($("security")){Event.observe("security","click",Page.NewPage.securityChanged.bind(this))}if($("file_data")){Event.observe("file_data","change",Page.NewPage.fileWasSelected.bind(this))}Event.observe("create-page-form","submit",Page.NewPage.submit.bind(this));if($("createpagemore")){Event.observe("createpagemore","click",Page.NewPage.toggleMoreOptions.bind(this));Page.NewPage.toggleElements=$$($("createpagemore").getAttribute("ui:elements"));Page.NewPage.link=$("createpagemore")}$$(".content-controller").each(function(A){Event.observe(A,"click",Page.NewPage.changeContentSource.bind(A))})},isCharacterValid:function(A){},toggleMoreOptions:function(D){var B=Page.NewPage.link;var C=B.innerHTML;var A=B.getAttribute("ui:alternate");if(A){B.setAttribute("ui:alternate",B.innerHTML);B.innerHTML=A}$(B.parentNode.parentNode).toggleClassName("expanded");B.blur();D.stop();Page.NewPage.toggleElements.invoke("toggle");$("createpageoptions_visible").setAttribute("value",$(B.parentNode.parentNode).hasClassName("expanded")?"true":"false");$("page_name").focus()},securityChanged:function(B){if(!$("page-content-import-security-warning")){return }var A=($("security").value=="default security")?"none":"block";$("security-type").innerHTML=$("security").value;$("page-content-import-security-warning").setStyle({display:A})},submit:function(C){var A=$("page_name").value;if(!A){$("error-text").update("Empty page names are not allowed");Event.stop(C);return }var B;for(B=0;B<PBconst.kInvalidPageCharacters.length;B++){if(A.indexOf(PBconst.kInvalidPageCharacters[B])>=0){$("error-text").update("Page names can't contain any of the following characters: "+PBconst.kInvalidPageCharacters.escapeHTML());Event.stop(C);return }}$$(".form-action-button").each(function(D){D.setAttribute("disabled","disabled")})}};var stIsIE=
/*@cc_on!@*/
false;var _timer=false;sorttable={init:function(){if(arguments.callee.done){return }arguments.callee.done=true;if(_timer){clearInterval(_timer)}if(!document.createElement||!document.getElementsByTagName){return }sorttable.DATE_RE=/^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;forEach(document.getElementsByTagName("table"),function(A){if(A.className.search(/\bpbSortable\b/)!=-1){sorttable.makeSortable(A)}})},makeSortable:function(B){if(B.getElementsByTagName("thead").length==0){the=document.createElement("thead");the.appendChild(B.rows[0]);B.insertBefore(the,B.firstChild)}if(B.tHead==null){B.tHead=B.getElementsByTagName("thead")[0]}if(B.tHead.rows.length!=1){return }sortbottomrows=[];for(var A=0;A<B.rows.length;A++){if(B.rows[A].className.search(/\bsortbottom\b/)!=-1){sortbottomrows[sortbottomrows.length]=B.rows[A]}}if(sortbottomrows){if(B.tFoot==null){tfo=document.createElement("tfoot");B.appendChild(tfo)}for(var A=0;A<sortbottomrows.length;A++){tfo.appendChild(sortbottomrows[A])}delete sortbottomrows}headrow=B.tHead.rows[0].cells;for(var A=0;A<headrow.length;A++){if(!headrow[A].className.match(/\bsorttable_nosort\b/)){mtch=headrow[A].className.match(/\bsorttable_([a-z0-9]+)\b/);if(mtch){override=mtch[1]}if(mtch&&typeof sorttable["sort_"+override]=="function"){headrow[A].sorttable_sortfunction=sorttable["sort_"+override]}else{headrow[A].sorttable_sortfunction=sorttable.guessType(B,A)}headrow[A].sorttable_columnindex=A;headrow[A].sorttable_tbody=B.tBodies[0];dean_addEvent(headrow[A],"click",function(D){if(this.className.search(/\bsorttable_sorted\b/)!=-1){sorttable.reverse(this.sorttable_tbody);this.className=this.className.replace("sorttable_sorted","sorttable_sorted_reverse");this.removeChild(document.getElementById("sorttable_sortfwdind"));sortrevind=document.createElement("span");sortrevind.id="sorttable_sortrevind";sortrevind.setAttribute("style","float: left;");sortrevind.innerHTML=stIsIE?'&nbsp<font face="webdings">5</font>&nbsp;':"&nbsp;&#x25B4;&nbsp;";this.insertBefore(sortrevind,this.firstChild);return }if(this.className.search(/\bsorttable_sorted_reverse\b/)!=-1){sorttable.reverse(this.sorttable_tbody);this.className=this.className.replace("sorttable_sorted_reverse","sorttable_sorted");this.removeChild(document.getElementById("sorttable_sortrevind"));sortfwdind=document.createElement("span");sortfwdind.id="sorttable_sortfwdind";sortfwdind.setAttribute("style","float: left;");sortfwdind.innerHTML=stIsIE?'&nbsp<font face="webdings">6</font>&nbsp;':"&nbsp;&#x25BE;&nbsp;";this.insertBefore(sortfwdind,this.firstChild);return }theadrow=this.parentNode;forEach(theadrow.childNodes,function(E){if(E.nodeType==1){E.className=E.className.replace("sorttable_sorted_reverse","");E.className=E.className.replace("sorttable_sorted","")}});sortfwdind=document.getElementById("sorttable_sortfwdind");if(sortfwdind){sortfwdind.parentNode.removeChild(sortfwdind)}sortrevind=document.getElementById("sorttable_sortrevind");if(sortrevind){sortrevind.parentNode.removeChild(sortrevind)}this.className+=" sorttable_sorted";sortfwdind=document.createElement("span");sortfwdind.id="sorttable_sortfwdind";sortfwdind.setAttribute("style","float: left;");sortfwdind.innerHTML=stIsIE?'&nbsp<font face="webdings">6</font>&nbsp;':"&nbsp;&#x25BE;&nbsp;";this.insertBefore(sortfwdind,this.firstChild);row_array=[];col=this.sorttable_columnindex;rows=this.sorttable_tbody.rows;for(var C=0;C<rows.length;C++){row_array[row_array.length]=[sorttable.getInnerText(rows[C].cells[col]),rows[C]]}row_array.sort(this.sorttable_sortfunction);tb=this.sorttable_tbody;for(var C=0;C<row_array.length;C++){tb.appendChild(row_array[C][1])}delete row_array})}}},guessType:function(C,B){sortfn=sorttable.sort_alpha;for(var A=0;A<C.tBodies[0].rows.length;A++){text=sorttable.getInnerText(C.tBodies[0].rows[A].cells[B]);if(text!=""){if(text.match(/^-?[�$�]?[\d,.]+%?$/)){return sorttable.sort_numeric}possdate=text.match(sorttable.DATE_RE);if(possdate){first=parseInt(possdate[1]);second=parseInt(possdate[2]);if(first>12){return sorttable.sort_ddmm}else{if(second>12){return sorttable.sort_mmdd}else{sortfn=sorttable.sort_ddmm}}}}}return sortfn},getInnerText:function(B){hasInputs=(typeof B.getElementsByTagName=="function")&&B.getElementsByTagName("input").length;if(B.getAttribute("sorttable_customkey")!=null){return B.getAttribute("sorttable_customkey")}else{if(typeof B.textContent!="undefined"&&!hasInputs){return B.textContent.replace(/^\s+|\s+$/g,"")}else{if(typeof B.innerText!="undefined"&&!hasInputs){return B.innerText.replace(/^\s+|\s+$/g,"")}else{if(typeof B.text!="undefined"&&!hasInputs){return B.text.replace(/^\s+|\s+$/g,"")}else{switch(B.nodeType){case 3:if(B.nodeName.toLowerCase()=="input"){return B.value.replace(/^\s+|\s+$/g,"")}case 4:return B.nodeValue.replace(/^\s+|\s+$/g,"");break;case 1:case 11:var C="";for(var A=0;A<B.childNodes.length;A++){C+=sorttable.getInnerText(B.childNodes[A])}return C.replace(/^\s+|\s+$/g,"");break;default:return""}}}}}},reverse:function(A){newrows=[];for(var B=0;B<A.rows.length;B++){newrows[newrows.length]=A.rows[B]}for(var B=newrows.length-1;B>=0;B--){A.appendChild(newrows[B])}delete newrows},sort_numeric:function(B,A){aa=parseFloat(B[0].replace(/[^0-9.-]/g,""));if(isNaN(aa)){aa=0}bb=parseFloat(A[0].replace(/[^0-9.-]/g,""));if(isNaN(bb)){bb=0}return aa-bb},sort_alpha:function(B,A){if(B[0]==A[0]){return 0}if(B[0]<A[0]){return -1}return 1},sort_ddmm:function(B,A){mtch=B[0].match(sorttable.DATE_RE);y=mtch[3];m=mtch[2];d=mtch[1];if(m.length==1){m="0"+m}if(d.length==1){d="0"+d}dt1=y+m+d;mtch=A[0].match(sorttable.DATE_RE);y=mtch[3];m=mtch[2];d=mtch[1];if(m.length==1){m="0"+m}if(d.length==1){d="0"+d}dt2=y+m+d;if(dt1==dt2){return 0}if(dt1<dt2){return -1}return 1},sort_mmdd:function(B,A){mtch=B[0].match(sorttable.DATE_RE);y=mtch[3];d=mtch[2];m=mtch[1];if(m.length==1){m="0"+m}if(d.length==1){d="0"+d}dt1=y+m+d;mtch=A[0].match(sorttable.DATE_RE);y=mtch[3];d=mtch[2];m=mtch[1];if(m.length==1){m="0"+m}if(d.length==1){d="0"+d}dt2=y+m+d;if(dt1==dt2){return 0}if(dt1<dt2){return -1}return 1},shaker_sort:function(F,D){var A=0;var C=F.length-1;var G=true;while(G){G=false;for(var B=A;B<C;++B){if(D(F[B],F[B+1])>0){var E=F[B];F[B]=F[B+1];F[B+1]=E;G=true}}C--;if(!G){break}for(var B=C;B>A;--B){if(D(F[B],F[B-1])<0){var E=F[B];F[B]=F[B-1];F[B-1]=E;G=true}}A++}}};PBwiki.init(sorttable.init);function dean_addEvent(B,D,C){if(B.addEventListener){B.addEventListener(D,C,false)}else{if(!C.$$guid){C.$$guid=dean_addEvent.guid++}if(!B.events){B.events={}}var A=B.events[D];if(!A){A=B.events[D]={};if(B["on"+D]){A[0]=B["on"+D]}}A[C.$$guid]=C;B["on"+D]=handleEvent}}dean_addEvent.guid=1;function removeEvent(A,C,B){if(A.removeEventListener){A.removeEventListener(C,B,false)}else{if(A.events&&A.events[C]){delete A.events[C][B.$$guid]}}}function handleEvent(D){var C=true;D=D||fixEvent(((this.ownerDocument||this.document||this).parentWindow||window).event);var A=this.events[D.type];for(var B in A){this.$$handleEvent=A[B];if(this.$$handleEvent(D)===false){C=false}}return C}function fixEvent(A){A.preventDefault=fixEvent.preventDefault;A.stopPropagation=fixEvent.stopPropagation;return A}fixEvent.preventDefault=function(){this.returnValue=false};fixEvent.stopPropagation=function(){this.cancelBubble=true};if(!Array.forEach){Array.forEach=function(D,C,B){for(var A=0;A<D.length;A++){C.call(B,D[A],A,D)}}}Function.prototype.forEach=function(A,D,C){for(var B in A){if(typeof this.prototype[B]=="undefined"){D.call(C,A[B],B,A)}}};String.forEach=function(A,C,B){Array.forEach(A.split(""),function(E,D){C.call(B,E,D,A)})};var forEach=function(A,D,B){if(A){var C=Object;if(A instanceof Function){C=Function}else{if(A.forEach instanceof Function){A.forEach(D,B);return }else{if(typeof A=="string"){C=String}else{if(typeof A.length=="number"){C=Array}}}}C.forEach(A,D,B)}};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");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")]};SearchHilite=Class.create({initialize:function(){if(/SearchFor\=/.test(window.location.search)){var C=window.location.search.replace(/[a-zA-Z0-9\?\&\=\%\#]+SearchFor\=(\w+)(\&.*)?/,"$1");var A=C.replace(/\%20|\+/g,"|");var B=A.split("|");this.highlight($("wikipage-inner"),B);this.highlight($("comments"),B);var E=$$("span.searchhilitepage");if(E.length>0){var D=new Element("span").update('&nbsp;[ <a href="'+window.location.href.replace(window.location.search,"")+'">remove highlighting</a> ]');E[0].insert({after:D})}}},highlight:function(C,E){for(var B=0;B<E.length;B++){var D=new RegExp(">([^<]*)?("+E[B]+")([^>]*)?<","ig");var A=C.innerHTML;C.innerHTML=A.replace(D,'>$1<span class="searchhilitepage">$2</span>$3<')}}});PBwiki.init(SearchHilite);Page.AjaxSave={initialize:function(){document.observe("ui:fckeditor_oncomplete",Page.AjaxSave.activate.bind(Page.AjaxSave))},activate:function(){this.saveButton=$("edit-toolbar").down(".button");this.saveButton.observe("click",this.saveContent.bind(this));this.saveButton.setAttribute("onclick","");this.tagfield=$("tagfield");this.initialTags=this.tagfield.value;document.observe("ui:disablesave",this.disableSave.bind(this));document.observe("ui:autosaveSuccess",this.autosaveSuccess.bind(this));document.observe("ui:autosaveFailure",this.autosaveFailure.bind(this));document.observe("ui:savepage",this.saveContent.bind(this))},saveContent:function(D){if(D){D.stop()}if(this.saveButton.hasClassName("disabled")){return }this.disableSave();this.setMsg("Saving "+PBwiki.getPageName().toString().escapeHTML()+"...",true);var C=[];var A=window.location.search.toQueryParams()||{};if(A.folder||A.security){var B={page:PBwiki.getPageName()};if(A.folder){B.folder=decodeURIComponent(A.folder.toString().replace(/\+/g," "))}if(A.security){B.security=A.security}B.html=Page.AjaxEdit.getEditor().GetData(true);C.push(["CreatePage",B,{onFailure:this.saveFail.bind(this),onSuccess:this.saveSuccess.bind(this),incUsess:true}])}else{var B={create_if_missing:true};B.page=PBwiki.getPageName();B.html=Page.AjaxEdit.getEditor().GetData(true);C.push(["PutPage",B,{onFailure:this.saveFail.bind(this),onSuccess:this.saveSuccess.bind(this),incUsess:true}])}C.push(["UnlockPage",{page:PBwiki.getPageName()},{onFailure:this.saveFail.bind(this)}]);if(this.initialTags!=this.tagfield.value){C.push(["SetPageTags",{page:PBwiki.getPageName(),tags:this.tagfield.value},{onFailure:this.saveFail.bind(this)}])}new PBwiki.MultiAPIRequest(C,{incUsess:true,onFailure:this.saveFail.bind(this)})},autosaveSuccess:function(){if(this.getMsg()==this.autosaveErrorMsg){this.clearMsg()}},autosaveFailure:function(A){if($("save_msg").style.display!="inline"){this.autosaveErrorMsg=A.memo;this.setMsg(A.memo)}},saveSuccess:function(B){Page.EditPage.cancel=true;this.setMsg("Page Saved Successfully",false,true);var A="/"+(B.page?B.page:PBwiki.getPageName());if(Prototype.Browser.WebKit){A+=((window.location.search.indexOf("?unlock=true")!=-1)?"":"?unlock=true")}window.location=A},saveFail:function(B,A){if(A==403&&$H(PBwiki.getSessCookie()).values()[0]==""){this.setMsg("You have been logged out in another window.  Log back in and try again",false)}else{this.setMsg(B,false)}this.enableSave()},setMsg:function(B,A){var C=$("save_msg");C.style.display="inline";C.innerHTML=B;C.style.background=(A)?"url(/images/spin_bw.gif) no-repeat center left":"none"},clearMsg:function(){$("save_msg").style.display="none"},getMsg:function(){return $("save_msg").innerHTML},disableSave:function(){Page.EditPage.AutoSave.stop();this.saveButton.addClassName("disabled");this.saveButton.onclick=null;this.saveButton.setAttribute("href","javascript:void(0);");$("cancelButton").onclick=null;$("cancelButton").addClassName("disabled");try{this.saveButton.blur()}catch(A){}Page.EditPage.cancel=true},enableSave:function(){Page.EditPage.AutoSave.start();this.saveButton.removeClassName("disabled");$("cancelButton").removeClassName("disabled");Page.EditPage.cancel=false}};PBwiki.init(Page.AjaxSave);PBwiki.AutoComplete=function(){if($("input-search")){var C=new PBwiki.Components.SearchAutoComplete({elm:$("input-search")});if($("ws-nav-search")){var D=$("input-search").cumulativeOffset();var A=$("input-search").getDimensions();var B=0;C.acout.style.left=(D.left+B)+"px";C.acout.style.top=(D.top+A.height)+"px"}}};PBwiki.Components=PBwiki.Components||{};PBwiki.Components.AutoComplete=Class.create({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("ui: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.AutoComplete,{apiMethod:"GetObjects",apiCacheability:["filetime","foldertime","page_list_time","permtime"],requestOptions:{sortby:"name",count:10,offset:0,verbose:true,detail:"partial"},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":(G.type=="page")?"tbpage":"tbfile"});C.dataObject=G;var F=Util.iconMap[Util.getFileExtension(G.name.toString())];var E=(G.type=="page")?"/"+Util.dashified_link(G.name.toString()):"/f/"+encodeURIComponent(G.name);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(){this.hasData=PBwiki.Data.getInstance("DOMObjectListNonVerbose").hasData();return(this.hasData)?10:200},shouldDisplayLoadingMessage:function(){return false}});PBwiki.Components.QuickLinkAutoComplete=Class.create(PBwiki.Components.SearchAutoComplete,{requestOptions:{sortby:"name",count:6,offset:0,verbose:true,detail:"partial"},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.AutoComplete,{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.AutoComplete.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("ui: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,{initialize:function(A,B){this.map=new Object();this.arr=new Array();this.autoComplete=A;this.elm=B;this.placeholderText=this.autoComplete.elm.attributes["ui: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["ui:placeholder"].value=""}else{this.autoComplete.elm.attributes["ui:placeholder"].value=this.placeholderText}},_each:function(A){this.arr.each(A)}});PBwiki.Components.UserAutoComplete.SelectedUser=Class.create({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.init(PBwiki.AutoComplete);Page.AjaxSave={initialize:function(){document.observe("ui:fckeditor_oncomplete",Page.AjaxSave.activate.bind(Page.AjaxSave))},activate:function(){this.saveButton=$("edit-toolbar").down(".button");this.saveButton.observe("click",this.saveContent.bind(this));this.saveButton.setAttribute("onclick","");this.tagfield=$("tagfield");this.initialTags=this.tagfield.value;document.observe("ui:disablesave",this.disableSave.bind(this));document.observe("ui:autosaveSuccess",this.autosaveSuccess.bind(this));document.observe("ui:autosaveFailure",this.autosaveFailure.bind(this));document.observe("ui:savepage",this.saveContent.bind(this))},saveContent:function(D){if(D){D.stop()}if(this.saveButton.hasClassName("disabled")){return }this.disableSave();this.setMsg("Saving "+PBwiki.getPageName().toString().escapeHTML()+"...",true);var C=[];var A=window.location.search.toQueryParams()||{};if(A.folder||A.security){var B={page:PBwiki.getPageName()};if(A.folder){B.folder=decodeURIComponent(A.folder.toString().replace(/\+/g," "))}if(A.security){B.security=A.security}B.html=Page.AjaxEdit.getEditor().GetData(true);C.push(["CreatePage",B,{onFailure:this.saveFail.bind(this),onSuccess:this.saveSuccess.bind(this),incUsess:true}])}else{var B={create_if_missing:true};B.page=PBwiki.getPageName();B.html=Page.AjaxEdit.getEditor().GetData(true);C.push(["PutPage",B,{onFailure:this.saveFail.bind(this),onSuccess:this.saveSuccess.bind(this),incUsess:true}])}C.push(["UnlockPage",{page:PBwiki.getPageName()},{onFailure:this.saveFail.bind(this)}]);if(this.initialTags!=this.tagfield.value){C.push(["SetPageTags",{page:PBwiki.getPageName(),tags:this.tagfield.value},{onFailure:this.saveFail.bind(this)}])}new PBwiki.MultiAPIRequest(C,{incUsess:true,onFailure:this.saveFail.bind(this)})},autosaveSuccess:function(){if(this.getMsg()==this.autosaveErrorMsg){this.clearMsg()}},autosaveFailure:function(A){if($("save_msg").style.display!="inline"){this.autosaveErrorMsg=A.memo;this.setMsg(A.memo)}},saveSuccess:function(B){Page.EditPage.cancel=true;this.setMsg("Page Saved Successfully",false,true);var A="/"+(B.page?B.page:PBwiki.getPageName());if(Prototype.Browser.WebKit){A+=((window.location.search.indexOf("?unlock=true")!=-1)?"":"?unlock=true")}window.location=A},saveFail:function(B,A){if(A==403&&$H(PBwiki.getSessCookie()).values()[0]==""){this.setMsg("You have been logged out in another window.  Log back in and try again",false)}else{this.setMsg(B,false)}this.enableSave()},setMsg:function(B,A){var C=$("save_msg");C.style.display="inline";C.innerHTML=B;C.style.background=(A)?"url(/images/spin_bw.gif) no-repeat center left":"none"},clearMsg:function(){$("save_msg").style.display="none"},getMsg:function(){return $("save_msg").innerHTML},disableSave:function(){Page.EditPage.AutoSave.stop();this.saveButton.addClassName("disabled");this.saveButton.onclick=null;this.saveButton.setAttribute("href","javascript:void(0);");$("cancelButton").onclick=null;$("cancelButton").addClassName("disabled");try{this.saveButton.blur()}catch(A){}Page.EditPage.cancel=true},enableSave:function(){Page.EditPage.AutoSave.start();this.saveButton.removeClassName("disabled");$("cancelButton").removeClassName("disabled");Page.EditPage.cancel=false}};PBwiki.init(Page.AjaxSave);SendALink=Class.create({initialize:function(A){$$("span.sendalink-milestone a").each(function(B){B.observe("click",this.milestoneLinkObserver.bindAsEventListener(this,B))}.bind(this));this.element=$(A);if(!this.element){return }this.link=this.element.down("a");PBwiki.debug(this.link);this.link.observe("click",this.linkObserver.bindAsEventListener(this));if(window.location.hash=="#send-a-link"){window.location.hash="";this.linkObserver(null)}},milestoneLinkObserver:function(D,C){if(D){D.stop()}var F=C.up("div.milestone");var A=F.getAttribute("milestone_id");var B=F.down("span.milestone-title");var E=B.textContent||B.innerText;if(!A){PBwiki.error("milestone_id not found, unable to continue");return }new PBwiki.DialogCommands.SendALink({dimensions:{width:510,height:"auto"},url:Util.URLRelativeToContext("/w/tasks/#milestone"+A,{wiki:PBinfo.CurrentWiki.name}),title:"Project Milestones",description:'the milestone "'+E+'"',destination_type:PBconst.kSendALinkType.Milestone})},linkObserver:function(B){if(B){B.stop()}var A={dimensions:{width:510,height:"auto"}};if(PBinfo.CurrentPage.page){A.page=PBinfo.CurrentPage.page;A.destination_type=PBconst.kSendALinkType.Page;A.objectname=A.page}else{if(PBwiki.ObjectBrowser&&PBwiki.ObjectBrowser.view&&PBwiki.ObjectBrowser.view.name=="ViewFileRevision"){A.url=window.location.toString();A.title=PBwiki.ObjectBrowser.view.options.parameter;A.description='"'+A.title+'" on this workspace';A.destination_type=PBconst.kSendALinkType.File;A.objectname=PBwiki.ObjectBrowser.view.refreshOptions.file}else{if(PBwiki.ObjectBrowser&&PBwiki.ObjectBrowser.view&&PBwiki.ObjectBrowser.view.displayTitle){A.url=Util.URLRelativeToContext("/w/folder/"+encodeURIComponent(PBwiki.ObjectBrowser.view.metadata.name),{wiki:PBinfo.CurrentWiki.name});A.title=PBwiki.ObjectBrowser.view.displayTitle;A.description='"'+A.title+'" on this workspace';A.destination_type=PBconst.kSendALinkType.Folder;A.objectname=PBwiki.ObjectBrowser.view.metadata.name}else{if(PBwiki.Project&&PBwiki.Project.currentView){A.url=window.location.toString();A.title=PBwiki.Project.currentView.getPageTitle();A.objectname=$("project-action").getAttribute("task_id");A.description='the task "'+A.title+'"';A.destination_type=PBconst.kSendALinkType.Task}}}}new PBwiki.DialogCommands.SendALink(A)}});PBwiki.init(SendALink,"sendalink");PBwiki.DialogCommands.SendALink=Class.create(PBwiki.DialogCommands.TemplateDialog,{templateName:"sendalink",title:"Send a link",initialize:function($super,A){if(A.destination_type){this.title="Share this "+A.destination_type}else{this.title="Share this page"}$super(A)},setupDialog:function($super){$super();this.setupInstructions();this.setupUserList();this.setupStar();this.message=$("sendalink_message");Event.observe("sendalink_send","click",this.submit.bind(this))},submit:function(A){A.stop();if(this.userList.empty()){window.alert("Please select people on the workspace to share this page with.");return false}var B={to_uids:this.userList.getUIDs().join(","),destination_type:this.options.destination_type,objectname:this.options.objectname};if(this.options.page){B.page=this.options.page}if(this.options.url){B.url=this.options.url}if(this.options.title){B.title=this.options.title}if(this.allowEmails()){B.to_emails=this.userList.getExtraEmails().join(",");B.new_user_permission=$("sendalink_to_perm-guest").checked?"guest":"user";if($("sendalink-trackuser").checked){B.track_new_users=true}}if(!this.message.value.blank()){B.message=this.message.value.strip()}if(this.userList.contains(PBconst.kSendALinkAllUsersWithAccess)){B.send_to_all_users_with_access=true}new PBwiki.APIRequest("SendALink",B,{method:"post",parameters:B,onSuccess:function(C){document.fire("dialog:close");document.fire("ui:onNotifyUser",{message:"Successfully sent a link to this page.",mode:"success"})}.bind(this),onFailure:function(C){document.fire("dialog:close");document.fire("ui:onNotifyUser",{message:"Failed to send the link. "+C,mode:"error"})}.bind(this)});return true},setupInstructions:function(){if(this.options.description){$("sendalink-workspace-page-title").update(this.options.description.escapeHTML());$("sendalink-network-page-title").update(this.options.description.escapeHTML())}if(this.options.destination_type){$$(".sendalink-destination-type").each(function(A){A.update(this.options.destination_type.escapeHTML())}.bind(this))}$$("a.sendalink-add-all-users").each(function(A){A.observe("click",this.onAddAllUsersClicked.bind(this))}.bind(this));if(PBinfo.GetFeatures.send_a_link_find_users_improvements&&PBinfo.CurrentNetwork){$("sendalink-workspace-instructions").hide();if(this.allowEmails()){$("sendalink-network-instructions").hide();$("sendalink-network-admin-instructions").show()}else{$("sendalink-network-instructions").show();$("sendalink-network-admin-instructions").hide()}$("sendalink-advice-standalone").hide();$("sendalink-advice-network").show();$("sendalink-find-users").observe("click",this.onFindUsersClicked.bind(this))}else{$("sendalink-workspace-instructions").show();$("sendalink-network-instructions").hide();$("sendalink-network-admin-instructions").hide();$("sendalink-advice-standalone").show();$("sendalink-advice-network").hide()}},onAddAllUsersClicked:function(C){var B={name:"All workspace members with access",uid:PBconst.kSendALinkAllUsersWithAccess};var A=new PBwiki.Components.UserAutoComplete.SelectedUser(this.userAutoComplete,B);this.userAutoComplete.selectedUserList.append(A)},onFindUsersClicked:function(A){var B=new PBwiki.FindNetworkUsers.Dialog({callback:this.onUsersSelected.bind(this),exclude_self:false})},onUsersSelected:function(A){$(A).each(function(C){var B=new PBwiki.Components.UserAutoComplete.SelectedUser(this.userAutoComplete,C);this.userAutoComplete.selectedUserList.append(B)}.bind(this))},setupUserList:function(){var A=$("sendalink_to");if(A){if(this.allowEmails()){A.setAttribute("ui:placeholder","Type a name or email address");$("sendalink-to-advice").hide();document.stopObserving("ui:autoCompleteListChange");document.observe("ui:autoCompleteListChange",this.togglePermissionLevel.bind(this));$("sendalink-guest-help-icon").observe("click",function(E){if(E){E.stop()}$("sendalink-guest-help-icon").hide();$("sendalink-guest-help").show()});$("sendalink_to_perm-guest").observe("change",this.togglePermissionLevel.bind(this));$("sendalink_to_perm-user").observe("change",this.togglePermissionLevel.bind(this))}new InputText(A);var D,C;if(this.options.title==="All Pages"||this.options.title==="All Files"||this.options.title==="Unfiled Items"||this.options.destination_type===PBconst.kSendALinkType.Milestone||this.options.destination_type===PBconst.kSendALinkType.Task){D="GetPageUsers";C={page:PBinfo.CurrentWiki.front_page}}else{if(this.options.destination_type===PBconst.kSendALinkType.File){D="GetFileUsers";C={file:this.options.title}}else{if(this.options.destination_type===PBconst.kSendALinkType.Folder){D="GetFolderUsers";C={folder:this.options.title}}else{D="GetPageUsers";C={page:PBinfo.CurrentPage.page}}}}var B={userListContainer:$("sendalink_to_container"),userList:$("sendalink_to_list"),elm:A,apiMethod:D,requestOptions:C,allowEmails:this.allowEmails()};this.userAutoComplete=new PBwiki.Components.UserAutoComplete(B);this.userList=this.userAutoComplete.selectedUserList}},togglePermissionLevel:function(){var A=this.userList.getExtraEmails();if(PBinfo.CheckPermissions.network_perm=="admin"){$$(".sendalink-must-add-as-guests").invoke("hide")}else{$$(".sendalink-must-add-as-guests").invoke("show");$("sendalink-guest-row").select(".radio-label").invoke("hide");$("sendalink_to_perm-guest").checked="checked"}if(A.length==0){$("sendalink-guest-row").hide()}else{if(A.length==1){$$(".sendalink-guest-plural").map(function(B){B.hide()});$$(".sendalink-guest-singular").map(function(B){B.show()});$("sendalink-guest-row").show()}else{$$(".sendalink-guest-singular").map(function(B){B.hide()});$$(".sendalink-guest-plural").map(function(B){B.show()});$("sendalink-guest-row").show()}}if(A.length&&PBwiki.feature("user_tracking")&&(PBinfo.CheckPermissions&&(PBinfo.CheckPermissions.wikiperm=="admin"||PBinfo.CheckPermissions.network_perm=="admin"))&&$("sendalink_to_perm-guest").checked){$("sendalink-star-hr").show();$("sendalink-starred-row").hide();$("sendalink-unstarred-row").hide();$("sendalink-trackuser-row").show()}else{$("sendalink-trackuser-row").hide();this.setupStar()}},allowEmails:function(){var A=(PBinfo.CheckPermissions.network_perm=="admin")||(PBinfo.CheckPermissions.network_perm=="user"&&PBinfo.CheckPermissions.wikiperm=="admin");return PBwiki.feature("getting_started_v3")&&PBinfo&&PBinfo.CheckPermissions&&PBinfo.CheckPermissions.network_perm&&A&&PBinfo.CurrentWiki&&PBinfo.CurrentWiki.network_public&&$$(".security_btn_hidden").length===0&&$$(".security_btn_custom").length===0},setupStar:function(){if(!PBinfo.GetFeatures.stars){return }if(!PBinfo.CurrentPage||!PBinfo.CurrentPage.page){return }$("sendalink-page-name").update("'"+PBinfo.CurrentPage.page+"'");this.starred=PBwiki.UserPrefs.Stars.is_current_page_starred();if(PBinfo.CurrentWiki.granular_notifications){$$(".granular-notifications-message").each(function(A){A.show()})}else{$$(".no-granular-notifications-message").each(function(A){A.show()})}if(this.starred){$("sendalink-star-hr").show();$("sendalink-starred-row").show();$("sendalink-unstarred-row").hide();return }$("sendalink-star-hr").show();$("sendalink-starred-row").hide();$("sendalink-unstarred-row").show();Event.observe("sendalink-star","click",function(A){A.stop();this.toggleStarState();$("sendalink-star").addClassName("working");PBwiki.UserPrefs.Stars.set_object_starred({name:PBinfo.CurrentPage.page,starred:this.starred,onFailure:this.starPageError.bind(this),onSuccess:this.didStarPage.bind(this)});Util.tracking("page-star-sendalink-"+(this.starred?"on":"off"))}.bind(this))},didStarPage:function(A){$("sendalink-star").removeClassName("working")},starPageError:function(A){this.toggleStarState()},toggleStarState:function(B){var A=!this.starred;this.starred=A;if(A){$("sendalink-star").addClassName("starred")}else{$("sendalink-star").removeClassName("starred")}document.fire("ui:hideBubbles")}});PBwiki.init(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.PerfMon={initialize:function(){if(typeof PBperf!="undefined"){Event.observe(document,"pbwiki:init",this.initHandler.bindAsEventListener(this));Event.observe(window,"load",this.loadHandler.bindAsEventListener(this));Event.observe(window,"beforeunload",this.unloadHandler.bindAsEventListener(this));this.load_complete=false;this.init_complete=false}},initHandler:function(B){if(typeof PBperf=="undefined"){Cookie.set(PBconst.kPerfmonCookie,"",0);Cookie.set("pb_unload_time","",0)}else{this.notes=PBperf;var A=Cookie.get("pb_unload_time");if(A.length>0){this.notes.ts_c_req_st=A;Cookie.set("pb_unload_time","",0)}this.init_complete=true;this.addTimestamp("ts_c_init_fin")}},loadHandler:function(A){this.load_complete=true;this.addTimestamp("ts_c_load_fin")},addTimestamp:function(A){if(typeof PBperf!="undefined"){if(this.init_complete){this.notes[A]=new Date().getTime().toString();if(this.load_complete){Cookie.set(PBconst.kPerfmonCookie,Object.toJSON(this.notes),(1/24))}}}},unloadHandler:function(A){Cookie.set("pb_unload_time",new Date().getTime().toString(),(1/1440))}};PBwiki.init(function(){PBwiki.PerfMon.initialize()});PBwiki.Views={validViews:{page:true,loading:true},initialize:function(){if(PBinfo.CurrentPage&&PBinfo.CurrentPage.editor_v3){if(PBinfo.noStatics){this.validViews.edit=this.validViews.newpage=PBconst.kStaticDebugDirectory+"debug.php?manifest=editor.js&rand"+Math.random()}else{this.validViews.edit=this.validViews.newpage="/shared/statics/editor.js"}Event.observe(window,"load",function(){setTimeout(function(){if($("edit-tab")&&!$("edit-tab").hasClassName("logintoedit")){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(C){if(Object.isString(C.memo)){this.selectView(C.memo)}else{var B=C.memo.view;delete C.memo.view;this.selectView(B,C.memo)}}.bind(this));this.selectView(this.initialView);if($("view-tab")&&PBinfo.CurrentPage&&PBinfo.CurrentPage.editor_v3&&!$("edit-tab").hasClassName("readonlymode")){$("view-tab").observe("click",this.tabClick.bindAsEventListener(this,"page"));$("edit-tab").observe("click",this.tabClick.bindAsEventListener(this,"edit"))}},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;return A},findDefaultViewChecks:[function(){if(PBinfo.CurrentPage&&PBinfo.CurrentPage.editor_v3&&$("view-tab")&&$("edit-tab")&&$("edit-toolbar")&&!$("wikicontent")){return"newpage"}},function(){if($("view-tab")&&$("wikicontent")){return"page"}}],tabClick:function(C,B){if(C){C.stop();try{C.element().blur()}catch(A){}}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.switchView("loading",{view:A})){return false}this.loadView(A,function(){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.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.error(C,"views-init-"+A)}this.currentView=A;this.setHistoryKey(A);return true}};PBwiki.Views.base=Class.create({chromeVisibility:false,setChromeVisibility:function(A){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")?"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(){$("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.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){((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,{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($("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)}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))}},inviteUsers:function(A){A.stop();Util.tracking("f-wikipage-addusers_show");PBwiki.UsersPanel.showAddUsersDialog()},commentDeleteAllHandler:function(A){if(A){A.stop()}var B=confirm("Are you sure you want to delete all comments on this page? This action cannot be undone.");if(!B){return }new PBwiki.APIRequest("DeleteAllComments",{page:PBinfo.CurrentPage.page},{onSuccess:function(C){$("comments-delete-all").remove();var D=$$("div.comment");if(typeof Effect!=="undefined"){Effect.multiple(D,Effect.BlindUp,{speed:0,duration:1,afterFinish:function(E){$(E.element.id).remove()}})}else{D.invoke("hide")}if($("comments-count")){$("comments-count").update("0")}},onFailure:function(C){alert(C)}})},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(B,A){if(B){B.stop()}new PBwiki.APIRequest("DeleteComment",{page:PBinfo.CurrentPage.page,time:A},{onSuccess:function(F){var C=$("commentnum"+A);if(C){if(typeof Effect!=="undefined"){Effect.BlindUp(C,{duration:1,afterFinish:function(G){$(G.element.id).remove()}})}else{C.hide()}}if($("comments-count")){var D=$("comments-count");var E=Number(D.innerText?D.innerText:D.textContent);if(!isNaN(E)&&E>0){D.update(E-1)}}},onFailure:function(C){alert(C)}})},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.load("/shared/statics/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){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){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)}return true}});PBwiki.Views.loading=Class.create(PBwiki.Views.base,{initialize:function(A){if(A.view=="edit"||A.view=="newpage"){this.setActiveTab("edit");if($("notification-autosave")){Page.Notifications.findNotification($("notification-autosave")).remove()}this.setChromeVisibility(true);this.setEditLoading(true);this.resizeChromeHeight()}},destroy:function(){return true}});PBwiki.init(PBwiki.Views.initialize.bind(PBwiki.Views));PBwiki.Components=PBwiki.Components||{};PBwiki.Components.Bubble=Class.create({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)}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",this.hideFunctionBound);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,{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(PBwiki.feature("network_notifications")){A="<p>Changes made to starred pages will always be included in<br />        notifications about this workspace.</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,{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,{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,{showUserPref:PBconst.kShowCreatePageBubblePrefsKey,arrowDirection:"right",hideCheckbox:"dont_prompt_create_page",anchorToID:"sidebar-createpage",bubbleID:"create-page-bubble",setUp:function(){var A=$("sidebar-createpage");if(!PBwiki.feature("getting_started_v3")){return }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,{arrowDirection:"right",anchorToID:"sidebar-uploadfiles",bubbleID:"upload-files-bubble",setUp:function(){var A=$("sidebar-uploadfiles");if(!PBwiki.feature("getting_started_v3")){return }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,{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,{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)}],["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)}])}}if(this.options.uid!=PBinfo.CheckPermissions.uid){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.isSelf=true;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.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();if(!this.isSelf&&PBinfo.live_enabled&&PBwiki.Live.isConnected&&PBwiki.Live.userIsOnline(this.apiResponse.uid)){(new PBwiki.Components.Button({txt:"Chat with "+this.apiResponse.name,strong:true,onClick:function(){PBwiki.Live.createOrRestoreChat(this.apiResponse.uid);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}">        <div class="button-bar secondarypagetoolbar #{isthisyouclass}" style="padding-top: 0px;">          <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 />          <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>        </div>              <div class="pic"><a href="#{profile_link}"><img height="48" width="48" alt="" src="#{image}"/></a></div>        <h3 class="#{isthisyouclass}">#{name} <span class="you">&nbsp;</span></h3><h4 class="title">#{title}</h4>      </div>            <div class="profile-status #{className}">        <p>#{status.data}<span>#{status.timestamp}<span class="replyspan" style="display:none">&ndash; <a href="" class="reply">reply</a></span></span></p>        <div class="status-reply">          <textarea class="text"></textarea>          <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>        </div>      </div>            <div class="profile-info clearfix #{className}">        <div class="cell">          <h5 class="email">Email</h5>          <p class="email row">#{email}</p>          <p class="email row">&nbsp;</p>          <h5 class="location">Location</h5>          <p class="row location">#{location}</p>          <h5 class="phone">Phone</h5>          <p class="row phone">#{phone}</p>        </div>        <div class="cell right">          <h5 class="im">IM Presence</h5>          <p class="row clearfix im">#{im_links}</p>          <p class="row im">&nbsp;</p>          <h5 class="url">Website</h5>          <p class="row url"><a class="url" href="#{url}">#{url}</a></p>          <h5 class="role">Workspace Role</h5>          <p class="row role">#{role} &ndash; <a class="activity" href="">activity on workspace</a></p>          #{groups}        </div>      </div>      <div class="profile-link button-bar clearfix secondarypagetoolbar #{className}">        <a href="#{profile_link}" style="margin-bottom: 10px;" class="button"><span><strong>View profile</strong></span></a>        <a href="javascript: void(0);" style="margin-bottom: 10px;" class="button what-can-see" onclick="new PBwiki.DialogCommands.WhatCanSee(#{wcs_opts}); return false;"><span><strong>What can this user see?</strong></span></a>    </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,{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(function(){document.observe("click",PBwiki.Components.UserCard.intercept)});PBwiki.init(function(){if(!PBinfo.CurrentWiki||!PBinfo.GetRecentWikis){return }var C=[];$(PBinfo.GetRecentWikis.wikis).each(function(F){var G=F.icon?("icon-"+F.icon):"bullet";C.push({name:F.name,txt:F.title.escapeHTML(),className:"iconbutton "+G,onClick:function(){window.location=F.url}})});var D=$("network-crumb-all-workspaces-link")||$("network-crumb-my-link");var B="Go to workspaces list ("+PBinfo.GetRecentWikis.total_wiki_count+" total)";C.push({name:"all-workspaces",txt:B,className:"iconbutton goback",onClick:function(){window.location=D.href}});var A=new PBMenu({toggle:D,anchor:D.up("li"),items:C});var E=A.options.anchor.getDimensions().width+10;if(A.elm.getDimensions().width<E){A.elm.style.width=E+"px"}if($("network-bar").hasClassName("standalone")){$("network-crumb-all-workspaces-link-pbmenu").addClassName("standalone")}else{$("network-crumb-all-workspaces-link-pbmenu").addClassName("network")}});PBwiki.FindNetworkUsers={};PBwiki.FindNetworkUsersSteps={UserList:1,ProfileFields:2,ProfileFieldValues:3};PBwiki.FindNetworkUsers.Dialog=Class.create(PBwiki.DialogCommands.TemplateDialog,{templateName:"findnetworkusers",dialogPath:"/shared/network/dialog/",title:"Choose Network Users",dialogOptions:{closeable:true},options:null,currentStep:null,selectedUids:[],profileFields:null,networkUsers:null,ignoreUids:[],selectedProfileFieldId:null,selectedProfileValueId:null,backButton:null,selectButton:null,profileFieldsListBox:null,profileFieldValuesListBox:null,usersListBox:null,selectedUserCountIndicator:null,usersListBoxProfileFieldValueId:"undefined",buildUserRow:function(F){var E=new Element("li",{id:"user-"+F.uid,"ui:uid":F.uid});var H=new Element("a",{"class":"user","ui:uid":F.uid});var B=new Element("input",{type:"checkbox"});if(this.selectedUids.indexOf(F.uid)!==-1){B.checked=true}var G=new Element("div");H.appendChild(document.createTextNode(F.display_name||F.name));if(F.network_perm=="guest"){var A=new Element("img",{src:"/shared/network/images/label-client.gif",alt:"Guest",style:"margin-left: 8px"});H.appendChild(A)}var D=new Element("a");D.appendChild(document.createTextNode(F.email));var C=new Element("em");C.appendChild(D);E.appendChild(B);B.setStyle({"float":"left",display:"block"});G.setStyle({"margin-left":(B.getWidth()+20)+"px"});G.appendChild(H);G.appendChild(C);E.appendChild(G);return E},arrayToDetailsString:function(B){var A=3;if(B.length<=A){return B.join(", ")}else{return B.slice(0,A).join(", ")+" and "+(B.length-A)+" more"}},createListItem:function(F,D,A){var E=new Element("li",{id:F});var C=new Element("strong");C.appendChild(document.createTextNode(D));var B=new Element("em");B.appendChild(document.createTextNode(A));E.appendChild(C);E.appendChild(B);return E},getProfileFieldById:function(A){return $(this.profileFields).find(function(B){return B.id==A}.bind(this))},getProfileFieldValueById:function(C,A){var B=(typeof (C.options)=="undefined")?this.getProfileFieldById(C):C;return $(B.options).find(function(D){return D.id==A}.bind(this))},getUserGroupById:function(A){return $(this.userGroups).find(function(B){return B.group_id==A}.bind(this))},initialize:function($super,A){Object.extend(A,{dimensions:{width:510,height:"auto"},reuseDialogs:false});if(!A.callback){A.callback=function(B){}}if(A.ignoreUids){this.ignoreUids=A.ignoreUids}if(typeof (A.exclude_self)=="undefined"){A.exclude_self=true}if(A.selectedUids){this.selectedUids=A.selectedUids}else{this.selectedUids=[]}$super(A);this.options=A},onBackButtonClicked:function(A){switch(this.currentStep){case PBwiki.FindNetworkUsersSteps.UserList:this.selectedProfileFieldValueId=null;this.selectedUserGroupId=null;this.showStep(PBwiki.FindNetworkUsersSteps.ProfileFieldValues);break;case PBwiki.FindNetworkUsersSteps.ProfileFields:this.showStep(PBwiki.FindNetworkUsersSteps.UserList);break;case PBwiki.FindNetworkUsersSteps.ProfileFieldValues:this.selectedProfileFieldId=null;this.showStep(PBwiki.FindNetworkUsersSteps.ProfileFields);break}},onFilterByProfileClicked:function(A){this.showStep(PBwiki.FindNetworkUsersSteps.ProfileFields)},onItemClick_ProfileFields:function(A){if(A.element().id=="category-all-users"){this.selectedProfileFieldId=null;this.selectedUserGroupId=null;this.showStep(PBwiki.FindNetworkUsersSteps.UserList)}else{if(A.element().id=="profile-field-user-groups"){this.selectedProfileFieldId=null;this.selectedUserGroupId=null;this.showStep(PBwiki.FindNetworkUsersSteps.ProfileFieldValues)}else{if(A.element().getAttribute("ui:user-count")==0){alert("There are no users available to choose based on their "+A.element().down("strong").innerText.escapeHTML()+" value.")}else{this.selectedProfileFieldId=A.element().getAttribute("ui:profile-field-id");this.selectedUserGroupId=null;this.showStep(PBwiki.FindNetworkUsersSteps.ProfileFieldValues)}}}},onItemClick_ProfileFieldValues:function(F){if(this.selectedProfileFieldId){var A=F.element().getAttribute("ui:profile-field-value-id");if(F.element().getAttribute("ui:user-count")>0){this.selectedProfileFieldValueId=A;this.showStep(PBwiki.FindNetworkUsersSteps.UserList)}else{var E=this.getProfileFieldById(this.selectedProfileFieldId);var D=E.name;var G=this.getProfileFieldValueById(E,A).value;alert("There are no users available whose "+D.escapeHTML()+" value is "+G.escapeHTML()+".")}}else{var B=F.element().getAttribute("ui:group-id");if(F.element().getAttribute("ui:user-count")>0){this.selectedGroupId=B;this.showStep(PBwiki.FindNetworkUsersSteps.UserList)}else{var C=this.getUserGroupById(B);var H=C.name;alert("There are no users available in the user group "+H.escapeHTML()+".")}}},onItemClick_UserList:function(B){if(B.originalElement.tagName!=="INPUT"){B.element().down("input").checked=(B.element().down("input").checked)?false:"checked"}var A=B.element();if(A.tagName.toLowerCase()!=="li"){A=A.up("li")}if(A.down("input").checked){this.selectedUids.push(A.getAttribute("ui:uid"))}else{this.selectedUids=this.selectedUids.without(A.getAttribute("ui:uid"))}this.userSelectChanged()},onSelectAllClick:function(A){$("findnetworkusers-users-list").select("input").each(function(B){B.checked="checked"});this.usersListBox.data.each(function(B){if(this.selectedUids.indexOf(B.uid)===-1){this.selectedUids.push(B.uid)}return B}.bind(this));this.userSelectChanged()},onSelectButtonClicked:function(B){var A=[];A=this.selectedUids.collect(function(C){Util.tracking("f-findnetworkusers-selected_user_"+C);return this.networkUsers.find(function(D){return D.uid==C})}.bind(this));this.usersListBox.setIsLoading(true);window.setTimeout(function(){PBwiki.DialogFactory.close();this.options.callback(A)}.bind(this),10)},onSelectNoneClick:function(A){$("findnetworkusers-users-list").select("input").each(function(B){B.checked=false});this.selectedUids=[];this.userSelectChanged()},onShowAllUsersClicked:function(A){this.selectedProfileFieldId=null;this.selectedProfileFieldValueId=null;this.selectedGroupId=null;this.showStep(PBwiki.FindNetworkUsersSteps.UserList)},showHiddenSelectionNote:function(D){var C=D.pluck("uid");var B=this.selectedUids.intersect(C).length;var A=this.selectedUids.length-B;if(A>0){var E=$("findnetworkusers-hidden-selection");E.down("span").update(A);E.up("div.findnetworkusers-step").addClassName("findnetworkusers-has-hidden")}else{this.hideHiddenSelectionNote()}},hideHiddenSelectionNote:function(){$$("div.findnetworkusers-has-hidden").invoke("removeClassName","findnetworkusers-has-hidden")},populateUserList:function(B,C){if(B){var A=$(C.users).collect(function(D){return this.networkUsers.find(function(E){return E.uid==D})}.bind(this)).compact();this.showHiddenSelectionNote(A);this.usersListBox.appendData(A)}else{this.hideHiddenSelectionNote();this.usersListBox.appendData(this.networkUsers)}this.usersListBox.setIsLoading(false)},postProcessUserList:function(A){return $(A).reject(function(B){return(this.ignoreUids.indexOf((B.uid||B))>=0)}.bind(this))},setupDialog:function($super){this.backButton=$("findnetworkusers-back");this.selectButton=$("findnetworkusers-select");this.backButton.observe("click",this.onBackButtonClicked.bind(this));this.selectButton.observe("click",this.onSelectButtonClicked.bind(this));this.selectedUserCountIndicator=$("findnetworkusers-users-list-selected-count");this.setUpDialog_UserList();this.setUpDialog_ProfileFields();this.setUpDialog_ProfileFieldValues();this.showStep(PBwiki.FindNetworkUsersSteps.UserList)},setUpDialog_ProfileFields:function(){this.profileFieldsListBox=new PBwiki.ListBox({element:$("findnetworkusers-fields"),onItemClick:this.onItemClick_ProfileFields.bind(this)});this.profileFieldsListBox.setIsLoading(true);var B=[];if(PBwiki.feature("network_user_groups")&&PBinfo.CheckPermissions&&PBinfo.CheckPermissions.network_perm!=="guest"){B.push(["ListNetworkUserGroups",{},{onSuccess:this.setUpDialog_UserGroupsReceived.bind(this),onFailure:function(C){alert(C)}.bind(this)}])}B.push(["GetFilterableProfileFields",{},{onSuccess:this.setUpDialog_ProfileFieldsReceived.bind(this),onFailure:function(C){alert(C)}.bind(this)}]);var A=new PBwiki.MultiAPIRequest(B,{})},setUpDialog_UserGroupsReceived:function(D){if(!$("modal-findnetworkusers")){return }if(D.groups.length==0){return }this.profileFieldsListBox.setIsLoading(false);this.userGroups=D.groups;var F="profile-field-user-groups";var E="User Group";var A=this.userGroups.pluck("name").toArray();var B=this.arrayToDetailsString(A);var C=this.createListItem(F,E,B);this.profileFieldsListBox.addItem(C);$("no-profile-fields-error").hide()},setUpDialog_ProfileFieldsReceived:function(A){if(!$("modal-findnetworkusers")){return }this.profileFieldsListBox.setIsLoading(false);this.profileFields=A.profile_fields;$(this.profileFields).each(function(B){var D=0;$(B.options).each(function(I){I.users=this.postProcessUserList(I.users);D+=I.users.length}.bind(this));var H="profile-field-"+B.id;var G=B.name;var F=B.options.pluck("value").toArray();var C=this.arrayToDetailsString(F);var E=this.createListItem(H,G,C);E.setAttribute("ui:profile-field-id",B.id);E.setAttribute("ui:user-count",D);if(D===0){E.addClassName("unavailable")}this.profileFieldsListBox.addItem(E)}.bind(this));if(this.profileFieldsListBox.length==0){$("no-profile-fields-error").show()}else{$("no-profile-fields-error").hide()}},setUpDialog_ProfileFieldValues:function(){this.profileFieldValuesListBox=new PBwiki.ListBox({element:$("findnetworkusers-field-values"),onItemClick:this.onItemClick_ProfileFieldValues.bind(this)})},setUpDialog_UserList:function(){this.usersListBox=new PBwiki.ScrollingListBox({element:$("findnetworkusers-users-list"),itemBuilder:this.buildUserRow.bind(this),itemHeight:43,onItemClick:this.onItemClick_UserList.bind(this)});$("findnetworkusers-users-list-select-all").observe("click",this.onSelectAllClick.bind(this));$("findnetworkusers-users-list-select-none").observe("click",this.onSelectNoneClick.bind(this))},showStep:function(A){this.currentStep=A;$$(".findnetworkusers-step").invoke("hide");$("findnetworkusers-step-"+A).show();this.selectedUserCountIndicator.update("");switch(this.currentStep){case PBwiki.FindNetworkUsersSteps.UserList:Util.tracking("f-findnetworkusers-show_user_list");this.showStep_UserList();break;case PBwiki.FindNetworkUsersSteps.ProfileFields:Util.tracking("f-findnetworkusers-show_profile_fields");this.showStep_ProfileFields();break;case PBwiki.FindNetworkUsersSteps.ProfileFieldValues:Util.tracking("f-findnetworkusers-show_profile_field_values");if(this.selectedProfileFieldId){this.showStep_ProfileFieldValues()}else{this.showStep_UserGroups()}break}this.backButton.disabled=(this.currentStep==1&&!(this.selectedProfileFieldId||this.selectedGroupId))?"disabled":false;this.selectButton.disabled=(this.selectedUids.length==0)},showStep_ProfileFields:function(){delete this.selectedGroupId},showStep_UserGroups:function(){$$("span.profile-field-name").invoke("update","User Group");this.profileFieldValuesListBox.removeAll();$(this.userGroups).each(function(C){var E="profile-field-value-"+C.group_id;var D=C.name;var A;switch(C.user_count){case 0:A="No one available";break;case 1:A="One person";break;default:A=C.user_count+" people"}var B=this.createListItem(E,D,A);B.setAttribute("ui:group-id",C.group_id);B.setAttribute("ui:user-count",C.user_count);if(C.user_count===0){B.addClassName("unavailable")}this.profileFieldValuesListBox.addItem(B)}.bind(this))},showStep_ProfileFieldValues:function(){delete this.selectedGroupId;var A=this.getProfileFieldById(this.selectedProfileFieldId);$$("span.profile-field-name").invoke("update",A.name.escapeHTML());this.profileFieldValuesListBox.removeAll();$(A.options).each(function(C){var F="profile-field-value-"+C.id;var E=C.value;var B;switch(C.users.length){case 0:B="No one available";break;case 1:B="One person";break;default:B=C.users.length+" people"}var D=this.createListItem(F,E,B);D.setAttribute("ui:profile-field-value-id",C.id);D.setAttribute("ui:user-count",C.users.length);if(C.users.length===0){D.addClassName("unavailable")}this.profileFieldValuesListBox.addItem(D)}.bind(this))},showStep_UserList:function(){var K=false;var F=false;var D=$("findnetworkusers-step-1").down("span");if(this.selectedProfileFieldId||this.selectedGroupId){var H;var G;if(this.selectedProfileFieldId){K=$(this.profileFields).find(function(L){return L.id==this.selectedProfileFieldId}.bind(this));F=this.getProfileFieldValueById(K,this.selectedProfileFieldValueId);H=K.name;G=F.value}else{if(this.selectedGroupId){H="User Group";G=this.getUserGroupById(this.selectedGroupId).name}}var J=new Element("a",{href:"javascript:void(0)"});J.appendChild(document.createTextNode("All users"));J.observe("click",this.onShowAllUsersClicked.bind(this));var C=new Element("a",{href:"javascript:void(0)"});C.appendChild(document.createTextNode("Profile fields"));C.observe("click",this.onFilterByProfileClicked.bind(this));var E=new Element("a",{href:"javascript:void(0)"});E.appendChild(document.createTextNode(H.escapeHTML()));E.observe("click",this.onBackButtonClicked.bind(this));var B=new Element("a",{href:"javascript:void(0)"});B.observe("click",this.onBackButtonClicked.bind(this));D.update("");D.appendChild(document.createTextNode("Showing "));D.appendChild(J);D.appendChild(document.createTextNode(" \u00bb "));D.appendChild(C);D.appendChild(document.createTextNode(" \u00bb "));D.appendChild(E);D.appendChild(document.createTextNode(" \u00bb "));D.appendChild(document.createTextNode(G.escapeHTML()))}else{D.update("Showing all users. ");var A=new Element("a",{href:"javascript:void(0)"});A.appendChild(document.createTextNode("Filter users based on their profiles"));A.observe("click",this.onFilterByProfileClicked.bind(this));D.appendChild(A);D.appendChild(document.createTextNode("."))}var I=false;if(this.usersListBoxProfileFieldValueId&&this.usersListBoxProfileFieldValueId==this.selectedProfileFieldValueId){I=true}else{if(this.usersListBoxGroupId&&this.usersListBoxGroupId==this.selectedGroupId){I=true}else{if(!this.usersListBoxProfileFieldValueId&&!this.usersListBoxGroupId&&!this.selectedProfileFieldValueId&&!this.selectedGroupId){I=true}}}if(I){this.onSelectNoneClick();return }this.usersListBox.setIsLoading(true);this.usersListBox.removeAll();this.usersListBoxProfileFieldValueId=this.selectedProfileFieldValueId;this.usersListBoxGroupId=this.selectedGroupId;this.userSelectChanged();window.setTimeout(function(){if(this.usersListBoxGroupId){var L=new PBwiki.APIRequest("ListNetworkGroupUsers",{group_id:this.usersListBoxGroupId},{allowDefer:true,cacheability:["permtime","grouptime"],onSuccess:function(M){if(!$("modal-findnetworkusers")){return }var N=this.postProcessUserList(M.users);this.showHiddenSelectionNote(N);this.usersListBox.appendData(N);this.usersListBox.setIsLoading(false);this.selectUsers()}.bind(this),onFailure:function(M){alert(M)}.bind(this)})}else{if(this.networkUsers){this.populateUserList(K,F)}else{var L=new PBwiki.APIRequest("GetNetworkUsers",{verbose:true,exclude_pending:false,exclude_self:this.options.exclude_self,sortby:"last_name",exclude_guests:false},{allowDefer:true,cacheability:["permtime"],onSuccess:function(M){if(!$("modal-findnetworkusers")){return }this.networkUsers=this.postProcessUserList(M.users);this.populateUserList(K,F);this.selectUsers()}.bind(this),onFailure:function(M){alert(M)}.bind(this)})}}}.bind(this),10)},selectUsers:function(){this.selectedUids.each(function(A){var B=$$("#user-"+A+" input").first();if(!B||B.checked){return }B.checked=true}.bind(this));this.userSelectChanged()},userSelectChanged:function(){if(this.selectedUids.length==0){this.selectedUserCountIndicator.update("");this.hideHiddenSelectionNote();this.selectButton.disabled=true}else{if(this.selectedUids.length==1){this.selectedUserCountIndicator.update("One user selected");this.selectButton.disabled=false}else{this.selectedUserCountIndicator.update(this.selectedUids.length+" users selected");this.selectButton.disabled=false}}}});PBwiki.ListBox=Class.create({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.UsersPanelView={AllUsers:"all_users",Blocked:"blocked",Pending:"pending"};PBwiki.UserPermissions={admin:"Administrator",mod:"Editor",write:"Writer",read:"Reader",page:"Page-level only"};PBwiki.DoneIconTimeouts={Default:1000,PendingUserApproved:5000};PBwiki.UsersPanel={users:null,currentView:PBwiki.UsersPanelView.AllUsers,pageSize:10,currentPage:null,filter:"",mayShowPendingUsersBubble:true,getUsersMemo:null,letterToUIDMap:{},uidToIndexMap:{},uidToLetterMap:{},didTrackFilter:false,showAddUsersDialog:function(){if(PBwiki.feature("add_users_wizard")){var A={title:"Invite More People",workspace:PBinfo.CurrentWiki.name,workspace_title:(PBinfo.CurrentWiki.title||PBinfo.CurrentWiki.name),guest_only:(PBinfo.CheckPermissions.network_perm!=="admin"),default_network_role:PBinfo.CurrentWiki.default_network_role};if(document.location.href.indexOf("/w/users")!==-1){A.onSuccess=function(){document.location.reload()}}(new PBwiki.DialogCommands.AddUsersWizard(A))}else{(new PBwiki.DialogCommands.AddUsersDialog({}))}},blockedUserListDidLoad:function(A){PBwiki.UsersPanel.users=A.users;this.updateBlockedUserCount(A.users.length);$("user-count").update(A.users.length+(A.users.length==1?" user":" users"));document.fire("users::user-list-changed")},createRowForUser:function(D,B){var A=$("user-row-template");var I=A.cloneNode(true);$("userlist").down("tbody").appendChild(I);I.removeAttribute("id");if(!D){I.setStyle({visibility:"hidden"});return I}I.setAttribute("ui:uid",D.uid);I.setAttribute("id","user-row-"+D.uid);var G=(B%2==0);I.addClassName(G?"even":"odd");if(this.uidToLetterMap[D.uid]){I.down("div.letter").update(new Element("a",{name:this.uidToLetterMap[D.uid]})).update(this.uidToLetterMap[D.uid])}else{I.down("div.letter").remove()}I.down("img.user-pic").src=D.image;if(D.name){I.down("h3.user-info-name").update(D.name.toString().escapeHTML())}else{if(D.username){I.down("h3.user-info-name").update(D.username.toString().escapeHTML())}else{if(D.email){I.down("h3.user-info-name").update(D.email.toString().escapeHTML())}}}if(PBwiki.feature("workspace_user_groups")&&this.currentView===PBwiki.UsersPanelView.AllUsers){var E=this.getUserGroupLinkForUser(D.uid);I.down("span.user-info-detail").update(E)}else{if(D.email){I.down("span.user-info-detail").update(new Element("a",{href:"mailto:"+encodeURIComponent(D.email)})).update(D.email.escapeHTML())}else{if(D.username){I.down("span.user-info-detail").update(D.username.escapeHTML())}else{I.down("span.user-info-detail").update("")}}}if(D.uid==PBinfo.CheckPermissions.uid){var H=new Element("span",{"class":"you"});H.appendChild(document.createTextNode("\u00A0"));I.down("h3.user-info-name").appendChild(H)}if(D.network_perm&&D.network_perm=="guest"){I.down("h3.user-info-name").addClassName("guest").appendChild(new Element("img",{src:"/shared/network/images/label-client.gif"}))}if(!D.username&&!D.is_verified){I.down("h3.user-info-name").addClassName("unverified").appendChild(new Element("img",{src:"/shared/images/label-unverified.gif"}))}switch(this.currentView){case PBwiki.UsersPanelView.AllUsers:var F=new Element("label");F.appendChild(document.createTextNode("last visited"));var C=new Element("span");C.appendChild(document.createTextNode(D.lastviewtext?D.lastviewtext+" ago":"never"));I.down("td.user-time").update("");I.down("td.user-time").appendChild(F);I.down("td.user-time").appendChild(C);break;case PBwiki.UsersPanelView.Pending:var J=new Element("span",{"class":"request-time"});J.update(D.request_time_ago+" ago");I.down("td.user-time").update("");I.down("td.user-time").appendChild(J);break}I.getElementsBySelector("td.user-info a").each(function(K){K.setAttribute("ui:uid",D.uid);if(PBwiki.feature("usercard")&&!K.hasClassName("user-group-link")){K.addClassName("usercard_trigger")}else{K.setAttribute("href","/user/"+D.uid)}});this.updateUserRowControls(I);return I},getUserGroupLinkForUser:function(B){var A=this.uidToIndex(B);var D=this.users[A];if(PBinfo.CheckPermissions&&(PBinfo.CheckPermissions.wikiperm=="admin"||PBinfo.CheckPermissions.network_perm=="admin")){var C=new Element("a",{className:"user-group-link",href:"javascript: void(0);"});if(D.groups&&D.groups[0]&&D.groups[0].name){C.update(D.groups[0].name.escapeHTML());C.style.color="#333333"}else{C.update("Select a group...")}C.observe("click",this.onUserGroupLinkClicked.bindAsEventListener(this,D));return C}else{var E;if(D.groups&&D.groups[0]&&D.groups[0].name){E=D.groups[0].name}else{E="No group selected"}return E.escapeHTML()}return""},getUserGroupDropDownForUser:function(B,C){var A=new Element("select",{id:"user-group-"+B,className:"user-group-select"});var D=0;A.appendChild(new Element("option",{value:""}).update("No group"));$$("#group-filter li a").each(function(F){var E=F.getAttribute("group_id");var G=F.textContent||F.innerText;A.appendChild(new Element("option",{value:E}).update(G.escapeHTML()));if(C===E){D=A.options.length-1}});A.appendChild(new Element("option",{value:"new"}).update("Create new group..."));if(C==="new"){D=A.options.length-1}A.options[D].selected=true;A.observe("change",this.onUserGroupChange.bindAsEventListener(this,B));return A},onUserGroupLinkClicked:function(F,E){if(F){F.stop()}var A=(E.groups&&E.groups[0])?E.groups[0].group_id:null;var D=new Element("a",{href:"javascript:void(0)",className:"user-group-cancel"});D.update("cancel");D.observe("click",this.resetUserGroupLink.bind(this,E.uid));var C=$("user-row-"+E.uid);var B=C.down(".user-info-detail");B.update("");B.appendChild(this.getUserGroupDropDownForUser(E.uid,A));B.appendChild(new Element("span").update(" or "));B.appendChild(D)},onUserGroupChange:function(F,E){var D=$("user-row-"+E);var I=D.down(".user-info-detail");var C=I.down("select").options[I.down("select").selectedIndex];var B={user_id:E};if(C.value=="new"){var A=window.prompt("Enter the name for the new group:");if(A===null||A.empty()){this.resetUserGroupLink(E);return }if(A.length>PBconst.kMaxGroupNameLength){A=A.substring(0,PBconst.kMaxGroupNameLength);window.alert('This group name is too long. It has been shortened to "'+A+'".')}var H=I.down("select");H.options[H.options.length]=new Option(A);H.selectedIndex=H.options.length-1;var G=this.findGroupByName(A.strip());if(G!==null){B.group_id=G}else{B.name=A}}else{if(C.value){B.group_id=C.value}}I.down("span").remove();I.down("a").remove();I.down("select").disabled=true;I.addClassName("busy");new PBwiki.APIRequest("ReplaceWorkspaceGroupMembership",B,{onSuccess:this.onUserGroupChangeDone.bind(this,E),onFailure:function(J){alert(J);this.resetUserGroupLink(E)}.bind(this)})},findGroupByName:function(B){var A=$$("div#group-filter li a").find(function(D){var C=D.textContent||D.innerText;return(C&&C.strip()==B)}.bind(this));return(A)?A.getAttribute("group_id"):null},resetUserGroupLink:function(A){var B=$("user-row-"+A);var C=B.down(".user-info-detail");C.update(this.getUserGroupLinkForUser(A));C.removeClassName("busy");C.removeClassName("done")},onUserGroupChangeDone:function(B,D){var A=this.uidToIndex(B);this.users[A].groups=D.groups;if(D.groups.length>0){this.ensureUserGroupInList(D.groups[0].group_id,D.groups[0].name);$$("select.user-group-select").each(function(H){if(H.id==="user-group-"+B){return }var F=(H.selectedIndex===-1)?"":H.options[H.selectedIndex].value;var G=this.getUserGroupDropDownForUser(B,F);H.replace(G)}.bind(this))}var C=$("user-row-"+B);var E=C.down(".user-info-detail");E.removeClassName("busy");E.addClassName("done");window.setTimeout(this.resetUserGroupLink.bind(this,B),PBwiki.DoneIconTimeouts.Default)},ensureUserGroupInList:function(F,G){if(!$("group-filter")){return }if($("group-"+F)){return }var D=$("group-filter").down("ul");var B=D.select("li");var C=B.length;for(var A=B.length-1;A>=0;A--){var I=B[A];var J=I.textContent||I.innerText;if(G.toUpperCase()<J.toUpperCase()){C=A}}var H=new Element("li");var E=new Element("a",{id:"group-"+F,group_id:F,href:"#view="+this.currentView+"&group_id="+F});E.update(G.escapeHTML());H.appendChild(E);if(C==B.length){D.appendChild(H)}else{D.insertBefore(H,B[C])}$("group-filter").down("ul").show();$("group-filter-no-groups").hide()},doesUserMatchFilter:function(C,B){var A=C.name;if(C.email){A+=" "+C.email}else{if(C.username){A+=" "+C.username}}A+=" "+C.perm+" "+PBwiki.UserPermissions[C.perm];if(C.network_perm&&C.network_perm=="guest"){A+=" "+C.network_perm+" guest"}A=A.toLowerCase();return $(B.toLowerCase().split(/\s+/)).any(function(D){return(A.indexOf(D)>=0)})},getPermissionDropDownBoxForUser:function(D){is_pending_approval=(typeof (is_pending_approval)=="undefined")?false:is_pending_approval;var C=new Element("select",{"class":"user-permission"});var B;for(B in PBwiki.UserPermissions){if(D.username&&B=="admin"){continue}var A=new Element("option",{value:B}).update(PBwiki.UserPermissions[B]);A.selected=(B==D.perm);C.appendChild(A)}return C},getUsers:function(){if(this.getUsersMemo){return this.getUsersMemo}var E={};var B={};var A={};var D=0;if(!this.users){return new Array()}var C=this.users.findAll(function(H){if(this.currentView==PBwiki.UsersPanelView.AllUsers&&H.perm=="deny"){return false}if(this.filter&&!this.doesUserMatchFilter(H,this.filter)){return false}if(this.currentGroupID){if(!H.groups||!H.groups.find(function(I){return I.group_id===this.currentGroupID}.bind(this))){return false}}var F=H.uid;B[F]=D++;var G=H.last_name?H.last_name.charAt(0).toString().toUpperCase():false;if(/[A-Z]/.match(G)&&typeof (E[G])=="undefined"){E[G]=F;A[F]=G}if(B[F]==0&&A[F]=="undefined"){this.uidToLetterMap[H.uid]=" "}return true}.bind(this));this.letterToUIDMap=E;this.uidToIndexMap=B;this.uidToLetterMap=A;this.getUsersMemo=C;return C},initialize:function(){this.padUserList();if(PBinfo.CheckPermissions.wikiperm=="admin"){$("users-add").style.display="block";this.initializeButton($("users-add"))}if(PBwiki.feature("network_user_groups")){this.initializeGroups()}$("users-add").observe("click",this.onAddUsersClicked.bind(this));$("user-list-next").observe("click",this.onNextClicked.bind(this));$("user-list-prev").observe("click",this.onPrevClicked.bind(this));$("user-search").observe("keyup",this.onSearchChanged.bind(this));$("user-search").observe("click",this.onSearchChanged.bind(this));$("user-list-sortby").observe("change",this.onSortFieldChanged.bind(this));document.observe("users::refresh-data",this.refreshData.bind(this));document.observe("users::user-list-changed",this.userListChanged.bind(this));document.observe("users::group-changed",this.onUserGroupChanged.bind(this));document.observe("users::filter-changed",this.onUserFilterChanged.bind(this));if($("user-filter-info")){$("user-filter-info").hide();$("user-filter-close").observe("click",this.onRemoveUserFilterClicked.bind(this))}if($("user-group-info")){$("user-group-info").hide();$("user-group-close").observe("click",this.onRemoveGroupFilterClicked.bind(this))}if($("user-both-info")){$("user-both-info").hide();$("user-both-close-filter").observe("click",this.onRemoveUserFilterClicked.bind(this));$("user-both-close-group").observe("click",this.onRemoveGroupFilterClicked.bind(this))}var A=PBwiki.History.getKey("view").getValue()||PBwiki.UsersPanelView.AllUsers;var B=PBwiki.History.getKey("group_id").getValue();this.switchToView(A);this.switchToGroup(B);PBwiki.History.getKey("view").observe("onChange",this.switchToView.bind(this));PBwiki.History.getKey("group_id").observe("onChange",this.switchToGroup.bind(this));PBwiki.History.start()},initializeGroups:function(){if(!PBwiki.feature("network_user_groups")){return }if(PBinfo.CheckPermissions.wikiperm=="admin"&&PBinfo.CheckPermissions.network_perm!=="guest"){$("groups-add").style.display="block";this.initializeButton($("groups-add"));$("groups-add").observe("click",this.onAddGroupsClicked.bind(this))}this.loadGroupsList()},initializeButton:function(A){if(A.offsetLeft<0){A.style.marginLeft=(-1*A.offsetLeft)+"px"}},refreshData:function(){$("userlist").hide();$("userlist-sidebar").hide();$("userlist-header").hide();$("user-list-footer").hide();$("userlist-loading").show();this.loadUserList();this.loadGroupsList()},loadGroupsList:function(){if(!PBwiki.feature("network_user_groups")){return }var A=new PBwiki.APIRequest("ListWorkspaceUserGroups",{},{cacheability:["grouptime"],method:"get",onSuccess:this.workspaceGroupsListDidLoad.bind(this),onFailure:function(B){alert(B)}.bind(this)})},onAddGroupsClicked:function(A){if(A){A.stop()}new PBwiki.DialogCommands.AddNetworkGroup({})},workspaceGroupsListDidLoad:function(B){if(!$("group-filter")){return }var A=$("group-filter").down("ul");A.update("");B.groups.each(function(G){var D=new Element("li");var F=new Element("a",{id:"group-"+G.group_id,group_id:G.group_id,role:G.role,href:"#view=all_users&group_id="+G.group_id});F.update(G.name.escapeHTML());if(G.group_id==this.currentGroupID){D.addClassName("selected")}D.appendChild(F);A.appendChild(D);if(G.group_id==this.currentGroupID){if(PBinfo.CheckPermissions.network_perm!="guest"){var H=this.buildUserGroupActionLink("profile","View group profile",this.onUserGroupProfileClicked.bindAsEventListener(this));A.appendChild(H)}if(PBinfo.CheckPermissions.wikiperm=="admin"){var E=this.buildUserGroupActionLink("role","Change role",this.onUserGroupRoleClicked.bindAsEventListener(this));var C=this.buildUserGroupActionLink("remove","Remove group",this.onUserGroupRemoveClicked.bindAsEventListener(this));A.appendChild(E);A.appendChild(C)}}}.bind(this));if(B.groups.length>0){$("group-filter-no-groups").hide();$("group-filter").show();A.show()}else{A.hide();$("group-filter").show();$("group-filter-no-groups").show()}},loadBlockedUserList:function(){var A=new PBwiki.APIRequest("GetBlockedUsers",{},{cacheability:["permtime"],method:"get",onSuccess:PBwiki.UsersPanel.blockedUserListDidLoad.bind(this),onFailure:function(B){alert(B)}.bind(this)})},loadPendingUserList:function(){var A=new PBwiki.APIRequest("GetPendingUsers",{},{cacheability:["permtime"],method:"get",onSuccess:PBwiki.UsersPanel.pendingUserListDidLoad.bind(this),onFailure:function(B){alert(B)}.bind(this)})},loadUserList:function(){$$("div#group-filter li.selected").invoke("removeClassName","selected");var C=$("user-list-sortby").value;var A=(C=="lastview");var B=new PBwiki.APIRequest("GetUsersInfos",{sortby:C,reverse:A,verbose:true},{allowDefer:true,cacheability:["permtime","grouptime"],method:"get",onSuccess:PBwiki.UsersPanel.userListDidLoad.bind(this),onFailure:function(D){alert(D)}.bind(this)})},onUserGroupProfileClicked:function(B){if(B){B.stop()}var A=this.currentGroupID;document.location.href=Util.URLRelativeToContext("/n/users/group-profile?group_id="+this.currentGroupID,{network:PBinfo.CurrentNetwork.name})},onUserGroupRoleClicked:function(B){if(B){B.stop()}if(!this.currentGroupID){return }var A=$("group-"+this.currentGroupID).getAttribute("role");new PBwiki.DialogCommands.NetworkGroupRole({group_id:this.currentGroupID,name:this.currentGroupName,role:A})},onUserGroupRemoveClicked:function(A){if(A){A.stop()}if(!this.currentGroupID){return }new PBwiki.DialogCommands.NetworkGroupDel({group_id:this.currentGroupID,name:this.currentGroupName})},onUserGroupDeleteClicked:function(B){if(B){B.stop()}if(!this.currentGroupID){return }var C='Are you sure you want to delete the group "'+this.currentGroupName+'"? The members of this group may no longer be able to access some parts of this workspace.';var D=window.confirm(C);if(!D){return }var A=this.currentGroupID;document.location.href="#view=all_users";new PBwiki.APIRequest("DeleteWorkspaceUserGroup",{group_id:A},{method:"post",onSuccess:this.userGroupWasDeleted.bind(this,A),onFailure:function(E){alert(E)}.bind(this)})},userGroupWasDeleted:function(E,D){var C=false;for(var B=0;B<this.users.length;B++){if(!this.users[B].groups){continue}for(var A=0;A<this.users[B].groups.length;A++){if(this.users[B].groups[A].group_id===E){this.users[B].groups[A]=null;this.users[B].groups=this.users[B].groups.compact();C=true}}}if(C){this.userListChanged()}$("group-"+E).up("li").remove();if($$("#group-filter ul li").length===0){$("group-filter").down("ul").hide();$("group-filter-no-groups").show()}},onAddUsersClicked:function(A){Util.tracking("f-users_panel-addusers_show");PBwiki.UsersPanel.showAddUsersDialog()},onBlockUserClicked:function(E){var D=E.element().up("tr").getAttribute("ui:uid");var C=this.uidToIndex(D);var A=this.users[C].name||this.users[C].email||this.users[C].username||this.users[C].uid;if(!confirm("Are you sure you want to block "+A+" from rejoining this workspace?")){return }var B=new PBwiki.APIRequest("AddUser",{perm:"deny",demote:true,uid:D},{onSuccess:PBwiki.UsersPanel.userWasBlocked.bind(this),onFailure:function(F){alert(F)}.bind(this)});E.element().stopObserving("click")},onPendingUserPermissionSet:function(E){PBwiki.UsersPanel.setNavigationChickletsEnabled(false);var D=E.element().value;var C=E.element().up("td");E.element().stopObserving("change");E.element().observe("change",this.onChangeUserPermission.bind(this));Util.tracking("f-users_panel-approve_pending-"+D);C.removeClassName("done").addClassName("busy");var B=E.element().up("tr").getAttribute("ui:uid");var A=new PBwiki.APIRequest("AddUser",{perm:D,demote:true,uid:B},{onSuccess:PBwiki.UsersPanel.pendingUserPermissionWasChanged.bind(this),onFailure:function(F){C.removeClassName("busy");alert(F);PBwiki.UsersPanel.setNavigationChickletsEnabled(true)}.bind(this)})},onChangeUserPermission:function(D){Util.tracking("f-users_panel-change_perm");var C=D.element().up("tr").getAttribute("ui:uid");if(!this.canSetPermission(C,D.element().value)){D.stop();return }var A=D.element().up("td");A.removeClassName("done").addClassName("busy");D.element().disabled=true;var B=new PBwiki.APIRequest("AddUser",{perm:D.element().value,demote:true,uid:C},{onSuccess:PBwiki.UsersPanel.userPermissionWasChanged.bind(this),onFailure:function(G){D.element().disabled=false;A.removeClassName("busy");var F=this.uidToIndex(C);var E=this.users[F].perm;this.setSelectBoxValue(D.element(),E);alert(G)}.bind(this)})},onLetterClicked:function(E){var C=E.element().innerHTML;var A=this.userForLetter(C);if(A){var B=this.uidToIndexMap[A];var D=Math.floor(B/this.pageSize);this.showPage(D)}Util.tracking("f-users_panel-alphablock")},onNextClicked:function(A){if(A.element().disabled){return }this.showPage(this.currentPage+1)},onApproveButtonClicked:function(H){PBwiki.UsersPanel.setNavigationChickletsEnabled(false);var G=H.element().up("tr");var F=this.userRecordForRow(G);var A="write";var D=G.down("td.user-controls");D.update("").removeClassName("done").addClassName("busy");var E=this.getPermissionDropDownBoxForUser(F);E.observe("change",this.onPendingUserPermissionSet.bind(this));for(var C=0;C<E.options.length;C++){if(E.options[C].value==A){E.options.selectedIndex=C;break}}D.appendChild(E);Util.tracking("f-users_panel-approve_pending-"+A);var B=new PBwiki.APIRequest("AddUser",{perm:A,demote:true,uid:F.uid},{onSuccess:PBwiki.UsersPanel.pendingUserPermissionWasChanged.bind(this),onFailure:function(I){D.removeClassName("busy");alert(I);PBwiki.UsersPanel.setNavigationChickletsEnabled(true)}.bind(this)})},onDenyPendingUserClicked:function(D){var C=D.element().up("tr");var B=this.userRecordForRow(C);var A=new PBwiki.APIRequest("AddUser",{perm:"delete",demote:true,uid:B.uid},{onSuccess:PBwiki.UsersPanel.userWasDenied.bind(this),onFailure:function(E){alert(E)}.bind(this)});C.down("td.user-controls").update("").addClassName("busy")},userWasDenied:function(C){var B=$("user-row-"+C.uid);if(!B){return }var A=this.uidToIndex(C.uid);this.users[A].denied=true;this.updateUserRowControls_Pending(B)},onPrevClicked:function(A){if(A.element().disabled){return }this.showPage(this.currentPage-1)},canRemoveUser:function(C){if(!PBwiki.feature("network_user_groups")){return true}var B=this.uidToIndex(C);if(!this.users[B].groups||this.users[B].groups.length===0){return true}var A=this.users[B].name||this.users[B].email||this.users[B].username||C;var D;if(this.users[B].groups.length==1){D="You cannot remove "+A+' because they are a member of the group "'+this.users[B].groups[0].name+'". In order to remove this user from this workspace, you will need to remove the entire group.'}else{D="You cannot remove "+A+" because they are a member of "+this.users[B].groups.length+" groups:\n\n";this.users[B].groups.each(function(E){D+="   "+E.name+"\n"});D=D+"\nIn order to remove this user from this workspace, you will need to remove all of these groups."}alert(D);return false},canSetPermission:function(F,H){if(!PBwiki.feature("network_user_groups")){return true}var E=this.uidToIndex(F);if(this.users[E].groups.length===0){return true}var D=this.users[E].groups.collect(function(N){var M=N.group_id;return $("group-"+M).getAttribute("role")});var B=Object.keys(PBwiki.UserPermissions).reverse();var L=B.indexOf(H);var A=D.collect(function(M){return B.indexOf(M)});var J=A.max();if(L<J){var E=this.uidToIndex(F);var K=this.users[E].perm;var I=$("user-row-"+F).down("select.user-permission");for(var E=0;E<I.options.length;E++){if(I.options[E].value==K){I.selectedIndex=E;break}}var G=PBwiki.UserPermissions[H];var C="You cannot set this user's role to "+G+" because they are in a group with a higher role on this workspace.";alert(C);return false}return true},onRemoveUserClick:function(F){var D=F.element().up("tr").getAttribute("ui:uid");var C=this.uidToIndex(D);var A=this.users[C].name||this.users[C].email||this.users[C].username||D;if(!this.canRemoveUser(D)){return }var E="Are you sure you want to remove "+A+"?";if(PBinfo.CurrentNetwork){if(this.users[C].network_perm=="admin"){E+="\n\nAs a network administrator, "+A+" is able to re-join this workspace in the future."}else{if(PBinfo.CurrentWiki.isNetworkPublic&&this.users[C].network_perm=="user"){E+="\n\nThis workspace is open to the network, so "+A+" can re-join this workspace again in the future."}}}if(!confirm(E)){return }Util.tracking("f-users_panel-remove_user");F.element().up("tr").setAttribute("ui:original_perm",this.users[C].perm);var B=new PBwiki.APIRequest("AddUser",{perm:"delete",demote:true,uid:D},{onSuccess:PBwiki.UsersPanel.userWasRemoved.bind(this),onFailure:function(G){alert(G)}.bind(this)});F.element().up("tr").select("a[ui:uid]").invoke("removeClassName","usercard_trigger");F.element().stopObserving("click")},onRemoveUserFilterClicked:function(A){A.stop();$("user-search").value="";document.fire("users::filter-changed","");$("user-search").focus()},onRemoveGroupFilterClicked:function(A){this.switchToGroup(null)},onSearchChanged:function(B){if(this.users){if(B.keyCode==27){B.element().value=""}if(Util.isInternetExplorer6()&&B.keyCode!==13){return }var A=B.element().value.strip();if(A!=this.filter){document.fire("users::filter-changed",A)}}},onSortFieldChanged:function(B){var A=new PBwiki.APIRequest("SetUserPref",{key:PBconst.kUserPref_UsersPanel_SortBy,value:$("user-list-sortby").value},{onFailure:function(C){alert("Oops, an error occurred while saving your preferences. Please try again later.\n\n"+C)}.bind(this)});this.loadUserList()},onUnblockUserClicked:function(D){D.element().stopObserving("click");var C=D.element().up("td.user-controls");C.addClassName("busy");var B=D.element().up("tr").getAttribute("ui:uid");var A=new PBwiki.APIRequest("AddUser",{perm:"delete",demote:true,uid:B},{onSuccess:PBwiki.UsersPanel.userWasUnblocked.bind(this),onFailure:function(E){alert(E)}.bind(this)})},onUndoUserDeleteClick:function(F){F.stop();var D=F.element().up("tr").getAttribute("ui:uid");var C=this.uidToIndex(D);var A=F.element().up("tr");var E=A.getAttribute("ui:original_perm");this.users[C].deleted=false;this.updateUserRowControls_AllUsers(A);A.down("td.user-controls").addClassName("busy");A.select("a[ui:uid]").invoke("addClassName","usercard_trigger");var B=new PBwiki.APIRequest("AddUser",{perm:E,demote:false,uid:D,invite:false},{onSuccess:PBwiki.UsersPanel.userDeleteWasUndone.bind(this),onFailure:function(G){alert(G)}.bind(this)});Util.tracking("f-users_panel-undo_remove_user")},drawFilterInfo:function(){$("user-both-info-filter").update(this.filter?this.filter.escapeHTML():"...");$("user-both-info-group").update(this.currentGroupName?this.currentGroupName.escapeHTML():"...");$("user-group-info-group").update(this.currentGroupName?this.currentGroupName.escapeHTML():"...");$("user-filter-info-filter").update(this.filter?this.filter.escapeHTML():"...");$("user-both-info").style.display=(this.currentGroupName&&this.filter)?"block":"none";$("user-group-info").style.display=(this.currentGroupName&&!this.filter)?"block":"none";$("user-filter-info").style.display=(!this.currentGroupName&&this.filter)?"block":"none"},onUserGroupChanged:function(E){$$("#group-filter li.action").invoke("remove");$$("#group-filter li.selected").invoke("removeClassName","selected");this.drawFilterInfo();if(this.currentGroupID){var B=$("group-"+this.currentGroupID).up("li");B.addClassName("selected");if(PBwiki.feature("network_user_groups")&&PBinfo.CheckPermissions.wikiperm=="admin"){var G=this.buildUserGroupActionLink("profile","View group profile",this.onUserGroupProfileClicked.bindAsEventListener(this));var C=this.buildUserGroupActionLink("role","Change role",this.onUserGroupRoleClicked.bindAsEventListener(this));var A=this.buildUserGroupActionLink("remove","Remove group",this.onUserGroupRemoveClicked.bindAsEventListener(this));if(PBinfo.CheckPermissions.network_perm=="guest"){B.insert({after:C});C.insert({after:A})}else{B.insert({after:G});G.insert({after:C});C.insert({after:A})}}else{if(PBwiki.feature("network_user_groups")&&PBinfo.CheckPermissions.network_perm!=="guest"){var G=this.buildUserGroupActionLink("profile","View group profile",this.onUserGroupProfileClicked.bindAsEventListener(this));B.insert({after:G})}else{if(PBinfo.CheckPermissions.wikiperm=="admin"){var D=this.buildUserGroupActionLink("delete","Delete group",this.onUserGroupDeleteClicked.bindAsEventListener(this));B.insert({after:D})}}}}if($("users-chicklet-all_users")){var F=(this.currentGroupID)?("&group_id="+this.currentGroupID):"";$("users-chicklet-all_users").href="#view=all_users"+F}document.fire("users::user-list-changed")},buildUserGroupActionLink:function(A,E,D){var C=new Element("li",{className:"action "+A});var B=new Element("a",{href:"javascript: void(0);",id:"group-filter-"+A});B.update(E.escapeHTML());B.observe("click",D);C.appendChild(B);return C},onUserFilterChanged:function(B){var A=B.memo.strip?B.memo.strip():"";this.filter=A;if($("user-search").value.strip()!=A.strip()){$("user-search").value=A.strip()}if(!this.didTrackFilter){this.didTrackFilter=true;Util.tracking("f-users_panel-filtered")}if($("user-filter-current-filter")){if(A){if(PBinfo.CurrentNetwork){$("user-filter-search-network").down("a").href=PBinfo.CurrentNetwork.url+"n/users?search="+encodeURIComponent(A)}else{$("user-filter-search-network").hide()}}}this.drawFilterInfo();document.fire("users::user-list-changed")},padUserList:function(){var C=$$("#userlist tr");var A=$("userlist");if(C.length<PBwiki.UsersPanel.pageSize){var B;for(B=0;B<PBwiki.UsersPanel.pageSize-C.length;B++){this.createRowForUser(false,C.length+B)}}},pendingUserListDidLoad:function(A){PBwiki.UsersPanel.users=A.users;this.updatePendingUserCount(A.users.length);$("user-count").update(A.users.length+(A.users.length==1?" user":" users"));document.fire("users::user-list-changed")},refreshLetterMap:function(){var D;var E=$("user-alpha");E.update("");for(D="A".charCodeAt(0);D<="Z".charCodeAt(0);D++){var C=String.fromCharCode(D);var B=this.userForLetter(C);if(B){var A=new Element("a",{href:"javascript:void(0)"});A.observe("click",this.onLetterClicked.bind(this));A.update(C);E.appendChild(A);E.appendChild(document.createTextNode(" "))}else{E.appendChild(document.createTextNode(C+" "))}}},refreshUserRow:function(D){var B;var A;if(D.i){B=D.uid;A=D.i}else{B=D;A=this.uidToIndex(D)}var C=$("user-row-"+B);if(C){this.updateUserRowControls(C)}},showPage:function(D){PBwiki.UsersPanel.currentPage=D;var H=this.getUsers();$$("#userlist tr").each(function(I){if(I.id!=="user-row-template"){I.remove()}});var B=D*PBwiki.UsersPanel.pageSize;var C=Math.min(B+PBwiki.UsersPanel.pageSize,H.length);var A=H.slice(B,C);var G=0;$(A).each(function(I){PBwiki.UsersPanel.createRowForUser(I,G++)});this.padUserList();var F;switch(this.currentView){case PBwiki.UsersPanelView.AllUsers:var E=(PBwiki.feature("workspace_user_groups")||PBwiki.feature("network_user_groups"));F=(E&&!this.filter)?$("user-group-no-users"):$("user-search-no-users");break;case PBwiki.UsersPanelView.Pending:F=$("user-no-pending-users");break;case PBwiki.UsersPanelView.Blocked:F=$("user-no-blocked-users");break}$$(".no-users-message").invoke("hide");if(A.length==0){F.show();$("user-list-pager").setStyle({visibility:"hidden"})}else{F.hide();$("user-list-pager").setStyle({visibility:"visible"})}$("user-list-page-current").update((B+1)+"-"+(C));if(H.length>PBwiki.UsersPanel.pageSize){$("user-list-page-count").down("strong").update(H.length);$("user-count").update(H.length+(H.length==1?" user":" users"));$("user-list-prev").disabled=(B==0);if($("user-list-prev").disabled){$("user-list-prev").addClassName("disabled")}else{$("user-list-prev").removeClassName("disabled")}$("user-list-next").disabled=(B+PBwiki.UsersPanel.pageSize)>=H.length;if($("user-list-next").disabled){$("user-list-next").addClassName("disabled")}else{$("user-list-next").removeClassName("disabled")}$("user-list-page-count").show();$("user-list-prev").show();$("user-list-next").show()}else{$("user-list-page-count").hide();$("user-list-prev").hide();$("user-list-next").hide()}Util.tracking("f-users_panel-show_page_"+D)},switchToGroup:function(B){if(!PBwiki.feature("workspace_user_groups")&&!PBwiki.feature("network_user_groups")){return }var A;if(this.currentView===PBwiki.UsersPanelView.AllUsers&&B&&$("group-"+B)){A=$("group-"+B)}else{A=null}if(A){this.currentGroupID=B;this.currentGroupName=A.textContent||A.innerText}else{B=null;delete this.currentGroupID;delete this.currentGroupName}document.fire("users::group-changed",B)},switchToView:function(B){if(B!=PBwiki.UsersPanelView.AllUsers&&!$("users-chicklet-"+B)){this.switchToView(PBwiki.UsersPanelView.AllUsers);return }this.currentView=B;$$(".no-users-message").invoke("hide");$("user-list-sortby").hide();switch(B){case PBwiki.UsersPanelView.AllUsers:if($("group-filter")){if($$("#group-filter ul li").length>0){$("group-filter").down("ul").show();$("group-filter-no-groups").hide()}else{$("group-filter").down("ul").hide();$("group-filter-no-groups").show()}$("group-filter").show()}$("user-list-sortby").show();this.loadUserList();break;case PBwiki.UsersPanelView.Blocked:if($("group-filter")){$("group-filter").hide()}this.loadBlockedUserList();break;case PBwiki.UsersPanelView.Pending:if($("group-filter")){$("group-filter").hide()}this.mayShowPendingUsersBubble=false;this.loadPendingUserList();break;default:this.switchToView(PBwiki.UsersPanelView.AllUsers);return }if($("user-chicklet-nav")){if($("user-chicklet-nav").down("a.active")){$("user-chicklet-nav").down("a.active").removeClassName("active")}if($("users-chicklet-"+B)){$("users-chicklet-"+B).addClassName("active")}}if($("group-filter")){$$("div#group-filter li a").each(function(C){C.href="#view="+this.currentView+"&group_id="+C.getAttribute("group_id")}.bind(this))}Util.tracking("f-users_panel-switch_view_"+B);if(PBwiki.History.getValue("view")!==B){var A={view:B};if(this.currentGroupID){A.group_id=this.currentGroupID}PBwiki.History.setItems(A)}},uidToIndex:function(B){var A;if(!this.users){return null}for(A=0;A<this.users.length;A++){if(this.users[A].uid==B){return A}}return null},updateBlockedUserCount:function(A){var B="Blocked Users";if(A>0){B+=" ("+A+")"}$("users-chicklet-blocked").down("span").update(B)},updatePendingUserCount:function(A){$("users-chicklet-pending").down("span").update("Request Access ("+A+")")},updateUserRowControls:function(A){switch(this.currentView){case PBwiki.UsersPanelView.AllUsers:this.updateUserRowControls_AllUsers(A);break;case PBwiki.UsersPanelView.Blocked:this.updateUserRowControls_Blocked(A);break;case PBwiki.UsersPanelView.Pending:this.updateUserRowControls_Pending(A);break}},updateUserRowControls_AllUsers:function(A){var I=A.down("td.user-controls");I.update("").removeClassName("permission");var G="permission";var D=this.userRecordForRow(A);if(D.was_just_blocked||D.was_just_unblocked){this.updateUserRowControls_Blocked(A);return }if(D.deleted){G="deleted";var H=new Element("a",{href:"javascript:void(0)"});H.appendChild(document.createTextNode("Undo"));H.observe("click",this.onUndoUserDeleteClick.bind(this));I.appendChild(document.createTextNode("This user has been removed. "));if($("users-chicklet-blocked")){I.appendChild(new Element("br"));I.appendChild(H);I.appendChild(document.createTextNode(" or "));var E=new Element("a",{href:"javascript:void(0)"});E.appendChild(document.createTextNode("block this user from rejoining"));E.observe("click",this.onBlockUserClicked.bind(this));I.appendChild(E);I.appendChild(document.createTextNode("."))}else{I.appendChild(H);I.appendChild(document.createTextNode("."))}}else{if(D.uid==PBinfo.CheckPermissions.uid){I.update(PBwiki.UserPermissions[D.perm]+" (this is you)")}else{if(PBinfo.CheckPermissions.wikiperm=="admin"){if(D.network_perm&&D.network_perm=="admin"){I.appendChild(document.createTextNode("Network Administrator"))}else{var B=this.getPermissionDropDownBoxForUser(D);B.observe("change",this.onChangeUserPermission.bind(this));I.appendChild(B)}var C=new Element("a",{href:"javascript:void(0)","class":"user-remove",title:"Remove this user"}).update("&nbsp;");C.observe("click",this.onRemoveUserClick.bind(this));I.appendChild(C)}else{var F="";if(D.network_perm&&D.network_perm=="admin"){F="Network Administrator"}else{F=PBwiki.UserPermissions[D.perm]}I.update(F)}}}if(G){I.addClassName(G)}},updateUserRowControls_Blocked:function(E){var C=E.down("td.user-controls");C.update("").removeClassName("busy").removeClassName("done").addClassName("permission");var B=new Element("a",{href:"javascript:void(0)"});B.appendChild(document.createTextNode("Unblock"));B.observe("click",this.onUnblockUserClicked.bind(this));var D=this.userRecordForRow(E);if(D.was_just_blocked){addClassName="blocked";if(this.currentView==PBwiki.UsersPanelView.AllUsers){C.appendChild(document.createTextNode("This user has been blocked. "));C.appendChild(B);C.appendChild(document.createTextNode("."))}else{C.appendChild(B)}}else{if(D.was_just_unblocked){var A=new Element("a",{href:"javascript:void(0)"});A.appendChild(document.createTextNode("Undo"));A.observe("click",this.onBlockUserClicked.bind(this));C.appendChild(document.createTextNode("This user has been unblocked. "));C.appendChild(A)}else{C.appendChild(B)}}},updateUserRowControls_Pending:function(A){var I=A.down("td.user-controls");I.update("").removeClassName("busy").removeClassName("done").addClassName("permission");var E=this.userRecordForRow(A);if(E.perm&&E.perm!=="deny"){var D=this.getPermissionDropDownBoxForUser(E);D.observe("change",this.onChangeUserPermission.bind(this));I.appendChild(D);A.down("td.user-time").update("")}else{if(E.denied){I.update("This user has been denied.");A.down("td.user-time").update("")}else{var H=new Element("div",{"class":"secondarypagetoolbar"});var F=new Element("a",{"class":"button pbapprove",href:"javascript:void(0)"});var G=new Element("span",{"class":"iconbutton accepticon",style:"padding-left:24px"});G.appendChild(document.createTextNode("Approve"));F.appendChild(G);H.appendChild(F);F.observe("click",this.onApproveButtonClicked.bind(this));var C=new Element("span",{style:"line-height:28px"});var B=new Element("a",{"class":"pending_deny",href:"javascript:void(0)"});B.appendChild(document.createTextNode("deny"));B.observe("click",this.onDenyPendingUserClicked.bind(this));C.appendChild(document.createTextNode("or "));C.appendChild(B);H.appendChild(C);I.appendChild(H)}}},userDeleteWasUndone:function(C){var B=this.uidToIndex(C.uid);var A=$("user-row-"+C.uid);this.users[B].perm=A.getAttribute("ui:original_perm");A.removeAttribute("ui:original_perm");this.userPermissionWasChanged(C)},userForLetter:function(B){var A;for(A in this.uidToLetterMap){if(this.uidToLetterMap[A]==B){return A}}return false},userListChanged:function(A){$("userlist-loading").hide();$("userlist-sidebar").show();$("userlist-header").show();$("userlist").show();$("user-list-footer").show();this.getUsersMemo=null;this.getUsers();this.refreshLetterMap();this.showPage(0)},userListDidLoad:function(E){var B=$("user-list-sortby");B.style.visibility="visible";var C=0;for(C=0;C<B.options.length;C++){var D="sorted-by-"+B.options[C].value;if(B.value==B.options[C].value){$("user-roster").addClassName(D)}else{$("user-roster").removeClassName(D)}}PBwiki.UsersPanel.users=E.uids;if($("users-chicklet-blocked")){this.updateBlockedUserCount(E.blocked_count)}else{if($("users-chicklet-pending")){if(this.mayShowPendingUsersBubble&&E.pending_count>0){var A=new PBwiki.Components.PendingUsersBubble({pending_count:E.pending_count})}this.updatePendingUserCount(E.pending_count)}}document.fire("users::user-list-changed")},pendingUserPermissionWasChanged:function(C){var A=$("user-row-"+C.uid);var B=this.uidToIndex(C.uid);this.users[B].perm=C.perm;delete this.users[B].request_time;delete this.users[B].request_time_ago;this.getUsersMemo=null;A.down("td.user-time").update("Approved");this.userPermissionWasChanged(C,PBwiki.DoneIconTimeouts.PendingUserApproved);PBwiki.UsersPanel.setNavigationChickletsEnabled(true)},userPermissionWasChanged:function(E,D){var A;for(A=0;A<this.users.length;A++){if(this.users[A].uid==E.uid){this.users[A].perm=E.perm;break}}var C=$("user-row-"+E.uid);if(!C){return }if(!this.users[A].network_perm||this.users[A].network_perm!="admin"){var B=C.down("select.user-permission");this.setSelectBoxValue(B,E.perm)}C.down("select.user-permission").disabled=false;this.userWasModifiedSuccessfully(E.uid)},setNavigationChickletsEnabled:function(A){$$("#user-chicklet-nav a").each(function(B){if(A&&B.getAttribute("ui:href")){B.setAttribute("href",B.getAttribute("ui:href"));B.removeAttribute("ui:href")}else{if(!A&&B.getAttribute("href")){B.setAttribute("ui:href",B.href);B.setAttribute("href","javascript:void(0)")}}})},setSelectBoxValue:function(C,B){for(var A=0;A<C.options.length;A++){if(C.options[A].value==B){C.selectedIndex=A;return true}}return false},userWasModifiedSuccessfully:function(B){var C=$("user-row-"+B);if(!C){return }var A=C.down("td.user-controls");A.removeClassName("busy").addClassName("done");doneIconTimeout=(typeof (doneIconTimeout)!="undefined")?doneIconTimeout:PBwiki.DoneIconTimeouts.Default;window.setTimeout(function(){A.removeClassName("done")},doneIconTimeout)},userRecordForRow:function(B){var A=B.getAttribute("ui:uid");return this.users[this.uidToIndex(A)]},userWasBlocked:function(B){var A=this.uidToIndex(B.uid);this.users[A].deleted=false;this.users[A].perm="deny";this.users[A].was_just_blocked=true;this.refreshUserRow(B.uid)},userWasRemoved:function(B){var A=this.uidToIndex(B.uid);if(A===null){return }this.users[A].deleted=true;this.refreshUserRow(B.uid)},userWasUnblocked:function(B){var A=this.uidToIndex(B.uid);this.users[A].was_just_blocked=false;this.users[A].was_just_unblocked=true;this.refreshUserRow(B.uid);this.userWasModifiedSuccessfully(B.uid);Util.tracking("f-users_panel-unblock_user")}};PBwiki.Dashboard={};PBwiki.Profile={};PBwiki.ActivityStream=Class.create({apiMethod:"GetNetworkChanges",apiOpts:{},apiCacheability:["pagetime","filetime","permtime","foldertime","commenttime","userupdatetime","milestonetime","followtime"],maxEffectLoadCount:5,iconSize:48,itemsSeen:[],subChanges:[],initialize:function(A){this.elm=A;if(this.moreActivityId){this.moreActivity=$(this.moreActivityId)}if(this.moreActivityLinkId){this.moreActivityLink=$(this.moreActivityLinkId)}if(this.noActivityId){this.noActivity=$(this.noActivityId)}if(this.moreActivityLink){this.moreActivityLink.observe("click",function(C){try{C.element.blur()}catch(B){}C.stop();this.loadMore()}.bind(this))}document.observe("ui:refreshactivity",this.refresh.bind(this));document.observe("ui:newactivity",this.loadNew.bind(this))},destroy:function(){if(this.moreActivityLink){this.moreActivityLink.stopObserving("click")}document.stopObserving("ui:refreshactivity")},refresh:function(A){if(!A&&!this.loadingTimeout){this.loadingTimeout=setTimeout(this.setLoadingMsg.bind(this),300)}delete this.lastResult;this.apiOpts=Object.clone(this.apiOpts);if(this.requiredAPIOpts){Object.extend(this.apiOpts,this.requiredAPIOpts)}this.isLoading=true;(new PBwiki.APIRequest(this.apiMethod,this.apiOpts,{cacheability:this.apiCacheability,onSuccess:function(B){if(this.loadingTimeout){clearTimeout(this.loadingTimeout);delete this.loadingTimeout}if(B.updates&&!B.changes){B.changes=B.updates}this.isLoading=false;this.lastResult=B;this.itemsSeen=B.changes.collect(function(C){return this.getChangeId(C)},this);this.lastTimes=Object.clone(PBinfo.GetTimes);this.updateDisplay(B,this.apiOpts.count-1)}.bind(this),onFailure:function(B){if(this.loadingTimeout){clearTimeout(this.loadingTimeout);delete this.loadingTimeout}this.elm.update(B);this.isLoading=false}.bind(this)}))},setLoadingMsg:function(){if(this.moreActivity){this.moreActivity.hide()}if(this.noActivity){this.noActivity.hide()}this.elm.update('<li class="loading">&nbsp;</li>')},loadMore:function(A){if(this.isLoading){return }if($("status-reply-text")){if(!confirm("Loading more activity will clear your in progress status reply, are you sure you want to continue?")){return }}this.apiOpts.count=(this.apiOpts.count||0)+(this.displayCount*2);if(!A){this.elm.appendChild(new Element("li",{"class":"loading"}))}if(this.moreActivity){this.moreActivity.hide()}this.refresh(true)},loadNew:function(){if(this.isLoading){return }if(!this.lastResult||!this.lastResult.changes||this.lastResult.changes.length==0){return this.refresh()}var A=Object.clone(this.apiOpts);if(this.apiMethod=="GetUpdates"){A.after_id=this.lastResult.changes[0].id}else{A.after_hash=this.lastResult.changes[0].hash}(new PBwiki.APIRequest(this.apiMethod,A,{cacheability:this.apiCacheability,onSuccess:function(B){if(B.updates&&!B.changes){B.changes=B.updates}if(B.changes.length>0){this.showRefreshDisplay(B.changes.length)}}.bind(this)}))},showRefreshDisplay:function(A){$$("p.dashboard-bc-refresh").each(function(C){var B=new Element("a",{href:"#"}).observe("click",function(D){D.stop();this.refresh()}.bind(this)).update("Show "+A+" new item"+(A>1?"s":""));if(C.firstChild){C.removeChild(C.firstChild)}C.appendChild(B);C.show()},this)},getChangeId:function(A){return(A.type=="userupdate"?A.id:A.hash)},getChangeParentId:function(A){return A.parent_id||A.parent_hash},contains:function(A){return this.itemsSeen.indexOf(this.getChangeId(A))>-1},updateDisplay:function(E,A){var D="";var C=0;var B=false;if(E.changes.last()){E.changes.last().className="last"}this.subChanges=[];var F=[];B=E.changes.length>(A||this.displayCount);E.changes.each(function(H){if(C==(A||this.displayCount)){throw $break}var G=this.getChangeParentId(H);if(!this.showUpdate&&!G&&H.op=="userupdate_add"&&PBwiki.feature("nested_updates")){return }if(!this.showReply&&G&&PBwiki.feature("nested_updates")){return }if(this.showReply&&G&&PBwiki.feature("nested_updates")){if(!this.subChanges[G]){this.subChanges[G]=[]}this.subChanges[G].push(H);return }C++;F.push(this.getActivityRowHTML(H,0))},this);this.elm.innerHTML=F.join("");if(this.noActivity){this.noActivity.style.display=(F.length==0)?"block":"none"}$$("p.dashboard-bc-refresh").invoke("hide");if(this.moreActivity){((B)?this.moreActivity.show():this.moreActivity.hide())}Tooltips.addLinkTooltips(this.elm);if(this.onUpdate){this.onUpdate(F)}if((C<this.minDisplayCount||C==this.lastCount)&&B&&PBwiki.feature("nested_updates")&&this.moreActivity){this.moreActivity.hide();setTimeout(this.loadMore.bind(this,true),100);return }this.lastCount=C;return B},getActivityRowHTML:function(D,C){if(!this.template){this.template=new Template(this.activityRowTemplate)}if(D.user){D.userLink=Util.getAuthorNameFromObject(D.user).escapeHTML()}if(D.title){D.escapedTitle=D.title.toString().escapeTruncate()}if(this.apiOpts.wiki_filter&&!D.wiki){D.wiki=this.apiOpts.wiki_filter}if(D.user.image&&D.user.image.indexOf("http://")===0){D.user.image="https://"+D.user.image.substring(7)}D.userImage='<img src="'+(D.user.image||"/uimg/bread.png")+'" alt="activity-thumb" width="'+this.iconSize+'" height="'+this.iconSize+'"/>';if(D.time){D.ago=Util.time_ago(PBwiki.getTimestamp()-D.time)+" ago";D.datestring=new Date(D.time*1000).toString()}if(D.op_word){D.opTitle=(D.type=="task"||D.type=="milestone")?D.op_word+" "+D.type:D.op_word}if(D.type=="userupdate"){D.typetext="Status update"}else{D.typetext=D.type.capitalize()}if(PBwiki.feature("nested_updates")){if(this.showReply&&C<1){D.replyLink='<span class="reply"><a href="#" onclick="document.fire(\'ui:activityreply\', this); return false;" '+(D.type=="userupdate"?'update_id="'+D.id+'"':'hash_id="'+D.hash+'"')+">Reply</a></span>"}var B=this.getChangeId(D);if(this.subChanges[B]){var A=[];this.subChanges[B].each(function(E){A.unshift(this.getActivityRowHTML(E,C?C+1:1))}.bind(this));D.subUpdates="<ul>"+A.join("")+"</ul>"}}if(D.type=="userupdate"&&D.data){D.status=" "+this.escapedChangeTxt(D.data);D.opTitle=""}else{if(D.op=="mv"||D.op=="mvf"){D.opTitle="renamed '"+D.title.toString().escapeTruncate()+"' to ";D.escapedTitle=D.to.escapeTruncate()}else{if(D.op=="network_userjoined"){D.escapedTitle=""}else{if(D.op=="del"||D.op=="rm"){D.opTitle="deleted"+(D.op=="rm"?" file":"")+" '"+D.title.toString().escapeTruncate()+"'";D.escapedTitle=""}else{if(D.data){D.dataSpan='<span class="data">'+this.escapedChangeTxt(D.data)+"</span><br />"}}}}}if(D.wiki_title){if(this.wikiTitleLinks){D.wikiTitle=' on <a href="'+Util.URLRelativeToContext("/",{wiki:D.wiki})+'" onclick="document.fire(\''+this.workspaceFilterEvent+"', {'wiki': this.getAttribute('workspace'), 'title': this.innerText ? this.innerText : this.textContent }); return false;\" workspace=\""+D.wiki.escapeHTML()+'">'+D.wiki_title.escapeHTML()+"</a>"}else{D.wikiTitle=" on "+D.wiki_title.escapeHTML()}}return this.template.evaluate(D)},escapedChangeTxt:function(A){var D=/(http(s)?:(\/\/)([\w]+(.[\w]+))([\w\-\.,@?^=%&:;\/~\+#]*[\w\-\@?^=%&:;\/~\+#])?)/gi;var C=A.escapeHTML();var E=[];while(url=D.exec(A)){if(!url[0]||E.indexOf(url[0].escapeHTML())!=-1){continue}var B="";if(url[0].length>60){B=url[0].substr(0,50).escapeHTML()+"&hellip;"}else{B=url[0].escapeHTML()}C=C.replace(new RegExp(url[0].escapeHTML(),"g"),"<a href='"+url[0]+"' target=\"_blank\" class='status-link'>"+B+"</a>");E.push(url[0].escapeHTML())}return C},setFilterOptions:function(C,D,B,A,E){var F={};if(C){F.workspace=C}if(A){F.updates=true}if(E){F={notifications:true}}if(this.setHistory){PBwiki.History.setItems(F)}this.showReply=false;this.showUpdate=true;if(E){this.apiMethod="GetNetworkChanges";this.apiOpts={ignore_self:true,filter_mode:"following_starred",my:true}}else{if(A){this.apiMethod="GetUpdates";if(D=="following_starred"){D="following"}this.apiOpts={filter:D||"all",format_as_getchanges:true,count:this.displayCount+1,user_id:PBwiki.getUID()};delete this.event_filter}else{this.apiMethod="GetNetworkChanges";this.apiOpts={filter_mode:D||"all",count:this.displayCount+1};if(C){this.apiOpts.wiki_filter=C}else{this.apiOpts.my=true}if(B){if(B!="userupdate_add"){this.showUpdate=false}this.apiOpts.event_filter=(PBwiki.feature("nested_updates")?"userupdate_add,":"")+B}this.event_filter=B;this.showReply=true}}this.refresh()}});PBwiki.Dashboard.ActivityStream=Class.create(PBwiki.ActivityStream,{displayCount:20,minDisplayCount:10,filterFieldId:"dashboard-activity-event-filter",moreActivityId:"dashboard-more-activity",moreActivityLinkId:"dashboard-more-activity-link",noActivityId:"dashboard-no-activity",activityRowTemplate:'<li class="clearfix #{className}">\n  <a class="activity-pic usercard_trigger" ui:uid="#{user.uid}" href="/n/users/profile?uid=#{user.uid}">\n    #{userImage}\n  </a>\n  <p class="activity-text #{type}">\n  <span class="who"><a href="/n/users/profile?uid=#{user.uid}" class="usercard_trigger" ui:uid="#{user.uid}">#{userLink}</a></span><span class="said">#{status}</span>\n  <span class="action">#{opTitle}</span>\n  <span class="what"><a class="preview" wiki="#{wiki}" time="#{time}" href="#{url}">#{escapedTitle}</a></span><br/>\n  #{dataSpan}\n  <span class="type #{type}" title="#{typetext}"></span><span class="when" title="#{datestring}"><span class="activity-ago-time" time="#{time}">#{ago}</span>#{wikiTitle}</span>#{replyLink}\n  </p>\n#{subUpdates}\n</li>',workspaceFilterEvent:"dashboard:filter-workspace",wikiTitleLinks:true,setHistory:true});PBwiki.Profile.ActivityStream=Class.create(PBwiki.ActivityStream,{displayCount:10,minDisplayCount:5,filterFieldId:"profile-activity-event-filter",moreActivityId:"profile-more-activity",moreActivityLinkId:"profile-more-activity-link",noActivityId:"profile-no-activity",activityRowTemplate:'<li>\n  <span class="who">#{userLink}</span><span class="said">#{status}</span>\n  <span class="action">#{opTitle}</span>\n  <span class="what"><a class="preview" wiki="#{wiki}" time="#{time}" href="#{url}">#{escapedTitle}</a></span><br/>\n  #{dataSpan}\n  <span class="type #{type}" title="#{typetext}"></span><span class="when" title="#{datestring}">#{ago}#{wikiTitle}</span>\n</li>',workspaceFilterEvent:"profile:workspace-activity",wikiTitleLinks:true,setHistory:false,initialize:function($super,B,A){this.requiredAPIOpts={user_id_filter:A};$super(B)}});PBwiki.init(function(){if(!PBinfo.CurrentNetwork||!PBinfo.CurrentNetwork.license||PBinfo.CheckPermissions.network_perm!=="admin"){return }if(PBinfo.CurrentNetwork.license.is_expired){var A=new PBwiki.DialogCommands.LicenseExpired({})}});PBwiki.DialogCommands.LicenseExpired=Class.create(PBwiki.DialogCommands.TemplateDialog,{dialogPath:"/shared/network/dialog/",templateName:"licenseexpired",title:"Your PBworks license has expired",initialize:function($super,A){Object.extend(A,{dimensions:{width:480}});$super(A)},setupDialog:function($super){$super();$("licenseexpired-expiry").update(PBinfo.CurrentNetwork.license.expiry_date_readable.escapeHTML());$("licenseexpired-shutdown").update(PBinfo.CurrentNetwork.license.grace_period_end_date_readable.escapeHTML());$("licenseexpired-grace-current").update(PBinfo.CurrentNetwork.license.grace_period_current.toString().escapeHTML());$("licenseexpired-grace-limit").update(PBinfo.CurrentNetwork.license.grace_period_length.toString().escapeHTML())}});