if(!window.wb) wb = {};

(function(){

    wb.tabList = {
        init: function(){
            var that = this;
            this.submit = $('.btn_add-this-tab', '#tabListDialog');
            this.submit.click(function(){
                wb.dialog.hide();
                var type = this.id.split('_')[1];
                wb.wizard.initNewTab(type, '', function() {
                    // wb.wizard.updateTabs();
                    // wb.wizard.schedulePageModelUpdate(wb.wizard.currentPageId, false, true, true);
                });
            });
            $('.appIcon', '#tabListDialog').click(function() {
                $(this).siblings('span.btn_add-this-tab').click();
            });
        },
        show: function(){
            //resize
            var windowHeight = parseInt($(window).height(), 10);
            var wrap = $('#tabListDialog');
            var h = parseInt(windowHeight * 0.8, 10);
            wrap.css('height', h + 'px');
            wrap.find('.tabList_apps').css('height', (h - 100) + 'px');
            
            wb.dialog.show('tabListDialog');
        }
    };
    
})();    
