﻿// Schließt fancybox
function fancyClose() {
    window.parent.$.fn.fancybox.close();
}

// Zeigt ausgewähltes Bild an
// idx = id im BilderArray, frame = umgebender Container
function showImage(idx, frame) {
        var curr = 0;
        var c = $(frame + " img");
        c.hide();
        $(frame + " img:eq(" + idx + ")").show();
}

// Öffnet Iframe
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
        });
    });
}


// Höhe Seite abfragen
function getHeight() {
    var wHeight = 0;
    if (typeof (window.innerWidth) == 'number') {
        //Non-IE
        wHeight = window.innerHeight;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        wHeight = document.documentElement.clientHeight;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible
        wHeight = document.body.clientHeight;
    }
    return wHeight;
}

// Höhe Masterframe anpassen
function fixHeight() {
    var diff = document.getElementById("schattenHeader").offsetHeight + document.getElementById("schattenFooter").offsetHeight;
    if (document.getElementById("schattenMiddle").offsetHeight < (getHeight() - diff)) {
        document.getElementById("schattenMiddle").style.height = (getHeight() - diff) + "px";
    }
}
