//登陆
var g_host="http://ym.weelaa.com/";
function sessionLogin()
{
	if($("#userid").val()=="")
	{
		alert("用户名不能为空");
		return false;
	}
	if($("#pwd").val()=="")
	{
		alert("密码不能为空");
		return false;
	}

	var name=$("#userid").val();
	var pwd=$("#pwd").val();
	var content="";
	var s=Math.random();
	var src=g_host+"session.php?name="+encodeURIComponent(name)+"&pwd="+pwd+"&id="+s;
	$.getJSON(src,function(json)
	{
		if(json!="0")
		{
			content="<p>尊敬的"+json+",您好!<br />欢迎您进入云之秘境世界.</p>";
			content+='<a class="close" href="javascript:unset();"> </a><ul class="landfall"><li><a href="http://pay.weelaa.com/?m=paytype&game_id=8" target="_blank"><img src="/images/resultCenter.gif" alt="" /></a><a href="http://ymbbs.weelaa.com/" target="_blank"><img src="/images/playersForum.gif" alt="" /></a></li><li><a href="http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player.exe" target="_blank"><img src="/images/download.gif" alt="" /></a><a href="http://cs.weelaa.com/" target="_blank"><img src="/images/callCenter.gif" alt="" /></a></li></ul>';
			$("#formlogin").html(content);
		}else
		{
			alert("用户名或密码错误");
		}
	});
}

function sessions()
{
	var s=Math.random();
	$.getJSON(g_host+"session.php?see=session&id="+s,function(json)
	{
		if(json!="-1")
		{
			content="<p>尊敬的"+json+",您好!<br />欢迎您进入云之秘境世界.</p>";
			content+='<a class="close" href="javascript:unset();"> </a><ul class="landfall"><li><a href="http://pay.weelaa.com/?m=paytype&game_id=8" target="_blank"><img src="/images/resultCenter.gif" alt="" /></a><a href="http://ymbbs.weelaa.com/" target="_blank"><img src="/images/playersForum.gif" alt="" /></a></li><li><a href="http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player.exe" target="_blank"><img src="/images/download.gif" alt="" /></a><a href="http://cs.weelaa.com/" target="_blank"><img src="/images/callCenter.gif" alt="" /></a></li></ul>';
			$("#formlogin").html(content);
		}
	});
}

function unset()
{
	var s=Math.random();
	$.getJSON(g_host+"session.php?unsee=unset&id="+s,function(json)
	{
		if(json=="10")
		{
			window.location=g_host+"index.php";
		}
	});
}

//侠客榜
function getxkb()
{
	var serverid=$("#serverid").val();
	var serverbang=$("#serverbang").val();
	var link="xkb.php?serverid="+serverid+"&serverbang="+serverbang;
	var content="";
	$.getJSON(link,function(json)
	{
		for(var i=0;i<10;i++)
		{
			content+='<li><span class="listNo">'+(i+1)+'</span><span class="listName">'+json[i]['name'][0]+'</span><span class="listAmount">'+json[i]['val']['0']+'</span></li>';
		}
		$('#xkbten').html(content);
	});
}