// Active logo, onclick return to home page
jQuery(document).ready(function(){
	// habillage des selects
	if($('.blackSelect').length) 
    {
		$('.blackSelect').selectmenu({style :'dropdown', 
									
									  width : 500
						});
	}
	// Active logo, onclick return to home page
    $(".logo-header").click(
        function()
        {
            var href =  $('a', this).get(0).href;
            document.location.href = href;
        }
    );
    
    $("#preinscription").submit(function(){
    	var email = $("#preInscription_email").val();
    	var confirmEmail = $("#preInscription_confirm_email").val();
    	
    	if(email != confirmEmail)
    	{
    		$("#preinscription_error").text("Les 2 emails ne sont pas identiques. Merci de vérifier.");
    		return false;
    	}
    });
    
    $("#searchForm").submit(function(){
    	var name 	   = $("#name").val();
    	var department = $("#department").val();
    	var country    = $("#country").val();
    	var activity = $("#activity").val();
    	
    	if(name == "" && department == "" && country == "" && activity == "")
    	{
    		$("#searchForm_error").show().html("Merci de remplir au moins un des champs nom, département ou pays.");
    		return false;
    	}
    });
    
    $(".theme").click(
    		function()
    		{
    			var id  = "#" + $(this).attr('id');
    			var title = $(id +" > img").attr('title');
    			$("#curElem").text(title);
    			document.getElementById('rotatorId').loadFile({file : baseUrl + 'som/som/get-album-photo-playlist/id/' + this.id.replace('album-','')});
    		}
    	);
    
    displayAlert.init(0);
    
    
});

$(function() {
       if (jQuery.fn.carousel){     
           jQuery('#slider-stage').carousel('#previous', '#next');
        }

});

var switchSite = {
	    el : null,
	    url : null,
	    init : function(el) {
	        $(el).change(function(){        	
	        	 target = $(this).val();
	        	 document.location.href = target;
	    });
	        
	    }
	};
var displayAlert = {
	
	init: function(error){
		if (!error)
		{
			$("#topError").hide();
		}
		else
		{
			$("#topError").show();
		}
	}
};

