/**
 * Author:秦威
 * create date:2007-10-26
 * 机票查询中公共的方法
 **/
 function showDiscount(dis,cabin) {
 var ret = "";
 if (!(dis==""||dis=='')) {
	 if(dis*1 >150 )
	 {
		 ret="特价";
	 }
	if (dis == 150||dis == '150'||dis=='120'||dis==120) {
		ret = "头等舱";
	}
	if (dis == 130||dis == '130') {
	    ret = "商务舱";
	}
	if (dis == 100||dis == '100') {
				ret = "全价";
	}
	if (dis*1 < 100) {
		var z = dis*1 / 10;
		var m = dis*1 % 10;
		ret = z + "折";
		if (m != 0) {
		ret = z  + "折";
		}

	}
	if(dis*1 ==0) ret="特价";
}
 if(cabin=='F'||cabin=='f') ret="头等舱";
	if(cabin=='C'||cabin=='c') ret="商务舱";
	if(cabin=='Y'||cabin=='y') ret="全价";
	
	//if(cabin=='P'||cabin=='p') ret="头等舱";
	return ret;
}
 
//经停div显示
 function stopInfoShow(msg,flightNo,depDate,oImage)
{
   stopInfoDiv('',oImage,'','','',true);   
	 var fileName="stopResult.jsp?";
	     fileName=fileName+"flightNo="+flightNo;
		 fileName=fileName+"&depDate="+depDate;
	  var http_request;
	 if (window.XMLHttpRequest) {
		http_request = new XMLHttpRequest();
	  } else {
		if (window.ActiveXObject) {
			try {
				http_request = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e) {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
	  }
	http_request.open("GET", fileName, true);
	if (http_request) { 
		http_request.onreadystatechange = function () {
			if (http_request.readyState == 4) {
				if (http_request.status == 200) {
					var context= http_request.responseText;
					
					stopInfoDiv('',oImage,'','',context,false);
				}
			}
		};
		http_request.send(null);
	}
}
 
/**
指定ID显示规定内容 
**/
function showContext(labelId,context)
{
	try
	{
    if(!isNaN(context)) {context=context*1;}
	}catch(ex)
	{}
	if (navigator.appName=="Microsoft Internet Explorer")//如果是IE
		{
		    if(document.getElementById(labelId))
			document.getElementById(labelId).innerText=context;// IE
		    
		}
		else 
		{
			document.getElementById(labelId).textContent=context;// Mozilla
		}
}
/*
得到指定ID规定内容
*/
function getContext(labelId)
{
	if (navigator.appName=="Microsoft Internet Explorer")//如果是IE
		{
			return document.getElementById(labelId).innerText;// IE
		}
		else 
		{
			return document.getElementById(labelId).textContent;// Mozilla
		}
}


function parseDateChild(s)
{
	var reg=new RegExp("[^0-9-]","")
	if(s.search(reg)>=0)return today;
	var ss=s.split("-");
	if(ss.length!=3)return today;
	if(isNaN(ss[0])||isNaN(ss[1])||isNaN(ss[2]))return today;
	return new Date(parseFloat(ss[0]),parseFloat(ss[1])-1,parseFloat(ss[2]));
}

function parseIDNoDate(s)
{
    var reg=/^\d{4}-[0-1]?\d{1}-[0-3]?\d{1}$/;
	return reg.test(s); 
}

function  forDight(Dight,How)     
{   
   Dight  =  Math.round  (Dight*Math.pow(10,How))/Math.pow(10,How);    
   return  Dight;     
  
}     
//退改签显示
function showPenalty(msg1,msg2,msg3,msg4,msg5,fareType,airwaysCode,cabin,discount)
{
   displayMessageDiv(msg1,msg2,msg3,msg4,msg5,'');
}

//填写来回程特价信息,,
function nextSpecail(depCity1,arrCity1, depCity2, arrCity2,depDate1,depDate2 ,airCode, cabin, totalPrice,airCodeName)
{
	
	 document.FlightSpecailQueryForm.depCity1.value=depCity1;
	 document.FlightSpecailQueryForm.arrCity1.value=arrCity1;
	 
	 document.FlightSpecailQueryForm.depCity2.value=depCity2;
	 document.FlightSpecailQueryForm.arrCity2.value=arrCity2;
	 
	 
	 
	 document.FlightSpecailQueryForm.depCity1Name.value= airportArray[depCity1].cname;
	 document.FlightSpecailQueryForm.arrCity1Name.value= airportArray[arrCity1].cname;
	 
	 document.FlightSpecailQueryForm.depCity2Name.value= airportArray[depCity2].cname;
	 document.FlightSpecailQueryForm.arrCity2Name.value= airportArray[arrCity2].cname;
	 
	 document.FlightSpecailQueryForm.airCodeName.value=airCodeName;
	 
	 document.FlightSpecailQueryForm.depDate1.value=depDate1;
	 document.FlightSpecailQueryForm.depDate2.value=depDate2;
	 
	 document.FlightSpecailQueryForm.airCode.value=airCode;
	 document.FlightSpecailQueryForm.totalPrice.value=totalPrice;
	 
	 document.FlightSpecailQueryForm.cabin.value=cabin;
	 document.FlightSpecailQueryForm.submit();
	 showDisposeFlightDiv();
}
function repeatLowSearch(airCode,id){
	document.FlightSearchForm1.airwaysCode.value=airCode;	
	document.FlightSearchForm1.lowType.value="1";
	document.FlightSearchForm1.specialPriceProductId.value=id;
	document.FlightSearchForm1.submit();	
	 showDisposeFlightDiv();
	}
