﻿(function ($) {
    $.fn.ieffembedfix = function () {

        // CONFIGURE THE PATH TO YOUR 1BY1 PNG HERE, RELATIVE TO THE LOCATION OF THIS JS FILE.

        var pngimgurl = "img/font_IEfix.png";

        return this.each(function () {
            //check for IE7/8
            if (jQuery.browser.msie == true) {
                $(this).css({
                    filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + pngimgurl + ",sizingMethod=crop)",
                    zoom: "1"
                });
            }
        });
    }
})(jQuery);

function resize() {    
    if (document != null && document.body != null && document.documentElement != null) {
        var htmlheight; 
        // browser window height
        var windowheight = document.documentElement.clientHeight;

        // offset values
        var distanceToTop = 35;
        var minDistanceToBottom = 100;

        var contentHeight;
        var contentLeftHeight;
        var contentLeftHigherThenStandard = false;
        var contentLeftHigherThenContent = false;

        var content = document.getElementById("contentContainer");
        var contentbackground = document.getElementById("bg_content");
        var contentLeft = $fwd(".contentLeft");

        if (contentLeft[0] != null) {
            content.style.width = "390px";
            contentLeftHeight = contentLeft[0].clientHeight + distanceToTop;
            // if inleiding is higher then content ==> set value
            if (contentLeftHeight > content.clientHeight && contentLeft[0].clientHeight > 441)
                contentLeftHigherThenContent = true;

            if (contentLeftHeight > 441) {
                contentLeftHigherThenStandard = true;
            }
        }
        
        if (content != null) {
            // get content height
            contentHeight = content.clientHeight;
            htmlheight = contentHeight;
            if (contentHeight > 441) {
                if (contentHeight > windowheight - distanceToTop - minDistanceToBottom)
                    contentHeight = windowheight - distanceToTop - minDistanceToBottom;
            }         
        }

        if (contentLeftHigherThenContent)
            htmlheight = contentLeftHeight + distanceToTop + minDistanceToBottom;

        content.style.height = contentHeight + "px";

        if (contentLeftHigherThenContent) {
            contentbackground.style.height = contentLeftHeight + "px";
            content.style.height = contentHeight + distanceToTop + minDistanceToBottom + "px";
        }
        else if (contentLeftHigherThenStandard) {
            if (contentHeight > contentLeftHeight) {
                contentbackground.style.height = contentHeight + "px";
                content.style.height = contentHeight + "px";
            }
            else {
                contentbackground.style.height = contentLeftHeight + "px";
                content.style.height = contentLeftHeight + "px";
            }
        }
        else
            contentbackground.style.height = contentHeight + "px";        
    }
    return false;
}

function initLightbox(relAttribute) {
    // Use this example, or...
    lightbox.jQuery('a[@rel*=' + relAttribute + ']').lightBox(); // Select all links that contains lightbox in the attribute rel
    // This, or...
    //$('#gallery a').lightBox(); // Select all links in object with gallery ID
    // This, or...
    //$('a.lightbox').lightBox(); // Select all links with lightbox class
    // This, or...
    //$('a').lightBox(); // Select all links in the page
    // ... The possibility are many. Use your creative or choose one in the examples above

    return false;
}
