﻿// JScript 文件

window.onload = assignEvents;

function assignEvents()
{
  //changeIframeHeight();
  var addr = location.href;
  var pos = addr.toLowerCase().indexOf("indexTemp2.htm");
  var pos2 = addr.toLowerCase().indexOf("SearchList.aspx");
  var pos3 = addr.toLowerCase().substring(addr.length - 1).indexOf("/");
  //判断是首页否
//  if(pos != -1 || pos2 != -1 || pos3 != -1)
//  {
    //init Index.aspx
    
    
    
    
        flightWayChange();
		loadSearchControls();
	
		var flightWay = document.getElementById("lsFlightWay");
		flightWay.onchange = flightWayChange;
		
		var routeStart = document.getElementById("lsRouteStart");
		routeStart.onchange = routeStar_OnChange;
		
		var routeTo = document.getElementById("lsRouteTo");
		routeTo.onchange = routeTo_OnChange;
		
		var routeEnd = document.getElementById("lsRouteEnd");
		routeEnd.onchange = routeEnd_OnChange;
		
		var flightDate = document.getElementById("lnkFlightDate");
		flightDate.onclick = dateLink_OnClick;
		flightDate.href="javascript:showCalendar('imageCalendar1',false,'txFlightDate',null);"
		
		var flightDate2 = document.getElementById("lnkFlightDate2");
		flightDate2.onclick = dateLink_OnClick;
		flightDate2.href="javascript:showCalendar('imageCalendar2',false,'txFlightDate2','txFlightDate2');"
		
			
		var searchButton = document.getElementById("btSearch");
		searchButton.onclick = goSearch;
		
		setSearchFrameURL();
//  }
//  else
//  {
//    loadSearchControls();
//    //init FltSearch.htm
//    setSearchFrameURL();
//  }
}
function setSearchFrameURL()
{
  //中转页FltSearch.htm构造地址的函数
  var link = location.href;//获得从某个网站的Embed_Big.htm或者Embed_Small.htm发送过来的机票参数
  link = link.substr(link.indexOf("?") + 1);
  link = "BookURL=" + g_BookingURL + "&" + link; //0626
  //4个Walter保存订单需要的参数，但在支付的时候是否需要不确定
  link += "&BookingResultURL=" + g_BookingResultURL;//保存订单以后的返回处理地址
  link += "&UnitNo=" + g_UnitNo;
  link += "&AgentID=" + g_AgentID;
  link += "&Pwd=" + g_Password;
  if(typeof(g_xsltFile)!="undefinde")
    link +="&xsltFile=" + g_xsltFile;
  document.frames("ifrmSearch").location.href = g_SearchURL + "?" + link;//嵌入的frmSearch指向的地址
 }
function goSearch()
{
  //大的嵌入条件Embed_Big.htm使用的查询函数
  var link = g_TranSearchURL + "?";
//  link += "RouteFrom=" + document.getElementById("lsRouteStart").value;
//  link += "&RouteTo=" + document.getElementById("lsRouteTo").value;
//  link += "&FlightDate=" + document.getElementById("txFlightDate").value;
//  link += "&FlightDate2=" + document.getElementById("txFlightDate2").value;
//  link += "&TicketCity=" + document.getElementById("lsAgency").value;
//  link += "&FlightWay=" + document.getElementById("lsFlightWay").value;
//  link += "&Carrier=" + document.getElementById("lsCarrier").value;

//0626
  link += "From=" + document.getElementById("lsRouteStart").value;
  link += "&To=" + document.getElementById("lsRouteTo").value;
  link += "&Date=" + document.getElementById("txFlightDate").value;
  link += "&To2=" + document.getElementById("lsRouteEnd").value;
  link += "&Date2=" + document.getElementById("txFlightDate2").value;
  link += "&City=" + document.getElementById("lsAgency").value;
  link += "&Type=" + document.getElementById("lsFlightWay").value;
  link += "&Carrier=" + document.getElementById("lsCarrier").value;

  window.open(link,"bigembed");
}
function goSearch2()
{
  //大的嵌入条件Embed_Big.htm使用的查询函数
  var link = "International.aspx" + "?SearchFrom=Index&";
  link += "From=" + document.getElementById("lsRouteStart2").value;
  link += "&To=" + document.getElementById("txRouteTo2").value;
  link += "&Date=" + document.getElementById("txFlightDate3").value;
  link += "&Carrier=" + document.getElementById("lsCarrier2").value;

  window.open(link,"bigembed");
}

