$(document).ready(function () {
    CreateBackgroundImage();
    CreateFlags();
});
$(window).resize(function () {
    CreateBackgroundImage();
});

function CreateFlags() {
    $(".lan img").hover(
      function () {
          $(".lan img").not(this).addClass("lan-unselected");
          $(this).addClass("lan-hover");
      },
      function () {
          $(this).removeClass("lan-hover");
          $(".lan img").removeClass("lan-unselected");
      }
    );
}
function CreateBackgroundImage() {
    var wH = $(window).height();
    var wW = $(window).width();
    $(".body-fade").width($(document).width());
    $(".body-fade").height($(document).height());
    $(".body-image img").css("height", "");
    $(".body-image img").css("width", "");
    if (wH > wW) {
        $(".body-image img").css("height", wH);
    }
    else {
        $(".body-image img").css("width", wW);
    }

    if (wH > $(".body-image img").height()) {
        $(".body-image img").css("height", wH);
    }

    if (wW > $(".body-image img").width()) {
        $(".body-image img").css("width", wW);
    }
}

