function MMTooltip(text)
{				
	this.map;
		
	// container for the contextmenu
	this.div = document.createElement("div");		
	this.div.style.background = "#ffffff";
	this.div.style.borderColor = "#666666";
	this.div.style.borderWidth = "1px";
	this.div.style.borderStyle = "solid";
	this.div.style.padding = "2px";
	this.div.style.cssFloat = "left";
	this.div.style.styleFloat = "left";
	this.div.style.fontFamily = "arial,sans-serif";
	this.div.style.color = "#777777";
	this.div.style.fontSize = "8pt";		
	this.div.innerHTML = text;
	
	
	// pane for appending to the map
	this.pane = document.createElement("div");
	this.pane.style.display="none";
	this.pane.appendChild(this.div);

	
}
MMTooltip.prototype = new GControl();

// display only one contextmenu at the same time
MMTooltip.someIsVisible = false;

/** Returns to the map if the control should be printable. */
MMTooltip.prototype.printable = function(){return false;}


/** Returns to the map if the control contains selectable text. */
MMTooltip.prototype.selectable = function(){return false;}

/**
 * Returns to the map the position in the map view at which the control appears by default. 
 * This will be overridden by the second argument to GMap2.addControl(). 
 */
MMTooltip.prototype.getDefaultPosition = function(){
	return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(0,0));	
}

/**
 * Will be called by the map so the control can initialize itself. The control will 
 * use the method GMap2.getContainer() to get hold of the DOM element that contains 
 * the map, and add itself to it. It returns the added element. 
 */
MMTooltip.prototype.initialize = function(map){

	this.map = map;
	map.getContainer().appendChild(this.pane);     

	return this.pane;      
}

MMTooltip.prototype.setText = function(text){
	this.div.innerHTML = text;	
}

MMTooltip.prototype.hide = function(){
	this.pane.style.display="none";
}

MMTooltip.prototype.show = function(pxPoint){
	
	if(!this.map) return false;
	
	
	/* store the "pixel" info in case we need it later
	 * adjust the context menu location if near an egde
	 * create a GControlPosition
	 * apply it to the context menu, and make the context menu visible
	 */		
	var x = pxPoint.x;
	var y = pxPoint.y;
	
	if (x > this.map.getSize().width - 120) { x = this.map.getSize().width - 120 }
	if (y > this.map.getSize().height - 100) { y = this.map.getSize().height - 100 }
	var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(x+20,y-10));  
	pos.apply(this.pane);
	
	this.pane.style.display="block";
}


