/*
 * decorator.js
 *
 * @name        decorator
 * @package     www.annekrusche.de
 * @category    script
 * @author      Marcel Jänicke Software <mail@mj-software.net>
 * @since       25.09.2011
 * @modified    22.10.2011
 */
$(window).load(function() {
    // show image in page if fully loaded
    $("#content img").fadeIn();
});

$(window).ready(function() {
    // hide image on loading page
    $("#content img").hide();
    
    setViewSize();
});

$(window).resize(function() {
    setViewSize();
});

function setViewSize() {
    // used to fix browser problems
    var maxHeight = parseInt($("#container").css("max-height"));
    var maxWidth = parseInt($("#container").css("max-width"));

    var height = $(window).height() - 180;
    // var width = height * 16 / 8;
    var width = height * 2;

    width = width > $(window).width() ? $(window).width() : width;
    // height = 8 * width / 16;
    height = (height <= maxHeight) || (width <= maxWidth) ? width / 2 : maxHeight;

    $("#container").css("height", height);
    $("#container").css("width", width);
    
    $("#navigation").css("width", width);
    $("#footer").css("width", width);
}
