﻿var gmarkers = [];
var points = [];
var htmls = [];
var i = 0;

function createBasicMarkerNoDirections(point, name, html) {
    var marker = new GMarker(point);
    GEvent.addListener(marker, "click", function() {
        marker.openInfoWindowHtml(html);
    });
    points[i] = point;
    gmarkers[i] = marker;
    htmls[i] = html;
    i++;
    return marker;
}

// A function to create the marker and set up the event window
function createMarkerWithDirections(point, name, html) {
    var marker = new GMarker(point);
    // The inactive version of the direction info
    html = html + '<br/><c><a href="googlemap.aspx">Click here for a larger<br/>map & directions</a><br/></c>';

      GEvent.addListener(marker, "click", function() {
        marker.openInfoWindowHtml(html);
    });
    points[i] = point;
    gmarkers[i] = marker;
    htmls[i] = html;
    i++;
    return marker;
}

// functions that open the directions forms
function tohere(i) {
    gmarkers[i].openInfoWindowHtml(to_htmls[i]);
}

function fromhere(i) {
    gmarkers[i].openInfoWindowHtml(from_htmls[i]);
}
function load() {
    if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));

        var pointCenter = new GLatLng(53.83852545878738, -1.776888370513916);
        map.setCenter(pointCenter, 14);

        var point = new GLatLng(53.83517164224877, -1.778014898300171);
        var marker = createMarkerWithDirections(point, 'TCF', '<b>Best Buy Carpets</b>');
        map.addOverlay(marker);

        map.openInfoWindowHtml(points[0], htmls[0]);
    }
}


