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){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:[-99.26887400753637,34.934983806306484],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":[-77.03658923,38.90252109],"type":"star-plain"};markerData[1][1]={"lonLat":[-74.008510487421,40.713790716511426],"best":1,"time":300,"distance":280,"type":"numbered","c":{"route":{"id":625,"color":"#fa5050"},"card":{"title":"New York City","d":"280 miles","t":300,"p":"[\"b104eb8aa7f7acb1057d00128e790d8b\",\"Times Square, New York, at daytime with yellow taxis\"]","oX":175,"oY":0,"link":"\/trip\/road-trip-from-washington-dc-to-new-york-city","linkText":"Read more"}}};markerData[1][2]={"lonLat":[-75.164936,39.953779],"best":2,"time":150,"distance":139,"type":"numbered","c":{"route":{"id":1890,"color":"#fa5050"},"card":{"title":"Philadelphia","d":"139 miles","t":150,"p":"[\"166eabb9ca851bf5ec93ae5d84d04754\",\"Independence Hall and statue of George Washington in Philadelphia, Pennsylvania\"]","oX":175,"oY":0,"link":"\/trip\/road-trip-from-washington-dc-to-philadelphia","linkText":"Read more"}}};markerData[1][3]={"lonLat":[-76.614445,39.292058],"best":3,"time":60,"distance":39,"type":"numbered","c":{"route":{"id":1886,"color":"#fa5050"},"card":{"title":"Baltimore","d":"39 miles","t":60,"p":"[\"713c98933c812f6329d75bb0d9cc9d2e\",\"Baltimore, Maryland, USA taken at the Inner Harbor at sunset with a colorful sky and city skyline in the distance. \"]","oX":175,"oY":0}}};markerData[1][4]={"lonLat":[-79.03770269230469,43.097017596243454],"best":4,"time":460,"distance":480,"type":"numbered","c":{"route":{"id":611,"color":"#fa5050"},"card":{"title":"Niagara Falls","d":"480 miles","t":460,"p":"[\"f13bcdbaf8fa0ce0cddbee95e58bba47\",\"Niagara Falls\"]","oX":-175,"oY":-60,"link":"\/trip\/road-trip-from-washington-dc-to-niagara-falls","linkText":"Read more"}}};markerData[1][5]={"lonLat":[-76.492318,38.978392],"best":5,"time":45,"distance":32,"type":"numbered","c":{"route":{"id":1885,"color":"#fa5050"},"card":{"title":"Annapolis","d":"32 miles","t":45,"p":"[\"8a9887e49c4003b6664b47498f60f4ed\",\"Annapolis Main Street with the State House in the background, Maryland\"]","oX":175,"oY":0}}};markerData[1][6]={"lonLat":[-80.006173,40.452831],"best":6,"time":240,"distance":245,"type":"numbered","c":{"route":{"id":1896,"color":"#fa5050"},"card":{"title":"Pittsburgh","d":"245 miles","t":240,"p":"[\"19af5953cd443b8a8ddcc68b0a07d8ac\",\"The Allegheny and Monongahela Rivers join at the start of the Ohio River in Pittsburgh, Pennsylvania\"]","oX":-175,"oY":0}}};markerData[1][7]={"lonLat":[-71.0598385035527,42.359809037103865],"best":7,"time":450,"distance":440,"type":"numbered","c":{"route":{"id":597,"color":"#fa5050"},"card":{"title":"Boston","d":"440 miles","t":450,"p":"[\"a42ca94d4f3b0e7180f5cf69305c4882\",\"Downtown Boston with the Faneuil Hall and Quincy Market at dusk.\"]","oX":175,"oY":0,"link":"\/trip\/road-trip-from-washington-to-boston","linkText":"Read more"}}};markerData[1][8]={"lonLat":[-86.77839918,36.16284013],"best":8,"time":740,"distance":765,"type":"numbered","c":{"route":{"id":1489,"color":"#fa5050"},"card":{"title":"Nashville","d":"765 miles","t":740,"p":"[\"18961df38307ae40717ae0f6b467ccac\",\"Honky-tonks on Lower Broadway with illuminations and bright signs advertising country music entertainment, Nashville, USA\"]","oX":-175,"oY":0,"link":"\/trip\/road-trip-from-washington-dc-to-nashville","linkText":"Read more"}}};markerData[1][9]={"lonLat":[-87.629802,41.878133],"best":9,"time":730,"distance":745,"type":"numbered","c":{"route":{"id":1487,"color":"#fa5050"},"card":{"title":"Chicago","d":"745 miles","t":730,"p":"[\"be57a52b6b13596d16249772f2470a1b\",\"Chicago River with boats and traffic in Downtown Chicago\"]","oX":-175,"oY":0,"link":"\/trip\/road-trip-from-washington-dc-to-chicago","linkText":"Read more"}}};markerData[1][10]={"lonLat":[-75.075286,38.341312],"best":10,"time":170,"distance":146,"type":"numbered","c":{"route":{"id":1892,"color":"#fa5050"},"card":{"title":"Ocean City","d":"146 miles","t":170,"p":"[\"157367a5800531e44a8a0886e512bf90\",\"Visitors flock to the very popular beach at Ocean City during the summer in Maryland\"]","oX":175,"oY":0}}};markerData[1][11]={"lonLat":[-71.950604,41.050564],"best":11,"time":390,"distance":360,"type":"numbered","c":{"route":{"id":1899,"color":"#fa5050"},"card":{"title":"Tour of Long Island, Wineries, and Montauk","d":"360 miles","t":390,"p":"[\"c2ffe01359cbaf072ae9662b100b0386\",\"Montauk Lighthouse right at the end of Long Island, New York\"]","oX":175,"oY":0}}};markerData[1][12]={"lonLat":[-83.234824,35.785633],"best":12,"time":480,"distance":500,"type":"numbered","c":{"route":{"id":3909,"color":"#fa5050"},"card":{"title":"Great Smoky Mountains","d":"500 miles","t":480,"p":"[\"7f583b2000a3d35d1da35d63ad246f37\",\"Autumn Scenics in the Great Smoky Mountains National Park\"]","oX":175,"oY":0}}};markerData[1][13]={"lonLat":[-84.40918111241112,33.76220371500808],"best":13,"time":630,"distance":640,"type":"numbered","c":{"route":{"id":2198,"color":"#fa5050"},"card":{"title":"Atlanta","d":"640 miles","t":630,"p":"[\"45ebd08dd7233f0e61a2a82aacefb8b0\",\"Outside of the National Craft Gallery, Kilkenny\"]","oX":-175,"oY":0,"link":"\/trip\/road-trip-from-washington-dc-to-atlanta","linkText":"Read more"}}};markerData[1][14]={"lonLat":[-77.44121,37.543273],"best":14,"time":110,"distance":109,"type":"numbered","c":{"route":{"id":1888,"color":"#fa5050"},"card":{"title":"Richmond","d":"109 miles","t":110,"p":"[\"f8cecdda86bc459af2b74da2d0022a45\",\"Main Street Station is one of many amazing architectural gems in Richmond, Virginia\"]","oX":-175,"oY":360}}};markerData[1][15]={"lonLat":[-74.423806,39.367798],"best":15,"time":195,"distance":190,"type":"numbered","c":{"route":{"id":1893,"color":"#fa5050"},"card":{"title":"Atlantic City","d":"190 miles","t":195,"p":"[\"de1c0fcba419b1596b80036ec2d03610\",\"Atlantic City's Boardwalk and Steel Pier on a sunny day in New Jersey\"]","oX":175,"oY":0}}};markerData[1][16]={"lonLat":[-78.8881702918808,33.69127767727745],"best":16,"time":630,"distance":530,"type":"numbered","c":{"route":{"id":79,"color":"#fa5050"},"card":{"title":"Myrtle Beach","d":"530 miles","t":630,"p":"[\"78786ec684fc2471c2e47ac6d55bad2c\",\"Myrtle Beach, South Carolina, USA city skyline.\"]","oX":-175,"oY":0,"link":"\/trip\/road-trip-from-washington-dc-to-myrtle-beach","linkText":"Read more"}}};markerData[1][17]={"lonLat":[-77.41233996578922,39.4147549110934],"best":17,"time":58,"distance":45,"type":"numbered","c":{"route":{"id":2168,"color":"#fa5050"},"card":{"title":"Frederick","d":"45 miles","t":58,"p":"[\"61e2c1224f4427e7379469299acf49fa\",\"Sunrise over Carroll Creek in downtown Frederick, Maryland.\"]","oX":-175,"oY":0}}};markerData[1][18]={"lonLat":[-78.638407,35.806744],"best":18,"time":255,"distance":278,"type":"numbered","c":{"route":{"id":1897,"color":"#fa5050"},"card":{"title":"Raleigh","d":"278 miles","t":255,"p":"[\"3558a7c31067037ca5e1481820b62b29\",\"Downtown Raleigh, North Carolina from behind the George Washington statue at the State Capitol\"]","oX":-175,"oY":0}}};markerData[1][19]={"lonLat":[-70.25582320134356,43.662588748055605],"best":19,"time":820,"distance":670,"type":"numbered","c":{"route":{"id":2197,"color":"#fa5050"},"card":{"title":"Portland","d":"670 miles","t":820,"p":"[\"c85ab4595c639ee15fdf1d491360ce9c\",\"The Portland Breakwater Light (also called Bug Light) is a small lighthouse in South Portland, Maine,United States.The lighthouse winter view after snow with blue sky background.\"]","oX":175,"oY":0,"link":"\/trip\/road-trip-from-washington-dc-to-portland-maine","linkText":"Read more"}}};markerData[1][20]={"lonLat":[-73.875368,42.23549],"best":20,"time":360,"distance":320,"type":"numbered","c":{"route":{"id":1898,"color":"#fa5050"},"card":{"title":"Delaware River, Callicoon, and the Catskills","d":"320 miles","t":360,"p":"[\"b834a8ea3a5f05b6fdfb0eef7e8aed1d\",\"The rolling hills of the Catskills around Pepacton Reservoir at sunset in upstate New York\"]","oX":175,"oY":0}}};markerData[1][21]={"lonLat":[-77.741757,39.325073],"best":21,"time":75,"distance":67,"type":"numbered","c":{"route":{"id":1887,"color":"#fa5050"},"card":{"title":"Harpers Ferry","d":"67 miles","t":75,"p":"[\"41f0e1ea40e30221671c49c6838705eb\",\"The historic houses and shops along High Street in Harpers Ferry, West Virginia\"]","oX":-175,"oY":0}}};markerData[1][22]={"lonLat":[-78.191819,38.906949],"best":22,"time":210,"distance":175,"type":"numbered","c":{"route":{"id":1894,"color":"#fa5050"},"card":{"title":"Skyline Drive through Shenandoah National Park","d":"175 miles","t":210,"p":"[\"457929cca10be161543b50020804d6e4\",\"Skyline Drive in Virginia winding through the beautiful Shenandoah National Park.\"]","oX":-175,"oY":0}}};markerData[1][23]={"lonLat":[-75.047236,38.548845],"best":23,"time":165,"distance":141,"type":"numbered","c":{"route":{"id":1891,"color":"#fa5050"},"card":{"title":"Bethany Beach and Rehoboth Beach","d":"141 miles","t":165,"p":"[\"f30f70291b33b648fc32a48bfeff1b33\",\"White benches on the boardwalk overlooking Rehoboth Beach in Delaware.\"]","oX":175,"oY":0}}};markerData[1][24]={"lonLat":[-81.113407,32.107767],"best":24,"time":520,"distance":575,"type":"numbered","c":{"route":{"id":1903,"color":"#fa5050"},"card":{"title":"Savannah","d":"575 miles","t":520,"p":"[\"84fcf00a943ddd2de4724809a626c6cb\",\"Historic houses lining Forsyth Park with grand live oak trees, in Savannah, Georgia\"]","oX":-175,"oY":0}}};markerData[1][25]={"lonLat":[-79.797387,37.825997],"best":25,"time":120,"distance":106,"type":"numbered","c":{"route":{"id":1889,"color":"#fa5050"},"card":{"title":"George Washington and Jefferson National Forests and the Appalachian Trail","d":"106 miles","t":120,"p":"[\"2eee20d51d7f51ff3d8d4ae0a7201118\",\"Sunset in the Appalachian Mountains in Virginia in George Washington and Jefferson National Forest\"]","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);});markerData[1][31]={"lonLat":[-81.37622112324105,28.543651055388157],"time":870,"distance":900,"type":"grey","c":{"route":{"id":302,"color":"#fa5050"},"card":{"title":"Orlando","d":"900 miles","t":870,"p":"[\"0d2151513ce3f1893cb87cdb49e79e44\",\"Orlando, Florida, USA at Universal studios city walk with a view of the Lighthouse, entrance to Islands of Adventure.\"]","oX":-175,"oY":0,"link":"\/trip\/road-trip-from-washington-dc-to-orlando","linkText":"Read more"}}};markerData[1][26]={"lonLat":[-80.908243,36.568838],"time":1050,"distance":610,"type":"grey","c":{"route":{"id":1904,"color":"#fa5050"},"card":{"title":"Blue Ridge Parkway","d":"610 miles","t":1050,"p":"[\"24024ee74f9935c086d8d204799b9758\",\"Snow-capped mountains in Liechtenstein's Malbun ski resort\"]","oX":-175,"oY":0}}};markerData[1][27]={"lonLat":[-80.18735439207644,25.760438861660205],"time":1110,"distance":1160,"type":"grey","c":{"route":{"id":440,"color":"#fa5050"},"card":{"title":"Miami","d":"1,160 miles","t":1110,"p":"[\"fb1d77b79a09308ab3215a7f54530019\",\"Aerial view of Miami Beach, South Beach, Florida, USA on a sunny day.\"]","oX":-175,"oY":0,"link":"\/trip\/road-trip-from-washington-dc-to-miami","linkText":"Read more"}}};markerData[1][28]={"lonLat":[-90.07153325914618,29.95091298165949],"time":1140,"distance":1260,"type":"grey","c":{"route":{"id":622,"color":"#fa5050"},"card":{"title":"New Orleans","d":"1,260 miles","t":1140,"p":"[\"7e58459094b5d8c8ca1df18cac1d7442\",\"Ornate wrought iron balconies with hanging plants in New Orleans' French Quarter, Louisiana\"]","oX":-175,"oY":0,"link":"\/trip\/road-trip-from-washington-dc-to-new-orleans","linkText":"Read more"}}};markerData[1][29]={"lonLat":[-118.24272356049656,34.05493795520103],"time":2460,"distance":2755,"type":"grey","c":{"route":{"id":1050,"color":"#fa5050"},"card":{"title":"Los Angeles","d":"2,755 miles","t":2460,"p":"[\"53b9204feda6e0291893ec381b433e40\",\"Beautiful cloudy day of Los Angeles downtown skyline and palm trees in foreground\"]","oX":-175,"oY":0,"link":"\/trip\/road-trip-from-washington-dc-to-los-angeles","linkText":"Read more"}}};markerData[1][30]={"lonLat":[-122.433002,37.776324],"time":2820,"distance":3000,"type":"grey","c":{"route":{"id":1036,"color":"#fa5050"},"card":{"title":"San Francisco","d":"3,000 miles","t":2820,"p":"[\"d571266a4bc99e1108d4d7101384fada\",\"Golden Gate Bridge, San Francisco, USA at sunset.\"]","oX":-175,"oY":0,"link":"\/trip\/road-trip-from-washington-dc-to-san-francisco","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=(index+1)+titleElement.innerHTML.replace(/^\d+\./,'.');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))); });