$(document).ready(function () {
    $(".slidervert").easySlider({
        prevId: 'prevBtn',
        nextId: 'nextBtn',
        vertical: true
    });

    var menuisopen = true;
    $('.ladders .closearrow').click(function () {
        if (menuisopen == true) {
            $('.ladders ul').slideUp();
            menuisopen = false;
        }
        else {
            $('.ladders ul').slideDown();
            menuisopen = true;
        }
    });

    var menuisopen = true;
    $('.steigers .closearrow').click(function () {
        if (menuisopen == true) {
            $('.steigers ul').slideUp();
            menuisopen = false;
        }
        else {
            $('.steigers ul').slideDown();
            menuisopen = true;
        }
    });

    var menuisopen = true;
    $('.maatwerk .closearrow').click(function () {
        if (menuisopen == true) {
            $('.maatwerk ul').slideUp();
            menuisopen = false;
        }
        else {
            $('.maatwerk ul').slideDown();
            menuisopen = true;
        }
    });

    $("a.meerfotos").fancybox({
        'hideOnContentClick': false,
        'zoomSpeedIn': 0,
        'zoomSpeedOut': 0,
        'overlayShow': true,
        'overlayColor': '#000',
        'overlayOpacity': 0.8
    });

    $('#productbig').loupe({
        width: 300, // width of magnifier
        height: 250, // height of magnifier
        loupe: 'loupe' // css class for magnifier
    });

    $(".documentQRC").each(function () {
        $(this).simpletip({ content: "QR Code voor dit document:<br /><img src=\"" + $(this).attr("rel") + "\" alt=\"qrcode\" />", fixed: true, position: [($(this).outerWidth() + 10), -180] });
    });

    $(".superpromocontainer").click(function () {
        window.location = $("a:first", this).attr("href");
    }).css({ 'cursor': 'pointer' });
});

$(window).load(function () {
    /*$(".promoties_row").each(function () {
        var $maxHeight = 0;
        var $targetRow = $(this);
        $(".promotieitem_small", $(this)).each(function () {
            if ($maxHeight < $(this).height()) {
                $maxHeight = $(this).height();
            }
        });

        $(".promotieitem_small", $targetRow).css({ "height": $maxHeight + "px" });
    });*/

    if ($(".superpromocontainer").size() > 0) {
        $("#superpromo").cycle({
            fx: 'scrollLeft'
        });
    }

    var $termOrigValue;
    $(".focusreset").focusin(function () {
        $termOrigValue = $(this).val();
        $(this).val("");
    }).focusout(function () {
        if ($(this).val() == "") {
            $(this).val($termOrigValue);
        }
    });
});
