Ext.BLANK_IMAGE_URL = '/core/extjs/ext-2.1/resources/images/default/s.gif';
Ext.ns( 'contentHeightFix' );

contentHeightFix.app = function()
{
    function resizeHeight(){
        var bodyHeight = Ext.get(document.body).getHeight();
        var contentWrapper = Ext.get('contentwrapper');
	
    	var margin = 190; // 190px to account for header and footer height
	    if(contentWrapper !== undefined && bodyHeight !== undefined){
		    if(	contentWrapper.getHeight() < bodyHeight - margin){
			    var h = bodyHeight - margin;
    			contentWrapper.setHeight(h);
	    	}
    	}
    }
    return {
		init: function() 
		{
			resizeHeight();
            Ext.EventManager.onWindowResize( function()
		    {
                var contentWrapper = Ext.get('contentwrapper');
                if(contentWrapper !== undefined){  contentWrapper.setHeight('auto');}
                resizeHeight();
		    });
		}   // End init
	};  // End return
}();

Ext.onReady( contentHeightFix.app.init, contentHeightFix.app );
