$(document).ready(function() {

    var colheight5 = 0;
    $(".sameheight_inner").each(function(){
        if ($(this).height()>colheight5) colheight5=$(this).height();
    }).css({height:colheight5});

    var colheight = 0;
    $(".sameheight").each(function(){
        if ($(this).height()>colheight) colheight=$(this).height();
    }).css({height:colheight});
    
    $(".sameheight-li").each(function(){
        if ($(this).height()>colheight) colheight=$(this).height();
    }).css({height:colheight});
    
    var num = $(".section .rij").length;
    var colheight2 = 0;
    for (var i = 1; i <= num; i++) {
        $(".sameheight"+i).each(function(){
            if ($(this).height()>colheight2) colheight2=$(this).height();
        }).css({height:colheight2});        
    }
    
    var colheight3 = 0;
    $(".sameheightH2").each(function(){
        if ($(this).height()>colheight3) colheight3=$(this).height();
    }).css({height:colheight3});
    
     var colheight4 = 0;
    $(".sameheightFooter").each(function(){
        if ($(this).height()>colheight4) colheight4=$(this).height();
    }).css({height:colheight4});
    

    $("select.refines").change(function () {
        document.location = $(this).val();
    });
    
    $("#btnAdd, #btnAdd2").click(function(event) {
        if ($("#aantal").val() == "" || !is_numeric($("#aantal").val())) {
            alert("U dient het aantal op te geven.");
            event.preventDefault();
        }
    });
    
    $("table tr.trainingitem").mouseover(function() {
        $(this).addClass("selectedRow").mouseout(function() {
            $(this).removeClass("selectedRow");
        });
    });
    
    $("table tr.trainingitem").click(function() {
       window.location = $("a", $(this)).attr("href");
    });
});
