function mapClickSim(m,i){new bootstrap.Modal(document.getElementById('contentMapModal_'+m)).show();function w(){if(window.contentMaps[m]!==undefined&&typeof toggleMapIconClick==="function"&&typeof resetMarkersAndCards==="function"){resetMarkersAndCards(m);setTimeout(()=>{toggleMapIconClick(m,i,true);},500);}else{setTimeout(w,100);}} w();} function handleActionClick(e){const target=e.target.closest('[data-action]');if(!target)return;const{action,actionArgs}=target.dataset;const fn={mapClickSim}[action];fn&&fn(...actionArgs.split(',').map(Number));} if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',()=>{document.querySelectorAll('[data-action]').forEach(b=>b.addEventListener('click',handleActionClick));});}else{document.querySelectorAll('[data-action]').forEach(b=>b.addEventListener('click',handleActionClick));}function genImgContent(p,m){p=JSON.parse(p);if(Array.isArray(p[0])){let d='carousel'+Math.random().toString(36).substr(2,9);b='';for(let i=0;i`;} let c=``;return c;}else{return genImg(p,m);}} function genImg(p,m){var c=m?'w-100 h-100 object-fit-cover':'img-fluid w-100';var a=p[0];var u=`https://cdn.lazytrips.com/photos/`+a.slice(0,2)+'/'+a.slice(2,4)+'/'+a;var r=``+p[1]+``;return r;} function getNewLngLat(m,o,f){var p=m.project(new mapboxgl.LngLat(o[0],o[1]));p.x+=f.x;p.y+=f.y;return m.unproject(p);} function onMapZoom(m){console.log('fired');if(contentMaps[m]){contentMaps[m].on('zoom',function(){Object.keys(markerData[m]).forEach(function(i){var p=markerData[m][i];if(!mDev()&&p.cardInstance){var o={x:p.c.card.oX,y:p.c.card.oY};var n=getNewLngLat(contentMaps[m],p.lonLat,o);p.cardInstance.setLngLat([n.lng,n.lat]);}});});}} async function fetchRoute(d,m,i,c){const p={routeId:d};const r=await fetch('/api/request-route',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(p)});if(r.ok){const j=await r.json();if(j.response&&j.response.route){const d=JSON.parse(j.response.route);markerData[m][i].c.route.json=d;updateMapWithRoute(m,i,d,c);}}} function updateMapWithRoute(m,i,r,c){const l='iconRoute_'+m+'_'+i;const g={type:'Feature',properties:{},geometry:{type:'LineString',coordinates:r}};if(contentMaps[m].getLayer(l)){contentMaps[m].setLayoutProperty(l,'visibility','visible');contentMaps[m].getSource(l).setData(g);}else{contentMaps[m].addLayer({id:l,type:'line',source:{type:'geojson',data:g},layout:{'line-join':'round','line-cap':'round'},paint:{'line-color':c,'line-width':5,'line-opacity':0.8}});}} function hideRouteLayer(m,i){const l='iconRoute_'+m+'_'+i;if(contentMaps[m].getLayer(l)){contentMaps[m].setLayoutProperty(l,'visibility','none');}} window.toggleMapIconClick=function(m,i,e=true){if(markerData[m][i].a){return;} for(const[key,icon]of Object.entries(markerData[m])){if(parseInt(key)===i){continue;} if(icon.popupInstance){icon.popupInstance.remove();delete icon.popupInstance;} if(icon.c?.route&&contentMaps[m].getLayer('iconRoute_'+m+'_'+key)){hideRouteLayer(m,key);} if(icon.marker){icon.marker.getElement().classList.remove('markerSpanSelect');} if(icon.cardInstance){icon.cardInstance.remove();delete icon.cardInstance;} if(icon.cardOverlay){var o=icon.cardOverlay;if(o&&o.parentNode){o.parentNode.removeChild(o);delete icon.cardOverlay;}} icon.a=false;} if(!markerData[m][i].a){markerData[m][i].marker.getElement().classList.add('markerSpanSelect');if(markerData[m][i].c?.popup){const t=markerData[m][i].c.popup.title;const p=markerData[m][i].c.popup.text;let popupHTML='
';if(t){popupHTML+='

