			function startNewSearch(controls) {
				Event.fire(System,"beforeSearch");
				f_bD = doSearch.bind(this,controls);
				Event.observe(controls,"checkpassed",f_bD);
				Event.observe(controls,"checkfailed",null);
				controls.checkAll();
			}
			
			
			function doSearch(controls) {
				if($F("searchTypeSng"))
					System.status.subSearchType = $F("searchTypeSng");
				else
					System.status.subSearchType = $F("searchTypeRnd");
				System.status.searchCriteria = {	deptDate 				: $("deptDate").value,
																			returnDeptDate	: $("arriDate").value,
																			deptAirport			: $("hinpDeptCity").value,
																			arriAirport			: $("hinpArriCity").value};
																			
				if (System.status.subSearchType=="RoundTripFlight" && System.status.language=="zh")
				{
					var f_aW = "http://www.qunar.com/twell2/flight/Search.jsp?" + "fromCity="+encodeURIComponent(System.status.searchCriteria.deptAirport)+"&toCity="+encodeURIComponent(System.status.searchCriteria.arriAirport)+"&fromDate="+System.status.searchCriteria.deptDate+"&toDate="+System.status.searchCriteria.returnDeptDate + "&op=1";
					var isInter = $A(controls.getCityList()).any(function(f_hw){return f_hw.isInterCity()});
					if (isInter) {
						f_aW = f_aW.replace("op=1","op=2");
						f_aW += "&isInter=true";
					}
					if (window.location.host.indexOf("local")!=-1) f_aW +=("&host=" + window.location.host);
					window.location.href = (f_aW);
					return;
				}
				else {
				var f_aW = "http://www.qunar.com/site/oneway_list.htm" + "?" + "searchDepartureAirport="+encodeURIComponent(System.status.searchCriteria.deptAirport)+"&searchArrivalAirport="+encodeURIComponent(System.status.searchCriteria.arriAirport)+"&searchDepartureTime="+System.status.searchCriteria.deptDate+"&searchArrivalTime="+System.status.searchCriteria.returnDeptDate+"&searchType="+System.status.subSearchType+"&startSearch=true";
				window.location= f_aW;
				}
			}
			new function system_onload() {
				Object.extend(System.language, languageVars);
				var controlDef = $H({
					datepicker : $A([{ 
						id 			: "deptDate",
						targetInput	: "deptDate",
						dateOffset: 0,
						linkDP	: "arriDate",
						linkOffset : 3,
					  template_container: templates.datepicker_container,
					  template_main: templates.datepicker_main,
					  pickerImg: "himgDeptDate"
						},{ 
						id 			: "arriDate",
						targetInput	: "arriDate",
						dateOffset: 4,
					  template_container: templates.datepicker_container,
					  template_main: templates.datepicker_main,
					  pickerImg: "himgArriDate"
						}]), 	
					cityinput : $A([{
						id: "hinpDeptCity",
						options: {
							useSuggest: true,
							useValidate: true,
							validateURL: System.constant.VALIDATE_URL,
							language: System.currentLanguage,
							showAirport: true,
							suggestTemplateObj: templates.suggest,
							useHotCity: true,
							hotCityImage: "himgDeptHotCity",
							hotCityList : System.language._HOT_CITY_LIST,
							hotCityTemplateObj: templates.hotcity,
							homeCountry : System.language._CHINA
						}
						},
						{
						id: "hinpArriCity",
						options: {
							useSuggest: true,
							useValidate: true,
							validateURL: System.constant.VALIDATE_URL,
							language: System.currentLanguage,
							showAirport: true,
							suggestTemplateObj: templates.suggest,
							useHotCity: true,
							hotCityImage: "himgArriHotCity",
							hotCityList : System.language._HOT_CITY_LIST,
							hotCityTemplateObj: templates.hotcity,
							homeCountry : System.language._CHINA
						}
						}]),
					htmlformelement: $A ([
						{
						id:	"hrndRoundTrip"
						},{
						id: "hrndOneWay"
						}
					])
				});
				var cg = new ControlGroup(controlDef);
				function autoSelectRoundTrip() {
						var f_eS = $A(controlDef.cityinput).any(function(f_kB) {
							var f_iG = $(f_kB.id).country;
							return f_iG != null && f_iG != System.language._CHINA;
						})
						if (f_eS) {
							$("searchTypeRnd").checked = true;
							$("searchTypeRnd").click();
						}
				}
				Event.observe(System, "citychange", autoSelectRoundTrip);
				Event.observe(System, "checkfailed", autoSelectRoundTrip);
				
				Event.observe(System, "beforeSearch", function() {
					Event.stopObserving(System, "citychange", autoSelectRoundTrip);
				});
				
				System.status = {
					language : "zh",
					pageAbbr : "FH"
				};
				Event.observe("hbtnResearch","click",startNewSearch.bind(null,cg));
			}();