function createAjax(){
var xml;
if(window.XMLHttpRequest){xml = new XMLHttpRequest();}
else if(window.ActiveXObject){xml = new ActiveXObject("Microsoft.XMLHTTP");}
return xml;
}

var PNRIsNo;
 PNRIsNo = false;


function GetPNR(PNR,TEL){
	
	if(PNR == ''){
		alert("PNR不能为空！");
		return false;
	}
	

    ajax_Isno(PNR,TEL);

	//alert(PNRIsNo);

	return PNRIsNo;
	

}


function ajax_Isno(PNR,TEL){
	
	var http = createAjax();
	var url;
	
		url = '/include/getpnrv.asp?str=' + PNR + '&GGI=' + Math.round();
		http.open("GET", url, false);
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		http.onreadystatechange = function(){			
			if(http.readyState == 4){	
				if (http.status == 200){
					
					//alert(http.responseText);
					
					PNRText = http.responseText;
					
						if(PNRText == '0'){
							PNRIsNo = true;
						}else if(PNRText == '1'){
							alert("您预订的位置已过期,暂时不能进行支付。请致电：" + TEL); 
							PNRIsNo = false;
						}else if(PNRText == '2'){
							alert("您预订的位置暂时不能进行支付。请致电：" + TEL); 
							PNRIsNo = false;
						}else if(PNRText == '3'){
							alert("您预订的位置暂时不能进行支付。请致电：" + TEL); 
							PNRIsNo = false;
						}
						
				} 
			}		

		}


	http.send(null);
	
	//alert('正在验证您的机票信息');
	
	}





function $getid(id){return document.getElementById(id);}

function FunctionTab(){}

FunctionTab.prototype = {
	init: function(Menu, Panl, Css1, Css2){
		if(Panl.length != Menu.length){
			alert('list is number error');
			return false;
		}
		for(var i = 0;i<Menu.length; i++)
		{
			$getid(Menu[i]).value = i;
			$getid(Menu[i]).onclick = function()
			{
				for(var j = 0 ; j < Menu.length ; j++)
				{
					$getid(Menu[j]).className = Css2;
					$getid(Panl[j]).style.display = "none";
					if($getid('paysub0'+(j+1)))
					 $getid('paysub0'+(j+1)).style.display = "none";
				}
					$getid(Menu[this.value]).className = Css1;
					$getid(Panl[this.value]).style.display = "block";
					if($getid('paysub0'+Menu[this.value].replace('li','')))
					$getid('paysub0'+Menu[this.value].replace('li','')).style.display = "block";
			}
		}
	}
}

var Tab = new FunctionTab();

function __(){
	if($getid('view2').style.display != 'none'){
		$getid('Xmlger').style.display = '';
	}else{
		$getid('Xmlger').style.display = 'none';
	}
}
(function(){
	Tab.init(['li1','li2','li3'],['view1','view2','view3'],'payOver','payOut');
	//setInterval("__()",1000);
	if($getid('OcaXD')){
		$getid('OcaXD').onclick = function(){
			window.location.href = '/fouse_tickets/#fouse';
		}
	}
}());


/*
控制
**/
function HXYKB(){
	$getid('o_Zh').style.display = '';
	$getid('XYKB2').style.display = 'none';
}

function HXYKC( out ){
	$getid('o_Zh').style.display = 'none';
	$getid('XYKB2').style.display = '';
	var Bankinfo = ['','08.gif','10.gif','09.gif'];
	if(out){
		$getid('bankimg').src = '/Themes/images/BTN/back/' + Bankinfo[out];
		if(out == 3){
			$getid('CCTVNOR').style.display = '';
		}else{
			$getid('CCTVNOR').style.display = 'none';
		}
	}
}

function showBigImg1(obj,val){
				var __=new Array();
			        __[0]='为保证持卡人的利益，订单使用信用卡支付时持卡人必须是本订单的乘机人或联系人';
			        __[1]='请选择申请信用卡时的证件类型并填写证件号码';
			        __[2]='填写全部信用卡号';
			        __[3]='信用卡有效年月：位于您的信用卡卡号下方的有效截止日期<br /><img src="/Flight/xk/xykphoto.jpg" style="margin-top:10px;" />';
			        __[4]='信用卡卡片背面末三位数：位于您的信用卡背面签名栏的7位数字的后三位<br /><img src="/Flight/xk/creditcard.jpg" style="margin-top:10px;" />';
				var objBigImg     =    $getid("big_img1");
				var focusHTML =    $getid("focusHTML");
				var t=obj.style.top;
				var l=obj.offsetLeft;
				objBigImg.style.top = t;
				objBigImg.style.left = l - 20;
				focusHTML.innerHTML=__[val]
				objBigImg.style.display="";
}
function closeBigImg1(){
				var objBigImg=$getid("big_img1");
				objBigImg.style.display="none";
			  }
			  
function L(s){alert(s);}

function _BackActiveObject(){
	
	
	//信用卡支付验证
	var oFlag = false;
	var p = document.getElementsByName('BankName');	
	
	for(i=0;i<p.length;i++){
		if(p[i].checked == true){
			oFlag = true;
		}
	}
	
	if (oFlag == false){
		L('请选择银行类型.!!!');
		return false;
	}
	
	if($getid('UserName').value == ''){
		L('请填写持卡人的姓名');
		$getid('UserName').focus();
		return false;
	}
	
	if($getid('UCardNO').value == ''){
		L('请填写持卡人的证件号码');
		$getid('UCardNO').focus();
		return false;
	}
	
	if($getid('CardNO').value.length < 14 || $getid('CardNO').value.length > 18){
		L('请填写信用卡卡号.信用卡卡号必须为14 - 18位数.');
		$getid('CardNO').focus();
		return false;
	}
	
	if($getid('CardMonth').value == "" || $getid('CardYear').value == "")
	{
		L("请填写信用卡有效期");
		return false;
	}
	
	if($getid('CCTVNOR').style.display != 'none'){
		if($getid('cvv2NumberText').value == ''){
			L('请填写CVV2码');
			return false;
		}
	}
	
}





function TiShi(Str,v){
	var ss="";
	if(v=="1"){
	ss="机票未产生编码";}
	else if(v=="2"){
	ss="订单超出支付时限";	}
	else{
	ss="是特价机票";}
	alert('您预订的'+ss+'\r\n\n需等待我们的确认通知，才能进行支付（一般2-10分钟短信或电话通知）\r\n\n也可以致电  '+Str+'  进行咨询');
}




function TiShi_i(Str){
	alert('您预订的是国际机票\r\n\n需等待我们的确认通知，才能进行支付（一般2-10分钟短信或电话通知）\r\n\n也可以致电  '+Str+'  进行咨询');
}


function TiShi_ChaoShi(Str){
	alert('您预订的国际机票\n\n出票时限已超时 请重新预订 \n\n也可以致电  '+Str+'  进行咨询');
}
