﻿function fancyIframe(element, width, height){
    $(document).ready(function() { 
        $(element).fancybox({ 
            'zoomSpeedIn': 100, 
            'zoomSpeedOut': 100, 
            'overlayShow': true,
            'overlayOpacity' : 0.5, 
            'frameWidth' : width,
            'frameHeight' : height,
            'hideOnContentClick': true
            });
    });
}


// Bilder in Fancybox öffnen -> container = umgebender Frames
function fancyImages(container) {
    $(document).ready(function() {
        $(container + " a").fancybox({
            'zoomSpeedIn': 100,
            'zoomSpeedOut': 100,
            'overlayShow': true,
            'overlayOpacity': 0.5,
            'hideOnContentClick': true
        });
    });
}

// Cookie setzen
var cookieConf = { expires: 7, path: '/', domain: 'jquery.com', secure: true };

// Abstand nach links bei breiterem Bildschirm vergrößern
function fitScreen() {
    
    //    $.cookie("alles", wWidth);
    var headerHeight = $("#header").height();
    if ($.browser.msie) {
        if ($.browser.version == "8.0") { 
            headerHeight = $("#header").height() + 4;
        } else if ($.browser.version == "6.0") {
            headerHeight = $("#header").height() + 1;
        }       
    }

    if ($("#alles").height() < $(document).height() - headerHeight) {
        $("#alles").height($(document).height() - headerHeight);
    }

    $("#alles").width($(document).width());


    //    $.cookie("alles", wWidth);
    var headerHeight = $("#header").height();
    if ($.browser.msie) {
        if ($.browser.version == "8.0") {
            headerHeight = $("#header").height() + 4;
        } else if ($.browser.version == "6.0") {
            headerHeight = $("#header").height() + 1;
        }
    }

    if ($("#hg").height() < $(document).height() - headerHeight) {
        $("#hg").height($(document).height() - headerHeight);
    }

    $("#hg").width($(document).width());


    var minWidth = 1024;
    var maxWidth = 1044;

    //    $.cookie("masterPadding", 0);
    var wWidth = $(window).width() - 30;

    if ($.browser.msie) {
        if ($.browser.version == "6.0") {
        } else {
            if (wWidth > minWidth && wWidth < maxWidth) {
                $("#masterframe").css({ "padding-left": wWidth - 1024 + "px" });
                $.cookie("masterPadding", wWidth - 1024);
            } else if (wWidth > maxWidth) {
                $("#masterframe").css({ "padding-left": maxWidth - minWidth + "px" });
                $.cookie("masterPadding", maxWidth - minWidth);
            }
        }
    } else {
        if (wWidth > minWidth && wWidth < maxWidth) {
            $("#masterframe").css({ "padding-left": wWidth - 1024 + "px" });
            $.cookie("masterPadding", wWidth - 1024);
        } else if (wWidth > maxWidth) {
            $("#masterframe").css({ "padding-left": maxWidth - minWidth + "px" });
            $.cookie("masterPadding", maxWidth - minWidth);
        }
    }


}

$(document).ready(function () {
    fitScreen();

});

$(window).resize(function () {
    fitScreen();
});


