function SampleBalloonLayout(element) {
	var F = function () {
		this.element = element.clone();
		this.close   = this.element.find(".close");
		this.content = this.element.find(".content div");
	};
	F.prototype = this;
	return F;
}

SampleBalloonLayout.prototype = {
    // Отключает кнопку закрытия балуна
    disableClose: function(){
        this.close.unbind("click").css("display", "none");
    },
    // Включает кнопку закрытия балуна
    enableClose: function(callback){
        this.close.bind("click", callback).css("display", "");
        return false;
    },
    // Добавляет макет на страницу
    onAddToParent: function (parentNode) {
        this.element.appendTo(parentNode);
		this.update();
    },
    // Удаляет макет со страницы
    onRemoveFromParent: function () {
        this.element.remove();
    },
    // Устанавливает содержимое балуна
    setContent: function (content) {
        content.onAddToParent(this.content[0]);
    },
    // Обновляет балун
    update: function() {
       this.element.css("margin-top", "-" + this.element.height() + "px");
    },

	// Возвращает сдвиг макета балуна относительно его точки позиционирования
	getOffset: function () {
		return new YMaps.Point(-this.element.width()/2, -this.element.height()-20);
	},

    getSize: function () {
        return new YMaps.Size(this.element.width() + 20, this.element.height() + 20);
    }
};

