﻿$(function () {
    var theWindow = $(window), $bg = $("#bg"), aspectRatio = $bg.width() / $bg.height();
    if (jQuery.browser.msie && jQuery.browser.version < 8) {
        $bg.removeClass().addClass('bgNull');
    }
    else {
        function resizeBg() {
            if ((theWindow.width() / theWindow.height()) < aspectRatio) {
                $bg.removeClass().addClass('bgheight');
            } else {
                $bg.removeClass().addClass('bgwidth');

            }
        }
        theWindow.resize(function () {
            resizeBg();
        }).trigger("resize");
    }
});

