function InitObjs(n){attMouseEvent("upObjs");$("div.obj span:last-child").each(function(){this.innerHTML.length>24&&$(this).attr("title",$(this).text())});$("#upObjs div.obj td:first-child").each(function(){var t=$(this).attr("img");t==""?$(this).css("background-image","url(images/nopict.gif)"):t&&($(this).css("background-image","url(Thumb.ashx?src="+t+")"),$("<a href='UploadPicts/"+n+"/"+t+"' rel='cb'><img src='images/slide.png' title='幻灯' /><\/a>").appendTo(this))});ColorBoxPhoto()}function getIdenEle(){return $(srcObj).parents("div")[0].lastChild}function chkEnter(){if(getKeyCode()==13){var n=getEventSrc();return n&&n.blur(),!1}return!0}function showBodyMenu(){var n=$(getEventSrc()),t,i;return n.is("a,.obj > div")?!1:n.is(".obj > span")&&(t=n.closest(".obj").addClass("temp"),i=within(n[0],getEvent()),t.removeClass("temp"),i)?(HideAllMenu(),!0):(HasPanelShowing()||(HideAllMenu(),$("#paste").css("display",$("#pasteSource").val()==""?"none":""),ShowPop("bodyMenu",!0)),CanelEvent())}function showObjItemMenu(){if(!HasPanelShowing()){srcObj=getEventSrc();var t=getIdenEle(),n=t.getAttribute("attr").split("|");$("#curObjItem").val(n[0]+"|"+n[1]);HideAllMenu();$("#objMenu a[accesskey='D']").css("display",n[3]=="1"?"":"none");$("#objMenu a[accesskey='X']").css("display",n[4]=="1"?"":"none");$("#objMenu a[accesskey='E']").css("display",n[2]=="1"?"":"none");$("#objMenu a[accesskey='N']").css("display",n[6]=="1"?"":"none");$("#objMenu a[accesskey='C']").css("display",n[5]=="1"?"":"none");$("#objMenu a[accesskey='B']").css("display",n[7]=="1"?"":"none");ShowPop("objMenu",!0)}return CanelEvent()}function openTemplet(){return location="View.aspx?tid="+getCurAttr("tid"),!1}function setContentHeight(){var n=$f("objsDiv"),r,t,u,i;n.onscroll=HideAllMenu;r=$f("PagerBar");t=document.documentElement.clientHeight;r?(u=r.offsetHeight,i=t-u,n.style.height=i+"px",n.style.height=i-(n.offsetHeight-i)+"px"):(n.style.height=t+"px",n.style.height=t*2-n.offsetHeight+"px")}function doObjItemDefault(){var n=getEvent();srcObj=n.srcElement||n.target;$(srcObj).is("td")&&openObj(n.ctrlKey)}function openObj(n){var t="detail.aspx?tid="+getCurAttr("tid")+"&rid="+getCurAttr("rid")+"&InSerial=true";return n?toPopup(t):location=t,!1}function setSource(n){var t;return t=n+"|obj|"+getCurAttr("tid")+"|"+getCurAttr("rid"),$("#pasteSource").val(t),$.get("ajax.aspx",{pasteSource:t}),!1}function renameObj(){var t=getIdenEle(),n=document.createElement("input");return n.type="text",n.id="newName",n.value=t.innerHTML,n.onfocus=function(){this.select()},n.onblur=doRenameObj,n.onkeydown=chkEnter,oriNameNode=t.cloneNode(!0),t.innerHTML="",t.appendChild(n),$f("newName").focus(),!1}function doRenameObj(){var n=getEventSrc(),t;if(!n)return!1;if(n.value==oriNameNode.innerHTML)return n.parentNode.parentNode.replaceChild(oriNameNode,n.parentNode),!1;t=$.trim(n.value);n.disabled="disabled";PageMethods.reIdenObjItem(getCurAttr("tid"),getCurAttr("rid"),t,renameObj_callback)}function renameObj_callback(n){var t=$f("newName");n==""?t.parentNode.innerHTML=t.value:(t.parentNode.parentNode.replaceChild(oriNameNode,t.parentNode),alert(n))}function toCart(){addToCart(getCurAttr("tid"),getCurAttr("rid"))}function toFav(){addToFav(getCurAttr("tid"),getCurAttr("rid"))}function getCurAttr(n){var i=getIdenEle(),t=i.getAttribute("attr").split("|");if(t.length!=8)return"";switch(n){case"tid":return t[0];case"rid":return t[1];case"edit":return t[2];case"del":return t[3];case"cut":return t[4];case"copy":return t[5];case"rename":return t[6];case"buy":return t[7];default:return""}}function showOnly(n){return __doPostBack("types",n),!1}function askCopySubRecords(n,t,i){confirm("操作成功！是否要一并复制其关联的子模板记录？")&&PageMethods.CopySubRecords(n,t,i,function(n){ShowMsgPop(n)})}var srcObj,oriNameNode;$(function(){$(self.frameElement).is("iframe[scrolling='no']")&&$("#objsDiv").css("overflow","hidden");window.onresize=setContentHeight;document.oncontextmenu=showBodyMenu;document.onselectstart=HideAllMenu;document.onmouseout=function(n){n=n||event;var t=n.clientX>=0&&n.clientX<document.documentElement.clientWidth&&n.clientY>=0&&n.clientY<document.documentElement.clientHeight;t||HideAllMenu()};$(document).click(HideAllMenu).keydown(function(){var t=getEvent(),i,n;if($(t.srcElement||t.target).is("input"))return!0;i=t.keyCode||t.which;n=null;switch(i){case 37:case 33:n=$f("btnPrevious");break;case 39:case 34:n=$f("btnNext");break;case 36:n=$f("btnFirst");break;case 35:n=$f("btnLast")}return n&&!n.disabled?(__doPostBack(n.id,""),!1):!0});$("#ov,#menu_obj").mouseover(function(){$("#upObjs .obj td a").hide()});setContentHeight();$("body").removeClass("waiting");var n=Sys.WebForms.PageRequestManager.getInstance();n.add_initializeRequest(showLoading);n.add_endRequest(function(){hideLoading();tryFitParent()})})