$(document).ready(function() {
						
	// Superfish 
	$("div#leftsidebar ul").superfish({ 
		autoArrows:    false, 
		animation: {width:'show'},   // slide-down effect without fade-in 
		delay:500           
	}); 
	
	// Products fancybox
	
	if ( $('div#gallery_single').length > 0 ){
		$("a.gallery-image").fancybox({
			'transitionIn'	:	'elastic',
			'transitionOut'	:	'elastic',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	true
		});
	}
	
	// Galleria Slider
	
	if ( $('ul#slider').length > 0 ){

		 $('ul#slider').innerfade({
		 speed: 3000,
		 timeout: 5000,
		 type: 'sequence',
		 containerheight: '193px'
	 	});
	 }
	 
	 $("div#content p img").each(function(){
		    var $link = $(this).attr('src');			
			$(this).wrap('<a class="preview" rel="group1" href="'+ $link +'" />') ;
	  });
	 
	 $("div#content h3 img").each(function(){
		    var $link = $(this).attr('src');			
			$(this).wrap('<a class="preview" rel="group1" href="'+ $link +'" />') ;
	  });
	 
	// Fancybox for preview images
	$("div#content a.preview").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'titlePosition' : 	'inside',
		'titleFormat'	: 	'formatTitle',
		'autoScale'		:	'true'
	});
	 
	// Fancybox for aanbod images
	
	$("ul.galleries_list a.preview").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'titlePosition' : 	'inside',
		'titleFormat'	: 	'formatTitle',
		'autoScale'		:	'true',
		'onComplete' : function(){
			var image = $('div#fancybox-content img').attr('src') ;
			image = addToFilename(image, "-hr") ;
			$('div#fancybox-content img').wrap('<a href="'+ image +'" class="zoom" />');
			$('a.zoom').jqzoom(options);
		}
	});
	
	var options = {  
		zoomType: 'standard',  
		lens:true,  
		preloadImages: true,  
		alwaysOn:false,  
		zoomWidth: 300,  
		zoomHeight: 250,  
		xOffset:20,  
		yOffset:0,  
		position:'right',
		title:false 
	}
	
	function addToFilename(myString, myAddition)
	{	
		var ext = myString.slice(-4) ;
		myString = myString.slice(0, myString.length -4) ;
		return  myString + myAddition + ext ;
	}

});


