$(document).ready(function(){
	/* This code is executed after the DOM has been completely loaded */
	
	$('nav a,footer a.up').click(function(e){
										  
		// If a link has been clicked, scroll the page to the link's hash target:
		
		$.scrollTo( this.hash || 0, 500);
		e.preventDefault();
	});
	
	//Hide and show
	$('#block_connexion article').click(function(){
		var text = $(this).children('div');
		
		if (text.is(':hidden')){
			
			text.slideDown('500');
			$(this).children('span').html('&uarr;');
			}
		else {
			text.slideUp('300');
			$(this).children('span').html('&darr;');
			}
		
		});
		
		//Menu deroulant
		
		$('#nav_principal .deroule').hover(
	
		function(){
			$('.premier', this).fadeIn(350, function () {
            $("span").fadeIn(100);
          });
			
			
			},
			
		function(){
			
			$('ul', this).slideUp(100);
			}
	);
		$('#nav_principal .second').hover(
	
		function(){
			$('.hide', this).fadeIn(350, function () {
            $("span").fadeIn(100);
          });
			
			
			},
			
		function(){
			
			$('ul', this).slideUp(100);
			}
	);
	
	// Expand Panel
	$("#open").click(function(){
		$("div#panel").slideDown("slow");
	
	});	
	
	// Collapse Panel
	$("#close").click(function(){
		$("div#panel").slideUp("slow");	
	});		
	
	// Switch buttons from "Log In | Register" to "Close Panel" on click
	$("#toggle a").click(function () {
		$("#toggle a").toggle();
	});	
	
	//TABS
	$(".real_tabs").next("div").hide();
	$("#show").slideDown();
	$(".real_tabs").click(function(){
		if($(this).next("div").is(":hidden")){
		$(".real_tabs").next("div:visible").slideUp();
		$(this).next("div").slideDown();
		}
		});

});
