function SimpleOverlay (geoPoint, name, type) {
	var map, _this = this, offset = new YMaps.Point(-10, -22);

	this.onAddToMap = function (pMap, parentContainer) {
		map = pMap;
		parentContainer.appendChild(getElement());
		this.onMapUpdate();
	};

	this.onRemoveFromMap = function () {
		if (getElement().parentNode) {
			getElement().parentNode.removeChild(getElement());
		}
	};

	this.onMapUpdate = function () {
		var position = map.converter.coordinatesToMapPixels(geoPoint).moveBy(offset);
		getElement().style.left = position.x + 'px';
		getElement().style.top = position.y + 'px';
	};

	this.openBalloon = function () {
		getElement().style.display = "none";
		map.openBalloon(geoPoint, '<a href="/object/detail.php?NAME=' + name + '">' + name + '</a>', {onClose: function () {
			getElement().style.display = "";
		}});
	};

	function getElement () {
		var element = document.createElement('div');
		element.className = type;
		element.onclick = function () {
			_this.openBalloon();
		}
		return (getElement = function () {return element})();
	}
}
        
        
function createOverlay (point, name, type)  {
	newOverlay = new SimpleOverlay(point, name, type);
	return newOverlay;
}
