window.onload=function(){
	loadFnc();
	with(document){
	getElementById("btn_back").onclick=function(){c_pay()}
	if (getElementById("jump1")!=null){
		getElementById("jump1").onclick=function(){gotoPage(this.href,"jump1","pNum1")}
		getElementById("jump2").onclick=function(){gotoPage(this.href,"jump2","pNum2")}
	}
	getElementById("pay_price").onmouseup=function(){checkNum(this.value)}
	getElementById("pay_price").onkeyup=function(){checkNum(this.value)}	
	getElementById("btn_pay").onclick=function(){return chk_pay()}	
	}
}

function chk_pay(){//付款前检查数据
	with(document){
		var s=getElementById("pay_name").value.trim();
		if (s.length==0){
			alert("对不起,请填入付款人姓名!");
			return rtFocus("pay_name");
		}
		
		var s=getElementById("pay_phone").value.trim();
		if (s.length==0){
			alert("对不起,请填入付款人联系方式!");
			return rtFocus("pay_phone");
		}		
		
		var s=getElementById("pay_price").value.trim();
		if (s.length==0){
			alert("对不起,请填入付款金额!");
			return rtFocus("pay_price");
		}		
	}
	return true;
}

function gotoPage(u,i,p){
	var n=document.getElementById(p).value;
	document.getElementById(i).href=u+"?page="+n;
}

function book_del(u){
	redirect("GET",u,null,return_post);
	return false;		
}

function return_post(){
  if (http_request.readyState == 4){
    if(http_request.status == 200){
    	var r=http_request.responseText;
    	if (r.length>0){
				if (r.indexOf("恭喜")>-1){
					window.location.reload();
				}else{    		
	  			alert(r);
	  		}
			}else{
				alert("对不起，未返回消息，请重试！");
			}
		}else{
			alert("错误：\n\n" + http_request.statusText);
		}
	}		
}


function v_pay(b,d){	//显示付款面板b=预订编号,d=dd头部位置
	b_id="s"+b;
	with(document){
		var t=getElementById(d).offsetTop;
		getElementById("to_pay").style.top=t-120;
		getElementById("to_pay").style.display="block";
		
		getElementById("booking_id").value=b;
		getElementById("route_name").value=a_book[b_id]['route_name'];
		getElementById("pay_price").value=a_book[b_id]['pay_price']-a_book[b_id]['pay_over'];
		getElementById("route_id").value=a_book[b_id]['route_id'];
		getElementById("pay_name").value=a_book[b_id]['pay_name'];
		getElementById("pay_phone").value=a_book[b_id]['pay_phone'];
	}
	return false;
}

function c_pay(){
	document.getElementById("to_pay").style.display="none";
}