function init(){initLayout();initMenus();initTabs();initSwitchBar()};function initLayout(){resizeLayout();$(window).resize(function(){resizeLayout()})};function initMenus(){var topestMenuList=$("#topestMenu > li");var length=topestMenuList.length;topestMenuList.bind("click",function(){$("#topestMenu > li").removeClass("selected");$(this).addClass("selected");var index=$(this).index();hideAllTopestMenuContent(length);showTopestMenuContent(index);resizeSubMenu()});hideAllTopestMenuContent(length);showTopestMenuContent(0);initSubMenu();resizeSubMenu()};function initTabs(){$('#tabs1 ul.tabs').bind("dblclick",function(e){var tabTitle=$(e.target).text();e.stopPropagation();$('#tabs1').tabs('close',tabTitle)});$(".tabs-header .tabs-wrap .tabs ").bind('contextmenu',function(){event.preventDefault();$("#contextMenu").menu('show',{left:event.pageX,top:event.pageY})})};function initSwitchBar(){$("#switchBar").bind("click",function(){toggleSwitchBar()});$("#topestMenuName").bind("click",function(){toggleSwitchBar()})};function toggleSwitchBar(){var sideBarObj=$("#sideBar");var switchBarObj=$("#switchBar");var visiblity=sideBarObj.css("display");if(visiblity!="none"){sideBarObj.css("display","none");switchBarObj.css("display","block")}else{sideBarObj.css("display","");switchBarObj.css("display","none")};resizeLayout()};function resizeLayout(){$("#main").width(0);var windowHeight=$(this).outerHeight();var windowWidth=$(this).outerWidth();var headerHeight=$("#header").outerHeight();var sideBarWidth=$("#sideBar").outerWidth();var switchBarWidth=$("#switchBar").outerWidth();var footerHeight=$("#footer").outerHeight();var sideBarHeight=0;var mainHeight=0;var mainWidth=0;var sideBarDisplayProperty=$("#sideBar").css("display");if(sideBarDisplayProperty.toLowerCase()=="none"){sideBarWidth=0}else{switchBarWidth=0;$("#switchBar").css("display","none")};sideBarHeight=windowHeight-headerHeight-footerHeight-2;mainHeight=sideBarHeight;mainWidth=windowWidth-sideBarWidth-switchBarWidth-1;$("#sideBar").height(sideBarHeight);$("#switchBar").height(sideBarHeight);$("#main").height(mainHeight);$("#main").width(mainWidth);resizeSubMenu();$('#tabs1').tabs('resize')};function hideAllTopestMenuContent(length){for(var i=0;i<length;i++){$("#topestMenuContent"+i).css("display","none")}};function showTopestMenuContent(index){$("#topestMenuContent"+index).css("display","block");var topestMenuList=$("#topestMenu > li");var topestMenuItem=topestMenuList.get(index);$(topestMenuItem).addClass("selected");var topestMenuItemTitle=$(topestMenuItem).find("input").eq(0).val();$("#topestMenuName_text").html(topestMenuItemTitle)};function initSubMenu(){$("#menus .submenu .head").bind("click",function(event){var moduleID=$(event.target).parent().parent().attr("id");$("#menus #"+moduleID+" .selected").removeClass("selected");$(this).parent().addClass("selected");resizeSubMenu()})};function resizeSubMenu(){var currentTopestMenuContentID=null;var height_total=0;var height_used=0;var height_remain=0;var headHeight=0;$(".topestMenu-content:visible").each(function(){currentTopestMenuContentID=$(this).attr("id");});height_total=$("#sideBar").outerHeight();$("#menus #"+currentTopestMenuContentID+" .submenu .head").each(function(){headHeight=$(this).outerHeight(true);height_used+=headHeight});height_used+=$("#topestMenuName").outerHeight();height_remain=height_total-height_used-1;$("#menus #"+currentTopestMenuContentID+" .selected .body").height(height_remain)};function addTab(pageTitle,pageURL){var exists=$("#tabs1").tabs('exists',pageTitle);if(exists){$("#tabs1").tabs('select',pageTitle);return};$('#tabs1').tabs('add',{title:pageTitle,style:'padding:10px;overflow-x:hidden;border:0px;',content:'<iframe src="'+pageURL+'" style="width:100%;height:100%;border:0px;margin:0px;padding:0px;"  ></iframe>',closable:true,})};function logout(){if(confirm('确定要退出吗？')){window.location.href='logout.aspx'}}