<div class="gmnoprint" style="position: absolute; left: -21px; top: -104px;"> <div class="gmnoprint" style="position: relative; left: 0px; top: 0px; z-index: 10; width: 690px; height: 135px;">......
Try this -
The snippet is great and working fine on my site now. But i want to make a long list of markers. Can anyone modify the snippet so a dropdownlist will appear (instead of a long list of markers)?
$script .= '
// arrays to hold copies of the markers and html used by the sidebar
// because the function closure trick doesnt work there
var sidebar_html = \'<select onchange="this.value != 0 ? eval(this.value) : null;"><option>Some Dummy Text(for zero option)</option>\';
var gmarkers = [];
var htmls = [];
var i = 0;
// a function to create the marker and set up the event window
function createMarker(point,name,html) {
var marker = new GMarker(point);';
if($openMouseClickMarker) {
$script .= '
// event listener to open info on click
GEvent.addListener(marker, "click", function(){
marker.openInfoWindowHtml(html);
});';
}
if($openMouseOverMarker) {
$script .= '
// The new marker "mouseover" listener
GEvent.addListener(marker,"mouseover", function(){
marker.openInfoWindowHtml(html);
});';
}
$script .= '
// save the info we need to use later for the sidebar
gmarkers[i] = marker;
htmls[i] = html;
// add a line to the sidebar html
sidebar_html += \'<option ';
$script .= 'value="myclick(\' + i + \')"';
$script .= '>\' + name + \'</option>\';
i++;
return marker;
}
// This function picks up the click and opens the corresponding info window
function myclick(i) {
gmarkers[i].openInfoWindowHtml(htmls[i]);
}';
if($startID != "") {
$script .= $modx->runSnippet($dittoName,array('descendentDepth' => $descendentDepth, 'sortBy' => $sortBy, 'sortDir' => $sortDir, 'summarize' => 'all', 'displayArchive' => '0', 'tpl' => $dittoChunk, 'startID' => $startID, 'showPublishedOnly' => '0', 'trunc' => '0'));
$script .= '
// put the assembled sidebar_html contents into the sidebar div
sidebar_html += "</select>";
document.getElementById("'.$linksDiv.'").innerHTML = sidebar_html;';
}
$script .= '
// arrays to hold copies of the markers and html used by the sidebar
// because the function closure trick doesnt work there
var sidebar_html = "";
var gmarkers = [];
var htmls = [];
var i = 0;
// a function to create the marker and set up the event window
function createMarker(point,name,html) {
var marker = new GMarker(point);';
if($openMouseClickMarker) {
$script .= '
// event listener to open info on click
GEvent.addListener(marker, "click", function(){
marker.openInfoWindowHtml(html);
});';
}
if($openMouseOverMarker) {
$script .= '
// The new marker "mouseover" listener
GEvent.addListener(marker,"mouseover", function(){
marker.openInfoWindowHtml(html);
});';
}
$script .= '
// save the info we need to use later for the sidebar
gmarkers[i] = marker;
htmls[i] = html;
// add a line to the sidebar html
sidebar_html += \'<div class="'.$linksClass.'"><a href="javascript:void(0)" ';
if($openMouseClickLink) {
$script .= 'onClick="myclick(\' + i + \')"';
}
if($openMouseOverLink) {
$script .= 'onMouseOver="myclick(\' + i + \')"';
}
$script .= '>\' + name + \'</a></div>\';
i++;
return marker;
}
// This function picks up the click and opens the corresponding info window
function myclick(i) {
gmarkers[i].openInfoWindowHtml(htmls[i]);
}';
if($startID != "") {
$script .= $modx->runSnippet($dittoName,array('descendentDepth' => $descendentDepth, 'sortBy' => $sortBy, 'sortDir' => $sortDir, 'summarize' => 'all', 'displayArchive' => '0', 'tpl' => $dittoChunk, 'startID' => $startID, 'showPublishedOnly' => '0', 'trunc' => '0'));
$script .= '
// put the assembled sidebar_html contents into the sidebar div
document.getElementById("'.$linksDiv.'").innerHTML = sidebar_html;';
}Error: GUnload is not defined
Source File: http://www.xxx.com/index.php?id=321
Line: 112
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<base href="http://www.xxx.com/"></base>
<body>
<div style="padding:20px">
<div id="map" style="float:left; width: 350px; height: 350px;">Loading map...</div>
<div id="maplinks" style="margin-left: 10px; padding-right: 10px; float: left; display: block; height: 350px; overflow: auto;"></div>
<noscript>
<b>JavaScript must be enabled in order for you to use Google Maps.</b>
However, it seems JavaScript is either disabled or not supported by your browser.
To view Google Maps, enable JavaScript by changing your browser options, and then
try again.
</noscript>
</div>
<script type="text/javascript">
//<![CDATA[
// addEvent scripts written by Dean Edwards, 2005
// with input from Tino Zijdel, Matthias Miller, Diego Perini
// http://dean.edwards.name/weblog/2005/10/add-event/
function addEvent(element, type, handler) {
if (element.addEventListener) {
element.addEventListener(type, handler, false);
} else {
// assign each event handler a unique ID
if (!handler.$$guid) handler.$$guid = addEvent.guid++;
// create a hash table of event types for the element
if (!element.events) element.events = {};
// create a hash table of event handlers for each element/event pair
var handlers = element.events[type];
if (!handlers) {
handlers = element.events[type] = {};
// store the existing event handler (if there is one)
if (element["on" + type]) {
handlers[0] = element["on" + type];
}
}
// store the event handler in the hash table
handlers[handler.$$guid] = handler;
// assign a global event handler to do all the work
element["on" + type] = handleEvent;
}
};
// a counter used to create unique IDs
addEvent.guid = 1;
function removeEvent(element, type, handler) {
if (element.removeEventListener) {
element.removeEventListener(type, handler, false);
} else {
// delete the event handler from the hash table
if (element.events && element.events[type]) {
delete element.events[type][handler.$$guid];
}
}
};
function handleEvent(event) {
var returnValue = true;
// grab the event object (IE uses a global event object)
event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
// get a reference to the hash table of event handlers
var handlers = this.events[event.type];
// execute each event handler
for (var i in handlers) {
this.$$handleEvent = handlers[i];
if (this.$$handleEvent(event) === false) {
returnValue = false;
}
}
return returnValue;
};
function fixEvent(event) {
// add W3C standard event methods
event.preventDefault = fixEvent.preventDefault;
event.stopPropagation = fixEvent.stopPropagation;
return event;
};
fixEvent.preventDefault = function() {
this.returnValue = false;
};
fixEvent.stopPropagation = function() {
this.cancelBubble = true;
};
addEvent(window, "unload", GUnload);
if (GBrowserIsCompatible()) {
// Display the map, with some controls
var map = new GMap2(document.getElementById("map"));
// set initial center position
map.setCenter(new GLatLng(63.098332,23.056698),8);
//add controls to navigate / zoom
map.addControl(new GLargeMapControl());
// add controls to change map type
map.addControl(new GMapTypeControl(0));
//set initial map type
map.setMapType(G_NORMAL_MAP);
// arrays to hold copies of the markers and html used by the sidebar
// because the function closure trick doesnt work there
var sidebar_html = "";
var gmarkers = [];
var htmls = [];
var i = 0;
// a function to create the marker and set up the event window
function createMarker(point,name,html) {
var marker = new GMarker(point);
// event listener to open info on click
GEvent.addListener(marker, "click", function(){
marker.openInfoWindowHtml(html);
});
// save the info we need to use later for the sidebar
gmarkers[i] = marker;
htmls[i] = html;
// add a line to the sidebar html
sidebar_html += '<div class="maplink"><a href="javascript:void(0)" onClick="myclick(' + i + ')">' + name + '</a></div>';
i++;
return marker;
}
// This function picks up the click and opens the corresponding info window
function myclick(i) {
gmarkers[i].openInfoWindowHtml(htmls[i]);
}var point = new GLatLng(63.098332,23.056698); var marker = createMarker(point, '', ''); map.addOverlay(marker);
// put the assembled sidebar_html contents into the sidebar div
document.getElementById("maplinks").innerHTML = sidebar_html;
// ======== Add a map overview ==========
var ovcontrol = new GOverviewMapControl(new GSize(150,150));
map.addControl(ovcontrol,new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10, 10)));
//set hidden by default (without animation)
ovcontrol.hide(1);
} else { // !GBrowserIsCompatible()
alert("Sorry, the Google Maps API is not compatible with this browser");
}
// This Javascript is based on code provided by the
// Blackpool Community Church Javascript Team
// http://www.commchurch.freeserve.co.uk/
// http://www.econym.demon.co.uk/googlemaps/
//]]>
</script>
<script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-xxx-6");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</body>
</html> $script .= $modx->runSnippet($dittoName,array('filter' => $filter, 'depth' => $descendentDepth, 'sortBy' => $sortBy, 'sortDir' => $sortDir, 'summarize' => 'all', 'displayArchive' => '0', 'tpl' => '@CODE:var point = new GLatLng([+sponsorlatitudelongitude+]); var marker = createMarker(point, \'[+title:slashandstrip+]\', \'<img src="[+sponsorlogo+]"/><h3>[+title+]</h3> [+sponsorstreetaddress+]<br />[+sponsorcitystatezip+]<br /> [+sponsortelephone+]\'); map.addOverlay(marker);', 'parents' => $startID, 'showPublishedOnly' => '0'));