<script type="text/javascript">
//<![CDATA[
var map;
var url = "mypath";
var image = 'beachflag.png';
function initialize() {
// the central point of the map in lat and long
var latlng = new google.maps.LatLng(54.5, -3);
//options to set
var myOptions = {
<!--- Affects how far the map is zoomed in by default --->
zoom: 5,
center: latlng,
// there are four map types to select from and set as a default, ROADMAP,SATELLITE,HYBRID,TERRAIN
mapTypeId: google.maps.MapTypeId.TERRAIN
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
};
function showClear() {
if (document.getElementById("clear").checked == true) {
var res = new Ajax.Request(
url, {
method: "get", // Set the method of sending the variables
parameters : {
method: 'getClearLayer',
returnformat: 'json'
},
// When the call has returned a value
onComplete: outputMarkers
}
);
}
};
function outputMarkers(transport) {
results = transport.responseText.evalJSON();
// if some results have been returned
if (results.DATA.length > 0) {
// Plot the markers
for (i=0; i<=results.DATA.length; i++) {
var marker = new google.maps.Marker({
position: results.DATA[i][2],
map: map,
title:"New marker"
});
marker.setMap(map);
}
}
};
//]]>
</script>