  /*=====================
    START        CONTAINER
    * ====================*/
    function Container() {
        var that = this;
		
        this._module = $('#m-container');
        this._init();
        
        // для доступа к контенту из вне
        this.content = this._module;
    };

    Container.prototype = {
        _init: function() {

           this._menu = $('#orange_bottom_menu');
           this._content = $('#content_list');

        },
        // show module
        // открыть окно 
        show: function(action) {
            var that = this;
			this.hidden = false;
            that._show();
            if (action) that._load(action);
        },
        // load module
        // загрузить div c модулем и инициализировать
        _load: function(action, callback) {
            var that = this;
            $.ajax({
               url: '/ajax/' + action,
               type: 'get',
               dataType: 'html',
               success: function(html) {
                   that._module.html(html);
                   (callback || $.noop).call(this);
               }
            });
        },
        // resize module
        // реакция на изменение размера
        // TODO передавать размеры окна
        resize: function() {
            // TODO fix margin-left = width / 2
            if ($(window).width() <= 1446) {
                this._module.css('left', '535px');
                this._menu.css('left', '534px');
            } else {
                this._module.css('left', '50%');
                this._menu.css('left', '50%');
            }

            var contentH = $(window).height() - 292;
            this._content.height(contentH);
			
        },
        // bind events
        // привязать события
        _bind: function() {
            var that = this;

            // TODO in core
            $(window).resize(function() {
                that.resize();
            });

            that._module.bind('mousewheel', function(event, delta) {
                that._scroll(delta);
            });

            // клик на стрелку "закрыть"
            //$('#orange_close').click(function() {that._hide();});

            // клик на слово журнал
            $('#hideCommunity').click(function() {that._hide();});

           
        },

        bind: function(eventType, handler) {
            $.fn.bind.apply(this._module, arguments);
        },

        // hide module
        _hide: function() {
            this._module.trigger('hide');
        },

        // show module
        // показать Блок Сообщества
        _show: function() {
            var that = this;
            that._module.css({ top: $(document).scrollTop() + 'px' });

            // TODO in core
            $('body').css('overflow', 'hidden');
            that._module.html('').slideDown();
            that.resize();
            that._menu.show();
            // TODO in core
            $('.topPanel').hide();
        },
        // hide module
        // скрыть блок сообщества
        hide: function() {
             // TODO in core
            $('body').css('overflow-y', 'auto');
            this._module.slideUp();
            this._menu.hide();
			this.hidden = true;
            // TODO in core
            $('.topPanel').show()
        },
        // scroll module
        // обработка события mousewheel
        _scroll: function(delta) {
            return;
            var newTop = parseInt(this._module.css("top")) + delta * 50,
                    maxTop = $(document).scrollTop(),
                    //  -15 for orange panel
                    minTop = maxTop - this._module.height() + $(window).height() - 15;
            if (newTop > maxTop) {
                newTop = maxTop;
            } else if (newTop < minTop) {
                newTop = minTop;
            }
            this._module.css({"top" : newTop + "px"});
            //this._menu.css({"top" : $(window).height() + newTop + "px"});
        }
    };

    /*=====================
     END       COMMUNITY
    * ====================*/
