//作者:sahu@qq.com

function getprice(ids,pirce)
{
 if($("#day_"+ids).val()==0)
     {
         $("#day_"+ids).val(1);

     }
   if($("#renshu_"+ids).val()==0)
     {
         $("#renshu_"+ids).val(1);

     }


   $("#getscount_"+ids).val(pirce* $("#room_"+ids).val()* $("#day_"+ids).val());
    
}
function order(ids,what)
{
	$("body").append("<div id='myunput'></div>").show("slow");
	$("#myunput").fadeTo("fast", 0.6);
	$("select").hide();
	$("#myunput").width(document.body.offsetWidth).height(document.body.clientHeight>window.screen.height?document.body.clientHeight:window.screen.height);
	$("body").append("<div id='myshopcert'><img src='img/loading.gif'/></div>");
	$("#myshopcert").css({ left: (window.screen.width-600)/2 ,top:(window.screen.height-200)/2}); 
	$("#myshopcert").focus();
	$("#myshopcert").load("order.php?type="+what+"&id="+ids+"&ran="+Math.random());	
	
}
function orderclose()
{
	$("select").show();
	$("#myshopcert").remove();
	$("#myunput").remove();
}

function sendorder()
{
	isdate=/^\d{4}-\d{1,2}-\d{1,2}$/;
	if(!isdate.test($("#intime").val()))
	{
		alert("入住日期格式错误");	
		return;
	}
	if(!isdate.test($("#outdate").val()))
	{
		alert("离店日期格式错误");	
		return;
	}
	
	if($("#name").val()=="")
	{
		alert("姓名不能为空");	
	    return;
		
	}
	
	if($("#tel").val()=="")
	{
		alert("电话不能为空");	
	    return;
		
	}
	
	if($("#cardid").val()=="")
	{
		alert("身份证格式不能为空");	
	    return;
		
    }
	
	$.ajax({
				beforeSend:function(){
										//alert($("select").serialize());
										$("#msg").html("正在发送");},
				type: "post",
				url:"/order.php?act=save",
				data:$("input").serialize()+"&"+$("select").serialize(),
				success: function(comm){
					if(comm!="提交成功")
					{
						$("#msg").html(comm);
						alert(comm);
					}
					orderclose();
				},
				error:function(){
				$("#msg").html("链接出错");
			}
	});
	
}


