$(function () {
  //if ($.browser.msie && $.browser.version < 7) return;
  $('#nav li, body.contact div#content')
    .removeClass('highlight')
    .find('a')
    .html('<span class="hover" />').each(function () {
      var $span = $('> span.hover', this).css('opacity', 0);
      $(this).hover(function () {
        $span.stop().fadeTo(700, 1);
      }, function () {
        $span.stop().fadeTo(700, 0);
      });
    });

    var theWindow        = $(window),
    $bg              = $("#bg"),
    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");

});


