    //<![CDATA[		
		var map;
		var mgr;
		var gdir;
		var geocoder = null;
	    var addressMarker;	
		 var gmarkersDef=  null; 
		 
		var icon = new GIcon();
		//icon.image = "img/mm_20_red.png";
		icon.shadow = "img/mm_20_shadow.png";
		icon.iconSize = new GSize(12, 20);
		icon.shadowSize = new GSize(22, 20);
		icon.iconAnchor = new GPoint(6, 20);
		icon.infoWindowAnchor = new GPoint(6, 6);
		
		var iconlg = new GIcon();
		iconlg.shadow = "img/nymag_main_shadow.png";
		iconlg.iconSize = new GSize(23, 38);
		iconlg.shadowSize = new GSize(40, 37);
		iconlg.iconAnchor = new GPoint(6, 20);
		iconlg.infoWindowAnchor = new GPoint(16, 12);
		
		var iconsm = new GIcon();
		iconsm.shadow = "img/nymag_small_shadow.png";
		iconsm.iconSize = new GSize(12, 20);
		iconsm.shadowSize = new GSize(22, 20);
		iconsm.iconAnchor = new GPoint(6, 20);
		iconsm.infoWindowAnchor = new GPoint(6, 6);
		
		var gicons = [];
		gicons["listing"] = new GIcon(icon, "img/listing.png");
		gicons["office"] = new GIcon(icon, "img/office.png");
		gicons["nymag_main"] = new GIcon(iconlg, "img/nymag_pointer.png");
		gicons["nymag_small"] = new GIcon(iconsm, "img/nymag_small.png");
		gicons["alisting"] = new GIcon(iconlg, "img/nymag_pointer.png");

 var tooltip = document.createElement("div");

 function createMarker(point,type,html,title) {
			var marker = new GMarker(point,gicons[type]);
			marker.tooltip = '<div class="tooltip">'+title+'</div>';
            	GEvent.addListener(marker, "click", function() {
          		marker.openInfoWindowHtml(html);
        		});
        		 //  ======  The new marker "mouseover" and "mouseout" listeners  ======
		        GEvent.addListener(marker,"mouseover", function() {
		          showTooltip(marker);
		        });        
		            GEvent.addListener(marker,"mouseout", function() {
				tooltip.style.visibility="hidden"
		        });          
		    GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml(html);
		         });
		    return marker;
		    }
			
		
		function showTooltip(marker) {
			    tooltip.innerHTML = marker.tooltip;
				var point=map.getCurrentMapType().getProjection().fromLatLngToPixel(map.getBounds().getSouthWest(),map.getZoom());
				var offset=map.getCurrentMapType().getProjection().fromLatLngToPixel(marker.getPoint(),map.getZoom());
				var anchor=marker.getIcon().iconAnchor;
				var width=marker.getIcon().iconSize.width;
				var pos = new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(offset.x - point.x - anchor.x + width,- offset.y + point.y +anchor.y)); 
				pos.apply(tooltip);
				tooltip.style.visibility="visible";
		      }
			
			
		function setDirections(fromAddress, toAddress, locale) {
		      gdir.load("from: " + fromAddress + " to: " + toAddress,
                { "locale": locale });
		    }

   		 function handleErrors(){
	  		 if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
	     alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
	   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
	     alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);
	   
	   else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
	     alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);

	//   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
	//     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + gdir.getStatus().code);
	     
	   else if (gdir.getStatus().code == G_GEO_BAD_KEY)
	     alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);

	   else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
	     alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
	    
	   else alert("An unknown error occurred.");
	   
	}
	
	function onGDirectionsLoad(){ 
          
	}
	 

	function HideMapBox() {
		
		if (document.getElementById("MapBox").style.display == 'block') {
			document.getElementById("MapBox").style.display = 'none';
			document.getElementById("HideMap").src = 'img/o_showmap.gif';
			}
		else if (document.getElementById("MapBox").style.display = 'none') {
			document.getElementById("MapBox").style.display = 'block';
			document.getElementById("HideMap").src = 'img/o_hidemap.gif';
			}
		}		

function ExtMapTypeControl(opt_opts) {
  this.options = opt_opts || {};
}


function mapPop( f, s ){
				GEvent.trigger(f,s); 
				
			var ff= 0; 
				if( typeof( window.pageYOffset ) == 'number' ) 
 				ff = window.pageYOffset; 
				else ff = document.documentElement.scrollTop; 
				ff= 150 - ff;   
				window.scrollBy(0,ff);  
			}


ExtMapTypeControl.prototype = new GControl();


