Store Locator | PastureRX™ (2024)

' } else { storeimage = "" } if (phone != "") { phone = ' Tel: ' + phone + '
' } else { phone = "" } if (url != 0) { url = '
' + urltext + '
' } else { url = "" } if (extra != 0) { extra = '
' + extra + '
' } else { extra = "
" } createMarkerload(latlng, name, address, city, state, zip, country, distance, url, urltext, phone, email, extra, iconmarker, storeimage); } }); } function searchLocations() { document.getElementById("map").style.display = 'block'; var address = document.getElementById("addressInput").value; var geocoder = new google.maps.Geocoder(); geocoder.geocode({address: address}, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { searchLocationsNear(results[0].geometry.location); } else { alert(address + ' not found'); } }); } //Removes all loaded markers and sidebar entries function clearLocations() { infoWindow.close(); for (var i = 0; i < markers439.length; i++) { markers439[i].setMap(null); } markers439.length = 0; } function searchLocationsNear(center, address) { clearLocations(); var radius = document.getElementById('radiusSelect').value; var sidebar = document.getElementById('map_sidebar'); var e = document.getElementById('hwGroups'); var cat = e.options[e.selectedIndex].value; sidebar.innerHTML = ''; var sidebar_header = document.getElementById('map_sidebar_header'); sidebar_header.innerHTML = ''; var searchUrl = 'https://www.pasturerx.com/hwstorelocation' searchUrl += '/storesearch?lat=' + center.lat() + '&lng=' + center.lng() + '&radius=' + radius + '&units=' + units; searchUrl += '&cat=' + cat; //alert(searchUrl); downloadUrl(searchUrl, function (data) { var xml = parseXml(data); var markerNodes = xml.documentElement.getElementsByTagName('marker'); var bounds = new google.maps.LatLngBounds(); //Add the Home marker point = new google.maps.LatLng(center.lat(), center.lng()); bounds.extend(point); var homeMarker = new google.maps.Marker({ map: map439, position: point, shadow: shadow, icon: gGreenIcon }); var html = '

Your Location:
' + document.getElementById("addressInput").value; +'

