function xx()
{
    document.getElementById("tr_on_owdate").style.display="";
}
                        	
function xx1()
{
    document.getElementById("tr_on_owdate").style.display="none";
}
function dd()
{		
	var now = new Date(); 
	var days = now.getDate();
	var months = now.getMonth()+1;
	var years = now.getYear();
	if(days<10)
	{
	if(months<10)
	{
	var timenow = years+"-"+"0"+months+"-"+"0"+days;
	}
	else
	{
	var timenow = years+"-"+months+"-"+"0"+days;
	}
	}
	else
	{
	if(months<10)
	{
	var timenow = years+"-"+"0"+months+"-"+days;
	}
	else
	{
	var timenow = years+"-"+months+"-"+days;
	}
	}
	timenow=new Date(timenow);
	if(document.Form1.ArrayCity.value=="")
	{
		alert("请输入到达城市!");
		return false;
	}

	if(document.Form1.BeginDate.value=="")
	{
		alert("请输入出发日期!");
		return false;
	}
	if(document.Form1.ReturnDate.value==""&& document.Form1.WorldTicketDefault1_TwoWays.checked)
	{
		alert("请输入回程日期!");
		return false;
   }
   var bDate=new Date(document.Form1.BeginDate.value);
   var rDate=new Date(document.Form1.ReturnDate.value);
   if(bDate>rDate&& document.Form1.WorldTicketDefault1_TwoWays.checked)
   {
		alert("输入的回程日期小于去程日期!");
		return false;
   }
  
   if(bDate<timenow)
   {
   alert("您输入的时间不能小于今天!");
   return false;
   }
	document.getElementById("ImageButton2").style.display = "none";
	document.getElementById("clickLoading").style.display = "block";
}

function checkinto()
{
  
	//var temp=document.all("Checkbox1");
//判断航段是否多选择了
//遍历所有控件查找可能的
	for(j=0;j<document.all.length;j++)
	{
	var obj=document.all[j];
	if(obj.id.substring(0,6)=='divNUM')
	{
	obj.style.display="";
	}
	}
//document.getElementById("divNUM").style.display="";
var count=0;
for(i=0;i<document.getElementsByName("Checkbox1").length;i++)
{
if(document.getElementsByName("Checkbox1")[i].checked)
	{
		count=count+1;
		if(count<2)
		{
	//alert(document.getElementsByName("Checkbox1")[i].value);
	document.getElementById("divNUM").style.display="";
		}
		//else if(count<1)
		//{
		//	document.getElementById("divNUM").style.display="none";
		//}
		else
		{
		alert("已经有一个航段存在,如果您确认要选择该航段,请先请取消原已选择航段!");
		document.getElementsByName("Checkbox1")[i].checked=false;
		}
    } 
}

}

function checkinto2()
{

//判断航段是否多选择了
//alert("aaa");
for(j=0;j<document.all.length;j++)
{
	var obj=document.all[j];
	if(obj.id.substring(0,6)=='divNUM')
	{
		obj.style.display="";
	}
   
}


		//	document.getElementById("divNUM").style.display="";
var count=0;

	for(i=0;i<document.getElementsByName("Checkbox2").length;i++)
	{
	if(document.getElementsByName("Checkbox2")[i].checked)
	{	
	
	count=count+1;

	if(count<2)
	{	
		document.getElementById("divNUM").style.display="";
	}
//	else if(count<1)
//	{
	//		document.getElementById("divNUM").style.display="none";
//	}
   else
   {
   alert("已经有一个航段存在,如果您确认要选择该航段,请先请取消原已选择航段!");
   document.getElementsByName("Checkbox2")[i].checked=false;
   }
   } 
   }

}