ExtMapTypeControl.prototype.initialize = function(map) {
  var container = document.createElement("div");
  var me = this;

  var mapDiv = me.createButton_("Map");
  var satDiv = me.createButton_("Satellite");
  var hybDiv = me.createButton_("Hybrid");
 
  me.assignButtonEvent_(mapDiv, map, G_NORMAL_MAP, [satDiv, hybDiv]);
  me.assignButtonEvent_(satDiv, map, G_SATELLITE_MAP, [mapDiv, hybDiv]);
  me.assignButtonEvent_(hybDiv, map, G_HYBRID_MAP, [satDiv, mapDiv]);
  GEvent.addListener(map, "maptypechanged", function() {
    if (map.getCurrentMapType() == G_NORMAL_MAP) {
      GEvent.trigger(mapDiv, "click"); 
    } else if (map.getCurrentMapType() == G_SATELLITE_MAP) {
      GEvent.trigger(satDiv, "click");
    } else if (map.getCurrentMapType() == G_HYBRID_MAP) {
      GEvent.trigger(hybDiv, "click");
    }
  });

  
 if (me.options.showTraffic) {
   var trafficDiv = me.createButton_("Traffic");
   trafficDiv.style.marginRight = "0px";
   trafficDiv.style.visibility = 'hidden';
   trafficDiv.firstChild.style.cssFloat = "left";
   trafficDiv.firstChild.style.styleFloat = "left";
   // Sending true makes overlay hidden by default
  // var trafficOptions = {0};
  
   me.trafficInfo = new GTrafficOverlay({hide:true});
   me.trafficInfo.hidden = true;   

   // We have to do this so that we can sense if traffic is in view
   GEvent.addListener(me.trafficInfo, "changed", function(hasTrafficInView) {
     if (hasTrafficInView) {
       trafficDiv.style.visibility = 'visible';
     } else {
       trafficDiv.style.visibility = 'hidden';
     }
   });
   
   // map.removeOverlay(me.trafficInfo);
   map.addOverlay(me.trafficInfo);
   
   
   GEvent.addDomListener(trafficDiv.firstChild, "click", function() {
     if (me.trafficInfo.hidden) {
       me.trafficInfo.hidden = false;
       me.trafficInfo.show();
     } else {
       me.trafficInfo.hidden = true;
       me.trafficInfo.hide();
     }
      me.toggleButton_(trafficDiv.firstChild, !me.trafficInfo.hidden);
    });

    if (me.options.showTrafficKey) {
      keyDiv = document.createElement("div");
      keyDiv.style.cssFloat = "left";
      keyDiv.style.styleFloat = "left";
      keyDiv.innerHTML = "&nbsp;?&nbsp;";
  
      var keyExpandedDiv = document.createElement("div");
      keyExpandedDiv.style.clear = "both";
	  keyExpandedDiv.style.background = "none";
      //keyExpandedDiv.style.padding = "2px";
	  keyExpandedDiv.style.padding = "0px";
      var keyInfo = [{"color": "#30ac3e", "text": "&gt; 50mph"},
                     {"color": "#ffcf00", "text": "25-50mph"},
                     {"color": "#ff0000", "text": "&lt; 25mph"},
                     {"color": "#c0c0c0", "text": "No data"}];
      for (var i = 0; i < keyInfo.length; i++) {
        keyExpandedDiv.innerHTML += "<div style='text-align: left;width:68px;background:#fff;border:1px solid #666;padding:3px;position:relative;top:5px;'><span style='background-color: " + keyInfo[i].color + "'>&nbsp;&nbsp;&nbsp;</span>"
          +  "<span style='color: " + keyInfo[i].color + "'> " + keyInfo[i].text + " </span>" + "</div>"; 
      }
      keyExpandedDiv.style.display = "none";

      GEvent.addDomListener(keyDiv, "click", function() {
        if (me.keyExpanded) {
          me.keyExpanded = false;
          keyExpandedDiv.style.display = "none";
        } else {
          me.keyExpanded = true;
          keyExpandedDiv.style.display = "block";
        }
        me.toggleButton_(keyDiv, me.keyExpanded);
      });
    
      me.toggleButton_(keyDiv, me.keyExpanded);
    }

    var separatorDiv = document.createElement("div");
    separatorDiv.style.clear = "both";

    if (me.options.showTrafficKey) trafficDiv.appendChild(keyDiv);
    trafficDiv.appendChild(separatorDiv);
    if (me.options.showTrafficKey) trafficDiv.appendChild(keyExpandedDiv);
    me.toggleButton_(trafficDiv.firstChild, false);

    container.appendChild(trafficDiv);
  }

  container.appendChild(mapDiv);
  container.appendChild(satDiv);
  container.appendChild(hybDiv);

  map.getContainer().appendChild(container);

  return container;
}

/*
 * Creates simple buttons with text nodes. 
 * @param {String} text Text to display in button
 * @return {DOM Object} The div for the button.
 */
