
$(document).ready(function(){$("#category_all").addClass("act");$("#year_all").addClass("act");$("#yearandcategory").html("作品");var ajax_url="/ajax/ajax_portfolio.php?r="+new Date();var strQs=window.location.search;var strHash=window.location.hash;if(strHash.indexOf("200")!=-1)
{var t=strHash.split("#");var category=0;var year=parseInt(t[1]);var page=1;$("#category_all").addClass("act");$("#yearandcategory").html(year+"年 全部作品");$("#year_all").removeClass("act");$("#year_"+year).addClass("act");$.ajax({type:"GET",url:ajax_url,data:"category="+category+"&year="+year+"&page="+page,success:function(msg){var temp=msg.split("||");$("#portfolios").html(temp[1]);$("#total_page").html(temp[0]);$("#current_page").html("1");var total=parseInt(temp[0]);for(var i=1;i<=10;i++){$(".p"+i).hide();$(".p"+i).html(i);$(".p"+i).attr("href",i);$(".p"+i).removeClass("p_act");}
$(".pmore").attr("href",11);if(total>10)
{for(var i=1;i<=10;i++){$(".p"+i).show();}
$(".p1").addClass("p_act");$(".pmore").show();}else{for(var i=1;i<=total;i++){$(".p"+i).show();}
$(".p1").addClass("p_act");}
$(".pageup").hide();if(parseInt(temp[0])>1)
{$(".pagedown").show();$(".pagedown").attr("href",2);}else{$(".pagedown").hide();}
$("[@limit]").limit();}});}
if(strQs)
{var t=strQs.split("?");var category=parseInt(t[1]);var year=0;var page=1;$("#category_"+category).addClass("act");$("#yearandcategory").html($("#category_"+category).html());$("#category_all").removeClass("act");$.ajax({type:"GET",url:ajax_url,data:"category="+category+"&year="+year+"&page="+page,success:function(msg){var temp=msg.split("||");$("#portfolios").html(temp[1]);$("#total_page").html(temp[0]);$("#current_page").html("1");var total=parseInt(temp[0]);for(var i=1;i<=10;i++){$(".p"+i).hide();$(".p"+i).html(i);$(".p"+i).attr("href",i);$(".p"+i).removeClass("p_act");}
$(".pmore").attr("href",11);if(total>10)
{for(var i=1;i<=10;i++){$(".p"+i).show();}
$(".p1").addClass("p_act");$(".pmore").show();}else{for(var i=1;i<=total;i++){$(".p"+i).show();}
$(".p1").addClass("p_act");}
$(".pageup").hide();if(parseInt(temp[0])>1)
{$(".pagedown").show();$(".pagedown").attr("href",2);}else{$(".pagedown").hide();}
$("[@limit]").limit();}});}
$("#category_ul").children().children().click(function(){var year=$("#year_ul").children().children(".act").attr("href");var category=$(this).attr("href");var page=parseInt($("#current_page").html());$("#category_ul").children().children().removeClass("act");$(this).addClass("act");var s=$(this).html().replace(/<[^>].*?>/g,"");if(year=='0')
{$("#yearandcategory").html("全部 "+s);}else{$("#yearandcategory").html(year+"年 "+s);}
$.ajax({type:"GET",url:ajax_url,data:"category="+category+"&year="+year+"&page="+page,success:function(msg){var temp=msg.split("||");$("#portfolios").html(temp[1]);$("#total_page").html(temp[0]);$("#current_page").html("1");var total=parseInt(temp[0]);for(var i=1;i<=10;i++){$(".p"+i).hide();$(".p"+i).html(i);$(".p"+i).attr("href",i);$(".p"+i).removeClass("p_act");}
$(".pmore").attr("href",11);if(total>10)
{for(var i=1;i<=10;i++){$(".p"+i).show();}
$(".p1").addClass("p_act");$(".pmore").show();}else{for(var i=1;i<=total;i++){$(".p"+i).show();}
$(".p1").addClass("p_act");}
$(".pageup").hide();if(parseInt(temp[0])>1)
{$(".pagedown").show();$(".pagedown").attr("href",2);}else{$(".pagedown").hide();}
$("[@limit]").limit();}});return false;});$("#year_ul").children().children().click(function(){var year=$(this).attr("href");var category=$("#category_ul").children().children(".act").attr("href");var page=parseInt($("#current_page").html());$("#year_ul").children().children().removeClass("act");$(this).addClass("act");var s=$("#category_ul").children().children(".act").html().replace(/<[^>].*?>/g,"");if(year=='0')
{$("#yearandcategory").html("全部 "+s);}else{$("#yearandcategory").html(year+"年 "+s);}
$.ajax({type:"GET",url:ajax_url,data:"category="+category+"&year="+year+"&page="+page,success:function(msg){var temp=msg.split("||");$("#portfolios").html(temp[1]);$("#total_page").html(temp[0]);$("#current_page").html("1");var total=parseInt(temp[0]);for(var i=1;i<=10;i++){$(".p"+i).hide();$(".p"+i).html(i);$(".p"+i).attr("href",i);$(".p"+i).removeClass("p_act");}
$(".pmore").attr("href",11);if(total>10)
{for(var i=1;i<=10;i++){$(".p"+i).show();}
$(".p1").addClass("p_act");$(".pmore").show();}else{for(var i=1;i<=total;i++){$(".p"+i).show();}
$(".p1").addClass("p_act");}
$(".pageup").hide();if(parseInt(temp[0])>1)
{$(".pagedown").show();$(".pagedown").attr("href",2);}else{$(".pagedown").hide();}
$("[@limit]").limit();}});return false;});$(".pageup").hide();$(".pagedown").click(function(){for(var i=1;i<=10;i++){$(".p"+i).removeClass("p_act");}
var page=$(this).attr("href");var year=$("#year_ul").children().children(".act").attr("href");var category=$("#category_ul").children().children(".act").attr("href");$.ajax({type:"GET",url:ajax_url,data:"category="+category+"&year="+year+"&page="+page,success:function(msg){var temp=msg.split("||");$("#portfolios").html(temp[1]);var total=parseInt(temp[0]);var duan=Math.ceil(page/10);if(page==duan*10-10+1)
{var min=duan*10-10;var max=0;if(total<duan*10)
{max=total;for(var i=1;i<=(max-min);i++){$(".p"+i).show();$(".p"+i).html(i+min);$(".p"+i).attr("href",i+min);}
$(".pmore").hide();$(".p1").addClass("p_act");}else{max=duan*10;for(var i=1;i<=10;i++)
{$(".p"+i).show();$(".p"+i).html(i+min);$(".p"+i).attr("href",i+min);}
$(".p1").addClass("p_act");$(".pmore").show();$(".pmore").attr("href",duan*10+1);}}else if(page<=10){$(".p"+page).addClass("p_act");}else if(page%10==0){$(".p10").addClass("p_act");;}else{$(".p"+(page%10)).addClass("p_act");}
if((parseInt(page))<parseInt($("#total_page").html()))
{$(".pagedown").attr("href",(parseInt(page)+1));$(".pagedown").show();}else{$(".pagedown").hide();}
$("#current_page").html(page);$(".pageup").attr("href",parseInt(page)-1);$(".pageup").show();$("[@limit]").limit();}});return false;});$(".pageup").click(function(){for(var i=1;i<=10;i++){$(".p"+i).removeClass("p_act");}
var page=$(this).attr("href");var year=$("#year_ul").children().children(".act").attr("href");var category=$("#category_ul").children().children(".act").attr("href");$.ajax({type:"GET",url:ajax_url,data:"category="+category+"&year="+year+"&page="+page,success:function(msg){var temp=msg.split("||");$("#portfolios").html(temp[1]);var total=parseInt(temp[0]);var duan=Math.ceil(page/10);if(page==duan*10)
{var min=duan*10-10;var max=0;if(total<duan*10)
{max=total;for(var i=1;i<=(max-min);i++){$(".p"+i).show();$(".p"+i).html(i+min);$(".p"+i).attr("href",i+min);}
$(".pmore").hide();$(".p10").addClass("p_act");}else{max=duan*10;for(var i=1;i<=10;i++)
{$(".p"+i).show();$(".p"+i).html(i+min);$(".p"+i).attr("href",i+min);}
$(".p10").addClass("p_act");$(".pmore").show();$(".pmore").attr("href",duan*10+1);}}else if(page<=10){$(".p"+page).addClass("p_act");}else if(page%10==0){$(".p10").addClass("p_act");;}else{$(".p"+(page%10)).addClass("p_act");}
if((parseInt(page))<parseInt($("#total_page").html()))
{$(".pagedown").attr("href",(parseInt(page)+1));$(".pagedown").show();}else{$(".pagedown").hide();}
$("#current_page").html(page);if(parseInt(page)>1)
{$(".pageup").attr("href",parseInt(page)-1);$(".pageup").show();}else{$(".pageup").hide();}
$("[@limit]").limit();}});return false;});$(".p1").click(function(){var page=$(this).attr("href");var year=$("#year_ul").children().children(".act").attr("href");var category=$("#category_ul").children().children(".act").attr("href");$.ajax({type:"GET",url:ajax_url,data:"category="+category+"&year="+year+"&page="+page,success:function(msg){var temp=msg.split("||");$("#portfolios").html(temp[1]);var total=parseInt(temp[0]);for(var i=1;i<=10;i++){$(".p"+i).removeClass("p_act");}
$(".p1").addClass("p_act");if((parseInt(page))<parseInt($("#total_page").html()))
{$(".pagedown").attr("href",(parseInt(page)+1));$(".pagedown").show();}else{$(".pagedown").hide();}
$("#current_page").html(page);if($(".p1").attr("href")==1)
{$(".pageup").hide();}
$("[@limit]").limit();}});return false;});$(".p2").click(function(){for(var i=1;i<=10;i++){$(".p"+i).removeClass("p_act");}
$(".p2").addClass("p_act");var page=$(this).attr("href");var year=$("#year_ul").children().children(".act").attr("href");var category=$("#category_ul").children().children(".act").attr("href");$.ajax({type:"GET",url:ajax_url,data:"category="+category+"&year="+year+"&page="+page,success:function(msg){var temp=msg.split("||");$("#portfolios").html(temp[1]);var total=parseInt(temp[0]);if((parseInt(page))<parseInt($("#total_page").html()))
{$(".pagedown").attr("href",(parseInt(page)+1));$(".pagedown").show();}else{$(".pagedown").hide();}
$("#current_page").html(page);$(".pageup").attr("href",parseInt(page)-1);$(".pageup").show();$("[@limit]").limit();}});return false;});$(".p3").click(function(){for(var i=1;i<=10;i++){$(".p"+i).removeClass("p_act");}
$(".p3").addClass("p_act");var page=$(this).attr("href");var year=$("#year_ul").children().children(".act").attr("href");var category=$("#category_ul").children().children(".act").attr("href");$.ajax({type:"GET",url:ajax_url,data:"category="+category+"&year="+year+"&page="+page,success:function(msg){var temp=msg.split("||");$("#portfolios").html(temp[1]);var total=parseInt(temp[0]);if((parseInt(page))<parseInt($("#total_page").html()))
{$(".pagedown").attr("href",(parseInt(page)+1));$(".pagedown").show();}else{$(".pagedown").hide();}
$("#current_page").html(page);$(".pageup").attr("href",parseInt(page)-1);$(".pageup").show();$("[@limit]").limit();}});return false;});$(".p4").click(function(){for(var i=1;i<=10;i++){$(".p"+i).removeClass("p_act");}
$(".p4").addClass("p_act");var page=$(this).attr("href");var year=$("#year_ul").children().children(".act").attr("href");var category=$("#category_ul").children().children(".act").attr("href");$.ajax({type:"GET",url:ajax_url,data:"category="+category+"&year="+year+"&page="+page,success:function(msg){var temp=msg.split("||");$("#portfolios").html(temp[1]);var total=parseInt(temp[0]);if((parseInt(page))<parseInt($("#total_page").html()))
{$(".pagedown").attr("href",(parseInt(page)+1));$(".pagedown").show();}else{$(".pagedown").hide();}
$("#current_page").html(page);$(".pageup").attr("href",parseInt(page)-1);$(".pageup").show();$("[@limit]").limit();}});return false;});$(".p5").click(function(){for(var i=1;i<=10;i++){$(".p"+i).removeClass("p_act");}
$(".p5").addClass("p_act");var page=$(this).attr("href");var year=$("#year_ul").children().children(".act").attr("href");var category=$("#category_ul").children().children(".act").attr("href");$.ajax({type:"GET",url:ajax_url,data:"category="+category+"&year="+year+"&page="+page,success:function(msg){var temp=msg.split("||");$("#portfolios").html(temp[1]);var total=parseInt(temp[0]);if((parseInt(page))<parseInt($("#total_page").html()))
{$(".pagedown").attr("href",(parseInt(page)+1));$(".pagedown").show();}else{$(".pagedown").hide();}
$("#current_page").html(page);$(".pageup").attr("href",parseInt(page)-1);$(".pageup").show();$("[@limit]").limit();}});return false;});$(".p6").click(function(){for(var i=1;i<=10;i++){$(".p"+i).removeClass("p_act");}
$(".p6").addClass("p_act");var page=$(this).attr("href");var year=$("#year_ul").children().children(".act").attr("href");var category=$("#category_ul").children().children(".act").attr("href");$.ajax({type:"GET",url:ajax_url,data:"category="+category+"&year="+year+"&page="+page,success:function(msg){var temp=msg.split("||");$("#portfolios").html(temp[1]);var total=parseInt(temp[0]);if((parseInt(page))<parseInt($("#total_page").html()))
{$(".pagedown").attr("href",(parseInt(page)+1));$(".pagedown").show();}else{$(".pagedown").hide();}
$("#current_page").html(page);$(".pageup").attr("href",parseInt(page)-1);$(".pageup").show();$("[@limit]").limit();}});return false;});$(".p7").click(function(){for(var i=1;i<=10;i++){$(".p"+i).removeClass("p_act");}
$(".p7").addClass("p_act");var page=$(this).attr("href");var year=$("#year_ul").children().children(".act").attr("href");var category=$("#category_ul").children().children(".act").attr("href");$.ajax({type:"GET",url:ajax_url,data:"category="+category+"&year="+year+"&page="+page,success:function(msg){var temp=msg.split("||");$("#portfolios").html(temp[1]);var total=parseInt(temp[0]);if((parseInt(page))<parseInt($("#total_page").html()))
{$(".pagedown").attr("href",(parseInt(page)+1));$(".pagedown").show();}else{$(".pagedown").hide();}
$("#current_page").html(page);$(".pageup").attr("href",parseInt(page)-1);$(".pageup").show();$("[@limit]").limit();}});return false;});$(".p8").click(function(){for(var i=1;i<=10;i++){$(".p"+i).removeClass("p_act");}
$(".p8").addClass("p_act");var page=$(this).attr("href");var year=$("#year_ul").children().children(".act").attr("href");var category=$("#category_ul").children().children(".act").attr("href");$.ajax({type:"GET",url:ajax_url,data:"category="+category+"&year="+year+"&page="+page,success:function(msg){var temp=msg.split("||");$("#portfolios").html(temp[1]);var total=parseInt(temp[0]);if((parseInt(page))<parseInt($("#total_page").html()))
{$(".pagedown").attr("href",(parseInt(page)+1));$(".pagedown").show();}else{$(".pagedown").hide();}
$("#current_page").html(page);$(".pageup").attr("href",parseInt(page)-1);$(".pageup").show();$("[@limit]").limit();}});return false;});$(".p9").click(function(){for(var i=1;i<=10;i++){$(".p"+i).removeClass("p_act");}
$(".p9").addClass("p_act");var page=$(this).attr("href");var year=$("#year_ul").children().children(".act").attr("href");var category=$("#category_ul").children().children(".act").attr("href");$.ajax({type:"GET",url:ajax_url,data:"category="+category+"&year="+year+"&page="+page,success:function(msg){var temp=msg.split("||");$("#portfolios").html(temp[1]);var total=parseInt(temp[0]);if((parseInt(page))<parseInt($("#total_page").html()))
{$(".pagedown").attr("href",(parseInt(page)+1));$(".pagedown").show();}else{$(".pagedown").hide();}
$("#current_page").html(page);$(".pageup").attr("href",parseInt(page)-1);$(".pageup").show();$("[@limit]").limit();}});return false;});$(".p10").click(function(){for(var i=1;i<=10;i++){$(".p"+i).removeClass("p_act");}
$(".p10").addClass("p_act");var page=$(this).attr("href");var year=$("#year_ul").children().children(".act").attr("href");var category=$("#category_ul").children().children(".act").attr("href");$.ajax({type:"GET",url:ajax_url,data:"category="+category+"&year="+year+"&page="+page,success:function(msg){var temp=msg.split("||");$("#portfolios").html(temp[1]);var total=parseInt(temp[0]);if((parseInt(page))<parseInt($("#total_page").html()))
{$(".pagedown").attr("href",(parseInt(page)+1));$(".pagedown").show();}else{$(".pagedown").hide();}
$("#current_page").html(page);$(".pageup").attr("href",parseInt(page)-1);$(".pageup").show();$("[@limit]").limit();}});return false;});$(".pmore").click(function(){for(var i=1;i<=10;i++){$(".p"+i).hide();$(".p"+i).removeClass("p_act");}
var page=$(this).attr("href");var year=$("#year_ul").children().children(".act").attr("href");var category=$("#category_ul").children().children(".act").attr("href");$.ajax({type:"GET",url:ajax_url,data:"category="+category+"&year="+year+"&page="+page,success:function(msg){var temp=msg.split("||");$("#portfolios").html(temp[1]);var total=parseInt(temp[0]);var duan=Math.ceil(page/10);var min=duan*10-10;var max=0;if(total<duan*10)
{max=total;for(var i=1;i<=(max-min);i++){$(".p"+i).show();$(".p"+i).html(i+min);$(".p"+i).attr("href",i+min);}
$(".pmore").hide();$(".p1").addClass("p_act");}else{max=duan*10;for(var i=1;i<=10;i++)
{$(".p"+i).show();$(".p"+i).html(i+min);$(".p"+i).attr("href",i+min);}
$(".p1").addClass("p_act");$(".pmore").show();$(".pmore").attr("href",duan*10+1);}
if((parseInt(page))<parseInt($("#total_page").html()))
{$(".pagedown").attr("href",(parseInt(page)+1));$(".pagedown").show();}else{$(".pagedown").hide();}
$("#current_page").html(page);$(".pageup").attr("href",parseInt(page)-1);$(".pageup").show();$("[@limit]").limit();}});return false;});});
