var XWiki=function(c){Object.extend(c,{userprofile:{init:function(a){this.crtCategory="";if(this.tabsContainer=(a||$("body")).down("#user-vertical-menu"))this.tabsContainer.select(".category-tab").each(function(b){b.observe("click",function(d){Event.stop(d);this.switchTab(b.id,!0)}.bindAsEventListener(this))}.bind(this)),this.tabsContainer.select(".category-tab.current").each(function(b){this.updateCategoryFields(b.id);document.fire("xwiki:profile:switchedCategory",{category:b.id});document.fire("xwiki:dom:refresh")}.bind(this)),
this.handleCancelAction(),window.addEventListener("popstate",function(b){b.state&&b.state.category&&this.switchTab("vertical-menu-"+b.state.category)}.bindAsEventListener(this)),history.replaceState({category:window.location.search.toQueryParams().category||"profile"},document.title,document.location.href)},switchTab:function(a,b){var d=a.substring(14);$("user-page-content").select("div.user-page-pane").each(function(e){e.addClassName("hidden")});$(d+"Pane").removeClassName("hidden");$("user-vertical-menu").select("span.category-tab").each(function(e){e.removeClassName("current")});
$(a).addClassName("current");this.updateCategoryFields(a);b&&this.updateURL(d);document.fire("xwiki:profile:switchedCategory",{category:a});document.fire("xwiki:dom:refresh")},updateCategoryFields:function(a){this.crtCategory=a=a.substring(14);this.updateField("xredirect",c.currentDocument.getURL("view","category\x3d"+a));this.updateField("xcontinue",c.currentDocument.getURL("edit","editor\x3dinline\x26category\x3d"+a));this.updateField("category",a)},updateURL:function(a){if(history.pushState){var b=
window.location.search.toQueryParams();b.category=a;b=Object.toQueryString(b);window.history.pushState({category:a},"",window.location.protocol+"//"+window.location.host+window.location.pathname+"?"+b)}},updateField:function(a,b){(a=$$("input[name\x3d"+a+"]"))&&a.length&&(a[0].value=b)},handleCancelAction:function(){var a=$$("form .buttons input[type\x3dsubmit][name\x3daction_cancel]");a&&a.length&&(a=a[0],Event.stopObserving(a,"click"),a.observe("click",function(b){b.stop();window.location=c.currentDocument.getURL("view",
"category\x3d"+this.crtCategory)}.bindAsEventListener(this)))}}});var f=function(a){(a&&a.memo.elements||[$("body")]).each(function(b){c.userprofile.init(b)});return!0};c.domIsLoaded&&f()||document.observe("xwiki:dom:loaded",f);document.observe("xwiki:dom:updated",f);return c}(XWiki||{});