I have a problem where in some browsers my markers are not showing
up... so far IE only that I have seen.
Here is the code:
//<![CDATA[
//global variables
var map; //reference to
map
var markers = []; //array of markers
var lMarker = 0; //current marker
reference
var icon1; //icon for
overlays
var icon2; //custom icon 2
for overlays
if (GBrowserIsCompatible()) {
//function to create a tabbed marker and set up the
event window
function
createTabbedMarker(point,id,name,html1,html2,icon) {
var marker = new GMarker(point,
{icon: icon, title: name});
marker.tab1 = html1;
marker.tab2 = html2;
GEvent.addListener(marker, "click", function() {
if (marker.tab2) {
marker.openInfoWindowTabsHtml([new GInfoWindowTab("General
Info",html1), new GInfoWindowTab("Details",html2)]);
} else {
marker.openInfoWindowTabsHtml([new GInfoWindowTab("General
Info",html1)]);
}
});
markers[id] = marker;
return marker;
}
function loadMap(state, category, lat, lng) {
//display the map, with some controls and set
the initial
location
map = new GMap(document.getElementById("map"));
// create marker icon
icon1 = new GIcon();
icon1.image =
"http://www.bigrigbreakdowns.com/_global/images/
pinsmall.png";
//icon1.iconSize = new GSize(30, 22);
//icon.shadow =
"http://www.google.com/mapfiles/turkeyshadow.png";
icon1.iconAnchor = new GPoint(0, 28);
icon1.infoWindowAnchor = new GPoint(17, 3);
// create marker icon
icon2 = new GIcon();
icon2.image =
"http://www.bigrigbreakdowns.com/_global/images/
pinpreferred.png";
//icon1.iconSize = new GSize(30, 22);
icon2.iconAnchor = new GPoint(0, 28);
icon2.infoWindowAnchor = new GPoint(17, 3);
//add controls to map
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(lat,lng), 7);
//load clubs xml dom
var request = GXmlHttp.create();
//request.open("GET",
"http://www.bigrigbreakdowns.com/testing/
al.xml", true);
request.open("GET",
"http://www.bigrigbreakdowns.com/map-search/
xml-builder.asp?state=" + state + "&category=" + category, true);
request.onreadystatechange = function() {
if (request.readyState == 4) {
var xmlDoc =
request.responseXML;
//show all places on map
var places =
xmlDoc.documentElement.getElementsByTagName
("place");
for (var i=0; i <
places.length; i++) {
var latitude =
parseFloat(places[i].getAttribute("latitude"));
var longitude =
parseFloat(places[i].getAttribute
("longitude"));
//get location
information for place
var point = new
GLatLng(latitude, longitude);
//store place data into
local variables
var id =
places[i].getAttribute("id");
var name =
places[i].getAttribute("name");
//html for tabs
var html1 =
places[i].getAttribute("tab1");
var html2 =
places[i].getAttribute("tab2");
var html3 = "<b>" +
name + "</b><br><br>start address:<form
action='http://maps.google.com/maps' method='get'
target='_blank'><input type='text' size='40' maxlength='40'
name='saddr' id='saddr' value=''/><br><input value='get directions'
type='submit'/><input type='hidden' name='daddr' value='" + point.lat
() + "," + point.lng() + "(" + name.replace("'","") + ")" + "'/>";
var iconlevel =
places[i].getAttribute("iconlevel");
/*
//create marker, symbol
and info window, HTML, name
if (iconlevel != null)
{
var marker =
createTabbedMarker(point, id, name, html1, html2,
icon2);
}
else
{
var marker =
createTabbedMarker(point, id, name, html1, html2,
icon1);
}
*/
var marker =
createTabbedMarker(point, id, name, html1, html2,
icon1);
map.addOverlay(marker);
}
}
}
request.send(null);
}
//function picks up the sidebar click, zoom to and opens the
corresponding info window
function sidebarClick(i) {
//zoom to marker
map.setCenter(markers[i].point, 7);
//show marker info window
if (markers[i].tab2) {
markers[i].openInfoWindowTabsHtml([new
GInfoWindowTab("General
Info",markers[i].tab1), new GInfoWindowTab("Details",markers
[i].tab2)]);
} else {
markers[i].openInfoWindowTabsHtml([new
GInfoWindowTab("General
Info",markers[i].tab1)]);
}
}
}
else {
//do something here if browser is not compatible
alert("The map is not compatible with your browser");
}
//]]>
--
You received this message because you are subscribed to the Google Groups
"Google Maps API" 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-api?hl=en.