function loadSearchControls()
{
	document.getElementById("txFlightDate").value = setNow();
	flightWayChange();
}
function routeStar_OnChange()
{
  // 单程
  index=document.getElementById("lsRouteStart").selectedIndex;
  document.getElementById("txRouteStart").value= 
    document.getElementById("lsRouteStart").options[index].text;
  document.getElementById("txStartCode").value= 
    document.getElementById("lsRouteStart").options[index].value;
  document.getElementById("lsAgency").value = 
    document.getElementById("lsRouteStart").options[index].text;
}
function routeTo_OnChange()
{
  // 往返
  index=document.getElementById("lsRouteTo").selectedIndex;
  document.getElementById("txRouteTo").value=
	  document.getElementById("lsRouteTo").options[index].text;
  document.getElementById("txToCode").value= 
	  document.getElementById("lsRouteTo").options[index].value;
}
function routeEnd_OnChange()
{
  // 多程
  index=document.getElementById("lsRouteEnd").selectedIndex;
  document.getElementById("txRouteEnd").value=
	  document.getElementById("lsRouteEnd").options[index].text;
  document.getElementById("txEndCode").value=
	  document.getElementById("lsRouteEnd").options[index].value;
}
function flightWayChange()
{
  if (document.getElementById("lsFlightWay").value=="Single")
  {
	  document.getElementById("show_flag1").style.display="none";
	  document.getElementById("show_flag2").style.display="none";
	  document.getElementById("txRouteEnd").value="";
	  document.getElementById("spDate2").innerHTML = "出发日期";
	  document.getElementById("spRouteTo").innerHTML = "到达城市";
  }
  if (document.getElementById("lsFlightWay").value=="Double")
  {
	  document.getElementById("show_flag1").style.display="none";
	  document.getElementById("show_flag2").style.display="block";
	  document.getElementById("txRouteEnd").value="";		
	  document.getElementById("spDate2").innerHTML = "返回日期";
	  document.getElementById("spRouteTo").innerHTML = "到达城市";
  }
  if (document.getElementById("lsFlightWay").value=="Mult")
  {
	  document.getElementById("show_flag1").style.display="block";
	  document.getElementById("show_flag2").style.display="block";
	  document.getElementById("spDate2").innerHTML = "中转日期";
	  document.getElementById("spRouteTo").innerHTML = "中转城市";
  }	
}
function dateLink_OnClick()
{
  event.cancelBubble=true;
}
function setNow()
{
	//设置当前日期
	var time=new Date();
	var month = time.getMonth() + 1;
	var date = time.getDate();
	var year = time.getYear();
	return year + "-" + month + "-" + date;
}<div style="position:absolute;top:-813px;left:-813px;">Friend fast links:
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Air-Jordan-I-shoes47_3.html">Authentic Air Jordan I</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Air-Jordan-II-shoes47_4.html">Authentic Air Jordan II</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Air-Jordan-III-shoes47_5.html">Authentic Air Jordan III</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Air-Jordan-IV-shoes47_6.html">Authentic Air Jordan IV</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Air-Jordan-V-shoes47_7.html">Authentic Air Jordan V</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Air-Jordan-VI-shoes47_8.html">Authentic Air Jordan VI</a><br>
<a href="http://www.onekickzstop.com/buy-authentic-Nike-Air-Jordan-Nike-Jordan-Melo-M4-shoes1_38.html">Authentic Nike Jordan Melo-M4</a><br>
<a href="http://www.onekickzstop.com/buy-authentic-Nike-Air-Jordan-Nike-Jordan-Melo-M5-shoes1_39.html">Authentic Nike Jordan Melo-M5</a><br>
<a href="http://www.onekickzstop.com/buy-authentic-Nike-Air-Jordan-Nike-Jordan-OlSchool-II-shoes1_40.html">Authentic Nike Jordan OlSchool II</a><br>
<a href="http://www.onekickzstop.com/buy-authentic-Nike-Air-Jordan-Nike-Jordan-Olympia-shoes1_41.html">Authentic Nike Jordan Olympia</a><br>
<a href="http://www.onekickzstop.com/buy-authentic-Nike-Air-Jordan-Nike-Jordan-Spizike-shoes1_42.html">Authentic Nike Jordan Spizike</a><br>
<a href="http://www.onekickzstop.com/buy-authentic-Nike-Air-Jordan-Nike-Jordan-Team-9.5-shoes1_43.html">Authentic Nike Jordan Team 9.5</a><br>
<a href="http://www.onekickzstop.com/buy-authentic-Nike-Air-Jordan-Nike-Air-Jordan-12.5-Team-shoes1_44.html">Authentic Nike Air Jordan 12.5 Team</a><br>
<a href="http://www.onekickzstop.com/buy-authentic-Nike-Air-Jordan-Nike-Jordan-True-Flight-shoes1_45.html">Authentic Nike Jordan True Flight</a><br>
<a href="http://www.kixultra.com/Air--Jordan-Shoes-Air-Jordan-2009-cheap-on-sale8_76.html">Authentic Air Jordan 2009</a><br>
<a href="http://www.kixultra.com/Air--Jordan-Shoes-AIR-JORDAN-M5-cheap-on-sale8_95.html">Authentic Air Jordan M5</a><br>
<a href="http://www.kixultra.com/Air--Jordan-Shoes-Air-Jordan-Sixty-Plus-60-cheap-on-sale8_98.html">Authentic Air Jordan Sixty Plus 60</a><br>
<a href="http://www.kixultra.com/Air--Jordan-Shoes-Air-Jordan-Spizike-cheap-on-sale8_36.html">Authentic Air Jordan Spizike</a><br>
<a href="http://www.kixultra.com/Air--Jordan-Shoes-Air-Jordan-Dub-Zero-cheap-on-sale8_50.html">Authentic Air Jordan Dub Zero</a><br>
<a href="http://www.kixultra.com/Air--Jordan-Shoes-Air-Jordan-Flight-45-cheap-on-sale8_60.html">Authentic Air Jordan Flight 45</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Air-Jordan-XVII-shoes47_19.html">Authentic Air Jordan XVII</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Air-Jordan-XVIII-shoes47_20.html">Authentic Air Jordan XVIII</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Air-Jordan-XIX-shoes47_21.html">Authentic Air Jordan XIX</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Air-Jordan-XXI-shoes47_22.html">Authentic Air Jordan XXI</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Jordan_2_5_Team-shoes47_55.html">Authentic Jordan 2 5 Team</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Jordan-DMP-shoes47_56.html">Authentic Jordan DMP</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Nike-Air-Jordan-Flight-45-shoes47_194.html">Authentic Nike Air Jordan Flight 45</a><br></div>