'+t+'

';} if(p){popupHTML+='

'+p+'

';} popupHTML+='
';var popup=new mapboxgl.Popup({anchor:'bottom',closeButton:false,closeOnClick:false,className:'pointer'}).setLngLat(markerData[m][i].lonLat).setHTML(popupHTML).addTo(contentMaps[m]);markerData[m][i].popupInstance=popup;popup._content.addEventListener('click',function(){toggleMapIconClick(m,i);});markerData[m][i].marker.getElement().style.display='none';} if(markerData[m][i].c?.route){const layerId='iconRoute_'+m+'_'+i;if(contentMaps[m].getLayer(layerId)){contentMaps[m].setLayoutProperty(layerId,'visibility','visible');}else{fetchRoute(markerData[m][i].c.route.id,m,i,markerData[m][i].c.route.color);}} if(markerData[m][i].c?.card){var cardContent={n:markerData[m][i].c.card.title,d:markerData[m][i].c.card.d,t:markerData[m][i].c.card.t,p:markerData[m][i].c.card.p,};if(markerData[m][i].c.card.hasOwnProperty('link')){cardContent.l=markerData[m][i].c.card.link;} if(markerData[m][i].c.card.hasOwnProperty('linkText')){cardContent.s=markerData[m][i].c.card.linkText;} if(!mDev()){var cardContentHtml=createCardContentHtml(cardContent,false);var offsets={x:markerData[m][i].c.card.oX,y:markerData[m][i].c.card.oY};var newLngLat=getNewLngLat(contentMaps[m],markerData[m][i]['lonLat'],offsets);var cardPopup=new mapboxgl.Popup({anchor:'bottom',closeButton:false,closeOnClick:false,className:'mapPopupCard'}).setHTML(cardContentHtml).setLngLat([newLngLat.lng,newLngLat.lat]).addTo(contentMaps[m]);markerData[m][i].cardInstance=cardPopup;setTimeout(()=>{if(markerData[m][i].cardInstance&&markerData[m][i].cardInstance.isOpen()){markerData[m][i].c.card.height=markerData[m][i].cardInstance.getElement().offsetHeight;}},10);}else{var cardMobile=document.createElement('div');cardMobile.className='mapPopupCardMobile';cardMobile.innerHTML=createCardContentHtml(cardContent,true);var mapContainer=contentMaps[m].getContainer();mapContainer.appendChild(cardMobile);markerData[m][i].cardOverlay=cardMobile;}} markerData[m][i].a=true;if(e){updateMapBounds(m,i);}}else{resetMarkersAndCards(m);}} window.resetMarkersAndCards=function(m){Object.keys(markerData[m]).forEach((i)=>{if(markerData[m][i].marker){markerData[m][i].marker.getElement().classList.remove('markerSpanSelect');} if(markerData[m][i].popupInstance){markerData[m][i].popupInstance.remove();delete markerData[m][i].popupInstance;} if(markerData[m][i].c&&markerData[m][i].c.route){if(contentMaps[m].getLayer('iconRoute_'+m+'_'+i)){hideRouteLayer(m,i);}} if(markerData[m][i].c&&markerData[m][i].c.card){if(markerData[m][i].cardInstance){markerData[m][i].cardInstance.remove();delete markerData[m][i].cardInstance;}} if(markerData[m][i].cardOverlay){var o=markerData[m][i].cardOverlay;if(o&&o.parentNode){o.parentNode.removeChild(o);delete markerData[m][i].cardOverlay;}} markerData[m][i].marker.getElement().style.display='block';markerData[m][i].a=false;});} function formatTime(t){const h=Math.floor(t / 60);const m=t%60;return`⏱️ ${h > 0 ? h + " hour" + (h > 1 ? "s" : "") : ""}${h > 0 && m > 0 ? ", " : ""}${m > 0 ? m + " minute" + (m > 1 ? "s" : "") : ""}`;} function createCardContentHtml(c,m){cC='';if(m){cC=' d-flex flex-row';} let h='
';if(c.p){p=genImgContent(c.p,m);h+='
'+p+'
';} if(c.n||c.d||c.t||c.l){h+='
';if(c.n){h+='
'+c.n+'
';} if(c.d){h+='
';} if(c.d){h+='
🚗 '+c.d+'
';} if(c.t){h+='
'+formatTime(c.t)+'
';} if(!m){h+='
';} if(c.l){var z=c.s||'Read more';p='';if(m){p=' pt-2';} h+='';}} if(m){h+='
';} h+='
';return h;} document.addEventListener('shown.bs.modal',function(e){if(e.target.id.startsWith('contentMapModal_')){let m=e.target.id.replace('contentMapModal_','');let t=window.contentMaps[m];if(t){setTimeout(()=>{e.target.style.borderBottom='1px solid #eee';setTimeout(()=>{e.target.style.borderBottom='';},1);},1);}}});window.addEventListener('resize',function(){document.querySelectorAll('[id^="contentMapModal_"]').forEach(p=>{if(p.classList.contains('show')){let m=p.id.replace('contentMapModal_','');let t=window.contentMaps[m];if(t){setTimeout(()=>{t.style.borderBottom='1px solid #eee';setTimeout(()=>{t.style.borderBottom='';},1);},1);}}});});function mDev(){return window.innerWidth<=768||window.innerHeight<=600;} async function updateMapBounds(m,n){const map=contentMaps[m];const oldBounds=contentMaps[m].getBounds();var T=contentMaps[m].getBounds();const D=contentMaps[m].getContainer().getBoundingClientRect();const x=markerData[m][n];const lngDiff=oldBounds.getNorthEast().lng-oldBounds.getSouthWest().lng;const latDiff=oldBounds.getNorthEast().lat-oldBounds.getSouthWest().lat;const lngPerPx=lngDiff / D.width;const latPerPx=latDiff / D.height;const U=[];var B=new mapboxgl.LngLatBounds(T.toArray());var R=new mapboxgl.LngLatBounds(T.toArray());if(!mDev()&&markerData[m][n].c.card&&markerData[m][n].a){const cP=new Promise(async(resolve)=>{const h=await new Promise(resolveHeight=>{const hInt=setInterval(()=>{let chk=markerData[m][n].c.card.height;if(chk){clearInterval(hInt);resolveHeight(chk);}},100);});const w=300;var p=15;const z=contentMaps[m].getZoom();var a=0;if(z<7){a=(8-z)*10;} const oX=markerData[m][n].c.card.oX;const oY=markerData[m][n].c.card.oY;const P=map.project(new mapboxgl.LngLat(x.lonLat[0],x.lonLat[1]));const tG=P.y+oY-h if(tG{const jR=await new Promise(resolve=>{const intervalId=setInterval(()=>{if(x.c.route.json&&Array.isArray(x.c.route.json)&&x.c.route.json.length>0){clearInterval(intervalId);resolve(true);}},100);});if(jR){const paddingRoutePixels=20;let extendWest=false,extendEast=false,extendNorth=false,extendSouth=false;x.c.route.json.forEach(coord=>{if(coord[0]R.getEast())extendEast=true;if(coord[1]>R.getNorth())extendNorth=true;if(coord[1]status)){T.extend(B.getSouthWest());T.extend(B.getNorthEast());T.extend(R.getSouthWest());T.extend(R.getNorthEast());map.fitBounds(T,{padding:0,duration:600,easing:(t)=>t*(2-t)});}}const markerConfig={'finish':{className:'marker_finish',size:[58,58],offset:[0,-29],span:false,best:false,text:false,},'start':{className:'marker_start',size:[58,58],offset:[0,-29],span:false,best:false,text:false,},'star':{className:'marker_star',size:[58,58],offset:[0,-29],span:false,best:false,text:false,},'numbered':{className:'mapMarkerNum',size:false,offset:[0,0],span:true,best:true,text:false,},'star-plain':{className:'mapMarkerNum markerSpanRed',size:false,offset:[0,0],span:true,best:false,text:'☆',},'grey':{className:'mapMarkerNum markerSpanGrey',size:false,offset:[0,0],span:true,best:false,text:false,},};function addMarkersToMap(m,f=null){Object.values(markerData[m]).forEach((i,n)=>{if(f!==null&&n'+t+'';} if(mC.width&&mC.height){el.style.width=mC.width+'px';el.style.height=mC.height+'px';} var marker=new mapboxgl.Marker(el,{offset:mC.offset}).setLngLat(i.lonLat).addTo(window.contentMaps[m]);marker.markerType=i.iconType;if(f!==null){} i.marker=marker;window.bounds[m].extend(i.lonLat);if(i.c){marker.getElement().addEventListener('click',function(){event.stopPropagation();toggleMapIconClick(m,n,true);});}});}if(typeof window.contentMaps==='undefined'){window.contentMaps={};window.initialMapBounds={};} if(typeof window.bounds==='undefined'){window.bounds={};} if(typeof window.markerData==='undefined'){window.markerData={};} if(!markerData[1]){markerData[1]={};} function initMapbox_1(){mapboxgl.accessToken='pk.eyJ1IjoibGF6eXRyaXBzIiwiYSI6ImNsaTJ4anh2MTA5NDYzZW85ODJmMm45ZzcifQ.9u5pN47V7SsoFwF6_Pw5bQ';const contentMap_1=new mapboxgl.Map({container:'contentMap_1',style:'mapbox://styles/mapbox/streets-v11',center:[-80.19198072305731,25.76175997197795],zoom:5,cooperativeGestures:false});window.contentMaps[1]=contentMap_1;if(typeof window.bounds[1]==='undefined'){window.bounds[1]=new mapboxgl.LngLatBounds();} markerData[1][0]={"lonLat":[-80.03644717510925,26.705625907740686],"type":"star-plain"};markerData[1][1]={"lonLat":[-80.03644717510925,26.705625907740686],"best":1,"time":90,"distance":70,"type":"numbered","c":{"route":{"id":1650,"color":"#fa5050"},"card":{"title":"Palm Beach","d":"70 miles","t":90,"p":"[\"dc3516fcc38ed4b36083dc56fb696207\",\"Palm-lined Worth Avenue in Palm Beach, Florida at night\"]","oX":175,"oY":0}}};markerData[1][2]={"lonLat":[-81.37859586600084,28.53826107792944],"best":2,"time":420,"distance":255,"type":"numbered","c":{"route":{"id":314,"color":"#fa5050"},"card":{"title":"Orlando","d":"255 miles","t":420,"p":"[\"7e79811f3c2e2b0891a413087c7b4e93\",\"Orlando, Florida, USA with a roller coaster in the park. Universal Studios is one of Orlando famous theme parks. Universal in Orlando, Florida on April 3, 2014\"]","oX":175,"oY":0,"link":"\/trip\/road-trip-from-miami-to-orlando","linkText":"Read more"}}};markerData[1][3]={"lonLat":[-90.12697705156188,29.92920640402969],"best":3,"time":750,"distance":860,"type":"numbered","c":{"route":{"id":505,"color":"#fa5050"},"card":{"title":"New Orleans","d":"860 miles","t":750,"p":"[\"080e7315de0c88dfe01519e4a9b694df\",\"Streetcar in downtown New Orleans, USA at twilight\"]","oX":175,"oY":0,"link":"\/trip\/road-trip-from-miami-to-new-orleans","linkText":"Read more"}}};markerData[1][4]={"lonLat":[-82.26734420637723,26.756625633422328],"best":4,"time":220,"distance":215,"type":"numbered","c":{"route":{"id":2614,"color":"#fa5050"},"card":{"title":"Boca Grande","d":"215 miles","t":220,"p":"[\"a36cf5a37d5d51bcea271e946d6e9414\",\"Aerial views of Gasparilla Island State Park on Boca Grande, Florida\"]","oX":175,"oY":0}}};markerData[1][5]={"lonLat":[-79.93134843,32.77903128],"best":5,"time":550,"distance":590,"type":"numbered","c":{"route":{"id":2610,"color":"#fa5050"},"card":{"title":"Charleston","d":"590 miles","t":550,"p":"[\"db3d648925565fabc9cfd28916e9634e\",\"View of colourful historic homes and palm trees along the waterfront on The Battery, with bright blue skies and vibrant flowers along the waterfront walkway\"]","oX":175,"oY":0}}};markerData[1][6]={"lonLat":[-84.38768202230553,33.74879465275695],"best":6,"time":590,"distance":670,"type":"numbered","c":{"route":{"id":404,"color":"#fa5050"},"card":{"title":"Atlanta","d":"670 miles","t":590,"p":"[\"b8a10c01f64d45ced6eb43c7e48a4a3b\",\"Atlanta, Georgia, USA Piedmont Park skyline in autumn on Lake Meer at dusk.\"]","oX":175,"oY":0,"link":"\/trip\/road-trip-from-miami-to-atlanta","linkText":"Read more"}}};markerData[1][7]={"lonLat":[-81.08595200414975,32.074247645290896],"best":7,"time":610,"distance":660,"type":"numbered","c":{"route":{"id":2616,"color":"#fa5050"},"card":{"title":"Savannah","d":"660 miles","t":610,"p":"[\"bc4d4266c26ef7507874be3653dfda28\",\"Historic architecture surrounding a traditional Savannah Red Trolley Tour Bus.\"]","oX":175,"oY":0,"link":"\/trip\/road-trip-from-miami-to-savannah-georgia","linkText":"Read more"}}};markerData[1][8]={"lonLat":[-80.23785009986472,25.735698026800794],"best":8,"time":20,"distance":10,"type":"numbered","c":{"route":{"id":2611,"color":"#fa5050"},"card":{"title":"Coconut Grove","d":"10 miles","t":20,"p":"[\"da15e6dfb478029134a19a2735e3a8b4\",\"Panoramic view of the Coconut Grove skyline in Miami Florida\"]","oX":175,"oY":0}}};markerData[1][9]={"lonLat":[-82.63846907880715,27.76716678464712],"best":9,"time":270,"distance":305,"type":"numbered","c":{"route":{"id":1655,"color":"#fa5050"},"card":{"title":"Tampa and St Petersburg","d":"305 miles","t":270,"p":"[\"e71cc9261d52955fbb4d971ecbc382f8\",\"St Petersburg, Florida, USA with a boardwalk to a beach the beach with stunning flowers in the foreground on a sunny day.\"]","oX":175,"oY":0}}};markerData[1][10]={"lonLat":[-75.97925421056159,36.85160351948696],"best":10,"time":870,"distance":970,"type":"numbered","c":{"route":{"id":1663,"color":"#fa5050"},"card":{"title":"Virginia Beach","d":"970 miles","t":870,"p":"[\"f4b2f5d42382c5d7a8062cd5ead4a471\",\"Fishing Pier at Sunrise at Virginia Beach, Virginia, USA. Virginia Beach, a coastal city in southeastern Virginia, lies where the Chesapeake Bay meets the Atlantic Ocean.\"]","oX":175,"oY":0}}};markerData[1][11]={"lonLat":[-83.92052666427058,35.96021217852549],"best":11,"time":790,"distance":880,"type":"numbered","c":{"route":{"id":1661,"color":"#fa5050"},"card":{"title":"Knoxville and Great Smoky Mountains","d":"880 miles","t":790,"p":"[\"f893a263d7e619f7a2ab62e6cc30ef98\",\"Chimney Tops trailhead in Fall at Great Smoky Mountains National Park, Tennessee, USA with a bridge over a river.\"]","oX":175,"oY":0}}};markerData[1][12]={"lonLat":[-81.78064788749437,24.558631171617495],"best":12,"time":210,"distance":160,"type":"numbered","c":{"route":{"id":405,"color":"#fa5050"},"card":{"title":"Key West","d":"160 miles","t":210,"p":"[\"bf04e34e354d299f0f30a20c1ccdc442\",\"Palm trees on the beach in Key West, Florida, USA on a sunny day.\"]","oX":175,"oY":0,"link":"\/trip\/road-trip-from-miami-to-key-west","linkText":"Read more"}}};markerData[1][13]={"lonLat":[-81.949102,26.562615],"best":13,"time":170,"distance":170,"type":"numbered","c":{"route":{"id":1651,"color":"#fa5050"},"card":{"title":"Fort Myers and Cape Coral","d":"170 miles","t":170,"p":"[\"e8b5f7e5bc78d4093d14107741a4516f\",\"Architecture on First Street, River District, Fort Myers, Florida, USA\"]","oX":175,"oY":0}}};markerData[1][14]={"lonLat":[-81.64499649534406,28.803266879895443],"best":14,"time":250,"distance":260,"type":"numbered","c":{"route":{"id":2613,"color":"#fa5050"},"card":{"title":"Mount Dora","d":"260 miles","t":250,"p":"[\"eb24f694f5b52a8ddd305cd333cf65e8\",\"Aerial view of Mount Dora Lighthouse, Mount Dora, Florida\"]","oX":175,"oY":0}}};markerData[1][15]={"lonLat":[-86.4955751294294,30.39348592806411],"best":15,"time":580,"distance":640,"type":"numbered","c":{"route":{"id":1657,"color":"#fa5050"},"card":{"title":"Panama City Beach and Destin","d":"640 miles","t":580,"p":"[\"352a5148f45b272261a3ddacbe34ff8e\",\"A line of people on sun loungers with umbrellas along a white sandy beach in Destin, Florida\"]","oX":175,"oY":0}}};markerData[1][16]={"lonLat":[-80.0759365762096,26.463047141089756],"best":16,"time":70,"distance":55,"type":"numbered","c":{"route":{"id":2612,"color":"#fa5050"},"card":{"title":"Delray Beach","d":"55 miles","t":70,"p":"[\"a8ce8f437cf625598c93836602af8fe0\",\"Japanese Gardens, Delray Beach, Florida with a stunning lake surrounded by the tree lined gardens with wooden bridge in the foreground.\"]","oX":175,"oY":0}}};markerData[1][17]={"lonLat":[-82.11125888694038,26.44387996013335],"best":17,"time":190,"distance":170,"type":"numbered","c":{"route":{"id":1652,"color":"#fa5050"},"card":{"title":"Sanibel Island","d":"170 miles","t":190,"p":"[\"078761036f008c3a3116e8e84a5900e7\",\"Gulf of Mexico beach at Sanibel Island Lighthouse Beach Park on Sanibel Island Florida\"]","oX":175,"oY":0}}};initialMapBounds[1]=new mapboxgl.LngLatBounds(window.bounds[1].getSouthWest(),window.bounds[1].getNorthEast());const visibleMapRoutes_1=[];contentMaps[1].on('click',(e)=>{resetMarkersAndCards(1);});onMapZoom(1);markerData[1][23]={"lonLat":[-74.00595602233604,40.71237706190573],"time":1320,"distance":1380,"type":"grey","c":{"route":{"id":307,"color":"#fa5050"},"card":{"title":"New York","d":"1,380 miles","t":1320,"p":"[\"b104eb8aa7f7acb1057d00128e790d8b\",\"Times Square, New York, at daytime with yellow taxis\"]","oX":175,"oY":0,"link":"\/trip\/road-trip-from-miami-to-new-york","linkText":"Read more"}}};markerData[1][18]={"lonLat":[-104.97601746329596,39.82472054830853],"time":2160,"distance":2300,"type":"grey","c":{"route":{"id":384,"color":"#fa5050"},"card":{"title":"Denver, Colorado","d":"2,300 miles","t":2160,"p":"[\"23c0e4c613b12804b285d5eb97bb921b\",\"Denver, Colorado, USA with a panorama of Denver skyline long exposure at twilight.\"]","oX":175,"oY":0,"link":"\/trip\/road-trip-from-miami-to-denver-colorado","linkText":"Read more"}}};markerData[1][19]={"lonLat":[-82.53634272225798,35.59658326723081],"time":930,"distance":930,"type":"grey","c":{"route":{"id":380,"color":"#fa5050"},"card":{"title":"Asheville","d":"930 miles","t":930,"p":"[\"627bc60da6822db7be932d0488dbca7f\",\"Asheville, North Carolina skyline nestled in the Blue Ridge Mountains.\"]","oX":175,"oY":0,"link":"\/trip\/road-trip-from-miami-to-asheville","linkText":"Read more"}}};markerData[1][20]={"lonLat":[-118.08444062649956,33.94163174589105],"time":2880,"distance":3130,"type":"grey","c":{"route":{"id":339,"color":"#fa5050"},"card":{"title":"Los Angeles","d":"3,130 miles","t":2880,"p":"[\"75d3df143c6f7b79ab91789b59fcb046\",\"Los Angeles, California, USA with a view of Manhattan Beach and Pier at day time with palm trees in the foreground and sea in the distance. \"]","oX":175,"oY":0,"link":"\/trip\/road-trip-from-miami-to-los-angeles","linkText":"Read more"}}};markerData[1][21]={"lonLat":[-86.72481249650357,36.1609079743936],"time":840,"distance":960,"type":"grey","c":{"route":{"id":331,"color":"#fa5050"},"card":{"title":"Nashville","d":"960 miles","t":840,"p":"[\"8b2ca6ad0a6b8733d0e3e5559e519353\",\"Nashville, Tennessee, USA with neon signs on Lower Broadway Area.\"]","oX":175,"oY":0,"link":"\/trip\/road-trip-from-miami-to-nashville","linkText":"Read more"}}};markerData[1][22]={"lonLat":[-77.0387357986456,38.90683967984401],"time":1200,"distance":1260,"type":"grey","c":{"route":{"id":311,"color":"#fa5050"},"card":{"title":"Washington DC","d":"1,260 miles","t":1200,"p":"[\"dbcd94d0f44363189f2e79a940ece447\",\"Capitol building in the background with close-up of colorful tulips on a sunny day\"]","oX":175,"oY":0,"link":"\/trip\/road-trip-from-miami-to-washington-dc","linkText":"Read more"}}};addMarkersToMap(1);contentMap_1.fitBounds(window.bounds[1],{padding:{top:60,bottom:60,left:60,right:60}});const sortByValue=document.querySelector('.cardListSortDropdown').value;sortMapMarkers(markerData,sortOptionsMap,sortByValue,1);}const sortOptionsMap={'best':'best','distance':'distanceSort',};function sortMapMarkers(markerData,sortOptionsMap,sortBy,listNum){const markersWithDistance=Object.values(markerData[listNum]).filter(marker=>marker.hasOwnProperty('distance')&&marker.hasOwnProperty('best'));const hasDistanceSort=markersWithDistance.some(marker=>marker.hasOwnProperty('distanceSort'));if(!hasDistanceSort){const sortedMarkers=markersWithDistance.sort((a,b)=>a.distance-b.distance);sortedMarkers.forEach((sortedMarker,index)=>{sortedMarker.distanceSort=index+1;});} Object.keys(markerData[listNum]).forEach(n=>{const marker=markerData[listNum][n];if(marker.hasOwnProperty('distance')&&marker.hasOwnProperty('best')){const markerElement=document.getElementById('markerSpan-'+listNum+'-'+n);if(markerElement){const propertyToUse=sortOptionsMap[sortBy]||sortBy;const v=marker[propertyToUse];if(v!==undefined){markerElement.innerHTML=v;}else{markerElement.innerHTML='';}}}});document.querySelectorAll('.cardListSortDropdown').forEach(function(dropdownUpdate){dropdownUpdate.value=sortBy;});} (function(){function iSort(){document.querySelectorAll('.cardListSortDropdown').forEach(function(dropdown){dropdown.addEventListener('change',function(){const sortBy=this.value;const listNum=this.getAttribute('data-listnum');const cardsContainer=document.querySelector('.row[data-listnum=\"'+listNum+'\"]');Array.from(cardsContainer.children).sort((a,b)=>{const aValue=parseFloat(a.getAttribute('data-'+sortBy)||Infinity);const bValue=parseFloat(b.getAttribute('data-'+sortBy)||Infinity);return aValue-bValue;}).forEach((card,index)=>{cardsContainer.appendChild(card);const titleElement=card.querySelector('.card-title');if(titleElement){const updatedTitle=titleElement.innerHTML.replace(/^\s*\d+/,index+1);titleElement.innerHTML=updatedTitle;}});sortMapMarkers(markerData,sortOptionsMap,sortBy,listNum);});});} if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',iSort);}else{iSort();}})(); var mapScriptCreated = 0; var mapCssCreated = 0; var mapScriptLoaded = 0; var mapCssLoaded = 0; var mapLoadList = []; function showLazyMap(fname) { if (mapScriptLoaded == 1 && mapCssLoaded == 1) { if (!mapLoadList.includes(fname)) { window[fname](); mapLoadList.push(fname); } } } (function fn() { var pics = document.querySelectorAll('.no-js-hide'); pics.forEach(function(pic) { pic.classList.toggle('no-js-hide'); }); var lazyImages = [].slice.call(document.querySelectorAll(".lazeeload")); if ("IntersectionObserver" in window) { const config = { root: null, rootMargin: '1000px', threshold: 0 }; let lazyImageObserver = new IntersectionObserver(function(entries, observer) { entries.forEach(function(entry) { if (entry.isIntersecting) { let lazyImage = entry.target; if (lazyImage.dataset.src) {lazyImage.src = lazyImage.dataset.src;} if (lazyImage.dataset.srcset) {lazyImage.srcset = lazyImage.dataset.srcset;} if (lazyImage.dataset.map) { const fname = "initMapbox_"+lazyImage.dataset.map; if (mapScriptLoaded == 0) { let script = document.createElement('script'); script.async=true; script.defer=true; script.src = "https://api.mapbox.com/mapbox-gl-js/v3.0.0/mapbox-gl.js"; script.onload = function(){ mapScriptLoaded = 1; showLazyMap(fname); } document.head.appendChild(script); mapScriptCreated = 1; let css = document.createElement('link'); css.rel = "stylesheet"; css.href = "https://api.mapbox.com/mapbox-gl-js/v3.0.0/mapbox-gl.css"; css.onload = function(){ mapCssLoaded = 1; showLazyMap(fname); } document.head.appendChild(css); mapCssCreated = 1; } else { if (typeof window[fname] === 'function') { window[fname](); } showLazyMap(fname); } } lazyImage.classList.remove("no-js-hide"); lazyImage.classList.remove("lazeeload"); lazyImageObserver.unobserve(lazyImage); } }); }, config); lazyImages.forEach(function(lazyImage) { lazyImageObserver.observe(lazyImage); lazyImage.classList.add("lazeeload-activated"); }); } else { let active = false; const lazyLoad = function() { if (active === false) { active = true; setTimeout(function() { lazyImages.forEach(function(lazyImage) { if ((lazyImage.getBoundingClientRect().top <= window.innerHeight+1000 && lazyImage.getBoundingClientRect().bottom >= 0) && getComputedStyle(lazyImage).display !== "none") { if (lazyImage.dataset.src) lazyImage.src = lazyImage.dataset.src; if (lazyImage.dataset.srcset) lazyImage.srcset = lazyImage.dataset.srcset; if (lazyImage.dataset.onload) lazyImage.onload = lazyImage.dataset.onload; lazyImage.classList.remove("lazeeload"); lazyImages = lazyImages.filter(function(image) { return image !== lazyImage; }); if (lazyImages.length === 0) { document.removeEventListener("scroll", lazyLoad); window.removeEventListener("resize", lazyLoad); window.removeEventListener("orientationchange", lazyLoad); } } }); active = false; }, 200); } }; document.addEventListener("scroll", lazyLoad); window.addEventListener("resize", lazyLoad); window.addEventListener("orientationchange", lazyLoad); } var lazyImages = [].slice.call(document.querySelectorAll(".lazeeload")); i=1; lazyImages.forEach(function(lazyImage) { if (!(lazyImage.classList.contains("lazeeload-activated"))) { if (lazyImage.dataset.src) lazyImage.src = lazyImage.dataset.src; if (lazyImage.dataset.srcset) lazyImage.srcset = lazyImage.dataset.srcset; lazyImage.classList.remove("lazeeload"); } }); })(); document.addEventListener('DOMContentLoaded', () => { const h = document.querySelector('header.fixed-top'), o = getComputedStyle(h).right; ['show.bs.modal', 'hidden.bs.modal'].forEach(e => document.querySelectorAll('.fullScreenModal').forEach(m => m.addEventListener(e, ev => h.style.right = ev.type === 'show.bs.modal' ? `${window.innerWidth - document.documentElement.clientWidth}px` : o))); });