  function nextVoorbeeld(Optel,OptelMax){
    
    if(Optel!='' && Optel!='next' && Optel!='prev'){
    
    $(".content_voorbeeld.current").removeClass("current");
    $(".content_voorbeeld."+Optel).addClass("current");
    $(".voorbeeld_image.current").removeClass("current");
    $(".voorbeeld_image."+Optel).addClass("current");
    
    Oudoptel = Optel;
    }
    else if(Optel=='next'){
      if(typeof(Oudoptel) == 'undefined') Oudoptel = 1;
      if(Oudoptel<OptelMax){
        NieuwOptel=Oudoptel+1;
        $(".content_voorbeeld.current").removeClass("current");
        $(".content_voorbeeld."+NieuwOptel).addClass("current");
        $(".voorbeeld_image.current").removeClass("current");
        $(".voorbeeld_image."+NieuwOptel).addClass("current");
        Oudoptel=NieuwOptel;
      }     
    }
    else if(Optel=='prev'){
      if(typeof(Oudoptel) == 'undefined') Oudoptel = 1;
      if(Oudoptel>1){
        NieuwOptel=Oudoptel-1;
        $(".content_voorbeeld.current").removeClass("current");
        $(".content_voorbeeld."+NieuwOptel).addClass("current");
        $(".voorbeeld_image.current").removeClass("current");
        $(".voorbeeld_image."+NieuwOptel).addClass("current");
        Oudoptel=NieuwOptel;
      }     
    }
  }
  
  function getDocHeight() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
  }
  
  function searchTag(tag){
    $("#input_text_zoekwoorden").val(tag);
    $("#topmenu_search").submit();
  }
  
  function getY( oElement )
  {
    var iReturnValue = 0;
    while( oElement != null ) {
      iReturnValue += oElement.offsetTop;
      oElement = oElement.offsetParent;
    }
    return iReturnValue;
  }
  
  function initBackground(){
        
    $obj = document.getElementById("nieuws");
    
    backgroundOffset = document.documentElement.scrollHeight - getY($obj);
    backgroundOffset += 7;
    
    backgroundTop = document.documentElement.scrollHeight;
    backgroundTop -= backgroundOffset;
    
    $("#nieuws_background").css('margin-top',backgroundTop+'px');
  }
  
  function refreshBackground(){
    
    window.setTimeout('initBackground()', 10);
    
  }

  $(document).ready(function() {
    $('.spgImg a').lightBox({txtImage:'Afbeelding',txtOf:'v/d'});
    
    $("ul#nieuws_ticker").liScroll({travelocity: 0.10});
    
    $("#contactformulier").validate();
    
    $(".mainmenu_item_subpages").hide();
    $(".mainmenu_item_pages_link_current").next(".mainmenu_item_subpages").show();
    
    $(".mainmenu_item").hover(
      function(){        
        $(".mainmenu_item_pages_link").hover(
          function(){
            $(".mainmenu_item_subpages:visible").hide();
            $(this).next(".mainmenu_item_subpages").show();
            
          },
          function(){
            
          }
        );
      },
      function(){
        $(".mainmenu_item_subpages:visible").hide();
        $(".mainmenu_item_pages_link_current").next(".mainmenu_item_subpages").show();
      }
    );
    
    $("#linkedin_link").hover(function(){
      $("#linkedin_link_text").css("display","block");
    },function(){
      $("#linkedin_link_text").css("display","none");
    });
    
    $(".content_voorbeeld."+1).addClass("current");
    $(".voorbeeld_image."+1).addClass("current");
    
    initBackground();
    
    $('.mainmenu_item').hover(function(){
      $('.mainmenu_item_current').css('background','none');
      if($(this).css('background')!='#FFFFFF'){
        $(this).css('background','#FFFFFF');
      }
    },
    function(){
      $(this).css('background','none');
      $('.mainmenu_item_current').css('background','#FFFFFF');
    });
  });
