var tourstartArray=new Array();var tourstartMap=new Hash();var tourendArray=new Array();var tourendMap=new Hash();var tourStartDM,tourEndDM;function tourValidate(){var g=new Array();if($("tourLocation")){var a=$F("tourLocation");if(a=="NULL"){g[g.length]=errorMessage(ERR_TOUR_SELECT_RESORT)}}var f=$F("tourstart");var e=$F("tourend");if(formatDate(createDate(f),dateFormat_api)!=f){g[g.length]=errorMessage(ERR_TOUR_DATE_INVALID,{type:"start"})}if(formatDate(createDate(e),dateFormat_api)!=e){g[g.length]=errorMessage(ERR_TOUR_DATE_INVALID,{type:"end"})}if(e<f){g[g.length]=errorMessage(ERR_TOUR_RETURN_BEFORE_DEPARTURE)}var c=$("fs_paxTypes_tour").select("select.paxType");var b=0;for(var d=0;d<c.length;d++){b+=parseFloat($F(c[d]))}if(b==0){g[g.length]=errorMessage(ERR_TOUR_NO_PAX)}else{if(b>9){g[g.length]=errorMessage(ERR_TOUR_TOO_MANY_PAX)}}if(g.length>0){alert(g.join("\n"));return false}else{return true}}function submitTourSearch(){return tourValidate()}function tourLocationChange(){if(!$("tourName")){return}$("tourName").disable();new Ajax.Request(urlBase+"/landtour/tourList.jsp",{parameters:{location:$F("tourLocation"),tourType:tourTypeChange(),userType:$F("utt")},evalJS:"force"})}function updateTourList(){if(!$("tourName")){return}AniteDDB.populate($("tourName"),[{code:" ",name:" "},tourList].flatten().compact());$("fs_tourName").show();$("tourName").enable()}function toursInit(){if($("tourLocation")){Event.observe($("tourLocation"),"change",tourLocationChange)}if($("shortType")){Event.observe($("shortType"),"click",tourLocationChange);Event.observe($("longType"),"click",tourLocationChange);Event.observe($("shortType"),"click",tourTypeChange);Event.observe($("longType"),"click",tourTypeChange)}tourStartDM=new DateManager({months:$("tourstart_mon"),days:$("tourstart_day"),hidden:$("tourstart"),after:new Date(),afterOffset:landLeadTime});tourStartDM.addDisabledDates(null,landStartDate);tourEndDM=new DateManager({months:$("tourend_mon"),days:$("tourend_day"),hidden:$("tourend"),after:tourStartDM,afterOffset:1});tourEndDM.addDisabledDates(null,landStartDate);tourLocationChange();tourTypeChange();$("tourSearch").show()}function tourTypeChange(){if(!$("fs_tourLength")){return"S"}var a="S";if($("tourType")){a=$F("tourType")}else{if($("shortType").checked){a="S"}else{a="E"}}if(a=="S"){$("fs_tourLength").hide()}else{$("fs_tourLength").show()}return a}function tourDateChange(){dateChange(this.id);if(this.id=="tourstart"){$("tourend").mindate=formatFSSDate(addToDate(createDate(this.value),1));advanceDate("tourend",$("tourend").mindate)}}var tourList=new Array();Event.observe(window,"load",toursInit);
