function Infobox(id, placeholderId, imgId) {
    this.id = id;
    this.placeHolderId = placeholderId;
    this.placeHolder = $('#' + placeholderId);
    this.image = $('#' + imgId);

    this.url = "/ibcontent.ashx";
    this.data = {};

	this.loader = null;
}

Infobox.prototype.init = function() {
    this.loader = new ContentLoader(this.placeHolderId, "/ibcontent.ashx", this.data);

    if ($.cookie(this.id + '_needShow') == '1') {
        this.show();
    }
}

Infobox.prototype.toggle = function() {
    var oThis = this;

    if( this.placeHolder.is(':hidden') ) {
        this.show();
    }
    else {
        this.hide();
    }
}

Infobox.prototype.show = function() {
    var oThis = this;
    this.image.attr('src', '/images/collapse_blue.jpg');

    this.placeHolder.slideDown('fast', function() {
        if (!oThis.loader.loaded) {
            oThis.loader.load();
        }
    });

    $.cookie(this.id + '_needShow', '1', { expires: 365 });
}

Infobox.prototype.hide = function() {
    this.image.attr('src', '/images/expand_blue.jpg');
    this.placeHolder.slideUp('fast');

	$.cookie(this.id + '_needShow', null);
}
