
var g_currentPage=1;var g_pageCount=0;var g_oldPageIndex;var g_pageSize=4;function fnGetWorkAlbums(){fn$("#dvWorkals").html("<table width='100%' height='400px' align='center'><tr><td valign='middle' align='center'> <img src='./siteImages/loading.gif'/><font color='red'>正在加载专辑信息...</font></td></tr></table>");g_pageSize=4;fn$.ajax({type:"POST",data:"action=6&pageIndex="+g_currentPage+"&pageSize="+g_pageSize,url:"services/infoList.php",success:function(msg){var xmlDoc=fn$(msg);var alsNode=xmlDoc.find("root als");if(alsNode==null||alsNode.size()==0){g_pageCount=0;g_currentPage=0;fn$("#dvWorkals").html("<table width='100%' height='400px' align='center'><tr><td valign='middle' align='center'><font color='red'>当前不存在作品专辑信息!</font></td></tr></table>");}else{var strHtml="";alsNode.find("al").each(function()
{strHtml+=' <dl class="works"><dd class="workimg">'; var alNode = fn$(this); var strAlUrl="works.php?alid="+alNode.find("id").text();var strIntro= alNode.find("desc").text();if(strIntro.length>90){strIntro=strIntro.substring(0,90)+"...";}
var strName=alNode.find("name").text();strHtml+='<a href="'+strAlUrl+'" title="查看详细信息"><img src="'+alNode.find("pic").text()+'"  onload="fnResizeImg(0,this,167,168);"  alt="'+strName+'"/></a></dd>';strHtml+='<dt><span>专辑名称：</span><a href="'+strAlUrl+'" title="'+strName+'">'+strName+'</a></dt>';strHtml+='<dd><span>作品类型：</span>'+alNode.find("type").text()+'</dd>';strHtml+='<dd><span>作品  数：</span>'+alNode.find("tnum").text()+'</dd>';strHtml+='<dd><span>发行时间：</span>'+alNode.find("rdate").text()+'</dd> <dd><span>发行机构：</span>'+ alNode.find("corp").text()+'</dd>';strHtml+='<dd><span>专辑简介：</span>'+strIntro+'&nbsp;&nbsp;【<a href="'+strAlUrl+'">详细介绍</a>】</dd></dl>';});fn$("#dvWorkals").html(strHtml);var iPgIndex=parseInt(xmlDoc.find("root pgindex").text());if(g_currentPage==1||g_currentPage!=iPgIndex){g_currentPage=iPgIndex;g_pageCount=Math.ceil(parseInt(xmlDoc.find("root rcount").text())/g_pageSize);}}
fnUpdateNavigation();},error:function(){fn$("#pgCtrl1").hide();fn$("#dvWorkals").html("<table width='100%' height='400px' align='center'><tr><td valign='middle' align='center'><font color='red'>获得作品专辑信息失败!</font></td></tr></table>");alert("获得作品专辑信息失败，请稍候重试");g_currentPage=g_oldPageIndex;fnUpdateNavigation();}});}
function fnUpdateNavigation(){if(g_pageCount>1){fn$("#pgCtrl1").show();}else{fn$("#pgCtrl1").hide();return;}
if(g_currentPage<=1){fn$("#lfst").addClass("unclick").removeClass("prev");fn$("#lprev").addClass("unclick").removeClass("prev");}else{fn$("#lfst").addClass("prev").removeClass("unclick");fn$("#lprev").addClass("prev").removeClass("unclick");}
if(g_currentPage>=g_pageCount){fn$("#llast").addClass("unclick").removeClass("prev");fn$("#lnext").addClass("unclick").removeClass("prev");}else{fn$("#llast").addClass("prev").removeClass("unclick");fn$("#lnext").addClass("prev").removeClass("unclick");}
if(g_pageCount!=0){fn$("#btnGo").attr("disabled",false);}else{fn$("#btnGo").attr("disabled",true);}
fn$("#sppgindex").html(g_currentPage);fn$("#sppgcount").html(g_pageCount);}
function fnInit(){fn$("#btnGo").click(function(){fnGotoPage("Custom");});fn$("#lnext").click(function(){fnGotoPage("Next");});fn$("#lprev").click(function(){fnGotoPage("Previous");});fn$("#lfst").click(function(){fnGotoPage("First");});fn$("#llast").click(function(){fnGotoPage("Last");});g_currentPage=1;fnGetWorkAlbums();}
function fnGotoPage(strPage){g_oldPageIndex=g_currentPage;switch(strPage){case"Custom":var strPageIndex=fn$("#txtPage").val();if(strPageIndex==""){alert("请输入页码！");return;}
if(!fnChkData(4,strPageIndex)){alert("页码只能为大于0的整数！");return;}
strPageIndex=parseInt(strPageIndex);if(strPageIndex<1||strPageIndex>g_pageCount){alert("当前页码只能为1至"+g_pageCount+"的整数！");return;}
if(strPageIndex==g_currentPage)return;g_currentPage=strPageIndex;break;case"Next":g_currentPage++;break;case"Previous":g_currentPage--;break;case"First":g_currentPage=1;break;case"Last":g_currentPage=g_pageCount;break;}
fnGetWorkAlbums();}
