function slideSwitch() {	
    var $active = $('#slideshow .slideItem.active');
    if ( $active.length == 0 ) $active = $('#slideshow .slideItem:last');
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow .slideItem:first');
    $active.addClass('last-active');	
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 500, function() {
            $active.removeClass('active last-active');
        });
}
 
$(document).ready(function() {	

	$("a.openfoto").fancybox({
		'padding'			:	1, 
		'transitionIn'		:	'elastic',
		'transitionOut'		:	'elastic',
		'speedIn'			:	300, 
		'speedOut'			:	300, 
		'titleShow'			:	false, 
		'overlayOpacity'	:	0.0, 
		'hideOnContentClick':	true, 
		'overlayShow'		:	true
	});
	
	$("a.openfotometitel").fancybox({
		'padding'			:	1, 
		'transitionIn'		:	'elastic',
		'transitionOut'		:	'elastic',
		'speedIn'			:	300, 
		'speedOut'			:	300, 
		'titleShow'			:	true, 
		'overlayOpacity'	:	0.0, 
		'hideOnContentClick':	true, 
		'overlayShow'		:	true
	});
	
	$("a.tellFriend").fancybox({
		'padding'			:	1, 
		'transitionIn'		:	'elastic',
		'transitionOut'		:	'elastic',
		'speedIn'			:	300, 
		'speedOut'			:	300, 
		'titleShow'			:	false, 
		'overlayOpacity'	:	0.8,
		'hideOnContentClick':	false,
		'width' 			:	300,
		'overlayShow'		:	true
	});
	
	// slideshow
	$(function() {
		setInterval( "slideSwitch()", 4000 );
	});		
	
	
	// initialise plugins
	$('ul.sf-menu').superfish({ 
       delay:       1000,                            // one second delay on mouseout 
       animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
       speed:       'fast',                          // faster animation speed 
       autoArrows:  false,                           // disable generation of arrow mark-up 
       dropShadows: true                            // disable drop shadows 
    }); 


	$('.iframe-delta-0').attr({
	  allowtransparency: 'true'
	});
	
		// Rollover functie 
   $(".item_tr").hover(
      function () {
        $(this).addClass("rollover");
      }, 
      function () {
        $(this).removeClass("rollover");
      }
    );
    
    
    
   //Handleidingen netjes open en dicht schuiven
	$(".msg_head").click(function()
    {
		$(this).next("div.msg_body").slideToggle(300).siblings("div.msg_body").slideUp("slow");
    });

 });
 
// Youtube afbeelding binnen halen
function getScreen( url, size )
{
  if(url === null){ return ""; }

  size = (size === null) ? "big" : size;
  var vid;
  var results;

  results = url.match("[\\?&]v=([^&#]*)");

  vid = ( results === null ) ? url : results[1];

  if(size == "small"){
    return "http://img.youtube.com/vi/"+vid+"/2.jpg";
  }else {
    return "http://img.youtube.com/vi/"+vid+"/0.jpg";
  }
  
  
}

