Note: I removed function definitions in the prologue as the snippet was too long for the forum.
function wagmp_map_1() {
if(GBrowserIsCompatible()) {
if(!document.getElementById('wagmp_map_1')) return false;
var map = new GMap2(document.getElementById('wagmp_map_1'));
wagmp_map_1_obj = new WAMapRef(map);
map.enableContinuousZoom();
map.enableDoubleClickZoom();
map.addControl(new GSmallMapControl());
var geocoder = new GClientGeocoder();
var fromAddress = {
enabled: false,
street: '',
city: '',
state: '',
zip: '',
country: '',
full: ''
};
var icon_0 = new GIcon();
icon_0.image = 'plugins/google_javascript/images/traditionalflat_pacifica.png';
icon_0.shadow = 'google_javascript/images/traditionalflat_shadow.png';
icon_0.iconSize = new GSize(34,35);
icon_0.shadowSize = new GSize(34,35);
icon_0.iconAnchor = new GPoint(9,33);
icon_0.infoWindowAnchor = new GPoint(19,0);
icon_0.printImage = 'plugins/google_javascript/images/traditionalflat_pacifica.gif';
icon_0.mozPrintImage = 'plugins/google_javascript/images/traditionalflat_pacifica_mozprint.png';
icon_0.printShadow = 'google_javascript/images/traditionalflat_shadow.gif';
icon_0.transparent = 'google_javascript/images/traditionalflat_pacifica_transparent.png';
<?php $Google_recordset_id = 0; ?>
<?php do { ?>
var address_0_<?php echo $Google_recordset_id; ?> = {
street: '<?php echo str_replace("'", "\'", "".$row_Google_recordset['business_address'] .""); ?>',
city: '<?php echo str_replace("'", "\'", "".$row_Google_recordset['city'] .""); ?>',
state: '<?php echo str_replace("'", "\'", "".$row_Google_recordset['state'] .""); ?>',
zip: '<?php echo str_replace("'", "\'", "".$row_Google_recordset['zip'] .""); ?>',
country: '',
infowindow: 'custom',
infowindowtext: '<span style="font: 12px Verdana, Arial, Helvetica, sans-serif; color: black;"><?php echo str_replace("'", "\'", "<strong>Reported Merchant:</strong><br />".$row_Google_Recordset['business_name'] ."<br />".$row_Google_recordset['business_address'] ."<br />".$row_Google_recordset['city'] .", ".$row_Google_recordset['state'] ." ".$row_Google_recordset['zip'] .""); ?></span>',
full: '<?php echo str_replace("'", "\'", "".$row_Google_recordset['business_address'] .""); ?>, <?php echo str_replace("'", "\'", "".$row_Google_recordset['city'] .""); ?>, <?php echo str_replace("'", "\'", "".$row_Google_recordset['state'] .""); ?>, <?php echo str_replace("'", "\'", "".$row_Google_recordset['zip'] .""); ?>',
isdefault: true,
addressType: 'address',
loop: 'Google_recordset',
latitude: '',
longitude: '',
markerStyle: 'Google Traditional (flat)',
markerColor: 'Pacifica'
};
if (address_0_<?php echo $Google_recordset_id; ?>.addressType == "coordinates") {
var cacheReturn = '';
} else {
var cacheReturn = searchCache(address_0_<?php echo $Google_recordset_id; ?>.full, address_0_<?php echo $Google_recordset_id; ?>.zip);
}
if (cacheReturn != "" || (address_0_<?php echo $Google_recordset_id; ?>.addressType == "coordinates")) {
if(address_0_<?php echo $Google_recordset_id; ?>.addressType == "coordinates") {
var latitude = address_0_<?php echo $Google_recordset_id; ?>.latitude;
var longitude = address_0_<?php echo $Google_recordset_id; ?>.longitude;
} else {
var latitude = cacheReturn.substring(1,cacheReturn.indexOf(",")-1);
var longitude = cacheReturn.substring(cacheReturn.indexOf(",")+1,(cacheReturn.length)-1);
}
var point = new GLatLng(latitude, longitude);
if (point && !isNaN(latitude)) {
wagmp_map_1_obj.addressFailed = false;
var marker_0_<?php echo $Google_recordset_id; ?> = new GMarker(point, icon_0);
GEvent.addListener(marker_0_<?php echo $Google_recordset_id; ?>, 'click', function() {
marker_0_<?php echo $Google_recordset_id; ?>.openInfoWindowHtml(address_0_<?php echo $Google_recordset_id; ?>.infowindowtext);
});
if(!fromAddress.enabled || 'address_0_<?php echo $Google_recordset_id; ?>' != 'address_0_0') {
if('address_0_<?php echo $Google_recordset_id; ?>' == 'address_0_0')
map.setCenter(point, 13);
map.addOverlay(marker_0_<?php echo $Google_recordset_id; ?>);
map.setZoom(12);
if('address_0_<?php echo $Google_recordset_id; ?>' == 'address_0_0')
marker_0_<?php echo $Google_recordset_id; ?>.openInfoWindowHtml(address_0_<?php echo $Google_recordset_id; ?>.infowindowtext);
}
wagmp_map_1_obj.markers.push(marker_0_<?php echo $Google_recordset_id; ?>);
wagmp_map_1_obj.addresses.push(address_0_<?php echo $Google_recordset_id; ?>);
wagmp_map_1_obj.icons.push(icon_0);
wagmp_map_1_obj.points.push(point);
} else {
if (wagmp_map_1_obj.addressFailed) {
map.setCenter(new GLatLng(30, -98), 3);
}
wagmp_map_1_obj.addressFailed = true;
}
} else if (address_0_<?php echo $Google_recordset_id; ?>.addressType == "address") {
geocoder.getLatLng (
address_0_<?php echo $Google_recordset_id; ?>.full,
function(point) {
if(point) {
this.addressFailed = false;
addToCache(address_0_<?php echo $Google_recordset_id; ?>.full, '', point);
var marker_0_<?php echo $Google_recordset_id; ?> = new GMarker(point, icon_0);
GEvent.addListener(marker_0_<?php echo $Google_recordset_id; ?>, 'click', function() {
marker_0_<?php echo $Google_recordset_id; ?>.openInfoWindowHtml(address_0_<?php echo $Google_recordset_id; ?>.infowindowtext);
});
if(!fromAddress.enabled || 'address_0_<?php echo $Google_recordset_id; ?>' != 'address_0_0') {
if('address_0_<?php echo $Google_recordset_id; ?>' == 'address_0_0')
map.setCenter(point, 13);
map.addOverlay(marker_0_<?php echo $Google_recordset_id; ?>);
if('address_0_<?php echo $Google_recordset_id; ?>' == 'address_0_0')
marker_0_<?php echo $Google_recordset_id; ?>.openInfoWindowHtml(address_0_<?php echo $Google_recordset_id; ?>.infowindowtext);
}
wagmp_map_1_obj.markers.push(marker_0_<?php echo $Google_recordset_id; ?>);
wagmp_map_1_obj.addresses.push(address_0_<?php echo $Google_recordset_id; ?>);
wagmp_map_1_obj.icons.push(icon_0);
wagmp_map_1_obj.points.push(point);
} else {
var noZipAddress = address_0_<?php echo $Google_recordset_id; ?>.full.replace((address_0_<?php echo $Google_recordset_id; ?>.zip+','), '');
geocoder.getLatLng (noZipAddress,
function(point) {
if(point) {
wagmp_map_1_obj.addressFailed = false;
addToCache(address_0_<?php echo $Google_recordset_id; ?>.full, address_0_<?php echo $Google_recordset_id; ?>.zip, point);
var marker_0_<?php echo $Google_recordset_id; ?> = new GMarker(point, icon_0);
GEvent.addListener(marker_0_<?php echo $Google_recordset_id; ?>, 'click', function() {
marker_0_<?php echo $Google_recordset_id; ?>.openInfoWindowHtml(address_0_<?php echo $Google_recordset_id; ?>.infowindowtext);
});
if (!fromAddress.enabled || 'address_0_<?php echo $Google_recordset_id; ?>' != 'address_0_0') {
if('address_0_<?php echo $Google_recordset_id; ?>' == 'address_0_0')
map.setCenter(point, 13);
map.addOverlay(marker_0_<?php echo $Google_recordset_id; ?>);
if('address_0_<?php echo $Google_recordset_id; ?>' == 'address_0_0')
marker_0_<?php echo $Google_recordset_id; ?>.openInfoWindowHtml(address_0_<?php echo $Google_recordset_id; ?>.infowindowtext);
}
wagmp_map_1_obj.markers.push(marker_0_<?php echo $Google_recordset_id; ?>);
wagmp_map_1_obj.addresses.push(address_0_<?php echo $Google_recordset_id; ?>);
wagmp_map_1_obj.icons.push(icon_0);
wagmp_map_1_obj.points.push(point);
} else {
if (wagmp_map_1_obj.addressFailed) {
map.setCenter(new GLatLng(30, -98), 3);
}
wagmp_map_1_obj.addressFailed = true;
}
}
);
}
}
);
}
<?php $Google_recordset_id++; ?>
<?php } while ($row_Google_recordset = mysql_fetch_assoc($Google_recordset)); ?>
<?php mysql_data_seek($Google_recordset, 0); ?>
}
}