");
infowindow.open(map,this);
});
})(marker,i);
fulllist = "
"+
""+content[i].latitude+""+
""+content[i].longitude+""+
""+content[i].title+"
"+
""+
""+
"";
contentPane.append(fulllist);
}
}
}
});
});
jQuery("#wk_sl_search_button").click(function(e){
ShowMapLocationPassed();
});
function ShowMapLocationPassed(){
contentPane.empty();
jQuery("#wk_sl_loader").show();
jQuery.ajax({
url: "https://resurgencegear.com/storelocator/storelocator/getnearplace/?amp=1",
type: "POST",
dataType: "json",
data: {
geocode: {lat:lat,lng:lng},
add : jQuery("#wk_sl_search_input").val(),
pro : jQuery("#wk_sl_search_select").val(),
radious:jQuery('.radious').val(),
distance_in:jQuery('.distance_in').val()},
success: function(content) {
contentPane.empty();
if(content['sellerstore'].length == 0)
contentPane.append("
Sorry Didn't Found Your Store");
else{
/*center = new google.maps.LatLng(results[0].geometry.location.lat(),results[0].geometry.location.lng());
settings.center = center;*/
map = new google.maps.Map(document.getElementById("wk_sl_map_container"),settings);
if(typeof(cityCircle)!='undefined'){
cityCircle.setMap(null);
}
if(lat=='x'){
if(content['status']['status']==1){
lat=content['status']['lat'];
lng=content['status']['lng'];
}
}
if(lat !='x'){
map.setCenter(new google.maps.LatLng(lat,lng));
var unit=jQuery('.distance_in').val()=='km'?1000:1609.34;
var populationOptions = {
strokeColor: '#FF0000',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#FF0000',
fillOpacity: 0.35,
map: map,
center: new google.maps.LatLng(lat,lng),
radius: jQuery('.radious').val() * unit,
};
// Add the circle for this city to the map.
cityCircle = new google.maps.Circle(populationOptions);
map.setZoom(8);
}else{
map.setZoom(2);
}
var count = 65;
content=content['sellerstore'];
var iconBase = 'http://resurgencegear.com/map/';
for (var i = 0; i < content.length; i++) {
var letter = String.fromCharCode(count++);
var markerIcon = iconBase + 'marker.png';
var marker = new google.maps.Marker({
position: new google.maps.LatLng(content[i].latitude,content[i].longitude),
map: map,
title: content[i].title,
icon: markerIcon
});
markers[i] = marker;
(function(marker, i) {
google.maps.event.addListener(marker,"click",function() {
infowindow.setContent("
");
infowindow.open(map,this);
});
})(marker,i);
fulllist = "
"+
""+content[i].latitude+""+
""+content[i].longitude+""+
""+content[i].title+"
"+
""+content[i].address + content[i].locality+"
"+
""+
"";
contentPane.append(fulllist);
}
}
lat='x';
lng='x';
jQuery("#wk_sl_loader").hide();
}
});
}
function showcontent(link,title,address,marker) {
infowindow.setContent("
"+(marker+1)+". "+title+"
"+address+""+link+"");
infowindow.open(map,markers[marker]);
map.setZoom(10);
}
function onPlaceChanged() {
var place = autocomplete.getPlace();
if (place.geometry) {
map.panTo(place.geometry.location);
lat=place.geometry.location.lat();
lng=place.geometry.location.lng();
ShowMapLocationPassed();
} else {
document.getElementById('wk_sl_search_input').placeholder = 'Enter a city';
}
}
function initialize() {
autocomplete = new google.maps.places.Autocomplete((document.getElementById('wk_sl_search_input')),{
types: ['geocode']
//types: ['(cities)'],
});
google.maps.event.addListener(autocomplete, 'place_changed', onPlaceChanged);
}
google.maps.event.addDomListener(window, 'load', initialize);