'; google.maps.event.addListener(homeMarker, 'click', function () { infoWindow.setContent(html); infoWindow.open(map439, homeMarker); }); markers439.push(homeMarker); //end of adding the home marker for (var i = 0; i < markerNodes.length; i++) { var name = markerNodes[i].getAttribute("name"); var address = markerNodes[i].getAttribute("address"); var city = markerNodes[i].getAttribute("city"); var state = markerNodes[i].getAttribute("state"); var zip = markerNodes[i].getAttribute("zip"); var country = markerNodes[i].getAttribute("country"); var email = markerNodes[i].getAttribute("email"); var distance = parseFloat(markerNodes[i].getAttribute("distance")); var latlng = new google.maps.LatLng( parseFloat(markerNodes[i].getAttribute("lat")), parseFloat(markerNodes[i].getAttribute("lng"))); var url = markerNodes[i].getAttribute('url'); var urltext = markerNodes[i].getAttribute('urltext'); var extra = markerNodes[i].getAttribute('extra'); var storeimage = markerNodes[i].getAttribute('storeimage'); var storeicon = markerNodes[i].getAttribute('markericon'); var groupicon = markerNodes[i].getAttribute('fID'); var storegroup = markerNodes[i].getAttribute('groupname') if (groupicon != 0) { iconmarker = groupicon; } else if (storeicon != 0) { iconmarker = storeicon } else { iconmarker = gRedIcon; } //If url is missing http:// then add it first check to see if there is a web address if not ignore. if (url.length > 0) { if (url.indexOf("http://") == -1) { url = "http://" + url; } } var phone = markerNodes[i].getAttribute('phone'); if (urltext.length == 0) { urltext = 'Visit Dealer's Website'; } if (storeimage != 0) { storeimage = '

Store Locator | PastureRX™ (1)

' } else { storeimage = "" } if (phone != "") { phone = ' Phone: ' + phone + '
' } else { phone = "" } if (url != 0) { url = '
' + urltext + '
' } else { url = "" } if (extra != 0) { extra = '
' + extra + '
' } else { extra = "
" } var gcategory = new Array(); gcategory = storegroup.split(","); for (var j = 0; j < gcategory.length; j++) { var category = gcategory[j]; if (category == cat || category == "") { createMarker(latlng, i, name, address, city, state, zip, country, distance, url, urltext, phone, email, extra, iconmarker, storeimage); bounds.extend(latlng); } } } if (markers439.length == 1) { //changed from 0 to 1 to include search a marker. 14/03/2013 sidebar.innerHTML = '

No results found with the Radius of (' + radius + ' ' + units + ')
Please increase your search radius

'; return; } map439.fitBounds(bounds); }); } function createMarkerload(latlng, name, address, city, state, country, zip, distance, url, urltext, phone, email, extra, iconmarker, storeimage) { var directions_url = 'http://maps.google.com/maps?saddr=' + address_from + '&daddr=' + address + ' ' + city + ' ' + state + ' ' + zip + ' ' + country;// var html = ' ' + storeimage + '' + name + '
' + address + '
' + city + '
' + state + '
' + zip + '
' + country + ' ' + url + ' ' + phone + ' ' + email + ' ' + extra; var html = '

'+name+'

'; html += '

'+address+'
'+city+', '+state+' '+zip+'

'; html += '

'+distance.toFixed(1)+units+' Get Directions

'; html += '

'; html += phone; // html += 'Email Dealer '; html += url; html += '

'; var marker = new google.maps.Marker({ map: map439, position: latlng, icon: iconmarker }); google.maps.event.addListener(marker, 'click', function () { infoWindow.setContent(html); infoWindow.open(map439, marker); }); markers439.push(marker); } //Function add markers to the map function createMarker(latlng, idx, name, address, city, state, country, zip, distance, url, urltext, phone, email, extra, iconmarker, storeimage) { var address_from = document.getElementById("addressInput").value; var directions_url = 'http://maps.google.com/maps?saddr=' + address_from + '&daddr=' + address + ' ' + city + ' ' + state + ' ' + zip + ' ' + country;// var html = ' ' + storeimage + '' + name + '
' + address + '
' + city + '
' + state + '
' + zip + '
' + country + ' ' + url + ' ' + phone + ' ' + email + ' ' + extra + ' //'; var html = '

'+name+'

'; html += '

'+address+'
'+city+', '+state+' '+zip+'

'; html += '

'+distance.toFixed(1)+units+' Get Directions

'; html += '

'; html += phone; // html += 'Email Dealer '; html += url; html += '

'; var marker = new google.maps.Marker({ map: map439, position: latlng, icon: iconmarker }); google.maps.event.addListener(marker, 'click', function () { infoWindow.setContent(html); infoWindow.open(map439, marker); }); google.maps.event.addListener(marker, 'mouseover', function () { marker.setAnimation(google.maps.Animation.BOUNCE); }); google.maps.event.addListener(marker, 'mouseout', function () { marker.setAnimation(null); }); markers439.push(marker); var sidebarEntry = makeSidebar(marker, idx, name, address, city, state, country, zip, distance, url, urltext, phone, email, extra); var sidebar = document.getElementById('map_sidebar'); sidebar.appendChild(sidebarEntry); } //Creates the Sidebar function makeSidebar(marker, idx, name, address, city, state, country, zip, distance, url, urltext, phone, email, extra) { var address_from = document.getElementById("addressInput").value; var sidebar = document.getElementById('map_sidebar'); var div = document.createElement('div'); var directions_url = 'http://maps.google.com/maps?saddr=' + address_from + '&daddr=' + address + ' ' + city + ' ' + state + ' ' + zip + ' ' + country; //var html = '' + name + ' (' + distance.toFixed(1) + units + ')
' + address + ', ' + city + ', ' + state + ', ' + zip + ', ' + country + '
' + urltext + '' + '
' + phone + '' + email + '
Directions'; var html = '

'; html += '

'+(idx+1)+'

'; html += '

'; html += '

'+name+'

'; html += '

'+address+'
'+city+', '+state+' '+zip+'

'; html += '

'+distance.toFixed(1)+units+' Get Directions

'; html += '

'; html += phone; // html += 'Email Dealer '; html += url; html += extra; html += '

'; html += '

'; html += '

'; html += '

'; div.innerHTML = html; google.maps.event.addDomListener(div, 'click', function () { google.maps.event.trigger(marker, 'click'); }); google.maps.event.addDomListener(div, 'mouseover', function () { google.maps.event.trigger(marker, 'mouseover'); }); google.maps.event.addDomListener(div, 'mouseout', function () { google.maps.event.trigger(marker, 'mouseout'); }); return div; } function downloadUrl(url, callback) { var request = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest; request.onreadystatechange = function () { if (request.readyState == 4) { request.onreadystatechange = doNothing; callback(request.responseText, request.status); } }; request.open('GET', url, true); request.send(null); } function parseXml(str) { if (window.ActiveXObject) { var doc = new ActiveXObject('Microsoft.XMLDOM'); doc.loadXML(str); return doc; } else if (window.DOMParser) { return (new DOMParser).parseFromString(str, 'text/xml'); } } function doNothing() { } //]]>

Store Locator | PastureRX™ (2024)
Top Articles
Latest Posts
Article information

Author: Gov. Deandrea McKenzie

Last Updated:

Views: 6256

Rating: 4.6 / 5 (66 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Gov. Deandrea McKenzie

Birthday: 2001-01-17

Address: Suite 769 2454 Marsha Coves, Debbieton, MS 95002

Phone: +813077629322

Job: Real-Estate Executive

Hobby: Archery, Metal detecting, Kitesurfing, Genealogy, Kitesurfing, Calligraphy, Roller skating

Introduction: My name is Gov. Deandrea McKenzie, I am a spotless, clean, glamorous, sparkling, adventurous, nice, brainy person who loves writing and wants to share my knowledge and understanding with you.