
$(document).ready(function() {
  //  $("#topimage").animate({
  //      opacity: 0.7
  //    }, 0);

  function checkForm() {
    if ($("#search").val().length < 3) {
      $("#searchwarning").show();
      return false;
    } else
      return true;
  }

//  var height = document.getElementById('contentcontainer').offsetHeight;
//  height = height - 105;
//  $("#right").css("height", height);
  $(".new_right h3").click(function(){
    
    if (this.opentab == true) {
      $(".new_right div").slideUp();
      this.opentab = false    
    } else {
      $(".new_right div").slideUp();
      $(this).next().slideDown();
      this.opentab = true 
    }
  });

  checkMenu(window.location.href);
});

function checkMenu(url) {
  if ((url.toString()).indexOf("algemeen.asp") > -1) {
    $("#algemeen").show();
    $.cookie('menucookie', 'algemeen', { path: '/' });
  } else if ((url.toString()).indexOf("producten_en_diensten") > -1) {
    $("#producten").show();
    $.cookie('menucookie', 'producten', { path: '/' });
  } else if ((url.toString()).indexOf("links") > -1) {
    $("#links").show();
    $.cookie('menucookie', 'links', { path: '/' });
  } else if ((url.toString()).indexOf("archief") > -1) {
    $("#archief").show();
    $.cookie('menucookie', 'archief', { path: '/' });
  } else if ((url.toString()).indexOf("agenda") > -1 || (url.toString()).indexOf("contact") > -1 || (url.toString()).indexOf("home") > -1 || (url.toString()).indexOf("zoek") > -1) {
    $("#rightmenu ul li ul").hide();
    $.cookie('menucookie', 'archief', { path: '/' });
  } else {
    if ($.cookie('menucookie') != "") {
      $("#" + $.cookie('menucookie')).show();
    } 
  }
}
