
(function() {
    YAHOO.example.app = {  
    };

    //Call loader the first time
    var loader = new YAHOO.util.YUILoader({
        base: 'yui/build/',
        //Get these modules
        require: ['reset-fonts-grids', 'utilities', 'logger', 'button', 'container', 'tabview', 'resize', 'layout'],
        rollup: true,
        onSuccess: function() {
            //Use the DD shim on all DD objects
            YAHOO.util.DDM.useShim = true;
            //Load the global CSS file.
            //YAHOO.log('Main files loaded..', 'info', 'main.js');
            YAHOO.util.Get.css('yui/aom_assets/css/example1.css');

            //YAHOO.log('Create the first layout on the page', 'info', 'main.js');
            

            YAHOO.example.app.layout = new YAHOO.widget.Layout({
                minWidth: 1000,
                units: [
                    { position: 'top', height: 65, resize: false, body: 'top1' },
                    { position: 'right', width: 25, body: '', header: '', collapse: false },
                    { position: 'left', width: 310, body: 'left1', gutter: '0 5 0 5px', header: '<div id="progressBar"><img src="yui/aom_assets/progress.gif"> Loading...</div>', collapse: true },
                    { position: 'center', gutter: '0 5px 0 0'},
                    
                ]
            });
            //On resize, resize the left and right column content
            YAHOO.example.app.layout.on('resize', function() {
					
					//alert('RESIZING');
					
                var l = this.getUnitByPosition('center');
                var th = l.get('height') - 1;
                //var th = l.get('height') - YAHOO.util.Dom.get('layout-doc').offsetHeight;
                //var h = th - 12; //Borders around the 2 areas
                h = th - 30; //Padding between the 2 parts
                //alert('h is='+ h);
                YAHOO.util.Dom.setStyle('mapPanelContainer', 'height', '100%');
            }, YAHOO.example.app.layout, true);
            
            //On render, load tabview.js and button.js
            YAHOO.example.app.layout.on('render', function() {
                window.setTimeout(function() {
                    //YAHOO.util.Get.script('yui/aom_assets/js/logger.js');
                    YAHOO.util.Get.script('yui/aom_assets/js/tabview.js'); 
                }, 0);
                YAHOO.example.app.layout.getUnitByPosition('right').collapse();
                YAHOO.util.Dom.setStyle(document.body, 'visibility', 'visible');
                setTimeout(function() {
						 //alert('RESIZING');
                  //  YAHOO.example.app.layout.resize();
                }, 1000);
            });
            //Render the layout
            YAHOO.example.app.layout.render();
        }
    });
    loader.insert();
})();

