var HomeController = {
    
    iMinHeight: null,
    iFooterHeight: null,
    bIsIE6: false,
    
    init: function() {
        
        // Set flash or 'no-flash' class
        
        if (swfobject.hasFlashPlayerVersion("9.0.0")) {

            var flashvars = {data:"../home.xml"};
            var params = {allowscriptaccess:"sameDomain", wmode:"opaque"};
            var att = {id:"home-flash"};

            swfobject.embedSWF("../home.swf", "home-flash", "100%", "100%", "9.0.0", null, flashvars, params, att);

        } else {
            window.addEvent('domready', function(){
                $("content").addClass("no-flash");
            });
        }
        
        // Check for home promo and IE -- if both, fake min-height
        
        window.addEvent('domready', function(){
            if ($('home-promo') && Browser.Engine.trident) {
                HomeController.iMinHeight = $('content').getStyle('min-height').toInt() + $('home-promo').getStyle('bottom').toInt();
                HomeController.iFooterHeight = $('footer').getHeight();
                HomeController.bIsIE6 = (navigator.userAgent.indexOf('MSIE 6.0') > -1);
                HomeController.resize();
                window.addEvent('resize', function() {
                    HomeController.resize();
                });
            }
        });
        
    },
    
    /**
     * Handle window resize, fake min-height
     */
    resize: function() {
        var iHeight = window.getHeight().toInt() - HomeController.iFooterHeight;
        var sHeight = (iHeight <= this.iMinHeight) ? this.iMinHeight : iHeight;
        $('content').setStyle('height', sHeight + 'px');
    }
    
};

HomeController.init();