ExtMapTypeControl.prototype.createButton_ = function(text) {
  var buttonDiv = document.createElement("div");
  this.setButtonStyle_(buttonDiv);
  buttonDiv.style.cssFloat = "left";
  buttonDiv.style.styleFloat = "left";
  var textDiv = document.createElement("div");
  textDiv.appendChild(document.createTextNode(text));
  textDiv.style.width = "6em";
  buttonDiv.appendChild(textDiv);
  return buttonDiv;
}

/*
 * Assigns events to MapType buttons to change maptype
 *  and toggle button styles correctly for all buttons
 *  when button is clicked.
 *  @param {DOM Object} div Button's div to assign click to
 *  @param {GMap2} Map object to change maptype of.
 *  @param {Object} mapType GMapType to change map to when clicked
 *  @param {Array} otherDivs Array of other button divs to toggle off
 */  
ExtMapTypeControl.prototype.assignButtonEvent_ = function(div, map, mapType, otherDivs) {
  var me = this;

  GEvent.addDomListener(div, "click", function() {
    for (var i = 0; i < otherDivs.length; i++) {
      me.toggleButton_(otherDivs[i].firstChild, false);
    }
    me.toggleButton_(div.firstChild, true);
    map.setMapType(mapType);
  });
}

/*
 * Changes style of button to appear on/off depending on boolean passed in.
 * @param {DOM Object} div  Button div to change style of
 * @param {Boolean} boolCheck Used to decide to use on style or off style
 */
ExtMapTypeControl.prototype.toggleButton_ = function(div, boolCheck) {
   div.style.fontWeight = boolCheck ? "bold" : "";
   div.style.background = boolCheck ? "url(img/gmap2.gif)" : ""; 
   div.style.height = boolCheck ? "15px" : ""; 
   div.style.position = boolCheck ? "relative" : ""; 
   div.style.top = boolCheck ? "-2px" : ""; 
   div.style.padding = boolCheck ? "2px 0px 0px 0px" : ""; 
   div.style.border = "0px solid white";
   var shadows = boolCheck ? ["Top", "Left"] : ["Bottom", "Right"];
   for (var j = 0; j < shadows.length; j++) {
     div.style["border" + shadows[j]] = "0px solid #b0b0b0";
  } 
   }

/*
 * Required by GMaps API for controls. 
 * @return {GControlPosition} Default location for control
 */
ExtMapTypeControl.prototype.getDefaultPosition = function() {
  return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
}

/*
 * Sets the proper CSS for the given button element.
 * @param {DOM Object} button Button div to set style for
 */
ExtMapTypeControl.prototype.setButtonStyle_ = function(button) {
  button.style.color = "#fff";
  button.style.background = "#fff url(img/gmap.gif)";
  button.style.font = "small Tahoma";
  button.style.border = "1px solid #393020";
  button.style.padding = "2px 0px 0px 0px";
  button.style.margin= "0px";
  button.style.height = "17px";
  button.style.textAlign = "center";
  button.style.fontSize = "11px"; 
  button.style.cursor = "pointer";
}


// A TextualZoomControl is a GControl that displays textual "Zoom In"
// and "Zoom Out" buttons (as opposed to the iconic buttons used in
// Google Maps).
function TextualZoomControl() {
}
TextualZoomControl.prototype = new GControl();

// Creates a one DIV for each of the buttons and places them in a container
// DIV which is returned as our control element. We add the control to
// to the map container and return the element for the map class to
// position properly.
TextualZoomControl.prototype.initialize = function(map) {
  var container = document.createElement("div");

  var zoomInDiv = document.createElement("div");
  this.setButtonStyle_(zoomInDiv);
  container.appendChild(zoomInDiv);
  zoomInDiv.appendChild(document.createTextNode("+ Zoom In"));
  GEvent.addDomListener(zoomInDiv, "click", function() {
    map.zoomIn();
  });

  var zoomOutDiv = document.createElement("div");
  this.setButtonStyle_(zoomOutDiv);
  container.appendChild(zoomOutDiv);
  zoomOutDiv.appendChild(document.createTextNode("- Zoom Out"));
  GEvent.addDomListener(zoomOutDiv, "click", function() {
    map.zoomOut();
  });

  map.getContainer().appendChild(container);
  return container;
}

// By default, the control will appear in the top left corner of the
// map with 7 pixels of padding.
TextualZoomControl.prototype.getDefaultPosition = function() {
  return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(7, 7));
}

