function animate(){
   if($('#slider img').length > 1) { 
      var vis = $("#slider img:visible");
      var nxt = $(vis).next();
      if($(nxt).length == 0) {
         nxt = $("#slider img").eq(0);
      }
      $(vis).fadeOut("slow");
      $(nxt).fadeIn("slow");
      setTimeout("animate();", 8000);
   }
}
function animate_navigation() { 

   $("#navigation li").mouseover(function(){

      if(!$(this).is(".selected")) { 
         $(this).stop().animate({
            backgroundPosition:"-390px 0"
         },150,function(){
            $(this).addClass("hover"); 
         });
      }
   }).click(function(){ 
      $(this).parent().find('li>ul').hide();
      $(this).find('>ul').show();
   }).mouseout(function(e){
      if(!$(this).is(".selected")) { 
         $(this).stop()
         .animate({backgroundPosition:"-1430px 0"}, 400)
         .animate({},100,function(){$(this).removeClass("hover")})
         ;
      }
      return false;
   });
}
// start when dom is ready.
$(function(){
   $('form#search').hover(function(){
      $(this).stop().animate(
         {paddingTop:12},
         400
      );
      $(this).find('input').eq(0).focus();
   },function() { 
      $(this).stop().animate(
         {paddingTop:34},
         400
      );
   });
   $('form#search input[type=text]').focus(function(){
      if($(this).val()=='zoeken') { 
         $(this).val('');
      }
   });

   // header animation
   setTimeout("animate();", 8000);

   // add hover support
   $('.hover-children > *').hover(function(){
      $(this).addClass('hover');
   },function(){
      $(this).removeClass('hover');
   });

   // navigation animation
   setTimeout('animate_navigation()', 10);
});