// create the ToolTip overlay object

function MapToolTip(marker,html,width) {
	this.html_ = html;
	this.width_ = (width ? width + 'px' : 'auto');
	this.marker_ = marker;
}
MapToolTip.prototype = new GOverlay();

MapToolTip.prototype.initialize = function(map) {
	var div = document.createElement("div");
	div.style.display = 'none';
	map.getPane(G_MAP_FLOAT_PANE).appendChild(div);
	this.map_ = map;
	this.container_ = div;
}

MapToolTip.prototype.remove = function() {
	this.container_.parentNode.removeChild(this.container_);
}

MapToolTip.prototype.copy = function() {
	return new MapToolTip(this.html_);
}

MapToolTip.prototype.redraw = function(force) {
	if (!force) return;
	var pixelLocation = this.map_.fromLatLngToDivPixel(this.marker_.getPoint());

	this.container_.innerHTML = this.html_;
	this.container_.style.position = 'absolute';
	this.container_.style.left = pixelLocation.x + "px";
	this.container_.style.top = pixelLocation.y + "px";
	this.container_.style.width = this.width_;
	this.container_.style.font = 'bold 10px/10px verdana, arial, sans';
	this.container_.style.color = '#CCCCCC';
	this.container_.style.border = '1px solid #d0ab2b';
	this.container_.style.background = '#fffcdc';
	this.container_.style.padding = '4px';
	// one line to desired width
	this.container_.style.whiteSpace = 'nowrap';
	if(this.width_ != 'auto') this.container_.style.overflow = 'hidden';
	this.container_.style.display = 'block';
}

GMarker.prototype.MapToolTipInstance = null;

GMarker.prototype.openMapToolTip = function(content) {
	// don't show the tool tip if there is a custom info window
	if(this.MapToolTipInstance == null) {
		this.MapToolTipInstance = new MapToolTip(this, content)
		GoogleMap.addOverlay(this.MapToolTipInstance);
	}
}

GMarker.prototype.closeMapToolTip = function() {
		if(this.MapToolTipInstance != null) {
		GoogleMap.removeOverlay(this.MapToolTipInstance);
		this.MapToolTipInstance = null;
	}
}