// Sets the proper CSS for the given button element.
TextualZoomControl.prototype.setButtonStyle_ = function(button) {
  button.style.color = "#fff";
  button.style.background = "#fff url(img/gmap.gif)";
  button.style.font = "small Tahoma";
  button.style.border = "1px solid #393020";
  button.style.padding = "2px 6px 0px 6px";
  button.style.margin= "0px 0px 3px 0px";
  button.style.width = "60px";
  button.style.height = "17px";
  button.style.textAlign = "center";
  button.style.fontSize = "11px"; 
  button.style.cursor = "pointer";

}




function InfoBox(latlng, opts) {
  this.latlng_ = latlng;
  this.content_ = opts.content || "Hello World";
  this.offsetVertical_ = opts.offsetVertical || -5;
  this.offsetHorizontal_ = opts.offsetHorizontal || -5;

  this.className_ = opts.className || "";  
  this.height_ = opts.height || 100;
  this.width_ = opts.width || 200;
}

/* InfoBox extends GOverlay class from the Google Maps API
 */
InfoBox.prototype = new GOverlay();

/* Creates the DIV representing this InfoBox
 * @param {GMap2} map The map to add infobox to
 */
InfoBox.prototype.initialize = function(map) {
  // Create the DIV representing our Bar
  var div = document.createElement("div");

  if (this.className_ != "") {
    div.className = this.className_;
  } else {
    div.style.border = "1px solid #000000";
    div.style.position = "absolute";
    div.style.background = "url('img/infobox.gif')";
    //div.style.backgroundColor = "#FFFFFF";
    div.style.padding = "0px";
    div.style.width = this.width_ + "px";
    div.style.height = this.height_ + "px";
  } 

  var contentDiv = document.createElement("div");
  contentDiv.innerHTML = this.content_;

  var topDiv = document.createElement("div");
  topDiv.style.position = "absolute";
  topDiv.style.margin = "6px 0px 0px 270px";
  //topDiv.style.textAlign = "right";
  topDiv.style.padding = "0px";
  topDiv.style.border = "0px";
  var closeImg = document.createElement("img");
  closeImg.src = "img/h_closewindow.gif";
  topDiv.appendChild(closeImg);

  function removeInfoBox(ib, m) {
    return function() { 
      GEvent.trigger(ib, "closeclick");
      m.removeOverlay(ib);
    };
  }
  
  GEvent.addDomListener(closeImg, 'click', removeInfoBox(this, map));
 
  div.appendChild(topDiv);
  div.appendChild(contentDiv);
  div.style.display = 'none';

  map.getPane(G_MAP_MARKER_PANE).appendChild(div);

  this.map_ = map;
  this.div_ = div;
}

/* Remove the main DIV from the map pane
 */
InfoBox.prototype.remove = function() {
  this.div_.parentNode.removeChild(this.div_);
}

/* Copy our data to a new InfoBox
 * @return {InfoBox} Copy of infobox
 */
InfoBox.prototype.copy = function() {
  var opts = {};
  opts.latlng = this.latlng_;
  opts.content = this.content_;
  opts.offsetVertical = this.offsetVertical_;
  opts.offsetHorizontal = this.offsetHorizontal_;

  opts.className = this.className_ || "";  
  opts.height = this.height_;
  opts.width = this.width_;
  return new InfoBox(this.latlng, opts);
}

/* Redraw the Bar based on the current projection and zoom level
 * @param {boolean} force Helps decide whether to redraw overlay
 */
InfoBox.prototype.redraw = function(force) {
  // We only need to redraw if the coordinate system has changed
  if (!force) return;

  // Calculate the DIV coordinates of two opposite corners of our bounds to
  // get the size and position of our Bar
  var pixPosition = this.map_.fromLatLngToDivPixel(this.latlng_);

  // Now position our DIV based on the DIV coordinates of our bounds
  this.div_.style.width = this.width_ + "px";
  this.div_.style.left = (pixPosition.x + this.offsetHorizontal_) + "px";
  this.div_.style.height = this.height_ + "px";
  this.div_.style.top = (pixPosition.y + this.offsetVertical_) + "px";
  this.div_.style.display = 'block';

  // if we go beyond map, pan map
  var mapWidth = this.map_.getSize().width;
  var mapHeight = this.map_.getSize().height;
  var bounds = this.map_.getBounds();
  var boundsSpan = bounds.toSpan();
  var longSpan = boundsSpan.lng();
  var latSpan = boundsSpan.lat();
  var degWidth = (this.width_/mapWidth) * longSpan;
  var degHeight = (this.height_/mapHeight) * latSpan;

  if (this.latlng_.lng() + degWidth > bounds.getNorthEast().lng()) {
    this.map_.panTo(this.latlng_);
  }   

  var bottompt = new GLatLng( (this.latlng_.lat() - degHeight), this.latlng_.lng());
  if (!bounds.contains(bottompt)) {
    this.map_.panTo(this.latlng_);
  }
  
}
