﻿/*extern GBrowserIsCompatible, GEvent, GLatLng, GMap2, GMapTypeControl, GMarker, GSmallMapControl, GUnload */
/*jslint browser: true, nomen: true, plusplus: true, undef: true, white: true */

document.ready();
if (document.getElementById('sidebar-map') && GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById('sidebar-map'));
    var text = '<span class="gmap-title"><em>Advanced</em> Traffic Products, Inc.</span><br /><span class="gmap-address">909 SE Everett Mall Way Ste B280<br />Everett WA  98208-3740</span><br /><span class="gmap-directions">Get directions to our office</span><form action="http://maps.google.com/maps" target="_blank"><label for="saddr">Enter your address:</label><br /><input id="saddr" name="saddr" size="20" type="text" /><input name="daddr" type="hidden" value="909 SE Everett Mall Way, Everett, WA 98208-3740 @47.910906,-122.220497" /><input type="submit" value="Go" class="gmap-submit" /></form>';
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng(47.910906, -122.220497), 14);
    var marker = new GMarker(new GLatLng(47.910906, -122.220497));
    map.addOverlay(marker);
    marker.openInfoWindowHtml(text);
    GEvent.addListener(marker, 'click', function () {
        marker.openInfoWindowHtml(text);
    });
    window.addEvent('unload', function () {
        GUnload();
    });
}