    var map = "";
    var mgr = "";
    var tack = "";
    var markers = [];
    var markers1=new Array();
    var markers2=new Array();


    //the main setup arrays
    var mainURL=""
    var IMAGES = [ "baha", "baha", "baha" ];
    var TITLES = [ "Inn at Bay Harbor", "Bay Harbor Golf Club", "Crooked Tree Golf Club" ];
    var LINKS = [ "", "", "" ];
    var boyneLat = [ "45.368058", "45.363365", "45.358121"];
    var boyneLng = [ "-85.014716","-85.056643","-85.021893" ];
    var ICONS = [];
    var ADDRESS = [ "3600 Village Harbor Drive", "Petoskey, MI 49770",
        "5800 Coastal Drive", "Petoskey, MI 49770",
        "600 Crooked Tree Dr", "Petoskey, MI 49770"];
    var PHONES = [ "(231) 439-4000",
        "(231) 439-4085",
        "(231) 439-4030"];

    // arrays to hold variants of the info window html with get direction forms open

    var htmls = [];
    var to_htmls = [];
    var from_htmls = [];
    // functions that open the directions forms
    function tohere1(i) {
      markers1[i].openInfoWindowHtml(to_htmls[i]);
    }
    function fromhere1(i) {
      markers1[i].openInfoWindowHtml(from_htmls[i]);
    }

    function tohere2(i) {
      markers2[(i-3)].openInfoWindowHtml(to_htmls[i]);
    }
    function fromhere2(i) {
      markers2[(i-3)].openInfoWindowHtml(from_htmls[i]);
    }

    function getQueryVariable(variable) {
      var query = window.location.search.substring(1);
      var vars = query.split("&");
      for (var i=0;i<vars.length;i++) {
        var pair = vars[i].split("=");
        if (pair[0] == variable) {
          return pair[1];
        }
      }
    }
    function getTack (qvariable) {
      var openTack = getQueryVariable(qvariable);
      if (openTack != undefined) {
        outerClick(openTack);
      }
    }

    function getIcon(i) {
      if (!ICONS[i]) {
        var icon = new GIcon();
        icon.image = mainURL+"icons/"+IMAGES[i]+".png";
        icon.iconAnchor = new GPoint(10, 34);
        icon.infoWindowAnchor = new GPoint(10, 0);
        icon.iconSize = new GSize(20, 34);
        icon.shadow = mainURL+"/icons/marker_shadow.png";
        icon.shadowSize = new GSize(30, 30);
      }
      return ICONS[i] = icon;
    }

    function createMarker(i,x,loopstart) {
	var marker="";
        var lat = boyneLat[i];
        var lng = boyneLng[i];
        marker = new GMarker(new GLatLng(lat,lng), { icon: getIcon(i) });
        //The Info Window Builder
	var html = '<div class="infoWindow '+IMAGES[i]+'"><h3>'+TITLES[i]+'</h3>'+ADDRESS[i*2]+', '+ADDRESS[(i*2)+1]+'<br/>'+PHONES[i]+'<br>'
        // The info window version with the "to here" form open (The Directions Form part.)
        to_htmls[i] = html + '<div class="toFrom">Directions: <b>To here</b> - <a href="javascript:fromhere'+x+'(' + i + ')">From here</a>' +
           '<br />Start address:<form action="http://maps.google.com/maps" method="get" target="_blank">' +
           '<input type="text" style="width:288px;" maxlength="40" name="saddr" id="saddr" value="" />' +
           '<input value="Get Directions" type="submit" />' +
           '<input type="hidden" name="daddr" value="' + ADDRESS[i*2]+', '+ADDRESS[(i*2)+1]+'" /></form></div></div>';
        // The info window version with the "to here" form open
        from_htmls[i] = html + '<div class="toFrom">Directions: <a href="javascript:tohere'+x+'(' + i + ')">To here</a> - <b>From here</b>' +
           '<br />End address:<form action="http://maps.google.com/maps" method="get"" target="_blank">' +
           '<input type="text" style="width:288px;" maxlength="40" name="daddr" id="daddr" value="" />' +
           '<input value="Get Directions" type="submit">' +
           '<input type="hidden" name="saddr" value="' + ADDRESS[i*2]+', '+ADDRESS[(i*2)+1]+'" /></form></div></div>';
        // The inactive version of the direction info

        html = html + '<div class="toFrom">Directions: <a href="javascript:tohere'+x+'('+i+')">To here</a> - <a href="javascript:fromhere'+x+'('+i+')">From here</a></div></div>';
        htmls[i] = html;

        GEvent.addListener(marker, "click", function() {
           marker.openInfoWindowHtml(html);
        //   map.setCenter(new GLatLng(lat, lng), 12);
        });
        return marker;
    }

    function getMarkers1(n,loopstart) {
      for (var i = loopstart; i < n; i++) {
	var marker = createMarker(i,1,loopstart);
	markers1.push(marker);
      }
      return (markers1);
    }

    function outerClick(i) {
      markers1[i].openInfoWindowHtml(htmls[i]);
    }

    function setupMap() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(45.358121,-85.021893), 12);
        map.addControl(new GLargeMapControl());
        map.enableDoubleClickZoom();
        setupMarkers();
        getTack("tack");
      }
    }

    function setupMarkers() {
      mgr = new GMarkerManager(map);
      mgr.addMarkers(getMarkers1(3,0),0,17);
      mgr.refresh();
	  GEvent.trigger(markers1[0], "click");
    }


