
function Tooltip(marker, html, width) {	
	this.html_ = html;
	this.width_ = (width ? width: 'auto');
	this.height = 10;
	this.marker_ = marker;
}

Tooltip.prototype = new GOverlay();

Tooltip.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;
	

}

Tooltip.prototype.remove = function() {
	this.container_.parentNode.removeChild(this.container_);
}

Tooltip.prototype.copy = function() {
	return new ToolTip(this.html_);
}

Tooltip.prototype.redraw = function(force) {

		if(!force) {
			return;
		}

		var pos = this.map_.fromLatLngToDivPixel(this.marker_.getPoint());
		this.container_.innerHTML = this.html_;
		this.container_.style.position = 'absolute';		
		this.container_.style.width = this.width_;
		
		/**
		if((pos.x + this.width) > 350) {
			if((pos.x - this.width) > 0) { 
				this.container_.style.left = (pos.x - this.width) + "px";
			}
		} else {
			this.container_.style.left = pos.x + "px";
		}

			
		if((pos.y + this.height) < 0) {
			if((pos.x - this.width) > 0) { 
				this.container_.style.top = (pos.y - this.height) + "px";
			}
		} else {
			this.container_.style.top = pos.y + "px";
		}
		**/

		this.container_.style.top = pos.y + "px";
		this.container_.style.left = pos.x + "px";
		this.container_.style.font = 'bold 11px verdana';
		this.container_.style.border = '1px solid #e2e4ef';
		this.container_.style.background = '#e2e4ef';
		this.container_.style.padding = '2px';
		this.container_.style.whiteSpace = "nowrap";
		this.container_.style.zIndex = 100000;

	 	if(this.width_ != 'auto') {
	 		this.container_.style.overflow = 'hidden';
	 	}
}


Tooltip.prototype.show = function(){
	//var pos = this.map_.fromLatLngToDivPixel(map.getCenter());
	//alert(pos.x + ' ' + pos.y);	
	this.container_.style.display = 'block';

}

Tooltip.prototype.hide = function(){
	this.container_.style.display = 'none';
}


