$(document).ready(function () {

    try { $(".datepicker").datepicker() } catch (err) { };
    try { $("a[rel^='prettyPhoto']").prettyPhoto() } catch (err) { };
    try {
        $(".actueelblok").hover(
            function () {
                $(this).addClass("hover");
            },
            function () {
                $(this).removeClass("hover");
            }
    )
    } catch (err) { };

    /* KNOPPEN GEDRAG MENU */
    $('ul li ul').hide();
    var menutype = $(document).getUrlParam("menutype");

    if (menutype) {
        $('.show').show();
    } else {
        $('.show').slideDown();
    }

    $('a.menuitem').click(function (e) {
        e.preventDefault();
        var targetElement = $(this);


        if ($('.show').length != 0) {
            $('.show').slideUp('fast', function () {
                var targetURL = $(targetElement).attr('href');
                top.location.href = targetURL;
            });
        } else {
            var targetURL = $(targetElement).attr('href');
            top.location.href = targetURL;
        }
    });

    $('.show li a').click(function (e) {
        e.preventDefault();
        var targetElement = $(this);

        var targetURL = $(targetElement).attr('href');
        top.location.href = targetURL + "&menutype=sub";

    });


    $('.slideshow').cycle({
        fx: 'fade',
        timeout: 6000,
        delay: -2000,
        next: '#next',
        prev: '#prev'
    });


    /* $('.news').click(function() {
    $(this).next().slideToggle();
    });
    $('.artikel').click(function() {
    $(this).next().slideToggle();
    });
    $('.slide').click(function() {
    $(this).next().slideToggle();
    });*/



    /* Opmaak formulieren (blauwe randen bij activatie */
    $('textarea').focus(function () {
        $(this).css('border', 'solid 2px #0e477f');
    });
    $('textarea').blur(function () {
        $(this).css('border', 'solid 1px #547383');
    });
    $('input').focus(function () {
        $(this).css('border', 'solid 2px #0e477f');
    });
    $('input').blur(function () {
        $(this).css('border', 'solid 1px #547383');
    });


    /* Validatie op de formulieren activeren */
    $('#reactie').validate();
    $('#rondleiding').validate();
    $('#nieuwsbrief').validate();

    /* */
    $("#terugbelVerzoek, #directReserveren").click(function () {
        alert("Hier komt een formulier. Deze is nog niet uitgewerkt.");
    });
    $("#printVersie").click(function () {
        window.print();
        return false;

    });
    /*  $("#contactOpnemen").click(function() {
    $.prettyPhoto.open('http://ontw.louwmanmuseum.nl', 'Title', 'Description');    
    });
    */

});

