function loadGoogleMapsScriptWithNoConflict(url) { const script = document.createElement("script"); script.src = url; script.async = true; script.defer = true; script.onload = function () { // Store the current global `google` object in `google_sl` if (window.google && google.maps) { window.google_sl = window.google; // Store Google Maps in custom namespace // Initialize the map using google_sl namespace if (typeof _LB_Map_ObjInfo_1.initMap === "function") { _LB_Map_ObjInfo_1.initMap(); } } else { console.error("Failed to load Google Maps API."); } }; document.head.appendChild(script); } var _LB_Map_ObjInfo_1 = {mataCatergory:[]}; var DomObj; //_LB_Map_ObjInfo_1.mataCatergory (function () { var ID = '515dbe3d-f89d-4a81-94c0-dd84fb704f1d'; var LocationID = '515dbe3d-f89d-4a81-94c0-dd84fb704f1d'; var clientId = '00000000-0000-0000-0000-000000000000'; var loadFile = "https://api.locationbank.net/storelocator/"; var Debug = 'False'; var Layout = ''; var Platform = 'web'; var bOverrideDetailURL = false; var strDetailURL = ""; var SLMPage = ''; var Unit = 'metric'; // metric impearl var AddressLayout = ''; // usa , sa , var TimeFormat = '24'; // 24 or 12 var km2mil = 1.609344 var localizeText = {"usa":{"Country":"Country","Province":"State/Region","City":"City","Area":"Area","AddressLineLocality":"Locality,AdministrativeArea"}, "default":{"Country":"Country","Province":"Province","City":"City","Area":"Area","AddressLineLocality":"Locality"}} const sliderResponsiveSettings = [ { breakpoint: 1024, settings: { slidesToShow: 3, slidesToScroll: 3, infinite: true, dots: true } }, { breakpoint: 600, settings: { slidesToShow: 2, slidesToScroll: 1 } }, { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1 } } ]; _LB_Map_ObjInfo_1.Layout = Layout; let lodIDtmp = new URLSearchParams(window.location.search).get("locationid"); if(lodIDtmp!=null){ LocationID = lodIDtmp; }else{ let lodIDtmp = new URLSearchParams(window.location.search).get("id"); if(lodIDtmp!=null){ LocationID = lodIDtmp; }else{ let store = new URLSearchParams(window.location.search).get("location"); if (store == null) { let fullUrl = window.location.href; let locationRegex = /location=([^&]+)/; let match = fullUrl.match(locationRegex); if (match && match[1]) { store = match[1]; } } if (store != null) { let apiUrl = `https://api.locationbank.net/storelocator/StoreLocatorAPI/locationIdByShortUrl?shortUrl=${store}&clientID=${ID}`; fetch(apiUrl) .then(response => { if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return response.json(); }) .then(data => { LocationID = data; }) .catch(error => { console.error('Error fetching locationId by store:', error); }); } else { let path = window.location.pathname; if(!path.endsWith("/")){ path=path+"/"; } path = window.location.origin + path; if(window.location.href.indexOf("#")!=-1){ LocationID = encodeURI( path+window.location.hash.replace("#","")).toLowerCase(); }else if(window.location.href.indexOf("?")!=-1){ LocationID = encodeURI( path+window.location.search.replace("?","")).toLowerCase(); } } } } if(SLMPage===''){ let SLMPagetmp = new URLSearchParams(window.location.search).get("SLMPage"); if(SLMPagetmp!=null){ SLMPage = SLMPagetmp; } } var mapDiv; if (window.jQuery === undefined || window.jQuery.fn.jquery !== "1.9.1") { var d = document.createElement("script"); d.setAttribute("type", "text/javascript"); d.setAttribute("src", "https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"); if (d.readyState) { d.onreadystatechange = function() { if (this.readyState == "complete" || this.readyState == "loaded") { StoreLocationLoad() } } } else { d.onload = StoreLocationLoad } (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(d) } else { DomObj = window.jQuery; StoreLocationLoadDone() } function StoreLocationLoad() { //check that viewport is set var x = document.getElementsByTagName("meta"); let bfound = false; for(let i=0;i=0; }; var ID = '515dbe3d-f89d-4a81-94c0-dd84fb704f1d'; var MainDiv = document.getElementById(ID); MainDiv.appendChild(CreateScript("https://locationbank.net/" + "lib/slick/slick.js")); MainDiv.appendChild(CreateCSS("https://locationbank.net/" + "css/publicLocationDetails.css")); MainDiv.appendChild(CreateCSS("https://locationbank.net/" + "css/bootstrap-iso.min.css")); loadGoogleMapsScriptWithNoConflict( "https://maps.googleapis.com/maps/api/js?key=AIzaSyBhXCfT3P95gZVzbNofMgsvy9vVhmRXcfE&libraries=geometry,marker" ); MainDiv.appendChild(CreateCSS("https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css")); MainDiv.appendChild(CreateCSS("https://locationbank.net/" + "lib/slick/slick-theme.min.css")); MainDiv.appendChild(CreateCSS("https://locationbank.net/" + "lib/slick/slick.min.css")); //load css createBody(); if(MainDiv.attributes.getNamedItem("data-detail-url")!=null){ bOverrideDetailURL = true; strDetailURL = MainDiv.attributes.getNamedItem("data-detail-url").value; } var node = document.createElement("div"); node.className="LB_Loading" node.innerHTML = "Loading"; MainDiv.appendChild(node); } function createBody(){ let mainWindow = `




`; DomObj( "#"+ID ).append( mainWindow ); } let layoutCSS = ""; if(_LB_Map_ObjInfo_1.Layout=="template1"){ layoutCSS = `/*template 0*/ .LB_BODY-iso .template_news {margin-left: 0px !important;} .LB_BODY-iso .template_news h4 {margin-left: 20px !important;} #LB_Details_Social {margin-left: 20px !important;} .bootstrap-iso #LB_News .slider {margin-left: 20px !important;} .bootstrap-iso #LB_News .slick-prev {left: -25px;} @media screen and (min-width: 800px) { .bootstrap-iso #LB_News .interlock .card IMG {height: 180px !important; width: auto !important;} .bootstrap-iso #LB_News .interlock {height: 260px !important; width: auto !important;} .bootstrap-iso #LB_Details_media .interlock {height: 280px !important; width: auto !important;} .bootstrap-iso #LB_Details_media .interlock IMG {height: 270px !important; width: auto !important;} }`; } if(_LB_Map_ObjInfo_1.Layout=="template2"){ layoutCSS = `/*template 1*/ .LB_BODY-iso .template_media {margin-left: 0px !important;} .LB_BODY-iso .template_media h4 {margin-left: 20px !important;} #LB_Details_media {margin-left: 20px !important;} .bootstrap-iso #LB_Details_media .slider {margin-left: 20px !important;} .bootstrap-iso #LB_Details_media .slick-prev {left: -25px;} @media screen and (min-width: 800px) { .bootstrap-iso #LB_Details_media .interlock .card IMG {height: 280px !important; width: auto !important;} .bootstrap-iso #LB_Details_media .interlock {height: 280px !important; width: auto !important;} .bootstrap-iso #LB_News .interlock {height: 280px !important; width: auto !important;} .bootstrap-iso #LB_News .interlock IMG {height: 270px !important; width: auto !important;} }@media screen and (min-width: 1024px) and (max-width: 1400px) { .bootstrap-iso #LB_Details_media .interlock .card IMG {height: 420px !important; width: auto !important;} .bootstrap-iso #LB_Details_media .interlock {height: 420px !important; width: auto !important;} .bootstrap-iso #LB_News .interlock {height: 280px !important; width: auto !important;} .bootstrap-iso #LB_News .interlock IMG {height: 270px !important; width: auto !important;} }@media screen and (min-width: 1400px) and (max-width: 1800px) { .bootstrap-iso #LB_Details_media .interlock .card IMG {height: 350px !important; width: auto !important;} .bootstrap-iso #LB_Details_media .interlock {height: 350px !important; width: auto !important;} .bootstrap-iso #LB_News .interlock {height: 280px !important; width: auto !important;} .bootstrap-iso #LB_News .interlock IMG {height: 270px !important; width: auto !important;} } `; } if(_LB_Map_ObjInfo_1.Layout=="template3"){ layoutCSS = `/*template 3*/ .LB_BODY-iso .template_news {margin-left: 0px !important;} .LB_BODY-iso .template_news h4 {margin-left: 20px !important;} #LB_Details_Social {margin-left: 20px !important;} .bootstrap-iso #LB_News .slider {margin-left: 20px !important;} .bootstrap-iso #LB_News .slick-prev {left: -25px;} @media screen and (min-width: 800px) { .bootstrap-iso #LB_News .interlock .card IMG {height: 180px !important; width: auto !important;} .bootstrap-iso #LB_News .interlock {height: 260px !important; width: auto !important;} .bootstrap-iso #LB_Details_media .interlock {height: 280px !important; width: auto !important;} .bootstrap-iso #LB_Details_media .interlock IMG {height: 270px !important; width: auto !important;} }`; } _LB_Map_ObjInfo_1.CreateCSSRules = function(){ let strStyle = ``; DomObj(strStyle).appendTo("#"+ID); _LB_Map_ObjInfo_1.slick_nextArrow=``; _LB_Map_ObjInfo_1.slick_prevArrow=``; } _LB_Map_ObjInfo_1.ShowAddressInfo = function(loc){ let address = ""; if(loc.addressLine1!==""){ address+=loc.addressLine1 + "
"; } if(loc.addressLine2!==""){ address+=loc.addressLine2 + "
"; } if(loc.subLocality!==""){ address+=loc.subLocality + "
"; } if(loc.locality!==""){ if(_LB_Map_ObjInfo_1.AddressLineLocality=="Locality,AdministrativeArea"){ if(loc.administrativeArea!=""){ address+=loc.locality + ", " +loc.administrativeArea + " " + loc.postalCode + "
" }else{ address+=loc.locality + "
"; } }else{ address+=loc.locality + "
"; } } if(loc.postalCode!=="" && _LB_Map_ObjInfo_1.AddressLineLocality!=="Locality,AdministrativeArea"){ address+=loc.postalCode + "
"; } let addressHtml=""; if(_LB_Map_ObjInfo_1.StoreLocationInfo.showDetailsAddress){ addressHtml = `
${address}
` } let serviceAreasHtml=""; if(_LB_Map_ObjInfo_1.StoreLocationInfo.showDetailsAddress){ serviceAreasHtml = `
${_LB_Map_ObjInfo_1.StoreLocationInfo.locations[0].serviceAreaPlaces}
` } let email=""; if((loc.email!=="" && loc.email!==null) && _LB_Map_ObjInfo_1.StoreLocationInfo.showDetailsEmailAddresses){ let aemail = loc.email.split(";"); let emailList = aemail.map(x=>{return `${x}`}).join(" "); email = `
${emailList}
`; } let phone = ""; let phone1 = ""; if(_LB_Map_ObjInfo_1.StoreLocationInfo.showDetailsPhoneNumber && loc.primaryPhone!=""){ phone=`
`; } if(_LB_Map_ObjInfo_1.StoreLocationInfo.showDetailsAdditionalPhone && loc.additionalPhone1!=""){ phone1=`
`; } if(_LB_Map_ObjInfo_1.StoreLocationInfo.locations[0].serviceAreaBusinessType == 2 || _LB_Map_ObjInfo_1.StoreLocationInfo.locations[0].serviceAreaBusinessType == 1) { let serviceAreas = '
'+ `

Service Areas

${serviceAreasHtml}
`; DomObj("#"+ID + " #LB_Details_Address").append(DomObj(serviceAreas)); } if(_LB_Map_ObjInfo_1.StoreLocationInfo.locations[0].serviceAreaBusinessType == 0 || _LB_Map_ObjInfo_1.StoreLocationInfo.locations[0].serviceAreaBusinessType == 1) { let contact = '
'+ `

Address

${addressHtml} ${phone} ${phone1} ${email}
`; DomObj("#"+ID + " #LB_Details_Address").append(DomObj(contact)); } let clickHander = function(e) { let href = DomObj(e.target).attr("href"); //Yep Speed Test - console.log("Click Event",e.target,href); if(typeof href!=='undefined'){ if(href.indexOf("mailto:")>=0){ _LB_Map_ObjInfo_1.analytic('email',loc.id,href); }else if(href.indexOf("tel:")>=0){ _LB_Map_ObjInfo_1.analytic('phonecall',loc.id,href); } } }; DomObj("#"+ID + " #LB_Details_Address").click(clickHander); //Event eventObject if(_LB_Map_ObjInfo_1.StoreLocationInfo.showDetailsOperatingHours){ let lastOpenDay = ""; let strHTMl= ""; let colSizeDay = "col-xs-6"; let colSizeHour = "col-xs-6"; let bisSpecialHour = false; if(loc.gmbOpenInfoStatus==="CLOSED_TEMPORARILY"){ OpenDayText="CLOSED"; Arrow=""; strHTMl+= `
` + `
${OpenDayText} ${Arrow}
` + `
`; }else{ loc.specialHours.forEach(x=>{ if(_LB_Map_ObjInfo_1.checkDateWithNoTime(x.startDate)){ let OpenDayText = x.openDay + (x.isSpecialHour?" * ":""); if(x.isSpecialHour){ bisSpecialHour = true; } if(lastOpenDay!=x.openDay){ lastOpenDay=x.openDay }else{ OpenDayText =""; } let showHide = _LB_Map_ObjInfo_1.checkNowDate(OpenDayText)?"":"hidden"; let highlight = _LB_Map_ObjInfo_1.checkNowDate(OpenDayText)?"text-success":""; let Arrow = _LB_Map_ObjInfo_1.checkNowDate(OpenDayText)?``:""; if(x.isOpen){ if(TimeFormat!="24"){ x.openTime = _LB_Map_ObjInfo_1.formate12Time(x.openTime) x.closeTime = _LB_Map_ObjInfo_1.formate12Time(x.closeTime) } strHTMl+= `
` + `
${OpenDayText} ${x.openTime} - ${x.closeTime} ${Arrow}
` + `
`; }else{ if(TimeFormat!="24"){ x.openTime = _LB_Map_ObjInfo_1.formate12Time(x.openTime) x.closeTime = _LB_Map_ObjInfo_1.formate12Time(x.closeTime) } strHTMl+= `
` + `
${OpenDayText} CLOSED ${Arrow}
` + `
`; } } }); } let specialHoursText=""; if(bisSpecialHour){ specialHoursText='*These hours differ from normal trading hours'; } let openHours = DomObj(`
${strHTMl} ${specialHoursText}
`); DomObj("#"+ID + " #LB_Details_Address").append(DomObj(openHours)); if(loc.gmbOpenInfoStatus!=="CLOSED_TEMPORARILY"){ openHours.click(function(){DomObj(this).find('.row').toggleClass('hidden');DomObj(this).find('.row.text-success').removeClass('hidden');}); } } } _LB_Map_ObjInfo_1.checkDateWithNoTime= function(FirstDate){ let myDate = new Date() let fDate = new Date(FirstDate.substr(0,10)); let sDate = new Date(myDate.getFullYear(),myDate.getMonth(), myDate.getDate()); let dateInFuture = new Date(myDate.getFullYear(),myDate.getMonth(), myDate.getDate()); // add a day dateInFuture.setDate(dateInFuture.getDate() + 7); if(fDate.getTime()>sDate.getTime()){ if(fDate.getTime()x==strDay); if(idx === nowDate.getDay()){ return true; } return false; } _LB_Map_ObjInfo_1.checkNowDateOpen = function(strDay,OpenTime,Loc){ let nowDate = new Date(); let DayArray = ["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"]; let idx = DayArray.findIndex(x=>x==strDay); if(idx === nowDate.getDay()){ if(!Loc.zoneName){ Loc.zoneName = "Africa/Johannesburg"; } if(Loc.zoneName==null){ Loc.zoneName = "Africa/Johannesburg"; } // suppose the date is 12:00 UTC var invdate = new Date(nowDate.toLocaleString('en-US', { timeZone: Loc.zoneName })); if(OpenTime.openTime==null){ return false; } let startHour = OpenTime.openTime.split(":")[0]; let endHour = OpenTime.closeTime.split(":")[0]; let startMin = OpenTime.openTime.split(":")[1]; let endMin = OpenTime.closeTime.split(":")[1]; if(invdate.getHours()>=startHour && invdate.getHours()<=endHour){ if(invdate.getHours()==startHour && invdate.getMinutes()endMin){ return false } return true } } return false; } _LB_Map_ObjInfo_1.formate12Time = function(inputTime){ if(inputTime!=null) { let hr = Number(inputTime.split(':')[0]) let min = inputTime.split(':')[1] if(hr==12){ return `${hr}:${min} AM`; } if(hr==0){ hr=12 return `${hr}:${min} PM`; } if(hr>12){ hr = hr-12 return `${hr}:${min} PM`; } return `${hr}:${min} AM`; } return "00:00"; } _LB_Map_ObjInfo_1.formatDistance = function(dInM){ let formatNumber = function(num) { return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,') } if(Unit!="metric"){ if((dInM/1000)>0){ return formatNumber(Math.round((dInM/1000)/km2mil))+" mi" }else{ return "0 mi" } } return formatNumber(Math.round(dInM/1000))+" KM" } _LB_Map_ObjInfo_1.SetGUITextLocalize = function(){ let textLoc = localizeText["default"]; if(localizeText[AddressLayout]){ textLoc = localizeText[AddressLayout]; } _LB_Map_ObjInfo_1.CountryText = textLoc["Country"]; _LB_Map_ObjInfo_1.ProvinceText = textLoc["Province"]; _LB_Map_ObjInfo_1.CityText = textLoc["City"]; _LB_Map_ObjInfo_1.AreaText = textLoc["Area"]; _LB_Map_ObjInfo_1.AddressLineLocality = textLoc["AddressLineLocality"]; } //Load Default before the client loads _LB_Map_ObjInfo_1.SetGUITextLocalize(); _LB_Map_ObjInfo_1.setLocalize = function(){ if(_LB_Map_ObjInfo_1.StoreLocationInfo.local_units){ if(_LB_Map_ObjInfo_1.StoreLocationInfo.local_units!=null && _LB_Map_ObjInfo_1.StoreLocationInfo.local_units!==""){ Unit = _LB_Map_ObjInfo_1.StoreLocationInfo.local_units } } if(_LB_Map_ObjInfo_1.StoreLocationInfo.local_addressLayout){ if(_LB_Map_ObjInfo_1.StoreLocationInfo.local_addressLayout!=null && _LB_Map_ObjInfo_1.StoreLocationInfo.local_addressLayout!==""){ AddressLayout = _LB_Map_ObjInfo_1.StoreLocationInfo.local_addressLayout } } if(_LB_Map_ObjInfo_1.StoreLocationInfo.local_timeFormat){ if(_LB_Map_ObjInfo_1.StoreLocationInfo.local_timeFormat!=null && _LB_Map_ObjInfo_1.StoreLocationInfo.local_timeFormat!==""){ TimeFormat = _LB_Map_ObjInfo_1.StoreLocationInfo.local_timeFormat } } _LB_Map_ObjInfo_1.SetGUITextLocalize(); } _LB_Map_ObjInfo_1.showGoogleMapLoad = function(StoreLocationInfo,map){ _LB_Map_ObjInfo_1.StoreLocationInfo = StoreLocationInfo; _LB_Map_ObjInfo_1.setLocalize(); DomObj("#"+ID).find(".LB_Loading").css("display","none"); if(Debug==='False'){ _LB_Map_ObjInfo_1.analytic('view',_LB_Map_ObjInfo_1.StoreLocationInfo.locations[0].id,""); } _LB_Map_ObjInfo_1.CreateCSSRules(); if(StoreLocationInfo.useCustomCSS){ DomObj("#"+ID).append(CreateCSS(`${loadFile}StoreLocatorAPI/css?clientid=${_LB_Map_ObjInfo_1.StoreLocationInfo.locations[0].clientID}`)); } let loc = StoreLocationInfo.locations[0]; let mapOptions = { mapTypeControl: false, mapId: ID }; if (!map) { map = new google_sl.maps.Map(document.getElementById(ID), mapOptions); } else { map.setOptions(mapOptions); } let hours = ""; let lastOpenDay=""; if(loc.gmbOpenInfoStatus==="CLOSED_TEMPORARILY"){ hours="Temporarily Closed"; }else{ loc.regularHours.forEach(x=>{ let OpenDayText = x.openDay; if(lastOpenDay!=x.openDay){ lastOpenDay=x.openDay }else{ OpenDayText =""; } let colSizeDay = "col-xs-6"; let colSizeHour = "col-xs-6"; if(_LB_Map_ObjInfo_1.Layout=="overandunder" || _LB_Map_ObjInfo_1.Layout=="listonly"){ colSizeDay = "col-xs-6 col-md-1 col-lg-1"; colSizeHour = "col-xs-6 col-md-4 col-lg-4"; } if(_LB_Map_ObjInfo_1.checkNowDate(OpenDayText)){ //console.log("is open on this day", _LB_Map_ObjInfo_1.checkNowDate(OpenDayText)); //console.log("curently open", _LB_Map_ObjInfo_1.checkNowDateOpen(OpenDayText,x,loc)); //console.log("show closed text", _LB_Map_ObjInfo_1.StoreLocationInfo.showClosedTimes); if(x.isOpen){ // if its open today if(_LB_Map_ObjInfo_1.checkNowDateOpen(OpenDayText,x,loc)){ // if its open now show open text and the time hours= `OPEN ${x.openTime} - ${x.closeTime}`; } else if(!_LB_Map_ObjInfo_1.checkNowDateOpen(OpenDayText,x,loc) && _LB_Map_ObjInfo_1.StoreLocationInfo.showClosedTimes){ // if its closed now and they dont want to show closed text, they want to see the hours only hours= `${x.openTime} - ${x.closeTime}`; } else { hours= `CLOSED ${x.openTime} - ${x.closeTime}`; } }else{ hours="CLOSED"; } } }); } let phone=""; let IconVisible = "visible-sm visible-xs"; let NoIconVisible = "visible-lg visible-md"; if(_LB_Map_ObjInfo_1.Layout=="template1" || _LB_Map_ObjInfo_1.Layout=="template2" || _LB_Map_ObjInfo_1.Layout=="template3" ){ IconVisible = "visible-sm visible-xs visible-lg visible-md"; NoIconVisible = "visible-xl"; } if(_LB_Map_ObjInfo_1.StoreLocationInfo.showDetailsPhoneNumber){ phone =` ${loc.primaryPhone} `; } let direction = ""; if(_LB_Map_ObjInfo_1.StoreLocationInfo.showDetailsDirections){ direction = ` Directions `; if(_LB_Map_ObjInfo_1.StoreLocationInfo.showDirections_InnerColor){ direction+=``; } } let fpr = ""; if(_LB_Map_ObjInfo_1.StoreLocationInfo.showDetailsFirstPartReview){ //https://locationbank.net/public/fpr?id=${loc.clientID}&locationID=${loc.id} fpr = ` Review `; } let cta = ""; if(_LB_Map_ObjInfo_1.StoreLocationInfo.showDetailsFirstCallToAction){ if(loc.callToAction.length > 0) { cta = ` ${loc.callToAction[0].name} `; } } let online = ""; if(_LB_Map_ObjInfo_1.StoreLocationInfo.showOrderOnline){ online = ` Order Online `; } let LocationName = `
${loc.locationName} ${hours}
${phone} ${fpr} ${online} ${cta} ${direction}
`; if(StoreLocationInfo.showDetailsBanner){ let picURL = loadFile+"StoreLocatorAPI/locationImage?clientId=00000000-0000-0000-0000-000000000000&LocationID="+loc.id+"&MediaCat="+StoreLocationInfo.detailsBannerImagesCategory+"&Rule=first"; LocationName = `
${loc.locationName} ${hours}
${phone} ${fpr} ${online} ${cta} ${direction}
`; } if(_LB_Map_ObjInfo_1.Layout=="template1" || _LB_Map_ObjInfo_1.Layout=="template2" || _LB_Map_ObjInfo_1.Layout=="template3" ){ //LocationName=`
${loc.locationName}
`; LocationName=`
${loc.locationName} ${loc.gmbOpenInfoStatus==="CLOSED_TEMPORARILY" ? "(Temporarily Closed)" : ""}
${phone} ${fpr} ${online} ${cta} ${direction}
`; } DomObj("#"+ID + " #LB_Details_Name").append(DomObj(LocationName)); if(_LB_Map_ObjInfo_1.StoreLocationInfo.showServiceMessage){ let cellService = DomObj(`
${loc.serviceMessage}
`) DomObj("#"+ID + " #LB_Details_Name").append(cellService); } if(_LB_Map_ObjInfo_1.StoreLocationInfo.showDetailsPageAllCTA) { for(var i = 0; i < loc.callToAction.length;i++) { let cellService = DomObj(`${loc.callToAction[i].name} `) DomObj("#"+ID + " #LB_Details_Name").append(cellService); } } let headerHander = function(e) { var customType = e.target.innerText.trim(); let href = DomObj(e.target).attr("href"); //Yep Speed Test - console.log("Click Event",e.target,href); if(href.indexOf("tel:")>=0){ _LB_Map_ObjInfo_1.analytic('phonecall',loc.id,href); }else if(e.target.classList[0]=='customctaclick'){ _LB_Map_ObjInfo_1.analytic('customctaclick',loc.id,href,customType); }else{ _LB_Map_ObjInfo_1.analytic('directions',loc.id,href); } }; DomObj("#"+ID + " #LB_Details_Name").click(headerHander); let markerImg = null; if (StoreLocationInfo.showClientLocationPin) { markerImg = document.createElement("img"); markerImg.src = StoreLocationInfo.clientLocationPin.url; } let bounds = new google_sl.maps.LatLngBounds(); if(loc.serviceAreaBusinessType == 1 || loc.serviceAreaBusinessType == 2) { if(loc.serviceAreaPlacesPoly) { if(loc.serviceAreaPlacesPoly.length>0){ loc.serviceAreaPlacesPoly.forEach(x=>{ let polyPath = []; let p = x.split(' '); p.forEach(z=>{ let c = z.split(','); let lat = parseFloat(parseFloat(c[1]).toFixed(6)); let lng = parseFloat(parseFloat(c[0]).toFixed(6)); let b = new google_sl.maps.LatLng(lat, lng); //console.log("lat", lat); //console.log("lng", lng); polyPath.push(b); bounds.extend(b); }); let poly = new google_sl.maps.Polygon({ paths:polyPath, strokeColor:StoreLocationInfo.serviceBaseStrokeColour, strokeOpacity:StoreLocationInfo.serviceBaseStrokeOpacity, strokeWeight:3, fillColor:StoreLocationInfo.serviceBaseFillColour, fillOpacity:StoreLocationInfo.serviceBaseFillOpacity, }); poly.setMap(map); }); } if(loc.serviceAreaBusinessType == 1){ let markers = []; let mapPosition = { lat: parseFloat(StoreLocationInfo.locations[0].latitude.toFixed(6)), lng: parseFloat(StoreLocationInfo.locations[0].longitude.toFixed(6)) }; let marker = new google_sl.maps.marker.AdvancedMarkerElement({ position: mapPosition, map: map, content: markerImg, title: StoreLocationInfo.locations[0].locationName, }); markers.push(marker); bounds.extend(marker.position); } } } else if(loc.serviceAreaBusinessType == 0) { if (parseFloat(StoreLocationInfo.locations[0].latitude).toFixed(6) != 0) { let markers = []; let mapPosition = { lat: parseFloat(StoreLocationInfo.locations[0].latitude.toFixed(6)), lng: parseFloat(StoreLocationInfo.locations[0].longitude.toFixed(6)) }; let marker = new google_sl.maps.marker.AdvancedMarkerElement({ position: mapPosition, map: map, content: markerImg, title: StoreLocationInfo.locations[0].locationName, }); markers.push(marker); bounds.extend(marker.position); } else { let markers = []; let mapPostion = { lat: bounds.getCenter().lat(), lng: bounds.getCenter().lng()}; let marker = new google_sl.maps.marker.AdvancedMarkerElement({ position: mapPostion, map: map, content: markerImg, title: StoreLocationInfo.locations[0].locationName, }); markers.push(marker); } } map.fitBounds(bounds); if(loc.serviceAreaBusinessType == 0){ map.setZoom(15); } if(StoreLocationInfo.googleMapJson && StoreLocationInfo.googleMapJson!=null) { let styledMapType = new google_sl.maps.StyledMapType(DomObj.parseJSON(StoreLocationInfo.googleMapJson)); //Associate the styled map with the MapTypeId and set it to display. map.mapTypes.set('styled_map', styledMapType); map.setMapTypeId('styled_map'); } _LB_Map_ObjInfo_1.ShowAddressInfo(StoreLocationInfo.locations[0]); _LB_Map_ObjInfo_1.createJsonLD(StoreLocationInfo.locations[0]); _LB_Map_ObjInfo_1.saveJsonLD(); } _LB_Map_ObjInfo_1.showImages = function(data){ let AboutHr = ""; if(_LB_Map_ObjInfo_1.Layout===''){ AboutHr= "
"; } let AddressPadingCSS = "AddressPadding"; if(_LB_Map_ObjInfo_1.Layout=="template2"){ AddressPadingCSS="AddressPadding3"; } //Add Description if(_LB_Map_ObjInfo_1.StoreLocationInfo.locations[0].description!=="" && _LB_Map_ObjInfo_1.StoreLocationInfo.showDetailsDescription){ DomObj("#"+ID + " #LB_Details_description").append(`${AboutHr}

About Us

${_LB_Map_ObjInfo_1.StoreLocationInfo.locations[0].description}
`); } if(_LB_Map_ObjInfo_1.StoreLocationInfo.locations[0].shortDescription!=="" && _LB_Map_ObjInfo_1.StoreLocationInfo.showDetailsShortDescription){ DomObj("#"+ID + " #LB_Details_description").append(`${AboutHr}

About Us

${_LB_Map_ObjInfo_1.StoreLocationInfo.locations[0].shortDescription}
`); } if(!_LB_Map_ObjInfo_1.StoreLocationInfo.showDetailsMedia){ DomObj( "#"+ID + " #LB_Details_media" ).hide(); DomObj( "#"+ID + " #LB_Media_hr" ).hide(); } if(data.length>0){ let someImage = ""; for(let i = 0;i
` } let img = `

Media

`; DomObj("#"+ID + " #LB_Details_media").append(DomObj(img)); if(_LB_Map_ObjInfo_1.Layout==='') { let minToShow = Math.min(data.length,_LB_Map_ObjInfo_1.StoreLocationInfo.detailsNumberMedia); if(minToShow===0){ minToShow = 3; } if(DomObj.fn.slick){ DomObj("#"+ID + " .gallery_slider").slick({ dots: true, slidesToShow: minToShow, slidesToScroll: minToShow, autoplay: true, autoplaySpeed: _LB_Map_ObjInfo_1.StoreLocationInfo.detailsMediaAutoPlaySpeed*1000, nextArrow:_LB_Map_ObjInfo_1.slick_nextArrow, prevArrow: _LB_Map_ObjInfo_1.slick_prevArrow, responsive: sliderResponsiveSettings }); }else{ window.setTimeout(function(){ DomObj("#"+ID + " .gallery_slider").slick({ dots: true, slidesToShow: minToShow, slidesToScroll: minToShow, autoplay: true, autoplaySpeed: _LB_Map_ObjInfo_1.StoreLocationInfo.detailsMediaAutoPlaySpeed*1000, nextArrow:_LB_Map_ObjInfo_1.slick_nextArrow, prevArrow: _LB_Map_ObjInfo_1.slick_prevArrow, responsive: sliderResponsiveSettings }); },6000); } }else{ DomObj("#"+ID + " .gallery_slider").slick({ dots: true, slidesToShow: 1, slidesToScroll: 1, autoplay: true, autoplaySpeed: _LB_Map_ObjInfo_1.StoreLocationInfo.detailsMediaAutoPlaySpeed*1000, nextArrow:_LB_Map_ObjInfo_1.slick_nextArrow, prevArrow: _LB_Map_ObjInfo_1.slick_prevArrow, responsive: sliderResponsiveSettings }); } DomObj("#"+ID + " #LB_Details_media .img-wrapper" ).hover( function() { DomObj(this).find(".img-overlay").animate({opacity: 1}, 600); }, function() { DomObj(this).find(".img-overlay").animate({opacity: 0}, 600); } ); //https://locationbank.net if(_LB_Map_ObjInfo_1.Layout=="template2"){ _LB_Map_ObjInfo_1.StoreLocationInfo.detailsReviewWidgetType="Slider"; _LB_Map_ObjInfo_1.StoreLocationInfo.detailsNumberReviews=1; } var $overlay = DomObj('
'); var $image = DomObj(""); var $prevButton = DomObj('
'); var $nextButton = DomObj('
'); var $exitButton = DomObj('
'); $overlay.append($image).prepend($prevButton).append($nextButton).append($exitButton); DomObj("#gallery").append($overlay); //DomObj("#"+ID).append($overlay); $overlay.hide(); DomObj(".img-overlay").click(function(event) { event.preventDefault(); var imageLocation = DomObj(this).prev().attr("href"); $image.attr("src", imageLocation); $overlay.fadeIn("slow"); _LB_Map_ObjInfo_1.analytic('media',_LB_Map_ObjInfo_1.StoreLocationInfo.locations[0].id,imageLocation); }); $overlay.click(function() { DomObj(this).fadeOut("slow"); }); $nextButton.click(function(event) { DomObj("#overlay img").hide(); var $currentImgSrc = DomObj("#overlay img").attr("src"); var $currentImg = DomObj('#image-gallery img[src="' + $currentImgSrc + '"]'); var $nextImg = DomObj($currentImg.closest(".slick-slide").next().find("img")); var $images = DomObj("#image-gallery img"); if ($nextImg.length > 0) { DomObj("#overlay img").attr("src", $nextImg.attr("src")).fadeIn(800); } else { DomObj("#overlay img").attr("src", DomObj($images[0]).attr("src")).fadeIn(800); } event.stopPropagation(); }); $prevButton.click(function(event) { DomObj("#overlay img").hide(); var $currentImgSrc = DomObj("#overlay img").attr("src"); var $currentImg = DomObj('#image-gallery img[src="' + $currentImgSrc + '"]'); var $nextImg = DomObj($currentImg.closest(".slick-slide").prev().find("img")); DomObj("#overlay img").attr("src", $nextImg.attr("src")).fadeIn(800); event.stopPropagation(); }); $exitButton.click(function() { DomObj("#overlay").fadeOut("slow"); }); } let setOptionsReview = "navigationColor="+encodeURIComponent(_LB_Map_ObjInfo_1.StoreLocationInfo.detailsReviewsNavigationColor) + "&"; setOptionsReview+= "widgetType="+encodeURIComponent(_LB_Map_ObjInfo_1.StoreLocationInfo.detailsReviewWidgetType) + "&"; setOptionsReview+= "autoPlaySpeed="+encodeURIComponent(_LB_Map_ObjInfo_1.StoreLocationInfo.detailsReviewsAutoPlaySpeed) + "&"; setOptionsReview+= "numberShow="+encodeURIComponent(_LB_Map_ObjInfo_1.StoreLocationInfo.detailsNumberReviews); if(_LB_Map_ObjInfo_1.StoreLocationInfo.showDetailsPublicReview){ let setMaxShowLen = ""; if(_LB_Map_ObjInfo_1.StoreLocationInfo.maxLengthReviews>0){ setMaxShowLen = "&MaxDisplayReviewsLen="+_LB_Map_ObjInfo_1.StoreLocationInfo.maxLengthReviews; } DomObj("#"+ID + " #LB_Details_review" ).append(`

Reviews

`); } } _LB_Map_ObjInfo_1.createSocialMedia = function(socialMedia){ let strReturn = ""; if(socialMedia==null){ return ""; } socialMedia.forEach(Social=>{ strReturn+=`` }); return strReturn; } _LB_Map_ObjInfo_1.setOrderAhead = function(orderAhead) { if(orderAhead){ if(orderAhead!=null && orderAhead!=""){ DomObj("#lb-order-ahead-big","#"+ID).attr("href",orderAhead); DomObj("#lb-order-ahead-small","#"+ID).attr("href",orderAhead); return; } } DomObj("#lb-order-ahead-big","#"+ID).hide(); DomObj("#lb-order-ahead-small","#"+ID).hide(); } _LB_Map_ObjInfo_1.createPost = function(Post) { let strReturn = ""; if(Post!==null){ Post.forEach(p=> { let style = "" let firstImg =''; if(p._MediaList!==null){ if(p._MediaList.length>0){ if(p._MediaList[0].mediaFormat==="VIDEO"){ firstImg = ``; }else{ firstImg = ``; } } }else{ if(p._LocalPost.media!==null){ if(p._LocalPost.media.length>0){ if(p._LocalPost.media[0].mediaFormat==="VIDEO"){ firstImg = ``; }else{ firstImg = ``; } } } } let href = ""; let ButtonName = "Learn More"; if(p._LocalPost){ if(p._LocalPost.callToAction){ ButtonName = p._LocalPost.callToAction.actionType; switch(p._LocalPost.callToAction.actionType){ case "SIGN_UP": ButtonName="Sign Up"; break; case "ORDER": ButtonName="Order Online"; break; case "SHOP": ButtonName="Buy"; break; case "LEARN_MORE": ButtonName="Learn More"; break; case "CALL": ButtonName="Call"; p._LocalPost.callToAction.url =`tel:${_LB_Map_ObjInfo_1.StoreLocationInfo.locations[0].primaryPhone}`; break; } if(p._LocalPost.callToAction!=null){ href = p._LocalPost.callToAction.url; } } } let actionButton = `${ButtonName}` if(href===""){ actionButton=""; } strReturn+= `
${firstImg}
${p.title}
${actionButton}
`; }); } return strReturn; } _LB_Map_ObjInfo_1.findClosest = function(nearest) { let distances = []; let closest = -1; let pos = new google_sl.maps.LatLng(parseFloat(_LB_Map_ObjInfo_1.StoreLocationInfo.locations[0].latitude).toFixed(6), parseFloat(_LB_Map_ObjInfo_1.StoreLocationInfo.locations[0].longitude).toFixed(6)) for (i = 0; i < nearest.length; i++) { var loc = nearest[i]; let marPos = new google_sl.maps.LatLng(parseFloat(loc.latitude).toFixed(6), parseFloat(loc.longitude).toFixed(6)) let d = google_sl.maps.geometry.spherical.computeDistanceBetween(marPos, pos); distances.push({d:d,km:Math.round(d/1000),index:i,Title:loc.locationName,id:loc.id, lat:parseFloat(loc.latitude).toFixed(6), long:parseFloat(loc.longitude).toFixed(6), location:loc, Pos:marPos});// = d; if (closest == -1 || d < distances[closest].d) { closest = i; distances[i].isClose = true; } } //console.log("find_closest_marker",distances); let allClose = distances.sort((x,y)=>{ if(x.dy.d){return 1;} return 0; }); //console.log("find_closest_marker",allClose); let arrReturn = []; for(let i = 0;i{ let OpenDayText = x.openDay; if(lastOpenDay!=x.openDay){ lastOpenDay=x.openDay }else{ OpenDayText =""; } let colSizeDay = "col-xs-6"; let colSizeHour = "col-xs-6"; if(_LB_Map_ObjInfo_1.Layout=="overandunder" || _LB_Map_ObjInfo_1.Layout=="listonly"){ colSizeDay = "col-xs-6 col-md-1 col-lg-1"; colSizeHour = "col-xs-6 col-md-4 col-lg-4"; } if(_LB_Map_ObjInfo_1.checkNowDate(OpenDayText)){ if(x.isOpen){ if(_LB_Map_ObjInfo_1.checkNowDateOpen(OpenDayText,x,loc)){ if(TimeFormat!="24"){ x.openTime = _LB_Map_ObjInfo_1.formate12Time(x.openTime) x.closeTime = _LB_Map_ObjInfo_1.formate12Time(x.closeTime) } hours= `OPEN ${x.openTime} - ${x.closeTime}`; }else{ if(TimeFormat!="24"){ x.openTime = _LB_Map_ObjInfo_1.formate12Time(x.openTime) x.closeTime = _LB_Map_ObjInfo_1.formate12Time(x.closeTime) } hours= `${OpenDayText} ${x.openTime} - ${x.closeTime}`; } }else{ hours= `CLOSE`; } } }); return hours; } _LB_Map_ObjInfo_1.showDetails = function(data){ let allAttributes = ""; let priceList = ""; _LB_Map_ObjInfo_1.setOrderAhead(data.orderAhead); let Post = ""; if(_LB_Map_ObjInfo_1.StoreLocationInfo.showPost){ Post =_LB_Map_ObjInfo_1.createPost(data.posts); } if(data.attributes){ if(data.attributes.length>0){ data.attributes.forEach(att=>{ allAttributes+=` ${att.attributeId} `; }); } } if(allAttributes!=="") { if(_LB_Map_ObjInfo_1.StoreLocationInfo.showDetailsAmenities){ DomObj( "#"+ID + " #LB_Details_Address" ).append(`

Amenities

${allAttributes}
`); } } let socialMedia =_LB_Map_ObjInfo_1.createSocialMedia(data.socialMedia); if(_LB_Map_ObjInfo_1.StoreLocationInfo.showSocial){ DomObj("#"+ID + " #LB_Details_Social").append(`

Social Profiles

${socialMedia}
`); let socialHander = function(e) { //let href = DomObj(e.target).attr("href"); _LB_Map_ObjInfo_1.analytic('socialprofile',_LB_Map_ObjInfo_1.StoreLocationInfo.locations[0].id,""); }; DomObj("#"+ID + " #LB_Details_Social").click(socialHander) } if(Post!=""){ let style =""; if(_LB_Map_ObjInfo_1.Layout===''){ style="ml mr" } let postHeader=`

News Feed

${Post}
`; DomObj( "#"+ID + " #LB_News" ).append(postHeader); let postHander = function(e) { //e.preventDefault(); let href = DomObj(e.target).attr("href"); _LB_Map_ObjInfo_1.analytic('post',_LB_Map_ObjInfo_1.StoreLocationInfo.locations[0].id,href); }; DomObj( "#"+ID + " #LB_News" ).find(".interlock").click(postHander); if(_LB_Map_ObjInfo_1.Layout===''){ let minToShow = Math.min(data.posts.length,_LB_Map_ObjInfo_1.StoreLocationInfo.detailsNumberPost); if(minToShow === 0){ minToShow = 3; } if(minToShow === 1){ DomObj(".news-feed-container .slick-track").css("margin-left","0"); DomObj(".bootstrap-iso .news-feed-container .news-image-wrap").addClass("single-image"); } DomObj("#"+ID + " .news-feed-container").slick({ dots: true, nextArrow:_LB_Map_ObjInfo_1.slick_nextArrow, prevArrow: _LB_Map_ObjInfo_1.slick_prevArrow, slidesToShow: minToShow, slidesToScroll: minToShow, autoplay: true, autoplaySpeed: _LB_Map_ObjInfo_1.StoreLocationInfo.detailsPostAutoPlaySpeed*1000, responsive: sliderResponsiveSettings }); }else{ DomObj("#"+ID + " .news-feed-container").slick({ dots: true, nextArrow:_LB_Map_ObjInfo_1.slick_nextArrow, prevArrow: _LB_Map_ObjInfo_1.slick_prevArrow, slidesToShow: minToShow, slidesToScroll: minToShow, autoplay: true, autoplaySpeed: _LB_Map_ObjInfo_1.StoreLocationInfo.detailsPostAutoPlaySpeed*1000, responsive: sliderResponsiveSettings }); } DomObj("#"+ID + " #LB_News .interlock " ).hover( function() { DomObj(this).find(".img-overlay").animate({opacity: 1}, 600); }, function() { DomObj(this).find(".img-overlay").animate({opacity: 0}, 600); } ); var $overlay = DomObj('
'); var $image = DomObj(""); var $prevButton = DomObj('
'); var $nextButton = DomObj('
'); var $exitButton = DomObj('
'); $overlay.append($image).prepend($prevButton).append($nextButton).append($exitButton); DomObj("#newsGallary").append($overlay); //DomObj("#"+ID).append($overlay); $overlay.hide(); DomObj(".card .img-overlay").click(function(event) { event.preventDefault(); var imageLocation = DomObj(this).prev().attr("src"); $image.attr("src", imageLocation); $overlay.fadeIn("slow"); _LB_Map_ObjInfo_1.analytic('post',_LB_Map_ObjInfo_1.StoreLocationInfo.locations[0].id,imageLocation); }); $overlay.click(function() { DomObj(this).fadeOut("slow"); }); $nextButton.click(function(event) { DomObj("#newsOverlay img").hide(); var $currentImgSrc = DomObj("#newsOverlay img").attr("src"); var $currentImg = DomObj('#image-gallery img[src="' + $currentImgSrc + '"]'); var $nextImg = DomObj($currentImg.closest(".slick-slide").next().find("img")); var $images = DomObj("#image-gallery img"); if ($nextImg.length > 0) { DomObj("#newsOverlay img").attr("src", $nextImg.attr("src")).fadeIn(800); } else { DomObj("#newsOverlay img").attr("src", DomObj($images[0]).attr("src")).fadeIn(800); } event.stopPropagation(); }); $prevButton.click(function(event) { DomObj("#newsOverlay img").hide(); var $currentImgSrc = DomObj("#newsOverlay img").attr("src"); var $currentImg = DomObj('#image-gallery img[src="' + $currentImgSrc + '"]'); var $nextImg = DomObj($currentImg.closest(".slick-slide").prev().find("img")); DomObj("#newsOverlay img").attr("src", $nextImg.attr("src")).fadeIn(800); event.stopPropagation(); }); $exitButton.click(function() { DomObj("#newsOverlay").fadeOut("slow"); }); }else{ DomObj( "#"+ID + " #LB_News" ).hide(); DomObj( "#"+ID + " #LB_News_hr" ).hide(); //DomObj( "#"+ID + " #LB_Details_media" ).removeClass("col-sm-6 col-md-6 col-6 "); //DomObj( "#"+ID + " #LB_Details_media" ).addClass("center-block"); } //DomObj( "#"+ID + " #LB_Details_Address" ).append(`${priceList}`); if(data.nearest && _LB_Map_ObjInfo_1.StoreLocationInfo.showDetailsNearByLocation){ let nearest3 = data.nearest; let getURL = function(nearestLocation){ let backURL ="" if(SLMPage!=""){ backURL = "&SLMPage=" + encodeURI(SLMPage) } let locationNameUrl = "loc="+encodeURI(nearestLocation.locationName); let detailsPageView = `/public/TestLocationDetails?${locationNameUrl}&id=${nearestLocation.id}&clientid=${nearestLocation.clientID}`; let detailsPageReplaceDetails=locationNameUrl+"&locationid="+encodeURI(nearestLocation.id); if(nearestLocation.storeLocatorDetailsShortURL && nearestLocation.storeLocatorDetailsShortURL!==null && nearestLocation.storeLocatorDetailsShortURL !=="" && _LB_Map_ObjInfo_1.StoreLocationInfo.useShortUrls){ detailsPageReplaceDetails = nearestLocation.storeLocatorDetailsShortURL if(_LB_Map_ObjInfo_1.StoreLocationInfo.detailViewUrl.indexOf('?')>=0){ _LB_Map_ObjInfo_1.StoreLocationInfo.detailViewUrl=_LB_Map_ObjInfo_1.StoreLocationInfo.detailViewUrl.replace("?","/"); } } else if(nearestLocation.storeLocatorDetailsShortURL && nearestLocation.storeLocatorDetailsShortURL!==null && nearestLocation.storeLocatorDetailsShortURL !=="" && _LB_Map_ObjInfo_1.StoreLocationInfo.enableShortUrls){ detailsPageReplaceDetails = `?location=${nearestLocation.storeLocatorDetailsShortURL}`; } if(Debug==='False'){ if(Platform=="web"){ if(_LB_Map_ObjInfo_1.StoreLocationInfo.detailViewUrl){ if(_LB_Map_ObjInfo_1.StoreLocationInfo.detailViewUrl!==null){ detailsPageView = _LB_Map_ObjInfo_1.StoreLocationInfo.detailViewUrl.replace("locationid={locationid}",detailsPageReplaceDetails); } } }else{ if(_LB_Map_ObjInfo_1.StoreLocationInfo.detailView_app_Url){ if(_LB_Map_ObjInfo_1.StoreLocationInfo.detailView_app_Url!==null){ detailsPageView = _LB_Map_ObjInfo_1.StoreLocationInfo.detailView_app_Url.replace("locationid={locationid}",detailsPageReplaceDetails)+ backURLEncode; } } } if(bOverrideDetailURL==true) { detailsPageView = strDetailURL.replace("locationid={locationid}",detailsPageReplaceDetails)+ backURLEncode; } if(bOverrideDetailURL==true && _LB_Map_ObjInfo_1.StoreLocationInfo.useShortUrls) { detailsPageView = strDetailURL.replace("locationid={locationid}",detailsPageReplaceDetails); } if (nearestLocation.storeLocatorDetailsShortURL && nearestLocation.storeLocatorDetailsShortURL !== null && nearestLocation.storeLocatorDetailsShortURL !== "" && _LB_Map_ObjInfo_1.StoreLocationInfo.enableShortUrls && !_LB_Map_ObjInfo_1.StoreLocationInfo.useShortUrls) { detailsPageView = detailsPageView.replace(/\/+\?|^\?+|\?+/, "?"); if(detailsPageView.indexOf('??')>=0){ detailsPageView = detailsPageView.replace("??","?"); } } } return detailsPageView; } if(data.nearest.length>3){ nearest3 = _LB_Map_ObjInfo_1.findClosest(data.nearest); } if(nearest3.length==0){ nearest3 = [{locationName:"",addressLine1:"",OpenTime:"",atag:"",endTag:""}, {locationName:"",addressLine1:"",OpenTime:"",atag:"",endTag:""}, {locationName:"",addressLine1:"",OpenTime:"",atag:"",endTag:""}]; }else if(nearest3.length==1){ nearest3 = [{locationName:nearest3[0].locationName,addressLine1:nearest3[0].addressLine1, OpenTime:_LB_Map_ObjInfo_1.findClosestTime(nearest3[0]), atag:``,endTag:""}, {locationName:"",addressLine1:"",OpenTime:"",atag:"",endTag:""}, {locationName:"",addressLine1:"",OpenTime:"",atag:"",endTag:""}]; }else if(nearest3.length==2){ nearest3 = [{locationName:nearest3[0].locationName,addressLine1:nearest3[0].addressLine1, OpenTime:_LB_Map_ObjInfo_1.findClosestTime(nearest3[0]), atag:``,endTag:""}, {locationName:nearest3[1].locationName,addressLine1:nearest3[1].addressLine1, OpenTime:_LB_Map_ObjInfo_1.findClosestTime(nearest3[1]), atag:``,endTag:""}, {locationName:"",addressLine1:"",OpenTime:"",atag:"",endTag:""}]; }else if(nearest3.length==3){ nearest3 = [{locationName:nearest3[0].locationName,addressLine1:nearest3[0].addressLine1, OpenTime:_LB_Map_ObjInfo_1.findClosestTime(nearest3[0]), atag:``,endTag:""}, {locationName:nearest3[1].locationName,addressLine1:nearest3[1].addressLine1, OpenTime:_LB_Map_ObjInfo_1.findClosestTime(nearest3[1]), atag:``,endTag:""}, {locationName:nearest3[2].locationName,addressLine1:nearest3[2].addressLine1, OpenTime:_LB_Map_ObjInfo_1.findClosestTime(nearest3[2]), atag:``,endTag:""}]; } let firstLocation = `
${nearest3[0].atag}

${nearest3[0].locationName}

${nearest3[0].addressLine1}
${nearest3[0].OpenTime}
${nearest3[0].endTag}
`; let SecondLocation = `
${nearest3[1].atag}

${nearest3[1].locationName}

${nearest3[1].addressLine1}
${nearest3[1].OpenTime}
${nearest3[1].endTag}
`; let ThirdLocation = `
${nearest3[2].atag}

${nearest3[2].locationName}

${nearest3[2].addressLine1}
${nearest3[2].OpenTime}
${nearest3[1].endTag}
`; let backButton = `Find more`; if(SLMPage!=""){ backButton = `Find more`; } let nearestHTML = `

Nearby Locations

${firstLocation} ${SecondLocation} ${ThirdLocation}
${backButton}`; DomObj( "#"+ID + " #LB_Nearby_locations" ).append(nearestHTML); }else{ DomObj( "#"+ID + " #LB_Nearby_hr").hide(); DomObj( "#"+ID + " #LB_Nearby_locations").hide(); } } _LB_Map_ObjInfo_1.initMap = function() { if (!window.google_sl || !google_sl.maps) { console.error("Google Maps is not properly initialized."); return; } _LB_Map_ObjInfo_1.map = new google_sl.maps.Map(document.getElementById("LB_MAP_"+ID), { center: {lat: -34.397, lng: 150.644}, zoom: 1, mapId: ID }); _LB_Map_ObjInfo_1.isLoaded=true; setTimeout(function() { DomObj.ajax({url:loadFile+"StoreLocatorAPI/location?LocationID="+LocationID + "&clientID="+ID, success: function(result){ LocationID= result.locations[0].id; _LB_Map_ObjInfo_1.showGoogleMapLoad(result,_LB_Map_ObjInfo_1.map); let detailsImage = result.imagesCategory; let MediaCat2="",MediaCat3=""; if(result.detailsImagesCategory){ if(result.detailsImagesCategory!==null){ if(result.detailsImagesCategory!==""){ detailsImage = result.detailsImagesCategory; } } } if(result.detailsImagesCategory2){ if(result.detailsImagesCategory2!==null){ if(result.detailsImagesCategory2!==""){ MediaCat2= "&MediaCat2="+result.detailsImagesCategory2; } } } if(result.detailsImagesCategory3){ if(result.detailsImagesCategory3!==null){ if(result.detailsImagesCategory3!==""){ MediaCat3= "&MediaCat3="+result.detailsImagesCategory3; } } } DomObj.ajax({url:loadFile+"StoreLocatorAPI/locationImageList?ClientID="+ID+"&LocationID="+LocationID +"&MediaCat=" + detailsImage + MediaCat2+ MediaCat3, success: function(result){ _LB_Map_ObjInfo_1.showImages(result); DomObj.ajax({url:loadFile+"StoreLocatorAPI/locationDetails?LocationID="+LocationID+"&ClientID="+ID, success: function(result){ _LB_Map_ObjInfo_1.showDetails(result); }}); }}); }}); }, 2000); } _LB_Map_ObjInfo_1.JsonLD=[]; _LB_Map_ObjInfo_1.createJsonLD = function(locinfo){ if(!locinfo.imageUrlLogo_Medium){ locinfo.imageUrlLogo_Medium = null; } if(!locinfo.price){ locinfo.price = null; } _LB_Map_ObjInfo_1.JsonLD.push({ "@context": "https://schema.org/", "@type": "LocalBusiness", "address": { "@type": "PostalAddress", "addressLocality": locinfo.locality, "addressRegion": locinfo.administrativeArea, "postalCode": locinfo.postalCode, "streetAddress": locinfo.addressLine1 }, "name": locinfo.locationName, "telephone": locinfo.primaryPhone, "url": locinfo.websiteUrl, "image":locinfo.imageUrlLogo_Medium==null?"":locinfo.imageUrlLogo_Medium, "priceRange": locinfo.price==null?"":locinfo.price, }); } _LB_Map_ObjInfo_1.saveJsonLD = function(){ let head = (document.getElementsByTagName("head")[0] || document.documentElement); _LB_Map_ObjInfo_1.JsonLD.forEach(x=>{ var d = document.createElement("script"); d.setAttribute("type", "application/ld+json"); d.innerHTML+=JSON.stringify(x) + "," head.appendChild(d) }); } /////////////////////////////////////////////////////////////// _LB_Map_ObjInfo_1.analytic = function(type='',locationID='',context='',customType=''){ type = encodeURI(type); locationID = encodeURI(locationID); let analyticClientId = '00000000-0000-0000-0000-000000000000'; context = encodeURI(context); DomObj.ajax({url:loadFile+`StoreLocatorAnalyticsAPI/save?ClientID=${analyticClientId}&type=${type}&locationid=${locationID}&contex=${context}&customType=${customType}`, success: function(result){ //do nothing }}); } function CreateScript(url){ var mapDom = document.createElement("script"); mapDom.src = url; return mapDom; } function CreateCSS(url){ var css = document.createElement("link"); css.href = url; css.rel="stylesheet"; css.type="text/css"; //css.rel="preload"; return css; } function CreateScriptWithOnLoad(url,onload){ var mapDom = document.createElement("script"); mapDom.src = url; mapDom.onload = onload; return mapDom; } function bps_isMobile(){ return window.outerWidth<=768?true:false }; })();