var map;
var gmarkers = [];
var htmls = [];
function map_load() {
if (GBrowserIsCompatible()) {
// this variable will collect the html which will eventually be placed in the side_bar
var side_bar_html = "";
// arrays to hold copies of the markers and html used by the side_bar
// because the function closure trick doesnt work there
var i = 0;
// the icon information is passed to this function
// A function to create the marker and set up the event window
function createMarker(point,name,html,icontype) {
var marker = new GMarker(point,icon[icontype]);
GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); });
// save the info we need to use later for the side_bar
gmarkers[i] = marker;
htmls[i] = html;
// add a line to the side_bar html
if (i < 10 && name){
side_bar_html += '
' + name + '' + 'a>' + 'li>';
i++;
}
return marker;
}
// create the map
map = new GMap2(document.getElementById("OT_map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl() );
map.setCenter (new GLatLng(-5, -80), 3);
// === Define the function thats going to process the text file ===
process_it = function(doc) {
// === split the document into lines ===
lines = doc.split("\n");
for (var i=0; i 1) {
// === split each line into parts separated by "|" and use the contents ===
parts = lines[i].split('|');
var lat = parseFloat(parts[0]);
var lng = parseFloat(parts[1]);
var html = parts[2];
var label = parts[3];
var icontype = parseInt(parts[4]);
var point = new GLatLng(lat,lng);
// create the marker
var marker = createMarker(point,label,html,icontype);
map.addOverlay(marker);
}
}
// put the assembled side_bar_html contents into the side_bar div
document.getElementById("OT_side_bar").innerHTML = '' + side_bar_html + '' + 'ul>';
}
GDownloadUrl("projects.txt", process_it);
}
// display a warning if the browser was not compatible
else {
alert("Sorry, the Google Maps API is not compatible with this browser");
}
}
// This function picks up the click and opens the corresponding info window
function OTclick(i) { gmarkers[i].openInfoWindowHtml(htmls[i]); }
// Create some custom icon
// An array of GIcons, to make the selection easier
var icon = [];
// This icon is default Google marker
icon[0] = new GIcon(G_DEFAULT_ICON);
// This icon is a different shape, so we need our own settings
icon[1] = new GIcon();
icon[1].image = "icon/OT_Logo.png";
icon[1].shadow = "icon/OT_Logo_shadow.png";
icon[1].iconSize = new GSize(28, 21);
icon[1].shadowSize = new GSize(38, 21);
icon[1].iconAnchor = new GPoint(14, 10);
icon[1].infoWindowAnchor = new GPoint(22, 7);
icon[1].infoShadowAnchor = new GPoint(14, 25);
icon[1].transparent = "/icon/OT_Logo_trans.png";
icon[1].printImage = "/icon/OT_Logo.gif";
icon[1].mozPrintImage = "/icon/OT_Logo.png";
// This icon is a different shape, so we need our own settings
icon[2] = new GIcon();
icon[2].image = "./icon/OT_ThumbTack.png";
icon[2].shadow = "./icon/OT_ThumbTack_shadow.png";
icon[2].iconSize = new GSize(16, 35);
icon[2].shadowSize = new GSize(35, 35);
icon[2].iconAnchor = new GPoint(8, 32);
icon[2].infoWindowAnchor = new GPoint(8, 8);
icon[2].infoShadowAnchor = new GPoint(14, 25);
icon[2].transparent = "./icon/OT_ThumbTack_trans.png";
icon[2].printImage = "./icon/OT_ThumbTack.gif";
icon[2].mozPrintImage = "./icon/OT_ThumbTack.png";