function gatewayinfo(status){
	$.getJSON("gatewayinfo.php",
	{
	birthyear: $('#year').val() ,
	birthmonth: $('#month').val() ,
	birthday: $('#day').val() ,
	status:status
	},
	function(data) {
		 
	}); 	
}
gatewayinfo("arrive gateway");

function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}
 

//检查年龄
function checkAge(){
var year = document.getElementById("year").value;
var month = document.getElementById("month").value;
var day = document.getElementById("day").value;

if(year=="" || month=="" || day=="" || year=="年" || month=="月" || day=="日"){
	gatewayinfo("not complete");
alert("请输入您的生日！");
return false;
}

var patt =/^[\d]{4}$/;
var re = new RegExp(patt); 
if(! re.test(year)){
	gatewayinfo("wrong year format");
  alert("年份格式不对,如:1993");
  return false;
}

var obj = new Date();
var syear = obj.getFullYear();
var age = syear - year;
if(age < 18){
	gatewayinfo("too yong");
alert("抱歉, 您还未到合法饮酒年龄, 无法进入本站! 谢谢关注!");
//window.opener = null;
//window.open('', '_self');
//window.close();
return false;
}
//gatewayinfo("successfully");


return true;
/*var date = new Date();
date.setTime(date.getTime() + (1 * 12 * 30 * 86400 * 1000));
$.cookie("gateway", "pass", { path: '/', expires: date }); 

var relocation=gup("back");
if(relocation==""){
	relocation="index.php";
}
window.location=relocation;
 
return false;*/
}
