var bookingPage;var listingType;var tpl;var slideshow;var map;var mode,tplId,sectionId;var textArea,editorArea,newSectionArea;var rte;var addAnchor;var photoVideoTabView;var entryNote="";var textContentLong;addOnload(init);YAHOO.util.Event.onAvailable("textContent",function(){var C=$("textContent");if(C.className!="empty"){textContentLong=C.innerHTML;var B=C.innerHTML;var A=620;if(C.innerHTML.length>A){B=B.trimSize(A)}B+=" <a href='#' onclick='showMoreText();return false'>Read More</a>";C.innerHTML=B}});function showMoreText(){var A=$("textArea");A.style.height="100%";A.style.overflow="visible";if(textContentLong){$("textContent").innerHTML=textContentLong}$("controlArea").style.display=""}function showMore(A){var B=A.parentNode.previousSibling.previousSibling;B.style.display=""}function hideMore(A){var B=A.parentNode.parentNode;B.style.display="none"}function doSearch(){doFilters()}function removeSearchTerm(){window.location=window.location.pathname}YAHOO.util.Event.onAvailable("fastars",function(){var C=YAHOO.util.Dom.getElementsByClassName("star-option","div","fastars");var B=null;if(window.location.search.match(/stars=([\d,]*)/)){B=RegExp.$1}for(var D=0;D<C.length;D++){var A=C[D].getElementsByTagName("input")[0];if(B!=null){A.checked=B.match(A.value)}YAHOO.util.Event.addListener(C[D],"click",function(E){doFilters()})}});function doFilters(){var F=[];var E=document.filterForm.search.value;if(E){F.push("search="+encode(E))}var B=$("fastars").getElementsByTagName("input");var A="";for(var D=0;D<B.length;D++){if(B[D].checked){A+=","+B[D].value}}if(A){A=A.substring(1)}F.push("stars="+A);F.push("sort="+document.sortForm.sort.value);var C=window.location.pathname;if(F.length>0){window.location=C+"?"+F.join("&")}else{window.location=C}}YAHOO.util.Event.onAvailable("guide",function(){bookingPage="overview";tpl=$("tpl");if(tpl){tpl=tpl.value;bookingPage="section-"+tpl}listingType=$("listingType");if(listingType){listingType=parseInt(listingType.value);bookingPage="explore-"+listingType}YAHOO.util.Event.onContentReady("checkHotelRates",function(){new BookingWidget("checkHotelRates",bookingCityName,bookingPage+"-main","inline")});YAHOO.util.Event.onAvailable("bookingWidgetLodging",function(){new BookingWidget("bookingWidgetLodging",bookingCityName,bookingPage+"-side","calendar-travelers")});YAHOO.util.Event.onAvailable("bookingWidgetCombo",function(){var A="";if(originAirports){A=originAirports.split(/,/)[0]}new BookingWidget("bookingWidgetCombo",bookingCityName,bookingPage+"-sideCombo","combo",A,destAirport)});YAHOO.util.Event.onAvailable("dealArea",function(){new BookingDeals("dealArea",bookingCityName,bookingGuideId,bookingPage+"-main","tabbed")});YAHOO.util.Event.onAvailable("sideDealArea",function(){new BookingDeals("sideDealArea",bookingCityName,bookingGuideId,bookingPage+"-side","combined")})});YAHOO.util.Event.onAvailable("guidePath",function(){new BreadcrumbPopup($("guidePath"),false,true);prepMhl()});function init(){registerEnter(document.form.search,doSearch);initMap();if(window.hotelGeo){initHotelMap(hotelGeo)}renderPhotos();renderResults();if(document.userForm.userType.value=="true"){var A=$("editGuideButton");if(A){A.style.display="block"}}}function renderPhotos(){if(!slideshow){initSlideshow()}}var videoReady=false;function renderVideos(){if(!videoReady){var A=videoCode.replace(/lid=17236/g,"lid="+document.form.videoId.value);$("videos").innerHTML=A;videoReady=true}photoVideoTabView.set("activeIndex",1);showHideArea("videos",true);showHideArea("photos",false)}var videoCode='<div id="widgetWrapper" style="width:300px; height:339px; font-family:\'Lucida Sans Unicode\', \'Lucida Grande\', sans-serif;"><object width="300" height="339"><param name="movie" value="http://tripfilms.s3.amazonaws.com/DestWidget.swf"></param><param name="FlashVars" value="lid=17236"></param><param name="wmode" value="transparent"></param><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"></param><embed src="http://tripfilms.s3.amazonaws.com/DestWidget.swf" FlashVars="lid=17236" type="application/x-shockwave-flash" wmode="transparent" allowFullScreen="true" allowScriptAccess="always" width="300" height="339"></embed></object><p style="font-size: 12px; width:300px; margin: 0 auto 4px;">Watch more travel videos at <a style="color: #656155; font-size: 1em; text-decoration: none; font-weight:bold;" href="http://www.tripfilms.com">www.tripfilms.com</a></p></div>';function initMap(){var B=document.form.geo.value.split(",");mapCenterLat=parseFloat(B[0]);mapCenterLng=parseFloat(B[1]);mapCenterZoom=parseInt(B[2]);var A={mapTypeId:google.maps.MapTypeId.ROADMAP,mapTypeControl:false,center:new google.maps.LatLng(mapCenterLat,mapCenterLng),zoom:mapCenterZoom};map=new google.maps.Map($("map"),A);google.maps.event.addListener(map,"click",function(){var C=document.form.mapLink.value;if(listingType){C+="?listingType="+listingType}window.location=C})}function hasFilter(){return listingType}window.onunload=function(){if(window.GUnload){GUnload()}};function openEditor(A,C,B){if(!tpl){showMoreText();$("clipGuide").style.display="none"}if(tpl){mode="section"}else{mode="guide"}addAnchor=A;if(B){sectionId=null;tplId=C;textArea=addAnchor.parentNode}else{if(C){sectionId=C;tplId=tpl;textArea=addAnchor.parentNode.parentNode.previousSibling}else{sectionId=null;if(tpl){tplId=tpl}else{tplId=null}textArea=$("textContent")?$("textContent"):$("textArea")}}if(textArea.className.match(/empty/)){textArea.innerHTML="";textArea.className=""}myControlArea=$("controlArea");if(myControlArea){myControlArea.style.display="none"}if(mode=="section"){showHideArea("addSectionArea",false)}buildEditor()}function buildEditor(B){if(editorArea){saveEditor()}if(!editorArea){editorArea=document.createElement("DIV");textArea.parentNode.insertBefore(editorArea,textArea);var A="<div id='rteArea'></div>";A+="<div style='padding:5px'><a class='main-button' href='#' onclick='saveEditor(this);return false'><span>Save</span></a><a class='main-button' href='javascript:closeEditor()'><span>Cancel</span></a></div>";editorArea.innerHTML=A;var A=textArea.innerHTML;rte=new WYSIWYG_Editor("rte",editorArea.firstChild,A,"http://ui.geckogo.com/ui/editor",380,200);rte.setModeToggle(hasUserPriv());rte.setAllowAnchors(hasUserPriv());rte.display()}textArea.style.display="none"}function saveEditor(A){requireActiveUser(function(){saveEditorNow(A)},"Please login or sign-up to edit this item.")}function saveEditorNow(B){startSpinner(B);var A="";if(document.form.sectionName){A=document.form.sectionName.value}var F=rte.getContent();textArea.innerHTML=F;var C=document.form.guide.value;var E="event=saveText&guide="+C+"&name="+encode(A)+"&text="+encode(F)+"&mode="+mode;if(tplId){E+="&tpl="+tplId}if(sectionId){E+="&section="+sectionId}YAHOO.util.Connect.asyncRequest("POST","/Guides/",saveEditorHandler,E);var D=document.getElementById("emptyTextAreaMain");if(D){D.parentNode.removeChild(D)}var D=document.getElementById("emptyTextAreaSection");if(D){D.parentNode.removeChild(D)}}var saveEditorHandler={success:function(A){var B=getElementText("status",A.responseXML);if(B=="OK"){closeEditor()}else{displaySaveFailurePrompt()}endSpinner()},failure:function(A){endSpinner();displaySaveFailurePrompt()}};function displaySaveFailurePrompt(){alert("Your changes could not be saved.  Please try again.  If the problem continues, we may be experiencing technical difficulties.  Please save your work and add it later.")}function closeEditor(){textArea.style.display="block";editorArea.parentNode.removeChild(editorArea);editorArea=null;sectionId=null;if(myControlArea){showHideArea(myControlArea,true)}if(mode=="guide"){}else{showHideArea("addSectionArea",true)}if(newSectionArea){newSectionArea.parentNode.removeChild(newSectionArea);newSectionArea=null;window.location=window.location}}function addSection(){var A=document.form.guide.value;var B="/Guides/?event=getAvailableTemplates&guide="+A+"&tpl="+tpl;YAHOO.util.Connect.asyncRequest("GET",B,getAvailableTemplateHandler)}var tpls;var getAvailableTemplateHandler={success:function(A){var G=A.responseXML.getElementsByTagName("template");var D="";tpls=new Array();for(var B=0;B<G.length;B++){var E=new Object();E.id=G[B].getAttribute("id");E.name=G[B].firstChild.data;tpls.push(E);D+="<a href='javascript:selectTemplate("+B+")'>"+E.name+"</a><br>"}D+="<a href='javascript:selectTemplate(-1)'>(New Section)</a><br>";var C=document.getElementById("selectorArea");C.style.display="";C.innerHTML=D;var F=YAHOO.util.Dom.getXY("addSectionLink");F[1]+=20;YAHOO.util.Dom.setXY("selectorArea",F)},failure:function(A){}};function selectTemplate(A){newSectionArea=document.createElement("DIV");var B=document.getElementById("mainTitleArea").parentNode;B.appendChild(newSectionArea);var C;if(A==-1){tplId=tpl;mode="addFree";C="<input type='text' size='40' name='sectionName' value='New Section'>"}else{tplId=tpls[A].id;if(tplId=="main"){tplId=tpl}mode="addFixed";C=tpls[A].name}newSectionArea.innerHTML="<div class='sectionName'>"+C+"</div><div id='newSection'></div>";showHideArea("addSectionArea",false);textArea=document.getElementById("newSection");buildEditor();var D=YAHOO.util.Dom.getXY(newSectionArea);window.scrollTo(0,D[1]-100)}function hideSelector(){var A=document.getElementById("selectorArea");A.style.display="none"}function initSlideshow(){if(!$("slideshowArea")){return }var B=window.location.search.match(/cover=true/);var A="/services/Listings?event=getInterests&mostPopular=true&mode=bigPic&guide="+document.form.guide.value;slideshow=new Slideshow(A,$("slideshowArea"),{showName:true,showLocation:(parseInt(document.form.guideType.value)!=4),showUpload:true,onEmptyResults:initSlideshowAll,showMakeCover:B})}function initSlideshowAll(){var A="/services/Photos?event=getList&guide="+document.form.guide.value;slideshow=new Slideshow(A,$("slideshowArea"),{showName:true,showFlag:true,showCredit:true,showUpload:true,showLocation:(parseInt(document.form.guideType.value)!=4)})}function addListing(C){if(C==1){window.location="/Guides?event=displayEditor&item="}else{var A=document.form.guide.value;var B;if(C){B="/ListingEditor?event=displayMainEditor&guide="+A+"&listingType="+C}else{B="/Contribute.jsp"}window.location=B}}function renderResults(){var B=$("listingsResults");if(!B){return }var G=B.childNodes;var Q=parseInt(document.form.itemIndex.value);for(var O=0;O<G.length;O++){YAHOO.util.Event.addListener(G[O],"mouseover",showResultSelected,O+Q+1);YAHOO.util.Event.addListener(G[O],"mouseout",hideResultSelected,O+Q+1)}if(map){var A=mapCenterLat,P=mapCenterLng,M=mapCenterLat,F=mapCenterLng;var K=document.form.geoResults.value.split(/;/);var Q=parseInt(document.form.itemIndex.value);for(var O=0;O<K.length;O++){var L=K[O];if(!L){break}var H=L.split(/\,/);var I={lat:parseFloat(H[0]),lng:parseFloat(H[1])};if(I.lat!=0||I.lng!=0){var N=new google.maps.LatLng(I.lat,I.lng);var E=new NumericMarker(map,N,(O+Q+1),"poi-icon-2");E.setEventHandlers(markerClickHandler,markerOverHandlerResult,markerOutHandlerResult);E.url=I.url;markers.push(E);if(I.lat<A){A=I.lat}if(I.lat>M){M=I.lat}if(I.lng<P){P=I.lng}if(I.lng>F){F=I.lng}}}var D=(A+M)/2;var R=(P+F)/2;var J=new google.maps.LatLng(A,P);var C=new google.maps.LatLng(M,F);if(markers.length>1&&parseInt(tpl)>0){map.fitBounds(new google.maps.LatLngBounds(J,C))}}}function markerClickHandler(A){}var markers=new Array();function showResultSelected(A,D){var E=parseInt(document.form.itemIndex.value);D-=E+1;var C=YAHOO.util.Dom.get("listingsResults");var B=C.childNodes[D];B.className="result result-selected clear_fix";if(map&&markers.length>0){markers[D].setMode(true)}}function hideResultSelected(A,D){var E=parseInt(document.form.itemIndex.value);D-=E+1;var C=YAHOO.util.Dom.get("listingsResults");var B=C.childNodes[D];B.className="result clear_fix";if(map&&markers.length>0){markers[D].setMode(false)}}function markerOverHandlerResult(B){showResultSelected(null,B);var A=$("listingsResults");var D=A.scrollTop;var C=(B-1)*120;if(C<D||C>D+A.offsetHeight){A.scrollTop=C}}function markerOutHandlerResult(A){hideResultSelected(null,A)}var photoUploader;function addPhoto(){var A=document.getElementById("addPhotoArea");photoUploader=makePopup(A,"Add Some Photos...");tagSelector=new TagSelector(document.postForm.tagNames,"suggestedTagArea","optionalTagArea",12)}function checkFlights(K,L,A){costClick("flight:"+A);var F=K;var H=1;var C=new Date();C.setDate(C.getDate()+30);var G=new Date();G.setDate(G.getDate()+44);var E=C.getMonth()+1;var J=C.getDate();var D=G.getMonth()+1;var I=G.getDate();var B="http://www.mobissimo.com/validate_airsearch.php?t=geckogo&Type=roundtrip&Class=economy&depCity="+F+"&retCity="+L+"&depMonth="+E+"&depDay="+J+"&retMonth="+D+"&retDay="+I+"&NumTix="+H;window.open(B,"flights")}function checkHotels(J,A){costClick("hotels:"+A);J=J.split(",");var H=J[0];var E=J[J.length-1];var C=(J.length>2)?J[1]:"";var K=1;var D=new Date();D.setDate(D.getDate()+30);var I=new Date();I.setDate(I.getDate()+44);var G=D.getMonth()+1;var M=D.getDate();var F=I.getMonth()+1;var L=I.getDate();var B="http://www.mobissimo.com/validate_hotelsearch.php?t=geckogo&Type=roundtrip&Class=economy&dest="+encode(J)+"&arrMonth="+G+"&arrDay="+M+"&depMonth="+F+"&depDay="+L+"&numRooms=1&numGuests="+K;var B="http://www.mobissimo.com/validate_hotelsearch.php?t=geckogo&Type=roundtrip&Class=economy&dest="+encode(J)+"&arrMonth="+G+"&arrDay="+M+"&depMonth="+F+"&depDay="+L+"&numRooms=1&numGuests="+K;window.open(B,"hotels")}function costClick(A){logAction("guide","lead-"+A,true)}function goHistory(){window.location="/Guides?event=displayHistory&item="+document.form.guide.value}function goEditProperties(){window.location="/Guides?event=displayEditor&guide="+document.form.guide.value}function addTip(){window.location="/AddTip.html"}function clipGuide(C,A){var D=C||document.form.guide.value;var B=A||document.form.guideName.value;clipItem(D,B,"guide")}function clipListing(B,A){clipItem(B,A,"listing")}function listingsSorted(){doFilters()};
