﻿var city = {
	GetCityPictureList:function(){
		var url = "Ajax.aspx";
		var params = "m=3&top=" + top_ + "&page=" + arguments[0];
		var ajax = new Ajax.Request(url,{method:"post",parameters:params,onComplete:city.Re_GetCityPictureList});
		city.ShowPage(total_,"city.GetCityPictureList",arguments[0],top_,10,"pages");
	},
	Re_GetCityPictureList:function(){
		var str = arguments[0].responseText;
		$("pic_div").innerHTML = str;
	},
	ShowPage:function(total,method,page,pernum,shownum,showobj){
        if(isNaN(total) || total < 1){
		    $(showobj).style.display="none";
		    return;
	    }
	    if(total <= pernum){
		    $(showobj).style.display="none";
		    return;
	    }
	    var pagenum = Math.ceil(total/pernum);
	    var pageup = parseInt(page) - 1;
	    var pagenext = parseInt(page) + 1;
	    var up = "<a class=\"btn_leftmove\" href=\"javascript:eval('"+ method + "(" + pageup + ")');\"></a>";
	    var next = "<a class=\"btn_rightmove\" href=\"javascript:eval('"+ method + "(" + pagenext + ")');\"></a>";
	    var tmp = "";
		if(page < pagenum)
		    tmp = next;
	    else
		    tmp = "";
	    if(page > 1)
		    tmp += up;
	    else
		    tmp += "<a href=\"#\" class=\"btn_gray\"></a>";
	    $(showobj).style.display = "";
	    $(showobj).innerHTML = tmp;
    }
}