// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
var map;
var tooltip;

// === TOOLTIP FUNCTION STARTS =========
function showTooltip(marker,own_offset_x,own_offset_y) {
  tooltip.innerHTML = marker.tooltip;
  point=map.getCurrentMapType().getProjection().fromLatLngToPixel(map.fromDivPixelToLatLng(new google.maps.Point(0,0),true),map.getZoom());
  offset=map.getCurrentMapType().getProjection().fromLatLngToPixel(marker.getPoint(),map.getZoom());
  anchor=marker.getIcon().iconAnchor;
  width=marker.getIcon().iconSize.width;
  height=tooltip.clientHeight;
  pos = new google.maps.ControlPosition(G_ANCHOR_TOP_LEFT, new google.maps.Size(offset.x - point.x - anchor.x + width + own_offset_x, offset.y - point.y -anchor.y -height + own_offset_y));
  pos.apply(tooltip);
  tooltip.style.visibility="visible";
}
// === TOOLTIP FUNCTION ENDS =========
