$(document).ready(function(){

/*
//flickr
var url_xml_flickr = 'http://www.guidy.fr/poly/jamet/wp-content/themes/jamet/xml_flickr.php';
	$('.flickr_slider').each(function(index) {
		var set = $(this).attr('set');
		url_xml_flickr_f = url_xml_flickr + "?type=flickr_slider&set=" + set;

		charger_flickr(url_xml_flickr_f, '.flickr_slider');		
	});
	$('.flickr_album').each(function(index) {
		var set = $(this).attr('set');
		url_xml_flickr_f = url_xml_flickr + "?type=flickr_album&set=" + set;
		
		charger_flickr(url_xml_flickr_f, '.flickr_album');
	});

function charger_flickr(url, type){
	$.get(url, function(data) {
		$(type).append(data);
	});
}
//flickr
*/

    // Load theme
    Galleria.loadTheme('http://www.marc-antoine-jamet.com/wp-content/themes/jamet/js/galleria.classic.js');

var i=0;
	$('.galleria').each(function(index) {

		i++;
		$( this ).attr( 'id', 'galleria'+i );

//		alert('#galleria'+i);
		
				// run galleria and add some options
		$('#galleria'+i).galleria({
			image_crop: false, // crop all images to fit
			thumb_crop: true, // crop all thumbnails to fit
			transition: 'fade', // crossfade photos
			transition_speed: 700, // slow down the crossfade
			data_config: function(img) {
				// will extract and return image captions from the source:
				return  {
					title: $(img).parent().next('strong').html(),
					description: $(img).parent().next('strong').next().html()
				};
			},
			extend: function() {
				this.bind(Galleria.IMAGE, function(e) {
					// bind a click event to the active image
					$(e.imageTarget).css('cursor','pointer').click(this.proxy(function() {
						// open the image in a lightbox
						this.openLightbox();
					}));
				});
			}
		});

	});




});
