/**
 * Navigation Ajax - http://www.webinventif.fr/navigation-sans-rechargement-de-page-via-javascript-jquery/
 * 
 * Copyright (c) 2008 Julien Chauvin (webinventif.fr)
 * Licensed under the Creative Commons License:
 * http://creativecommons.org/licenses/by/3.0/
 *
 * Date: 2008-03-13 */
function ajax_page_advanced(ele,url){
	$('#footer').animate({ marginTop:'20px' }, 500 );
	$(ele).slideUp(500, function(){
		$(ele).html('<div class="loader"></div>').slideDown(500, function(){
			$(ele).load(url+' '+ele, null, function(){
				var tampon = $(ele).html();
				$(ele).html('<div class="loader"></div>').slideUp(500,function(){
					$(ele).html(tampon);
					// Navigation AJAX
					$('#content a.ajax').click(function(){
						ajax_page_advanced('#content',this.href);
						return false;
					});
					// Formulaire SPIP AJAX
					jQuery('form').removeClass();
					jQuery('form').parents('div.ajax').formulaire_dyn_ajax();
					jQuery('div.ajaxbloc').ajaxbloc();
					// Galerie
					$("a[rel^='prettyPhoto']").prettyPhoto({
						animationSpeed:'fast',
						padding:40,
						opacity:0.35,
						showTitle:false,
						allowresize:true,
						counter_separator_label: ' sur ',
						theme: 'light_rounded',
						callback: function(){}
					});
					$(ele).slideDown(500);
					$('#footer').animate({ marginTop:'0px' }, 500 );
				});
			});
		});
	});
}

$(document).ready(function(){
	// AJAX
	$('a.ajax').click(function(){
		ajax_page_advanced('#content',this.href);
		return false;
	});
	// Galerie
	$("a[rel^='prettyPhoto']").prettyPhoto({
		animationSpeed:'fast',
		padding:40,
		opacity:0.35,
		showTitle:false,
		allowresize:true,
		counter_separator_label: ' sur ',
		theme: 'light_rounded',
		callback: function(){}
	});
});