﻿
/* Page Navigation */
function GetNav(nid, scriptFunc, query, totalCount, start, count)
{
   
    obj = $(nid);   
    var strpost = "{\"scriptFun\":\""+scriptFunc+"\",\"query\":\""+query+"\", \"totalCount\":\""+totalCount+"\", \"start\":\""+start+"\", \"count\":\""+count+"\"}";
    var ajaxNav = new Ajax(null, null,"/WebService/JSON/JWPageNav.asmx/GetPageNav",2,strpost,function(rexm){GetNavSuccessCallBack(obj, rexm)});
    ajaxNav.post();
}
function GetNavSuccessCallBack(obj, rexm){
    var data = eval("(" + rexm + ")");
    //alert(data);
   
    obj.innerHTML = data;   
    //alert(data);
}

function GetList(obj, nid, cityId, totalCount, count, start)
{
    objs = $(obj);   
    
    var strpost = "{'cityId':'"+cityId+"','start':'"+start+"', 'count':'"+count+"'}";
    var ajaxList = new Ajax($('Div1'),"<img src='/Images/loading.gif' /> ","/WebService/JSON/JWProfile.asmx/FindByCity",2,strpost,function(rexm){GetListSuccessCallBack(objs, rexm)});
    ajaxList.post();
    GetNav(nid, "GetList", "'"+obj+"', '"+nid+"', '"+cityId+"', '"+totalCount+"', '"+count+"'", totalCount, start, count);
}

function GetListSuccessCallBack(obj, rexm){
    var data = eval("(" + rexm + ")");
    var str = "";
    str += "<ul class=clearfix>";
    for(var i=0;i<data.length;i++){
        str += "<li>";
        str += "<a href='"+ data[i].UserLink +"' target=_blank><img src='"+ data[i].Logo +"' /></a>";
        str += "<br /><a href='"+ data[i].UserLink +"' target=_blank>"+ data[i].NickName +"</a>";
        str += "</li>";
    }
    str += "</ul>";
    //alert(str);
    obj.innerHTML = str;
}

