// JavaScript Document
$(document).ready(function() {

   cache_tout();
   affiche_menu_courant();
   
	 $("#menu").one("mouseover", function(){
			a_droite();
			
    });
	
	$("#menu").one("mouseout", function(){
			a_gauche();
			
    });
	
	var h = $('#conteneur').height();
	if (h < 600)
		h = 600;
	$('#conteneur_gauche').height(h+25);
	$('#conteneur_droite').height(h+175);
	
/*	
 
	/*
	$("#menu li a").bind("mouseover", function(e){
          var $sous_menu = '#sous_'+$(this).attr("id");
			cache_tout();
			$($sous_menu).show();
	});
	
	$("#menu").bind("mouseout", function(e){
          var $sous_menu = '#sous_'+$(this).attr("id");
			cache_tout();
			affiche_menu_courant();//$($sous_menu).show(); //css({ backgroundColor:"yellow"});
			
    });*/
	
	$("#menu li a").hover(
		function() {
		var $sous_menu = '#sous_'+$(this).attr("id");
			cache_tout();
			$($sous_menu).show();
		},
		function() {
		var $sous_menu = '#sous_'+$(this).attr("id");
			cache_tout();
			affiche_menu_courant();
		});

 });

function cache_tout()
{
	$("#sous_menu_ursiea").hide();
	$("#sous_menu_iae").hide();
	$("#sous_menu_structures").hide();
	$("#sous_menu_ressources").hide();
	
}

function affiche_menu_courant()
{
	$pos_page = 5 + window.location.search.indexOf('page=');
	$pos_fin = 0 + window.location.search.indexOf('&');
	
	if ($pos_page != -1)
	{
		$longueur = $pos_fin-$pos_page;
		if ($pos_fin != -1)
			$page = window.location.search.substr($pos_page, $longueur);
		else
			$page = window.location.search.substring($pos_page);
		
		//alert ('page : '+$page);
		
		var $sous_menu = '#sous_menu_'+$page;
		$($sous_menu).show();
	}
}

function a_droite()
{
	$("#baseline #texte").animate({"left": "+=315px"}, "slow");

}

function a_gauche()
{
		$("#baseline #texte").animate({"left": "-=315px"}, "slow");
}


	
