$(document).ready(function(){

	//Menu déroulant
	$(function() {
    	$('#menu_drop').droppy({speed: 100});
	});
	
	//Formulaire newsletter
	$('#bt_valid_newsletter').click(function(){
		
		var nom 	= $('#nom').val();
	    var prenom 	= $('#prenom').val();
	    var email 	= $('#email').val();	    
	    var choix 	= $('input[type=radio][name=choix_news]:checked').attr('value');
	    
	    $.post('/modules/newsletter/newsletter.php', {'email': email, 'choix': choix, 'nom': nom, 'prenom': prenom}, function(data){
	    	$('#message_validation').css('opacity', 1);
	    	$('#message_validation').empty();
	    	$('#message_validation').append(data);
	    	setTimeout(function(){
				$('#message_validation').animate({opacity: 0}, 500);
    		}, 5000);
	    });
    });
	
	//Actualité slider vertical
	if($('#liste-actualite .SlideTab').size() > 0){
		$('#liste-actualite .SlideTab').tabSwitch('create', {type: 'scroll', height: 110, width: 290, speed: 2000 });
		$('#liste-actualite .SlideTab').tabSwitch('startAuto',{interval: 8000});
	}
	
	//Messages du forum slider vertical
	if($('#liste-message .SlideTab').size() > 0){
		$('#liste-message .SlideTab').tabSwitch('create', {type: 'scroll', height: 130, width: 290, speed: 2000 });
		$('#liste-message .SlideTab').tabSwitch('startAuto',{interval: 10000});
	}
	
	//Lightbox prettyPhoto
	$("a.lightbox").attr("rel","prettyPhoto[gallery]");
 	// Lightbox page d'accueil
	$("a.popup_accueil").attr("rel","prettyPhoto[gallery]");

	
	if($("a[rel^='prettyPhoto']").size()>0) {
		
		$("a[rel^='prettyPhoto']").prettyPhoto({
			animationSpeed: 'normal', /* fast/slow/normal */
			padding: 40, /* padding for each side of the picture */
			opacity: 0.40, /* Value betwee 0 and 1 */
			showTitle: false, /* true/false */
			allowresize: true, /* true/false */
			counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
			theme: 'dark_rounded', /* 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 */
		});
	}
		
});
