function init(){cur_asset_type=9;asset_gen_code=layout_gen_code;for(key in sectionData){if(sectionData[key].code==assetType){s_cur_section=key;sectionData.Current=sectionData[s_cur_section];bDisplayFull=sectionData[key].full;break;}}Data.Layout.LoadBlank();Data.CSS.Load(s_cur_network);if(s_cur_network=="my"){Data.CSS.Load(s_cur_network+"_v2");}Data.HTML.Load(s_cur_network);jQuery(".lc_btn_bar img[class *= 'prev_btn']").click(function(){var A=jQuery(this);var C=A.attr("id").replace("prevbtn_","");s_cur_asset_id=C;var B=$("input#assetPath_"+C).attr("value");if((cur_network=="myspace"||cur_network=="myspace2")&&s_cur_section=="fullLayouts"){goToLayoutEditor(B);}else{prevFull(C);}});jQuery(".lc_btn_bar img[class *= 'qp_btn']").click(function(){var A=jQuery(this);var B=A.attr("id").substr(A.attr("id").indexOf("_")+1,A.attr("id").length);selectLayout(B);OpenWildfire();});if(layoutType=="custom"){loadCustomLayouts();}}function selectLayout(A){s_cur_asset_id=A;asset_click(A,true);}function loadCustomLayouts(){$.ajax({url:permBaseUrl+"searchByType.jhtml?searchTerms=default_creatorID:"+creatorID+"&pageName=Layouts&viewAll=true&viewName=getCustomLayouts",type:"GET",dataType:"html",success:function(A){$("#custom_container").html(A);}});return false;}function onNetworkChange(A){var B="You are about to switch networks. Are you sure you want to continue?";if(sectionData.Current.promptOnChange()){B="You are about to switch to a network that doesn't support this asset type. Are you sure you want to continue?";bLoadWhatsHot=true;}VerifyNetworkChange(B,'NetChangeYes("'+A+'")',"NetChangeNo()");ui_close_func=NetChangeNo;}function NetChangeYes(B){ui_close_func=null;UI_Window_Close();nsp_changeToNetwork(B);sectionData["pageHeader"].xmlkey="nv_"+s_cur_network;Data.CSS.Load(s_cur_network);Data.HTML.Load(s_cur_network);Data.Layout.EmptyCache("pageHeader_");var A="<%=request.getContextPath()%>/layout/network/"+communityCodes[s_cur_network]+"/menubuilder.jhtml?reload=yes";getXml(A,menuCB);}function NetChangeNo(){var A;if((A=reverseLookup(networkCodes,s_cur_network))){nsp_changeTo("key_"+A);}ui_close_func=null;UI_Window_Close();}function overviewCB(){if(xmlReq.readyState==4&&xmlReq.status==200){g("asset_content").innerHTML=xmlReq.responseText;g("div_content").style.background="#FFEA0B url(http://ak.webfetti.com/lc_splash/whats_hot_bkgd.jpg) no-repeat top left";}}function menuCB(){if(xmlReq.readyState==4&&xmlReq.status==200){eval(xmlReq.responseText);resetPage();hideCopyCodeBar();if(checkCatExists(sectionData.Current.cat,s_cur_category)){mManager.GetMenuById(s_cur_category).SetExpanded();loadCategoryData(sectionData.Current.code,s_cur_category);}else{loadWhatsHot();bLoadWhatsHot=false;}}}function openSection(A,B){if(!B){B=true;}mManager.GetMenuById(sectionData[A].code+"_"+A).ExpandCollapse(B);}function LayoutSectionHandler(A,D){isMotherCat=false;s_cur_category="";var B;if(A.indexOf("_")!=-1){var C=A.split("_");B=C[1];isMotherCat=true;}else{B=A;}resetPage();hideCopyCodeBar();s_cur_section=B;sectionData.Current=sectionData[s_cur_section];dThumbW=sectionData.Current.w;dThumbH=sectionData.Current.h;bDisplayFull=sectionData.Current.full;loadCategoryPage(sectionData.Current);}function loadSumBar(){var A="<%=sLayoutCustUrl%>?sn="+s_cur_network+"&pn=summaryBar";getXml(A,loadSumBarCB);}function loadSumBarCB(){if(xmlReq.readyState==4&&xmlReq.status==200){g("summary_bar").innerHTML=xmlReq.responseText;}}function loadCustPage(D,A,C){var B="<%=sLayoutCustUrl%>?sn="+s_cur_network+"&pn="+D+"&cm="+C;getXml(B,A);}function loadCustPageCB(){if(xmlReq.readyState==4&&xmlReq.status==200){if(bAssetData){g("layout_customizer").innerHTML=xmlReq.responseText;resizeLayoutCustomizer();}else{g("asset_content").innerHTML=xmlReq.responseText;if(s_cur_section=="overview"){Data.Run(loadOverPrev,Data.DefaultRequires(),loadingPreviewIframe);g("lc_css").value=Data.CurrentCSS();}}layoutFormLoaded();layoutFormFill();}}function loadCategoryPage(D){var C=layoutCatData[D.cat];if(typeof (C)=="undefined"){return ;}if(C.length==1){loadCategoryData(D.code,C[0].assetId);bAssetData=false;return ;}var B="<table cellpadding='2' cellspacing='0' border='0' width='290' align='center'><tr><td colspan='3'><br><br><br><br><br><br></td></tr>";for(var A=0;A<C.length;A++){if(A%2==0){B+="<tr>";}if(A%2==1){B+="<td width='50'>&nbsp;</td>";}B+="<td width='120'><div id=\""+C[A].assetId+'" class="cat_button" onmouseover="btnRoll(this,\'v2_button_cat_roll.gif\');" onmouseout="btnRoll(this,\'v2_button_cat_def.gif\');" onclick="loadCategoryData('+D.code+',this.id);">'+C[A].name+"</div></td>";if(A%2==1){B+="</tr>";}else{if((A%2==0)&&(A==C.length-1)){B+="<td width='120'>&nbsp;</td></tr>";}}}B+="</table>";hideCopyCodeBar();g("asset_content").innerHTML=B;g("div_content").style.background="#CCEAFF url("+sImgPath+"/cat_over_bg.gif) no-repeat top left";bAssetData=false;}function loadCategoryData(B,G){var E,D;if(isNaN(B)&&B.indexOf("_")!=-1){var F=B.split("_");E=F[1];D=F[0];isMotherCat=true;}else{E=B;for(key in sectionData){if(sectionData[key].code==B){E=key;break;}}D=B;}s_cur_section=E;sectionData.Current=sectionData[s_cur_section];dThumbW=sectionData.Current.w;dThumbH=sectionData.Current.h;bDisplayFull=sectionData.Current.full;s_cur_category=G;var C=baseUrl+"/layout/category/"+D+"/"+communityCodes[s_cur_network]+"/"+G+"/getAssets.jhtml";getXml(C,layoutCB);var A=generateClickViewString("open",G);}function checkCatExists(A,C){var D=layoutCatData[A];if(D){for(var B=0;B<D.length;B++){if(D[B].assetId==C){return true;}}}return false;}function loadOptionsPage(E){var D="<table cellpadding='2' cellspacing='0' border='0' width='290' align='center'><tr><td colspan='3'><br><br><br></td></tr>";var A="loadCustPage(this.id,loadCustPageCB,'on');";var F=A;var B=new Array();if(E=="linkOptions"){B[B.length]=["linksDefault","Default Links"];B[B.length]=["linksNavFooter","Nav & Footer"];B[B.length]=["linksSubnav","Subnav"];}else{if(E=="moduleOptions"){B[B.length]=["moduleHeaders","Module Headers"];B[B.length]=["moduleColors","Module Colors"];}}for(var C=0;C<B.length;C++){if(B[C][0]=="moduleHeaders"){F="LayoutSectionHandler('"+B[C][0]+"',false);";}if(C%2==0){D+="<tr>";}if(C%2==1){D+="<td width='50'>&nbsp;</td>";}D+="<td width='120'><div id=\""+B[C][0]+'" class="cat_button" onmouseover="btnRoll(this,\'v2_button_cat_roll.gif\');" onmouseout="btnRoll(this,\'v2_button_cat_def.gif\');" onclick="'+F+'">'+B[C][1]+"</div></td>";if(C%2==1){D+="</tr>";}else{if((C%2==0)&&(C==B.length-1)){D+="<td width='120'>&nbsp;</td></tr>";}}F=A;}D+="</table>";g("asset_content").innerHTML=D;}function resizeLayoutCustomizer(){var A=g("div_content");g("layout_customizer_back").style.width=A.clientWidth+"px";g("layout_customizer_back").style.height=A.clientHeight+"px";g("layout_customizer").style.width=A.clientWidth+"px";g("layout_customizer").style.height=A.clientHeight+"px";}function toggleCustDiv(A){if(A){g("layout_customizer_back").style.display="block";g("layout_customizer").style.display="block";resizeLayoutCustomizer();g("div_content").style.overflowY="hidden";}else{g("layout_customizer_back").style.display="none";g("layout_customizer").style.display="none";if(isExternal){g("div_content").style.overflowY="visible";}else{g("div_content").style.overflowY="auto";}}}function loadOverPrev(){var A=g("lc_prev").contentWindow.document;A.open();A.write(Data.CurrentPreview());A.close();}function loadingPreviewIframe(){var A=g("lc_prev").contentWindow.document;A.open();A.write(HTML_LOADING);A.close();}function layoutCB(){if(xmlReq.readyState==4&&xmlReq.status==200){eval(xmlReq.responseText.replace(/\n/g,""));var categoryBarHtml=null;if(categoryBarHtml){assetsToHTML(res.assets,categoryBarHtml);}else{assetsToHTML(res.assets);}g("div_content").style.background="#FFFFFF";}}function editProp(A){if(s_cur_section=="fullLayouts"){if(A==1){Data.Run(function(){loadCustPage("overview",loadCustFullCB,"off");},Data.DefaultRequires());}else{Data.Run(function(){LayoutSectionHandler("overview",false);},Data.DefaultRequires(),loadingContent);}}else{toggleCustDiv(1);layoutFormLoaded();layoutFormFill();}}function buildCategoryBar(){var B=layoutCatData[sectionData.Current.cat];if(typeof (B)=="undefined"){return false;}if(B.length==1){return{pre:"<div class='categoryBar'>"+B[0].name+"</div><div class='dotted'>&nbsp;</div>"};}var A=B.length;while(A--){if(B[A].assetId==s_cur_category){return{pre:"<div class='categoryBar'><a onclick='loadCategoryPage(sectionData.Current)'>Back to Categories</a>"+B[A].name+"</div><div class='dotted'>&nbsp;</div>",post:"<div class='dotted'>&nbsp;</div><div class='categoryBarBottom'><a onclick='loadCategoryPage(sectionData.Current)'>Back to Categories</a></div>"};}}return false;}function hideCopyCodeBar(){g("main_content").className="";g("copy_code_bar").style.display="none";}function showSummaryBar(){g("main_content").className="showSummaryBar";}function hideSummaryBar(){g("main_content").className="";}function chooseAsset(){toggleCustDiv(0);}function loadCustFullCB(){if(xmlReq.readyState==4&&xmlReq.status==200){g("layout_customizer").innerHTML=xmlReq.responseText;g("div_content").scrollTop=0;toggleCustDiv(1);loadOverPrev();var A=Data.CurrentCSS();if(A){g("lc_css").value=Data.CurrentCSS();}}}