var AlbumList={fixFxBugIndexNum:0,getAlbumCt:function(E){var D=albums[E],B=[];var H=D.coverId,A=D.albumOper,J=D.albumName,F=D.albumPicNum;var K=Url.picUrl.format(H),I=Url.albumList.format(forumNameUrl,encode(J)).escapeJS();var C=new Image();C.src="{0}".format(K);B.push("<li><div class='figure' style='visibility: hidden' onmouseover='AlbumList.albumMouseOver(this)' onmouseout='AlbumList.albumMouseOut(this)'><table border='0' cellspacing='0' cellpadding='0' class='p' align='center' valign='bottom'><tr><td class='co tpl'></td><td class='le tc'></td><td class='co tr'></td></tr><tr><td class='ve lc'></td><td><a href='{2}'><img onload='Common.initPicCallBack(this,AlbumList.picCallBack);' id='album{0}_id' src='{1}' /></a></td><td class='ve rc'></td></tr><tr><td class='co bl'></td><td class='le bc'></td><td class='co br'></td></tr></table>".format(E+1,K,I));B.push("<div class='aname'><a href='"+I+"' >"+J.escapeHTML()+"</a>&nbsp;<span>("+F+")</span></div><p class='aedit'>");if(A.match(/[12]/)){B.push("<a href='#' onclick='AlbumList.popupHtml(\"edit\",\"{0}\");return false;'>编辑</a>".format(E))}if(A.match(/2/)){B.push("&nbsp;|&nbsp;<a href='#' onclick='AlbumList.popupHtml(\"delete\",\"{0}\");return false;'>删除</a>".format(E))}B.push("</p></div></li>");return B.join("")},createAlbums:function(){var D=albums?albums.length:0,E=[];if(D>0){var C=G("albumList"),B,A;for(var B=0;B<D;B++){E.push(AlbumList.getAlbumCt(B))}C.innerHTML=E.join("")}},hideSelTip:function(){G("allAlbums_tip").innerHTML=""},picCallBack:function(A){A.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.style.visibility="visible"},albumMouseOver:function(B){var A=B.getElementsByTagName("p")[0];if(A){A.style.visibility="visible"}},albumMouseOut:function(B){var A=B.getElementsByTagName("p")[0];if(A){A.style.visibility="hidden"}},popupHtml:function(type,i){if(type.match(/^edit$/)){var aname=albums[i].albumName;var url=Url.albumG.format(forumName_u,encode(aname));new Ajax.Request(url,{method:"get",onComplete:function(xmlHttp){var JData="("+xmlHttp.responseText+")";var rst=eval(JData).album;var aDes=rst.albumDes.escapeHTML();var str="<div class='popupCt'><table border='0' cellspacing='3' cellpadding='0'><tr><td width='80'>相册名称：</td><td><input id='album_name_edit' type='text' value='"+aname.escapeJS()+"' size='35' require='isNull:true|byteLength:30' errors='byteLength:"+Results["3153925"]+"'><font color='#666666'>(必填)</font></td></tr><tr><td></td><td id='album_name_edit_tip' ></td></tr><tr><td valign='top'>相册简介：</td><td><textarea id='album_des_edit' cols='40' rows='3' require='byteLength:200' errors='byteLength:"+Results["3153929"]+"'>"+aDes+"</textarea></td></tr><tr><td></td><td id='album_des_edit_tip'></td></tr><tr><td>&nbsp;</td><td><input type='button' onclick='AlbumList.albumEdit(\""+i+"\");' value='保存修改'>&nbsp;&nbsp;<span id='album_edit_success'></span></td></tr></table></div>";p=new Popup({width:420,height:170});p.html(str,"编辑相册")}})}else{if(type.match(/^delete$/)){var str="<div class='popupCt' style='line-height:25px'>您确定要删除该相册吗？<br>如果确定要删除，请您选择该相册中的图片如何处理：<br><label for='album_delete_radio1'><input name='album_delete_radio' id='album_delete_radio1' type='radio' onfocus='this.blur()' checked>将图片移动到</label>&nbsp;<select id='allAlbums' onchange='AlbumList.hideSelTip();'><option value=''>请选择...</option></select>&nbsp;<span id='allAlbums_tip'></span><br><label for='album_delete_radio2'><input type='radio' name='album_delete_radio' id='album_delete_radio2' onfocus='this.blur()' onclick='AlbumList.hideSelTip();'>将图片一起彻底删除。</label><br><div style='margin-left:20px'><input type='button' onclick='AlbumList.albumDelete(\""+i+"\");' value=' 确定 '>&nbsp;<input type='button' onclick='p.close();' value=' 取消 '>&nbsp;&nbsp;<span id='album_delete_tip'><span></div></div>";p=new Popup({width:450,height:180});p.html(str,"删除相册");Common.initAllAlbum("allAlbums",albums[i].albumName,"remove")}else{if(type.match(/^album_create$/)){var _w=460,_h=180;var str="<div class='popupCt'><table width='100%' border='0' cellspacing='3' cellpadding='0'><tr><td width='80'>相册名称：</td><td><input id='album_create_name' type='text' size='40' require='isNull:true|byteLength:30' errors='byteLength:{0}'><font color='#666666'>(必填)</font></td></tr><tr><td></td><td id='album_create_name_tip'></td></tr><tr><td valign='top'>相册简介：</td><td><textarea id='album_create_des' cols='47' rows='3' require='byteLength:200' errors='byteLength:{1}'></textarea></td></tr><tr><td></td><td id='album_create_des_tip'></td></tr><tr><td>&nbsp;</td><td><input type='button' onclick='AlbumList.albumCreate();' value=' 创建 '>&nbsp;&nbsp;<span id='album_create_success'></span></td></tr></table></div>".format(Results["3153925"],Results["3153929"]);if(totalAlbumNum>=Names.albumNumUpper){str="<div class='popupCt' style='color:red;margin-left:25px'>本吧相册数已达到上限，无法创建新相册！<br><br><input type='button' value=' 确定 ' onclick='p.close();'/></div>";_h=100}p=new Popup({width:_w,height:_h});p.html(str,"创建新相册")}else{if(type.match(/^album_set$/)){var str="<div class='popupCt'><table width='100%' cellspacing='3' cellpadding='0'><tr><td colspan='2' style='line-height:28px'><label for='album_set_radio1'><input name='album_set_radio' id='album_set_radio1' type='radio' onfocus='this.blur()' onclick='AlbumList.hideSelTip();' checked>首页随机显示相册</label></td></tr><tr><td width='120'><label for='album_set_radio2'><input name='album_set_radio' id='album_set_radio2' type='radio' onfocus='this.blur()'>首页显示指定相册</label></td><td><select id='allAlbums' style='visibility:visible' onchange='AlbumList.hideSelTip();'><option selected>请选择...</option></select></td></tr><tr><td>&nbsp;</td><td><span id='allAlbums_tip'></span></td></tr><tr><td colspan='2'><input type='button' onclick='AlbumList.albumSet();' value=' 确认 '>&nbsp;&nbsp;<span id='album_set_success'></span></td></tr></table></div>";p=new Popup({width:420,height:150});p.html(str,"设置首页显示相册");Common.initAllAlbum("allAlbums",null,"album_set")}}}}},albumEdit:function(E){var A=albums[E].albumName;var C=new Form().checkSubmit(null,[["album_name_edit","album_name_edit_tip"],["album_des_edit","album_des_edit_tip"]]);if(C==0){var D=Url.albumEdit.format(52,forumName_u,encode(G("album_name_edit").value.Alltrim()),encode(G("album_des_edit").value.Alltrim()),encode(A),crypt);var B=Url.albumS.format(forumNameUrl);if(A!=G("album_name_edit").value.Alltrim()){Common.setRefresh(p,true)}Common.validate(B,"album_edit","post",D)}},albumDelete:function(E){var A=albums[E].albumName;var C=Url.albumS.format(forumNameUrl);var D=Url.albumDel.format(53,forumName_u,"",encode(A),crypt);var B=document.getElementsByName("album_delete_radio");if(B[0].checked){if(G("allAlbums").selectedIndex==0&&G("allAlbums").value==""){Common.tip("allAlbums_tip",Results["4"],0);return }else{if(G("allAlbums").value==A){Common.tip("allAlbums_tip",Results["9"],0);return }}D=Url.albumDel.format(53,forumName_u,encode(G("allAlbums").value),encode(A),crypt)}Common.validate(C,B[0].checked?"album_delete1":"album_delete2","post",D)},albumCreate:function(){var B=new Form().checkSubmit(null,[["album_create_name","album_create_name_tip"],["album_create_des","album_create_des_tip"]]);if(B==0){var C=Url.albumCreate.format(51,forumName_u,encode(G("album_create_name").value.Alltrim()),encode(G("album_create_des").value.Alltrim()),crypt);var A=Url.albumS.format(forumNameUrl);Common.validate(A,"album_create","post",C)}},albumSet:function(){var A=Url.albumS.format(forumNameUrl);var B=Url.albumSet.format(57,forumName_u,encode(G("allAlbums").value),crypt);var C=document.getElementsByName("album_set_radio");if(C[0].checked){B=Url.albumSet.format(57,forumName_u,"",crypt);Common.validate(A,"album_set","post",B)}else{if(G("allAlbums").selectedIndex==0&&G("allAlbums").value==""){Common.tip("allAlbums_tip","请选择一个相册",0)}else{Common.validate(A,"album_set","post",B)}}},loadF:function(){if(G("forumName")){forumName=G("forumName").value}if(G("crypt")){crypt=G("crypt").value}forumName_u=encode(forumName);AlbumList.createAlbums();zy_UI.register("AlbumList");this.changeLayout()},changeLayout:function(){if(!isNoneTemplate){if(document.documentElement.offsetWidth<1260){if(Browser.IE){document.styleSheets[1].rules[1].style.width="24.5%"}else{document.styleSheets[1].cssRules[1].style.width="24.5%"}}else{if(Browser.IE){document.styleSheets[1].rules[1].style.width="19.5%"}else{document.styleSheets[1].cssRules[1].style.width="19.5%"}}}}};window.onresize=function(){AlbumList.changeLayout()};AlbumList.loadF();