function addDay(day)
	{
		var milliseconds=day * 24 *60 *60 *1000
		var m = this.getTime() + milliseconds;
		return new Date(m);
	}
	

	function timenow(begin,end,onway)
	{	
		var proNow=new Date();	
		proNow.addDay=addDay;		
		var now =proNow.addDay(6);	
		var days = now.getDate();	
		var years = now.getYear();	
		var months = now.getMonth()+1;		
		var timenow = years+"-"+(10>months?"0":"")+months+"-"+(10>days?"0":"")+days;
		//alert(timenow);
		if(begin=="")
	{ //WorldTicketDefault1_ReturnDate
	//document.getElementById("WorldTicketDefault1_BeginDate").value = timenow;
	
	}
	if(end=="")
	{	
	document.getElementById("ReturnDate").value = timenow;
	}
		
	if(onway=="OneWays")
		{
		document.getElementById("WorldTicketDefault1_OneWays").checked=true;
		document.getElementById("ReturnDateSelectArea").style.display="none";
		document.getElementById("ReturnDate").value="";
		}
		if(onway=="TowWays")
		{
		//alert(onway);
		document.getElementById("WorldTicketDefault1_TwoWays").checked=true;
		document.getElementById("ReturnDateSelectArea").style.display="";
		}
		
		//var zhen=document.getElementById("WCSearchto");
		//zhen.style.display="none";
		//var headID=document.getElementById("headID");
		//headID.style.display="none";
	}
       
	function xxx(onway)
	{
	if(onway=="OneWays")
		{
		
		document.getElementById("ReturnDateSelectArea").style.display="none";
		document.getElementById("ReturnDate").value="";
		}
		else
		{
	
		var proNow=document.getElementById("BeginDate").value;	
		var arr=proNow.split('-'); 
		var dt=new Date(); 
		dt.setFullYear(arr[0]); 
		dt.setMonth(arr[1]); 
		dt.setDate(arr[2]);		
		dt.addDay=addDay;
	
		var now =dt.addDay(6);	
		var days = now.getDate();	
		var years = now.getYear();	
		var months = now.getMonth();		
		var timenow = years+"-"+(10>months?"0":"")+months+"-"+(10>days?"0":"")+days;
			document.getElementById("ReturnDateSelectArea").style.display="";
		document.getElementById("ReturnDate").value=timenow;
		}
	}
	

function win(fileName) {
     myFloater = window.open('','myWindow','scrollbars=yes,status=no,width=545,height=485')
     myFloater.location.href = fileName;
     myFloater.focus();
}


function AreaCity(j,k)
{
//alert(j);
var i=j+"_"+k;
var y=(j+1)+"_"+k
//var x=j+1+k;
//alert("brandCombox"+i+"");
//alert("chu"+j+"");
for(j=0;j<document.all.length;j++)
	{
	    var obj=document.all[j];	 
	    if(obj.id.substring(0,3)=="chu")
	    {
	    var brandCombox=document.getElementById("brandCombox"+i+"").value;
	    var controlObj=document.getElementById("brandCombox"+i+"");
	  // alert( .options[document.getElementById("brandCombox"+i+"").selectedIndex].text);
		var chu=document.getElementById("chu"+y+"");
//alert(brandCombox);
//alert(chu.innerHTML);
		chu.innerHTML=controlObj.options[controlObj.selectedIndex].text;

	    }
	 }

}
function CityClick()
{
	var stopcitycode=document.Form1.citySelectCenter.options[document.Form1.citySelectCenter.selectedIndex].text
	document.getElementById("ArrayCity").value=stopcitycode;
	document.getElementById("TreCode").value=document.Form1.citySelectCenter.options[document.Form1.citySelectCenter.selectedIndex].value;
	var plane1side=document.getElementById("plane1");
	plane1side.style.display="none";
	//timenow('2008-09-09','2008-09-15','TowWays')
}

    function killerr()
    {
		return true
    }
    window.onerror=killerr;
	function Show_ticketMenu(topadid_num){
		for(i = 1; i < 3; i++)
		{
	document.getElementById("top"+i).background = "../images/index_16.gif";
	document.getElementById("ticket"+i).style.display = "none";
		}
	document.getElementById("top"+topadid_num).background = "../images/index_15.gif";
	document.getElementById("ticket"+topadid_num).style.display = "";
	} 

var popupwindow_window = null;

function popupwindow(status,url) 
{

if(status != 0) 
{

if(popupwindow != null)
 popupwindow.focus(); 

else 
{ 

var popupwindow = open(url, "popupwindow", "width=350,height=225,left=450,top=280");

popupwindow_window = popupwindow;
}
} 
else 
{

if(popupwindow_window != null) 
popupwindow_window.close();

}

}       


