function getNameFromObj(n){return $(n.nextSibling).text().replace(new RegExp(String.fromCharCode(160),"g")," ")}function chkEnter(){var n=getEvent(),t=n.srcElement||n.target,i=n.keyCode||n.which;return i==13?(t.blur(),!1):!0}function showObjMenu(n){var t,i;return n=n||event,t=n.srcElement||n.target,HasPanelShowing()||(srcObj=t,$("#curRoleName").val(getNameFromObj(t)),HideAllMenu(),i=$(srcObj).parent().is(".role_locked"),$("#menu_obj a[accesskey='R']").nextAll().css("display",i?"none":""),$("#anony").prev().addBack().css("display",i?"":"none"),ShowPop("menu_obj",!0)),n.cancelBubble=!0,!1}function showBodyMenu(n){var t,i,r;return(n=n||event,t=$(n.srcElement||n.target),t.is("a,.menu,.obj > div"))?!1:t.is(".obj > span")&&(i=t.closest(".obj").addClass("temp"),r=within(t[0],getEvent()),i.removeClass("temp"),r)?(HideAllMenu(),!0):(HasPanelShowing()||(HideAllMenu(),ShowPop("menu_body",!0)),n.cancelBubble=!0,!1)}function listUsers(){location="users.aspx?role="+$.url.encode(getNameFromObj(srcObj))}function doDefault(n){n=n||event;srcObj=n.srcElement||n.target;$f("curRoleName").value=getNameFromObj(srcObj);__doPostBack("showAttributes","")}function del(){if(!confirm("确定要删除该角色吗？"))return!1;var n=getNameFromObj(srcObj);return PageMethods.delRole(n,delRole_callback),!1}function delRole_callback(n){if(n==""){var t=srcObj.parentNode;t.parentNode.removeChild(t)}else alert(n)}function createRole(){var t=document.createElement("div"),r,i,n;return t.className="obj rolebg",r=document.createElement("div"),t.appendChild(r),i=document.createElement("span"),t.appendChild(i),n=document.createElement("input"),n.type="text",n.id="newName",n.value="新建角色",n.onfocus=function(){this.select()},n.onblur=doCreateRole,n.onkeydown=chkEnter,i.appendChild(n),$f("objsDiv").appendChild(t),$f("newName").focus(),!1}function doCreateRole(){var t=getEvent(),n,i;if(t==null)return!1;if(n=t.srcElement||t.target,i=$.trim(n.value),i=="")return n.focus(),!1;n.disabled="disabled";PageMethods.addRole(i,createRole_callback)}function createRole_callback(n){var t=$f("newName"),i,u,r;n==""?(i=t.parentNode.previousSibling,$.browser.isMobile?$(i).click(showObjMenu):(i.oncontextmenu=showObjMenu,$(i).click(doDefault).hover(function(){$(this).addClass("ObjMouseOver")},function(){$(this).removeClass("ObjMouseOver")})),u=document.createTextNode(t.value),t.parentNode.replaceChild(u,t)):(r=t.parentNode.parentNode,r.parentNode.removeChild(r),alert(n))}function setReadLevel(){var t=$("#attr_cbRead"),n=t.is(":checked");$("#attr_infoReadLevel").css("display",n?"":"none");$("#attr_cbComment,label[for='attr_cbComment']").css("display",n?"":"none");$("#attr_cbAdmin,label[for='attr_cbAdmin']").css("display",n?"":"none")}function setBatchSend(){var n=getEventSrc();$(n).parent().find("span:first").css("display",$(n).is(":checked")?"":"none")}function renameRole(){var t=srcObj.nextSibling.firstChild,n=document.createElement("input");return n.type="text",n.id="newName",n.value=t.nodeValue,n.onfocus=function(){this.select()},n.onblur=function(){var n=getEventSrc(),i,r;if(!n)return!1;if(n.value==oriNameNode.nodeValue)return n.parentNode.replaceChild(oriNameNode,n),!1;if(i=n.value.trim(),i=="")return n.focus(),!1;n.disabled="disabled";r=$(t).text();PageMethods.RenameRole(r,i,renameRole_callback)},n.onkeydown=chkEnter,oriNameNode=t.cloneNode(!0),t.parentNode.replaceChild(n,t),$f("newName").focus(),!1}function renameRole_callback(n){var t=$f("newName"),i;n==""?(i=document.createTextNode(t.value),t.parentNode.replaceChild(i,t)):(t.parentNode.replaceChild(oriNameNode,t),alert(n))}function ShowFilter(n,t){var i="advSearch.aspx?mode=temp"+(t?"&SessionName="+t:"")+"&tid="+n+"&readonly=true&timeStamp="+(new Date).getTime();return window.showModelessDialog?(window.showModelessDialog(i,window,"dialogHeight:400px;dialogWidth:560px;center:yes;status:no;help:0;scroll:0"),!1):toOpen(i,560,410)}var srcObj;$(function(){$(document).click(HideAllMenu).scroll(HideAllMenu);$.browser.isMobile?$(document.documentElement).click(function(){$(getEventSrc()).is("form,body")&&showBodyMenu()}):document.oncontextmenu=showBodyMenu;document.onselectstart=HideAllMenu;document.onmouseout=function(n){inWin(n||event)||HideAllMenu()};$.browser.isMobile&&$("body").addClass("disselect");var n=Sys.WebForms.PageRequestManager.getInstance();n.add_initializeRequest(showLoading);n.add_endRequest(hideLoading)})