/**
* $Date: 2009-05-27 16:56:06 +0200 (on, 27 maj 2009) $
* $Author: lars.huring $
* $Revision: 387 $
**/

function InfoWindowOverlay(latlng, html) {


	this._latlng = latlng;
	this._html = html;
	this.prototype = new GOverlay();

	this.initialize = function(map)
	{ }

	this.update = function(html) { }
	this.remove = function() { }
	this.copy = function() { }
	this.redraw = function(force) { }
	
}

InfoWindowOverlay.prototype = new GOverlay();
InfoWindowOverlay.prototype.initialize = function(map) {
	var div = document.createElement("div");
	div.className = 'mywindow';
	div.innerHTML = this.html;

	// offsets based on popup div dimensions
	offsetX = 193;
	offsetY = 261;

	div.style.top = (map.fromLatLngToDivPixel(this.marker.getPoint()).y - offsetY) + 'px';
	div.style.left = (map.fromLatLngToDivPixel(this.marker.getPoint()).x - offsetX) + 'px';

	div.onclick = closeOverlay;

	this._map = map;
	this._div = div;

	map.getPane(G_MAP_FLOAT_PANE).appendChild(div);
}
InfoWindowOverlay.prototype.remove = function() {
	this._div.parentNode.removeChild(this._div);
}
InfoWindowOverlay.prototype.redraw = function() {
	//haven't had need for this yet
}

function closeOverlay(currentMarker, map) {
	if (currentMarker) {
		map.removeOverlay(currentMarker.overlay);
		currentMarker.show();
	}
}
