$(document).ready(function(){
  
    AudioPlayer.setup("/player.swf", {width: 300});

    Shadowbox.init();
    
    $("form.contact").validationEngine({promptPosition : "centerRight"});

    //openen van links in nieuw window
    $(function() {
        $('a[href^=http], a[href$=.pdf], a[href$=.mid], a[href$=.MID]').click( function() {
            window.open(this.href);
            return false;
        });
    });

//    flashId="audioplayer_0";
//    count=0;
//    $('p').each(function(){
//            if($(this).children("a").attr("href")){
//                extensie = $(this).children("a").attr("href").substr(($(this).children("a").attr("href").lastIndexOf('.')+1))
//                if(extensie=="mp3" || extensie=="MP3"){
//                    if($(this).parent().attr("id")!="nieuws"){
//                        $(this).addClass("audioplayer");
//                        $(this).children("a").attr("id",flashId);
//                        $(this).prepend("<span class='audio-titel'>"+$(this).children("a").text()+"</span><br />");
//                        AudioPlayer.embed(flashId, {soundFile: $(this).children("a").attr("href")});
//                        count++;
//                        flashId="audioplayer_"+count;
//                    }
//                }
//            }
//    });
                
    $("#slider").easySlider({
            auto:false,
            continuous: false
    });

    //hover menu
    $("#header .headermenu li a.first").click(
      function () {
        $(this).parent().parent().children("li").children("a").removeClass("selected");
        $(this).addClass("selected");
        $(this).parent().parent().children("li").children("ul").stop(false,true).hide();
        $(this).parent().children("ul").stop(false,true).slideToggle("slow");
      });

    $(".selected").parent().children("ul").show();

    $(".image").prev("p").addClass("small");
    $(".image").next("p").addClass("small");

    $("table tr").mouseover(function(){
       $(this).children().not(".no_hover").css("background-color","#e3e3e3");
    });
    $("table tr").mouseout(function(){
       $("table tr").children().css("background-color","#fff");
    });
    $("table.wegwijzer").children("tbody").children("tr").children("td:first-child").addClass("first");

});

$(window).load(function(){
    count=0;
    hoogte=0;
    rijCount=0;
    $(".foto").each(function(){
        if(count==3){
            $(".rij-"+rijCount).each(function(){
                $(this).height(hoogte);
            });
            count=0;
            hoogte=0;
            rijCount++;
        }
        $(this).addClass("rij-"+rijCount)
        if($(this).height()>hoogte){hoogte=$(this).height()}
        count++;
    });
});

//Google Analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-19341680-1']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

