// A function to create the marker and set up the event window
function createMarker(point, name, html) {
    var marker = new GMarker(point);
    var linkid = "link" + (gmarkers.length);

    GEvent.addListener(marker, "click", function() {
    marker.openInfoWindowHtml(html);
    document.getElementById(linkid).style.background = "#ffff00";
    lastlinkid = linkid;
    });

    // save the info we need to use later for the side_bar
    gmarkers.push(marker);
    // add a line to the side_bar html
    side_bar_html += '<div id="' + linkid + '"><a href="javascript:myclick(' + (gmarkers.length - 1) + ')">' + name + '<\/a><br><\/div>';
    return marker;
}


// This function picks up the click and opens the corresponding info window
function myclick(i) {
    GEvent.trigger(gmarkers[i], "click");
}