$(document).ready(function() {
	
	// Ini Slideshow
	$('#slideshow').cycle({ 
    fx:     'fade', 
    speed:   400, 
    timeout: 3000, 
    pause:   1 
	});
	
	// Ini Carousel
	 jQuery('#home-carousel').jcarousel();
	
	// Patch Carousel video	
	$(".jcarousel-skin-videos .jcarousel-item-horizontal").css("margin", "0 6px 0 0");
	
	 // Insert :: 
	$('p.bullet-doubleDot').prepend(':: ');
	//$(".galleryVideo a").fancybox();

	// Bloc articles
	$(".articles-list li").click(function(){
    	window.location=$(this).find("a").attr("href");return false;
	});
	 	
	$("#news-home ul li:last-child").addClass("lastNews");
	$(".blog-post:last-child").css("border-bottom", "0");
 
	// PDF Link Styling
	$("a[href$='.pdf']").addClass("pdf");
	
	// English Version
	$(".light-window").fancybox({
		'modal' : true
	});	
	
	$(".yTube").click(function() {
		$.fancybox({
				'padding'		: 10,
				'autoScale'		: false,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none',
				'title'			: this.title,
				'width'		: 680,
				'height'		: 495,
				'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
				'type'			: 'swf',
				'swf'			: {
				'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
				}
			});
		
			return false;
		});
		
		$("a[rel=scenergie_group]").fancybox({
			'padding'		    : 0,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titlePosition' 	: 'over',
			'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
				return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
			}
		});	
	
});
