﻿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><small><a href="GoogleMap.aspx">See larger map & get directions</a></small>';

    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.79261548484452, -1.7413759231567382);
        map.setCenter(pointCenter, 13);

        var point = new GLatLng(53.78673454681053, -1.7382390797138214);
        var marker = createMarkerWithDirections(point, 'TLFlowers', '<c><b>TL Flowers & Plants Ltd</b></c><br/>Visit our distribution centre<br/>');
        map.addOverlay(marker);


        map.openInfoWindowHtml(points[0], htmls[0]);
    }
}


