$(document).ready(function() {
	// Initialize the 'pretty photo' behavior for images
	$('.gallery-item a, a[rel^="prettyPhoto"], .widget_sp_image a[target^="_blank"]').not('.testimonial-item a').prettyPhoto({
		animationSpeed: 'normal', /* fast/slow/normal */
		padding: 15, /* padding for each side of the picture */
		opacity: 0.7, /* Value betwee 0 and 1 */
		showTitle: false, /* true/false */
		allowresize: true, /* true/false */
		counter_separator_label: ' of ', /* The separator for the gallery counter 1 "of" 2 */
		theme: 'facebook', /* light_rounded / dark_rounded / light_square / dark_square */
		hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
		modal: false, /* If set to true, only the close button will close the window */
		changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
		callback: function(){} /* Called when prettyPhoto is closed */
	});


	// Add 'rel' attribute to all images in a specific gallery
	$('.gallery a').not('.testimonial-item a').each(function() {
		var galleryId = $(this).parents('.gallery').attr('id');
		$(this).attr('rel', 'prettyPhoto['+ galleryId +']');
	});

	// A little animation for the captions
	$('.gallery-item').hover(
		function() {
			$(this).children('.gallery-caption').slideToggle();
		},
		function () {
			$(this).children('.gallery-caption').slideToggle();
		}
	);

	$('.infiniteCarousel').infiniteCarousel();

});