// JavaScript Document
var  itinerarys=
{index:null,name:null,detail:null,
depCity:null,arrCity:null,loggingCity:null,
image:null,travelType:null,depDate:null,
checkInDate:null,checkOutDate:null};

var notices={type:null,detail:null};

var HotelInfo={hotelId:null,hotelName:null,area:null,roomType:null,roomLimit:null,breakfast:null,basePrice:null,roomPrice:null};

var AreaInfo={area:null,HotelInfo:{}};
var hotelLists={city:null,AreaInfo:{}};
var Tour={
	 packageId:null,
	 tourName:null,
	 depDays:null,
	 basePrice:null,
	 tourImage:null,
	 tourDescription:null,
	 itinerarys:{},
	 hotelLists:{},
	 notices:{},
	 minPeople:null,
	 effectDate:null,
	 closeDate:null
};
var city={depCity:null,arrCity:null,province:null,country:null};
function SearchDetail()
{
	var tmp_arrCity = null;
	if(document.form2.tourKind[0].checked == true || document.form2.tourKind[2].checked == true){	
		tmp_arrCity = document.form2.endPointSight.value;
	}
	if(document.form2.tourKind[1].checked == true ){
		tmp_arrCity = document.form2.shortLineSight.value;
	}
	if(document.form2.tourKind[3].checked == true ){
		tmp_arrCity = document.form2.endPointKeyWord.value;
	}

	//var form2 = $('form2');
	//city.depCity=document.form2.startPoint.value;
	city.depCity=document.form2.startPoint.options[document.form2.startPoint.options.selectedIndex].text;
	city.arrCity=tmp_arrCity;
	city.province=" ";
	city.country=" ";
	if(city.depCity==city.arrCity) 
    {
		alert("出发地与目的地不能一样!");
		return;
	}
	var para=JSON.stringify(city);
//	alert(para);
	window.location.href = "http://booking.et-china.com/engine/tours/more.html?"+para;

//window.location.href("http://10.2.1.235/engine/tours/more.html?"+para);
}

var packet = {packageId:null};
function queryProductAction(ele){
	var obj = ele.domBean.getEnv('tourDetail');
	packet.packageId = obj.packageId;
	var para = JSON.stringify(packet);
//	alert(para);
	window.location.href = "queryProductAction.html?"+para;
}

function processColData(result){
      if(result != null) {       
         if(result instanceof Array == false){ // only 1 result returns
            result = [result];
         }
      }else{
         result = [];
      }
      return result;
   }

var sCall = new ajax.RemoteCall(ajax.baseURI + "/ajaxremote?service=TourService");
function initpage()
{
	city =decodeURI(window.location.search.substring(1));
	city=JSON.parse(city);	
//	alert(JSON.stringify(city));
//	city = {"depCity":"广州","arrCity":"海南"};
  	Tour = sCall.call("query",city.depCity,city.arrCity,city.province,city.country);
	if(Tour == null){
//		alert(JSON.stringify(Tour));
		var noPro = JSON.stringify(city);
		window.location.href = "noProduction.html?"+noPro;
		return;
	}

	Tour.TourDetail=processColData(Tour.TourDetail);
	ajax.DomBean.InitPage();
}

function init(){
	ajax.DomBean.InitPage();
}

