function codeAddress(data){
var data = data;
var address = document.getElementById("address").value;
geocoder.geocode({
'address': address
},
function(results, status, data) {
if(status === google.maps.GeocoderStatus.OK){
map.setCenter(results[0].geometry.location);
map.setZoom(10);
}
});
var infoWindow = new google.maps.InfoWindow();
var markerBounds = new google.maps.LatLngBounds();
function makeMarker(options,data){
var pushPin = new google.maps.Marker({map:map});
pushPin.setOptions(options);
google.maps.event.addListener(pushPin, "click", function(){
infoWindow.setOptions(options);
infoWindow.open(map, pushPin);
var pushtitle = pushPin.title;
/*SHOW STORE FROM DATABASE SIDEBAR*/
if (pushtitle===""){
document.getElementById("side_bar").innerHTML="<h1>This will display
active Jobs for each Location.<\/h1>";
return;
}
if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera,
Safari
xmlhttp=new XMLHttpRequest();
}else{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState===4 && xmlhttp.status===200 &&
xmlhttp.responseText!=="" && xmlhttp.responseText!==null){
document.getElementById("side_bar").innerHTML=xmlhttp.responseText;
}else{
document.getElementById("side_bar").innerHTML="<h1>This will
display active Jobs for each Location.<\/h1>";
}
};
xmlhttp.open("GET","job_list.php?store_location="+pushtitle,true);
xmlhttp.send();
});
markerBounds.extend(options.position);
markerArray.push(pushPin);
return pushPin;
}
google.maps.event.addListener(map, "click", function(){
infoWindow.close();
});
google.maps.event.addListener(map, "load", function(){
infoWindow.close();
});
for (i = 0; i < data.length; i++) {
/*REMOVE MARKER WHEN NEW ONE IS SELECTED */
if (markersArray) {
for (i in markersArray) {
markersArray[i].setMap(null);
}
markersArray.length = 0;
}
makeMarker({
position: new google.maps.LatLng(data[i].latitude,data[i].longitude),
title:data[i].storeNumber,
content:
'<h1 class="firstHeading">'+ data[i].storeName +'<\/h1>'+
'<div id="bodyContent">'+
'<p>'+ data[i].address +' <br \/>'+
'Phone: '+ data[i].phone +' <br \/>'+
'<a
href=\"http://maps.google.com/maps?saddr='+address+'&daddr='+data[i].storeName+'
'+data[i].address+'\" target=_blank>Get Directions</a><\/p>'+
'<\/div>',
animation: google.maps.Animation.DROP
});
I tried implementing just this to get rid of the radius idea. To bring in
all my markers and zoom in on the zip code with geolocation the problem is
having function setinfoContent(str, locInfoRel){ and function
codeAddress(data){ as separate functions because it won't clear my markers
info windows between the two.
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.