﻿
function createMarker(title, address, zip, phone, letter) {
    var icon = new GIcon(getBaseIcon());
    icon.image = "http://www.google.com/mapfiles/marker_orange" + letter + ".png";
    geocoder = new GClientGeocoder();
    geocoder.getLatLng(address + ' ' + zip, function(point) {
        if (point) {
            var marker = new GMarker(point, icon);
            //map.setCenter(point, 9);
            map.addOverlay(marker);
            GEvent.addListener(marker, "click",
         function() {
             marker.openInfoWindowHtml(
               "<p class='marker'><b> " + title + "</b>"
                  + "<br/>" + address + " " + zip
                  + "<br/>" + phone
                  + "<form action='http://maps.google.com/maps' method='get' target='_blank'>"
                  + "<b>Directions to " + title + "</b>:"
                  + "<br/>Start Address"
                  + "<br/><input type='text' size='35' maxlength='40' name='saddr' id='saddr' value='' />"
                  + "<br/><input value='Get Directions' type='SUBMIT'>"
                  + "<input type='hidden' name='daddr' value='" + address + "'/></p>"
             );
         });
        }
    }); 
}



function getBaseIcon() {
    var baseIcon = new GIcon();
    baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
    baseIcon.iconSize = new GSize(20, 34);
    baseIcon.shadowSize = new GSize(37, 34);
    baseIcon.iconAnchor = new GPoint(9, 34);
    baseIcon.infoWindowAnchor = new GPoint(9, 2);
    baseIcon.infoShadowAnchor = new GPoint(18, 25);

    return baseIcon;
}
  
   
   
   
    
