        var divHeight = 0;
        rodape = function()
        {
                        var de = document.documentElement;
                        var h = (window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.offsetHeight)-5;
                        
                        if(h > jQuery("#tudo").height())
                        {
                                jQuery("#corpo").css({"height":(jQuery("#corpo").height()+(h - jQuery("#tudo").height())).toString()+"px"});
                        }
                        else if(h < jQuery("#tudo").height())
                        {
                                jQuery("#corpo").css({"height":divHeight.toString()+"px"});
                                if(h > jQuery("#tudo").height())
                                {
                                        jQuery("#corpo").css({"height":(jQuery("#corpo").height()+(h - jQuery("#tudo").height())).toString()+"px"});
                                }
                        }
        };
        
        jQuery(document).ready(function()
        {
                divHeight = jQuery("#corpo").height();
                
                rodape();
                
                jQuery(window).resize(function()
                {
                        rodape();
                });
        });
		
		$(window).load(function() {    

        var theWindow        = $(window),
            $bg              = $("#dv3"),
            aspectRatio      = $bg.width() / $bg.height();

        function resizeBg() {

                if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
                    $bg
                        .removeClass()
                        .addClass('bgheight');
                } else {
                    $bg
                        .removeClass()
                        .addClass('bgwidth');
                }

        }

        theWindow.resize(function() {
                resizeBg();
        }).trigger("resize");

});

