//一个弹出的浮动层
function sAlert(str,serial){ 
   var msgw,msgh,bordercolor; 
   msgw=400;//提示窗口的宽度 
   msgh=100;//提示窗口的高度 
   titleheight=25 //提示窗口标题高度 
   bordercolor="#336699";//提示窗口的边框颜色 
   titlecolor="#99CCFF";//提示窗口的标题颜色 
  
   var sWidth,sHeight; 
   sWidth=document.body.offsetWidth; 
   sHeight=screen.height; 
   var bgObj=document.createElement("div"); 
   bgObj.setAttribute('id','bgDiv'); 
   bgObj.style.position="absolute"; 
   bgObj.style.top="0"; 
   bgObj.style.background="#777"; 
   bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75"; 
   bgObj.style.opacity="0.6"; 
   bgObj.style.left="0"; 
   bgObj.style.width=sWidth + "px"; 
   bgObj.style.height=sHeight + "px"; 
   bgObj.style.zIndex = "10000"; 
   document.body.appendChild(bgObj); 
    
   var msgObj=document.createElement("div") 
   msgObj.setAttribute("id","msgDiv"); 
   msgObj.setAttribute("align","center"); 
   msgObj.style.background="white"; 
   msgObj.style.border="1px solid " + bordercolor; 
   msgObj.style.position = "absolute"; 
   msgObj.style.left = "50%"; 
   msgObj.style.top = "50%"; 
   msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif"; 
   msgObj.style.marginLeft = "-225px" ; 
   msgObj.style.marginTop = -75+document.documentElement.scrollTop+"px"; 
   msgObj.style.width = msgw + "px"; 
   msgObj.style.height =msgh + "px"; 
   msgObj.style.textAlign = "center"; 
   msgObj.style.lineHeight ="25px"; 
   msgObj.style.zIndex = "10001"; 
    
   var title=document.createElement("h4"); 
   title.setAttribute("id","msgTitle"); 
   title.setAttribute("align","right"); 
   title.style.margin="0"; 
   title.style.padding="3px"; 
   title.style.background=bordercolor; 
   title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);"; 
   title.style.opacity="0.75"; 
   title.style.border="1px solid " + bordercolor; 
   title.style.height="18px"; 
   title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif"; 
   title.style.color="white"; 
   title.style.cursor="pointer"; 
   title.innerHTML="关闭"; 
   title.onclick=function(){ 
          document.body.removeChild(bgObj); 
          document.getElementById("msgDiv").removeChild(title); 
          document.body.removeChild(msgObj); 
        } 
   document.body.appendChild(msgObj); 
   document.getElementById("msgDiv").appendChild(title); 
   var txt=document.createElement("z"); 
   txt.style.margin="1em 0" 
   txt.setAttribute("id","msgTxt");
   if(serial!=undefined)
   txt.innerHTML=str+serial+'<br>'; 
   else
	 txt.innerHTML=str+'<br>';
   document.getElementById("msgDiv").appendChild(txt);
   
   if(serial!=null)
   {
	   var ssstr = 'serial+num='+serial;
	   var link_net = '\''+'link_server.php?'+ssstr+'\'';
	   var my_ok = document.createElement("div");
	   my_ok.setAttribute("id","my_ok");
	   my_ok.setAttribute("align","center");
	   my_ok.innerHTML='<input type="button" onclick="window.location.href='+link_net+'" value="确定并进入游戏">';
	   document.getElementById("msgDiv").appendChild(my_ok);
   }

} 



function check()
{
	//alert('ok');
	var username =document.getElementById("username").value;
	if( username == '')
	{
		alert("账号不能为空！");
		return false;
	}
	var password =document.getElementById("password").value;
	if(password == '')
	{
	   alert("密码不能为空！");
		return false;
	}
	
	var myAjax = new Ajax.Request(
			
		 'login.php',      //  url
		 {
				method:'post',
			    parameters:"username=" + username +"&password=" + password +"&page=" + 'index.php',
				 asynchronous:true,
				 onSuccess:function(transport)
				{
				     var result = transport.responseText;
					 var str = result.split("abef");
					if(result.search(/登录成功/i)!=-1)
					{
						window.location.href="index.php";
					//	alert(str[1]);
					//	document.getElementById('login_info').innerHTML = '<span>欢迎<a href="#" target="_blank" style="color:#ff384a; font-weight:bold; text-decoration:underline">'+str[2]+'</a>进入德州扑克！</span><span><a href="#" target="_blank" style="color:#ff384a; text-decoration:underline">个人资料设置</a></span>'; 
				    }
					else
					{
						alert(str[0]);
						
					}
			  }
		 });
	
}
function getSerial(username)
{
	var exp = username;
	if (exp && typeof(exp)!="undefined" && exp!=null)
	{
		//alert(username);
		var myAjax = new Ajax.Request(
				'get_serial.php',
				{
					method:'post',
					//parameters:""
					asynchronous:true,
					onSuccess:function(transport)
					{
						result = transport.responseText;
						if(result.search(/您的邀请码:/i)!=-1)
						{
							var serial_str = result.split("aabbcc");
							sAlert(serial_str[0],serial_str[1]);
							
						}
						else
						{
							sAlert(result);
						}
					}
				}
				);
	}　
	else
		alert("你还没有登陆,请先登陆!");
}
function checkVIPSerial(userId)
{
	var exp = userId;
	if (exp && typeof(exp)!="undefined" && exp!=null)
	{
		serial = document.getElementById('VIP_card').value;
		num = serial.length;
		if(num!=10&&num!=6)
		{
			alert('输入错误!');
		}
		else
		{
			//alert('dddd');
			var myAjax = new Ajax.Request(
					'checkvipserial.php',
					{
						method:'post',
						parameters:"VIPcard=" + serial + "&userid=" + exp,
						asynchronous:true,
						onSuccess:function(transport)
						{
							result = transport.responseText;
							//alert(result);
							switch(result)
							{
							case '1':
								alert('您经使用过贵宾卡了,不能重复使用!');
								break;
							case '2':
								alert('卡号错误或该卡已经被使用过了,没有这个卡号,请核对后重输!');
								break;
							case '3':
								alert('使用成功,请到游戏里查看!');
								break;
									default:
									alert(result);
							}
						}
					}
					);
		}
	}　
	else
		alert("你还没有登陆,请先登陆!");
}
function clearContent()
{
	document.getElementById('username').value = '';
}
function register(promotion)
{
	window.location.href = "http://www.pomp.cn/register.php?origin=dezhoupuke&promotion=" + promotion;
}
function enterGame()
{
	window.location.href = "link_server.php";
}
/*
*author-shi-20100524
*推广链接
*/
function getRecommendLink(account)
{
	if (account && typeof(account)!="undefined" && account!=null)
	{
		//alert(account);
			var myAjax = new Ajax.Request(
					'getRecommendLink.php',
					{
						method:'post',
						parameters:"account=" + account,
						asynchronous:true,
						onSuccess:function(transport)
						{
							result = transport.responseText;

							if(result.search(/游戏账号错误/i)!=-1)
							{
								alert(result);
							}
							else
							{
								document.getElementById('recommendLink').value=result;
								//alert(result);
							}
							
						}
					}
					);
	}
	else
	{
		alert('请输入您的账号名！');
	}
}
