$(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.fotoboekfoto").fancybox({
		'padding'			:	1, 
		'transitionIn'		:	'fade',
		'transitionOut'		:	'fade',
		'speedIn'			:	300, 
		'speedOut'			:	300, 
		'titleShow'			:	true, 
		'overlayOpacity'	:	0.0, 
		'hideOnContentClick':	true, 
		'overlayShow'		:	true
	});
	
	
	
	// 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:  true,                           // disable generation of arrow mark-up 
       dropShadows: true                            // disable drop shadows 
    }); 


	$('.iframe-delta-0').attr({
	  allowtransparency: 'true'
	});
	
	
	jQuery('#mycarousel').jcarousel({
        auto: 5,
        scroll: 1,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
    
    
    $(".startdiscussie").click(function() {
		$('#voeg_topic_toe').slideToggle('normal', function() {
		    // Animation complete.
		});
	});
	
});


function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

 
// 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";
  }
  
  
}

