var PageSize = 25;
var CurrentPage = 1;
var status = 1;

$(document).ready(function() {
	BindAgentMember('Page=1' + (aid != '' ? ('&aid=' + aid) : ''));
	
	$('#btnsearchmember').click(function(){
		BindAgentMember('Page=1' + (aid != '' ? ('&mid=' + aid) : ''));
	});
});

//绑定数据
function BindAgentMember(urldata){
	$('#template').hide();//将第一行模板隐藏
    $.ajax({
        type:"get",
        dataType:"json",
        url:'MyMember.aspx?NoCopyRight=1&type=ajax&Action=GetAgentMember&PageSize=' + PageSize + '&code=' + $.trim($('#agentno').val()),
        data:urldata,
        cache:false,
        success:function(msg){
            $('tr:gt(1)','#datas').remove();
            var data = msg.Member;
            $.each(data,function(i,n){
               var row = $('#template').clone();
               row.show();
               row.find('#membername').html(n.membername);
			   row.find('#adddate').html(n.adddate);
			   row.find('#operate').html(n.code);
			   row.appendTo("#datas");
            });
           
            //分页
            $('.sub_container_page').show();
            var pagerStyle = "flickr";//jPagerBar样式
            ShowPageBar("pageDataList1_Pager",//[containerId]
               "MyMember.aspx",//[url]
               {style:pagerStyle,mark:"pageDataList1Mark",
               totalCount:msg.totalCount,showPageNumber:3,pageCount:PageSize,currentPageIndex:CurrentPage,noRecordTip:" 没有记录",preWord:"上一页",nextWord:"下一页",
               onclick:"CurrentPage={pageindex};BindAgentMember('Page={pageindex}');return false;"}
            );
        },//end success
        error:function(XMLHttpRequest,textStatus){alert(textStatus);}
    });//end ajax
};//end funciton
