﻿function getServerList(var_gameid){
	$.getJSON("http://passport.365ub.com/include/GetServerList.ashx?gameid="+var_gameid+"&jsoncallback=?",null, function(data){		
	if(data=='0'){
		for(var i=1;i<4;i++){
		    $("#LIST" + j).append("<p class=\"fwq_2\">新服筹备中.敬请期待!</p>");
		}
		return;
	}
	var ul =""
	for(var j=1;j<4;j++){
		$.each(data, function(i,item){
			if(item.BanKuai==j){				
				ul=ul+createList(item);
			}
		});
		ul = ($.trim(ul).length > 0) ? $.trim(ul) : "<p class=\"fwq_2\">新服筹备中.敬请期待!</p>";	
		$("#LIST"+j).append(ul);
		ul ="";
		}
	});
}


function getTuijian(var_gameid){
 $.getJSON("http://passport.365ub.com/include/GetServerList.ashx?gameid=" + var_gameid + "&jsoncallback=?", null, function(data) {
        if (data == '0') {
            $("#tuijian").prepend("<p>无推荐服务器</p>");
            return;
        }
        var ul = ""
        $.each(data, function(i, item) {
            if (item.Isrecommended=="True") {
                ul = ul + '<p class="fwq_1">['+ item.BanKuaiName +']<a href=\"http://passport.365ub.com/checkLogin.ashx?gameid='+ item.GameId +'&serverId='+ item.ServerId +'\" title="武林之王官方网站-服务器名字" target="_blank">'+ item.ServerName +'</a></p>';
            }
        });
	if(ul==""){
	ul="<p>无推荐服务器</p>";
	}
        $("#tuijian").prepend(ul);
    });
}


function createList(item) {
    return '<p class="fwq_2">['+ item.BanKuaiName +']<a href=\"http://passport.365ub.com/checkLogin.ashx?gameid='+ item.GameId +'&serverId='+ item.ServerId +'\" title="武林之王官方网站-服务器名字" target="_blank">'+ item.ServerName +'</a></p>';	
}


function getIndexServerList(var_gameid, serverTotal) {
    $.getJSON("http://passport.365ub.com/include/GetServerList.ashx?gameid=" + var_gameid + "&jsoncallback=?", null, function(data) {
        if (data == '0') {
            $("#SERVERLIST").prepend("<li><a>筹备中 ……</a></li>");
            return;
        }
        var ul = ""
        $.each(data, function(i, item) {
            if (i < serverTotal) {
                ul = ul + '<tr><td width="45" height="30" align="left" valign="middle"><span style="color:#800305">['+item.BanKuaiName+']</span></td><td width="70" height="30" align="left" valign="middle"><a href="http://passport.365ub.com/checkLogin.ashx?gameid='+item.GameId+'&serverId='+item.ServerId+'" title="我是掌门-'+item.ServerName+'">'+item.ServerName +'</a></td><td width="45" height="30" align="right" valign="middle">'+item.StatusName+'</td></tr>';
            }
        });
	
        $("#SERVERLIST").prepend(ul);
    });
}

function  getlastserlist()
{
		userId = GetCookie("Upal_COOKIES", "UpalUserId");
		

}












