$(document).ready(function(){


	$('#nav a').click(function() {

		var srcImg = $(this).attr('href');
		
		
		$('#nav a.active').removeClass('active');
		$(this).addClass('active');
		
		
		$("#slide img#imgActive").fadeOut(100, function() {
			$("#slide img#imgActive").attr({ src: srcImg });
			$("#slide img#imgActive").fadeIn(100);
			
			
		});
		
		

		return false;
	});

$('#newsfeed').feedreader({
targeturl: 'http://www.instants-suspendus.net/wp-rss2.php',
items: 3,
descLength: 50
});

$("div#preload").load("assets/templates/default/img.html", function () {
$("#loading").animate({opacity: 0}, 2000, function(){
	$("a#tirage").animate({opacity: 1}, 300);
	}
)});


/* TIRAGE ORACLE 	*/
$("a#tirage").click(
	function () {	
	
		var imgChemin = "http://www.parole-intime.com/oracle/oracle/";
		var totalNum = 33; //the total number of images in a folder.
		var rndNum = Math.floor(Math.random() * totalNum)+1;
	
		$("div#oracle").html("<img src=\"" + imgChemin + rndNum + ".jpg\" alt=\"\" />"); 
		$("div#description").css("display","none"); 
		
		$("div#description").load( imgChemin +"oracle_"+ rndNum +".html", 
					
					function() {
					$("div#description").css("display", "block"); 
					$("#oracle img").animate({opacity: 1}, 400); 
					$("a#tirage").css('display','none');
					//$("p#unparjour").css('display','inline');
					}
			);
		

		return false	
	}
);

	
/* CARTE ALEATOIRE

var imgChemin = "http://www.parole-intime.com/oracle/";
var totalNum = 33; //the total number of images in a folder.
var rndNum = Math.floor(Math.random() * totalNum)+1;
	
$("div#oracle").html("<img src=\"" + imgChemin + rndNum + ".jpg\" alt=\"\" />"); 
	*/

	

});

