var WikiPreferences={onPageLoad:function(){window.onbeforeunload=function(){if($("prefs").getFormElements().some(function(e){return e.getValue()!=e.getDefaultValue()}))return"prefs.areyousure".localize()}.bind(this)},savePrefs:function(){var e={prefSkin:"SkinName",prefTimeZone:"TimeZone",prefTimeFormat:"DateFormat",prefOrientation:"Orientation",editor:"editor",prefLanguage:"Language",prefSectionEditing:"SectionEditing"};for(var t in e)$(t)&&Wiki.prefs.set(e[t],$(t).getValue())}};window.addEvent("load",WikiPreferences.onPageLoad.bind(WikiPreferences));var WikiGroup={MembersID:"membersfield",GroupID:"groupfield",NewGroupID:"newgroup",GroupInfoID:"groupinfo",CancelBtnID:"cancelButton",SaveBtnID:"saveButton",CreateBtnID:"createButton",DeleteBtnID:"deleteButton",groups:{"(new)":{members:"",groupInfo:""}},cursor:null,isEditOn:!1,isCreateOn:!1,putGroup:function(e,t,n,r){this.groups[e]={members:t,groupInfo:n};var i=$("grouptemplate");gg=i.clone().removeProperty("id").setHTML(e).inject(i.getParent()).show(),(r||!this.cursor)&&this.onMouseOverGroup(gg)},onMouseOverGroup:function(e){if(this.isEditOn)return;this.setCursor(e);var t=this.groups[e.id==this.GroupID?"(new)":e.innerHTML];$(this.MembersID).value=t.members,$(this.GroupInfoID).innerHTML=t.groupInfo},setCursor:function(e){this.cursor&&$(this.cursor).removeClass("cursor"),this.cursor=$(e).addClass("cursor")},onClickNew:function(){if(this.isEditOn)return;this.isCreateOn=!0,$(this.MembersID).value="",this.toggle()},toggle:function(){this.isEditOn=!this.isEditOn,$(this.MembersID).disabled=$(this.SaveBtnID).disabled=$(this.CreateBtnID).disabled=$(this.CancelBtnID).disabled=!this.isEditOn;var e=$(this.DeleteBtnID);e&&(e.disabled=this.isCreateOn||!this.isEditOn),this.isCreateOn&&($(this.CreateBtnID).toggle(),$(this.SaveBtnID).toggle());var t=$(this.NewGroupID),n=$(this.MembersID);this.isEditOn?(n.getParent().addClass("cursor"),t.disabled=!this.isCreateOn,this.isCreateOn?t.focus():n.focus()):(n.getParent().removeClass("cursor"),this.isCreateOn&&(this.isCreateOn=!1,t.value=t.defaultValue,n.value=""),t.blur(),n.blur(),t.disabled=!1)},onSubmitNew:function(e,t){var n=$(this.NewGroupID);n.value==n.defaultValue?(alert("group.validName".localize()),n.focus()):this.onSubmit(e,t)},onSubmit:function(e,t){if(!this.cursor)return!1;var n=this.cursor.id==this.GroupID?$(this.NewGroupID).value:this.cursor.innerHTML;e.setAttribute("action",t),e.group.value=n,e.members.value=$(this.MembersID).value,e.action.value="save",Wiki.submitOnce(e),e.submit()}}