$(document).ready(function() {

    $('.type dl.woning:nth-child(5n+1)').addClass("small");
    $('#topmenu a:last').css('background','none');
    $('.type_d').append("<img src='"+site_root+"images/type/type_d_bottom.png' alt='' class='type_bottom png' />");
    $('.type_c').append("<img src='"+site_root+"images/type/type_c_bottom.png' alt='' class='type_bottom png' />");
    //$('.uitklappen').children('ul').not(':eq(0)').css('padding-left','0');

  $(".toon").toggle(
    function () {
      var thisId = $(this).attr('id');
      $(this).next('.uitklappen').show();
      $(this).text("Verberg alle " + thisId);
      $(this).addClass("uitgeklapt");
    },
    function () {
      var thisId = $(this).attr('id');
      $(this).next('.uitklappen').hide();
      $(this).text("Toon alle " + thisId);
      $(this).removeClass("uitgeklapt");
    }
  );
  
  $("#landen li a").not("#landen li.selected a").hover(function(){
    $(this).children().css("background-position","right -100px");
  },function(){
    $(this).children().css("background-position","right top");
  });

    if ($('#logo').length == 0) { // Home
        var height = 0;
        $('.type_a,.type_b').each(function () {
            if ($(this).height() > height) {
                height = $(this).height();
            }
        });
        $('.type_a,.type_b').each(function () {
            if ($(this).height() < height) {
                $(this).height(height);
            }
        });
    } else {
        var type_as = $('.type_a');
        var height = 0;
        for (var i = 0; i < type_as.length; i += 2) {
            if (type_as.length >= i+2) {
                if ($(type_as[i]).height() > $(type_as[i+1]).height()) {
                    $(type_as[i+1]).height($(type_as[i]).height());
                } else {
                    $(type_as[i]).height($(type_as[i+1]).height());
                }
            }
        }
    }

    var new_height = $('body').height() - ($('#wrapper').position().top + 29);
    if ($('#wrapper').height() < new_height) {
        $('#wrapper').height(new_height);
    }
});