var http_request=false;
function ViewData_Flag(i,airtkt_prod_info_id,BeginDate,ReturnDate,ArrayCity,BeginCity,markclass,SW_RT_FLAG,login_user,AIRLINE_CO_CD,TRV_CYCLE,BeginCityCN,ArriveCityCN)
		{	
	indexSeat=i;
	for(j=0;j<document.all.length;j++)
	{
	    var obj=document.all[j];
	   //alert(obj.id);
	    if(obj.id.substring(0,7)=="iframe_")
	    {
	       obj.style.display='none';
	    }
	}
	for(k=0;k<document.all.length;k++)
	{
	    var obj=document.all[k];
	   //alert(obj.id);
	    if(obj.id.substring(0,8)=="iframe2_")
	    {
	       obj.style.display='none';
	    }
	}
		
	var obj=document.getElementById("iframe_"+indexSeat);	    
	obj.style.display='';		
	//obj.style.height="120px";	
	obj.innerHTML="<p><img src='../images/indicator.gif'> 正在加载航班信息......</p>";			
	
	http_request=null;
	if (window.XMLHttpRequest)
	{
		http_request=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		http_request=new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		alert("lll");
	}
	
	var Select_BeginCity = BeginCity;
	var Select_EndCity = ArrayCity;
	
	http_request.onreadystatechange = DoViewData_Flag;
	var dateTimeOneway=BeginDate;
	var dateTimeReway=ReturnDate;
    //document.write('price_search.aspx?OperatorNameFlag=GetDataFlag&col='+i+'&airtkt_prod_info_id='+airtkt_prod_info_id+'&WorldTicketDefault1_BeginDate='+BeginDate+'&WorldTicketDefault1_ReturnDate='+ReturnDate+'&ArrayCity='+ArrayCity+'&BeginCity='+Select_BeginCity+'&markclass='+markclass+'&Return_Flag='+SW_RT_FLAG+'&login_User='+login_user+'&AIRLINE_CD='+AIRLINE_CO_CD+'&End_CityCN='+Select_EndCity+'&TRV_CYCLE='+TRV_CYCLE+'&BeginCityCN='+BeginCityCN+'&EndCityCN='+ArriveCityCN+'');
	http_request.open('GET','price_search.aspx?OperatorNameFlag=GetDataFlag&col='+i+'&airtkt_prod_info_id='+airtkt_prod_info_id+'&WorldTicketDefault1_BeginDate='+BeginDate+'&WorldTicketDefault1_ReturnDate='+ReturnDate+'&ArrayCity='+ArrayCity+'&BeginCity='+Select_BeginCity+'&markclass='+markclass+'&Return_Flag='+SW_RT_FLAG+'&login_User='+login_user+'&AIRLINE_CD='+AIRLINE_CO_CD+'&End_CityCN='+Select_EndCity+'&TRV_CYCLE='+TRV_CYCLE+'&BeginCityCN='+BeginCityCN+'&EndCityCN='+ArriveCityCN+'',true);
		   
		   http_request.send();
		}

		function DoViewData_Flag()
		{
	if (http_request.readyState==4)
	{
	    if(http_request.status==200)
	    {	
	        var obj=document.getElementById("iframe_"+indexSeat);
			    obj.style.display='';	
			     obj.innerHTML=http_request.responseText;
			   var ajaxTxtID=document.getElementById("objTxt"+indexSeat);
			    var AjaxText=ajaxTxtID.innerHTML;
		      eval(AjaxText);
	    }
	    else
	     {
	        alert('There was a problem with the request.');
	     }	
	}
			
		}
		//------------------------------------------------
		function aaa()
		{
		alert("suss");
		}
		
	var http_request=false;	
		function ViewData(i,airtkt_prod_info_id,Begin_Date,End_Date,End_Code,Begin_Code,marktype,Return_Flag,str_ID,login_user,AIRLINE_CD)
		{		
	indexSeat=str_ID;
	for(j=0;j<document.all.length;j++)
	{
	    var obj=document.all[j];
	    
	 
	    if(obj.id.substring(0,8)=="iframe2_")
	    {
	       obj.style.display='none';
	      }
	       
	        //-----------------------释放上一级checkbox------------------------
	    if(obj.id.substring(0,10)=="Checkbox2_")
	    {
			
			obj.checked=false;
			
	    }
	     if(obj.id.substring(0,10)=="Checkbox1_")
	    {
			
			 obj.checked=false;
	    }
	  
	}
	//alert("iframe2_"+indexSeat);
	var obj=document.getElementById("iframe2_"+indexSeat);	    
	obj.style.display='';	
	obj.style.height="120px";	
	obj.innerHTML="<p><img src='../images/indicator.gif'> 正在向GDS获取航班信息......</p>";		
	
	http_request=null;
	if (window.XMLHttpRequest)
	{
		http_request=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		http_request=new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		alert("111");
	}
	
		var CityArea="";		
		for (var j=0;j<document.forms[0].elements.length;j++)
		{
		var e = document.forms[0].elements[j];
		
		for(j=0;j<document.all.length;j++)
	{	
	    var obj=document.all[j];	 
	    if(obj.id.substring(0,11)=="brandCombox")
	    {	       
			CityArea+=obj.value+";";
			
	    }	  
	}	
	//alert(CityArea);
	http_request.onreadystatechange = DoViewData;
	//document.write('price_search.aspx?OperatorName=GetData&strAIRTKT_ID='+airtkt_prod_info_id+'&Begin_Date='+Begin_Date+'&End_Date='+End_Date+'&End_Code='+End_Code+'&Begin_Code='+Begin_Code+'&markclass='+marktype+'&RealCity='+CityArea+'&StrReturn_Flag='+Return_Flag+'&str_ID='+str_ID+'&strLogin_User='+login_user+'');
	http_request.open('GET','price_search.aspx?OperatorName=GetData&strAIRTKT_ID='+airtkt_prod_info_id+'&Begin_Date='+Begin_Date+'&End_Date='+End_Date+'&End_Code='+End_Code+'&Begin_Code='+Begin_Code+'&markclass='+marktype+'&RealCity='+CityArea+'&StrReturn_Flag='+Return_Flag+'&str_ID='+str_ID+'&strLogin_User='+login_user+'',true);
	http_request.send();
		 
		
		}
		}
		function DoViewData()
		{	
	if (http_request.readyState==4)
	{
	
	    if(http_request.status==200)
	    {	
	   	
	         
	        var obd=document.getElementById("iframe2_"+indexSeat);		    
			     obd.style.display='';	
			     obd.innerHTML=http_request.responseText;	
			     obd.style.height="";		 	        
	    }
	    else
	     {
	        alert('There was a problem with the request.');
	     }	
	}
		}
	
		function doOrderTicket(id,V_airtkt_prod_info_id,marktype,Begin_Date,End_Date,End_Code,End_CodeCN,Begin_Code,Begin_CodeCN,Return_Flag,login_user,AIRLINE_CD,Is_Session)
		{
	        var CityArea="";	
		    for(j=0;j<document.all.length;j++)
	        {
	            var obj=document.all[j];	 
	            if(obj.id.substring(0,11)=="brandCombox")
	            {	       
			        CityArea+=obj.value+";";
        	    }
	        }	
		    for(i=0;i<document.getElementsByName("Checkbox2").length;i++)
            {
                if(document.getElementsByName("Checkbox2")[i].checked)
	            {
		            var GoID=document.getElementsByName("Checkbox2")[i].value;
                } 
            }
	        for(i=0;i<document.getElementsByName("Checkbox1").length;i++)
            {
                if(document.getElementsByName("Checkbox1")[i].checked)
	            {
		            var ComeID=document.getElementsByName("Checkbox1")[i].value;
                } 
            }
		    document.Form1.OrderTicketNo.value=id;
		    document.Form1.AIRTKT_PROD_INFO_ID.value=V_airtkt_prod_info_id;
		    document.Form1.markclass.value = marktype
		    //alert(Is_Session);
		    //  alert("aaa");
		    window.location.href('order_creat.aspx?strAIRTKT_ID='+V_airtkt_prod_info_id+'&MARKCLASS='+marktype+'&OrderTicketNo1='+ComeID+'&OrderTicketNo2='+GoID+'&ArrayCity='+CityArea+'&strBegin_Date='+Begin_Date+'&strEnd_Date='+End_Date+'&strEnd_Code='+End_Code+'&strEnd_CodeCN='+End_CodeCN+'&strBegin_Code='+Begin_Code+'&strBegin_CodeCN='+Begin_CodeCN+'&strReturn_Flag='+Return_Flag+'&strLogin_user='+login_user+'&strAIRLINE_CD='+AIRLINE_CD+'&IsSession='+Is_Session+'');
			//window.location.href('order_creat.aspx?strAIRTKT_ID='+V_airtkt_prod_info_id+'&MARKCLASS='+marktype+'&OrderTicketNo1='+ComeID+'&OrderTicketNo2='+GoID+'&ArrayCity='+CityArea+'&strBegin_Date='+Begin_Date+'&strEnd_Date='+End_Date+'&strEnd_Code='+End_Code+'&strBegin_Code='+Begin_Code+'&strReturn_Flag='+Return_Flag+'&strLogin_user='+login_user+'&strAIRLINE_CD='+AIRLINE_CD+'');	
    	}