function fadeIt()
{
	$("#oceanologie").click(function (){
		$("#fondation").html(''+"<a class=\"fondation\"><img src=\"images/design/menu/fondation_gray.png\" /></a>");
		$("#collection").html(''+"<a class=\"collection\"><img src=\"images/design/menu/collection_gray.png\" /></a>");

		
		if( $("#oceanologie a").attr("class") == "oceanologie" )
		{
			$("#oceanologie a").html("<img src=\"images/design/menu/oceanologie_blue.png\" />");
			$("#oceanologie a").attr("class","oceanologie_hover");
			
			$("#menu-droit").hide();
			$("#menu-centre").hide();
			$("#menu-centre").html("<p id=\"a-propos\"><a id=\"a-propos_a\" \"class=\"a-propos\" onclick=\"javascript:myFade('a-propos');\">ACCUEIL</a></p><p id=\"services\" ><a id=\"services_a\" class=\"services\" onclick=\"javascript:myFade('services');\">SERVICES</a></p><p id=\"references\"><a id=\"references_a\" class=\"references\" href=\"index.php?page=oceanologie_references\" \"onclick=\"javascript:myFade('references');\">R&Eacute;F&Eacute;RENCES</a></p><p id=\"materiel\"><a id=\"materiel_a\" class=\"materiel\" href=\"index.php?page=oceanologie_materiels\" onclick=\"javascript:myFade('materiel');\">MAT&Eacute;RIEL</a></p><p id=\"education\"><a id=\"education-recherche_a\" class=\"education\" onclick=\"javascript:myFade('education-recherche');\">&Eacute;DUCATION / RECHERCHE</a></p>");
			$("#menu-centre").fadeIn("slow");
		}
	});
	
	$("#fondation").click(function (){
		$("#oceanologie").html(''+"<a class=\"oceanologie\" ><img src=\"images/design/menu/oceanologie_gray.png\" /></a>");
		$("#collection").html(''+"<a class=\"collection\" ><img src=\"images/design/menu/collection_gray.png\" /></a>");

		
		if( $("#fondation a").attr("class") == "fondation" )
		{
			$("#fondation a").html("<img src=\"images/design/menu/fondation_blue.png\" />");
			$("#fondation a").attr("class","fondation_hover");
			
			$("#menu-droit").hide();
			$("#menu-centre").hide();
			
			$("#menu-centre").html("<p id=\"club\"><a id=\"club_a\" href=\"index.php?page=decouverte_club\" class=\"club\" onclick=\"javascript:myFade('club');\">ECOLE DE PLONGEE \"BIO\"</a></p><p id=\"expedition\"><a id=\"expedition_a\" href=\"index.php?page=decouverte_voyage\" class=\"expedition\" onclick=\"javascript:myFade('expedition');\">VOYAGES / DESTINATIONS LOINTAINES</a></p><p id=\"naturaliste\"><a id=\"naturaliste_a\" href=\"index.php?page=decouverte_expedition\" class=\"naturaliste\" onclick=\"javascript:myFade('naturaliste');\">EXPEDITIONS NATURALISTES</a></p>");
			$("#menu-centre").fadeIn("slow");
		}
	});
	
	$("#collection").click(function (){
		$("#oceanologie").html(''+"<a class=\"oceanologie\" ><img src=\"images/design/menu/oceanologie_gray.png\" /></a>");
		$("#fondation").html(''+"<a class=\"fondation\"><img src=\"images/design/menu/fondation_gray.png\" /></a>");

		
		if( $("#collection a").attr("class") == "collection" )
		{
			$("#collection a").html("<img src=\"images/design/menu/collection_blue.png\" />");
			$("#collection a").attr("class","collection_hover");
			
			$("#menu-droit").hide();
			$("#menu-centre").hide();
			$("#menu-centre").html("<p id=\"galerie\"><a id=\"galerie_a\" class=\"galerie\" onclick=\"javascript:myFade('galerie');\">PHOTO SOUS-MARINE</a></p><p id=\"parution\" ><a id=\"parution_a\" href=\"index.php?page=collection_edition\" class=\"parution\" onclick=\"javascript:myFade('parution');\">EDITION</a></p><p id=\"documentaire\" ><a id=\"documentaire_a\" href=\"index.php?page=collection_documentaire\" class=\"documentaire\" onclick=\"javascript:myFade('documentaire');\">TV / DOCUMENTAIRE</a></p><p id=\"exposition\" ><a id=\"exposition_a\" href=\"index.php?page=collection_exposition\" class=\"exposition\" onclick=\"javascript:myFade('exposition');\">EXPOSITIONS</a></p><p id=\"conference\" ><a id=\"conference_a\" href=\"index.php?page=collection_conference\" class=\"conference\" onclick=\"javascript:myFade('conference');\">CONFERENCES</a></p><p id=\"boutique\" ><a id=\"boutique_a\"  href=\"index.php?page=collection_boutique\"  class=\"boutique\" \">BOUTIQUE</a></p>");
			$("#menu-centre").fadeIn("slow");
		}
	});
}


/* le parametre who indique quel bloc apelle la fonction */
function myFade(who)
{
	var nav = whichNav();
	switch(who)
	{
		/* OCEANOLOGIE */
		case 'a-propos':
			document.getElementById('education-recherche_a').className = "grey";
			document.getElementById('services_a').className = "grey";
			document.getElementById('references_a').className = "grey";
			document.getElementById('materiel_a').className = "grey";
			document.getElementById('a-propos_a').className = "blue";
			$("#menu-droit").hide();
			$("#menu-droit").html("<p id=\"societe\"><a id=\"societe_a\" href=\"index.php?page=oceanologie_accueil\">SOCIETE</a></p><p id=\"histoire\"><a id=\"histoire_a\" href=\"index.php?page=oceanologie_presentation\">HISTOIRE</a></p><p id=\"equipe\" ><a id=\"equipe_a\" href=\"index.php?page=oceanologie_equipe\">&Eacute;QUIPE</a></p><p id=\"philosophie\" ><a href=\"index.php?page=oceanologie_valeur\"id=\"philosophie_a\">PHILOSOPHIE / VALEURS</a></p><p id=\"locaux\" ><a href=\"index.php?page=oceanologie_locaux\"id=\"locaux_a\">LOCAUX</a></p><p id=\"presse\" ><a href=\"index.php?page=oceanologie_presse\"id=\"presse_a\">PRESSE</a></p>");				
		
			//$("#menu-droit").fadeIn("slow");
			if(nav == 'IE')
				$("#menu-droit").show();
			else
				$("#menu-droit").fadeIn("slow");
		break;
		
		case 'services':
			document.getElementById('education-recherche_a').className = "grey";
			document.getElementById('services_a').className = "blue";
			document.getElementById('references_a').className = "grey";
			document.getElementById('materiel_a').className = "grey";
			document.getElementById('a-propos_a').className = "grey";
			$("#menu-droit").hide();
			$("#menu-droit").html("<p id=\"bathymetrie\" ><a id=\"bathymetrie_a\" href=\"index.php?page=oceanologie_bathymetrie\">BATHYMETRIE</a></p><p id=\"cartographie\"><a id=\"cartographie_a\" href=\"index.php?page=oceanologie_cartographie\">CARTOGRAPHIE / SIG</a></p><p id=\"expertise\" ><a id=\"expertise_a\" href=\"index.php?page=oceanologie_expertise\">EXPERTISE ECOLOGIQUE</a></p><p id=\"amenagement\" ><a id=\"amenagement_a\" href=\"index.php?page=oceanologie_amenagement\">AMENAGEMENT DURABLE</a></p><p id=\"formation\" ><a id=\"formation_a\" href=\"index.php?page=oceanologie_formation\">FORMATION</a></p><p id=\"location\" ><a id=\"location_a\" href=\"index.php?page=oceanologie_location\">LOCATION</a></p>");				
			
			if(nav == 'IE')
				$("#menu-droit").show();
			else
				$("#menu-droit").fadeIn("slow");
		break;
		
		case 'references':
			document.getElementById('education-recherche_a').className = "grey";
			document.getElementById('services_a').className = "grey";
			document.getElementById('references_a').className = "blue";
			document.getElementById('materiel_a').className = "grey";
			document.getElementById('a-propos_a').className = "grey";
			$("#menu-droit").hide();	
		break;
		
		case 'materiel':
			document.getElementById('education-recherche_a').className = "grey";
			document.getElementById('services_a').className = "grey";
			document.getElementById('references_a').className = "grey";
			document.getElementById('materiel_a').className = "blue";
			document.getElementById('a-propos_a').className = "grey";
			$("#menu-droit").hide();		
		break;
		
		case 'education-recherche':
			document.getElementById('education-recherche_a').className = "blue";
			document.getElementById('services_a').className = "grey";
			document.getElementById('references_a').className = "grey";
			document.getElementById('materiel_a').className = "grey";
			document.getElementById('a-propos_a').className = "grey";
			$("#menu-droit").hide();
			$("#menu-droit").html("<p id=\"education\" ><a id=\"education_a\" href=\"index.php?page=oceanologie_education\">EDUCATION</a></p><p id=\"recherche\"><a id=\"recherche_a\" href=\"index.php?page=oceanologie_recherche\">RECHERCHE</a></p>");				
			
			if(nav == 'IE')
				$("#menu-droit").show();
			else
				$("#menu-droit").fadeIn("slow");
		break;
		
		/* COLLECTION*/
		case 'galerie':
			document.getElementById('galerie_a').className = "blue";
			document.getElementById('parution_a').className = "grey";
			document.getElementById('documentaire_a').className = "grey";
			document.getElementById('exposition_a').className = "grey";
			document.getElementById('conference_a').className = "grey";
			document.getElementById('boutique_a').className = "grey";
			$("#menu-droit").hide();
			$("#menu-droit").html("<p id=\"making\"><a id=\"making_a\" href=\"index.php?page=collection_makingof\">MAKING OF</a></p><p id=\"galerieG\"><a id=\"galerieG_a\" href=\"index.php?page=collection_galerie\">GALERIE</a></p>");	
			
			if(nav == 'IE')
				$("#menu-droit").show();
			else
				$("#menu-droit").fadeIn("slow");
			
		break;
		
		case 'parution':
			document.getElementById('galerie_a').className = "grey";
			document.getElementById('parution_a').className = "blue";
			document.getElementById('documentaire_a').className = "grey";
			document.getElementById('exposition_a').className = "grey";
			document.getElementById('conference_a').className = "grey";
			document.getElementById('boutique_a').className = "grey";
			$("#menu-droit").hide();
		break;
		
		case 'documentaire':
			document.getElementById('galerie_a').className = "grey";
			document.getElementById('parution_a').className = "grey";
			document.getElementById('documentaire_a').className = "blue";
			document.getElementById('exposition_a').className = "grey";
			document.getElementById('conference_a').className = "grey";
			document.getElementById('boutique_a').className = "grey";
			$("#menu-droit").hide();
		break;
		
		case 'exposition':
			document.getElementById('galerie_a').className = "grey";
			document.getElementById('parution_a').className = "grey";
			document.getElementById('documentaire_a').className = "grey";
			document.getElementById('exposition_a').className = "blue";
			document.getElementById('conference_a').className = "grey";
			document.getElementById('boutique_a').className = "grey";
			$("#menu-droit").hide();
		break;
		
		case 'conference':
			document.getElementById('galerie_a').className = "grey";
			document.getElementById('parution_a').className = "grey";
			document.getElementById('documentaire_a').className = "grey";
			document.getElementById('exposition_a').className = "grey";
			document.getElementById('conference_a').className = "blue";
			document.getElementById('boutique_a').className = "grey";
			$("#menu-droit").hide();
		break;
		
		case 'boutique':
			document.getElementById('galerie_a').className = "grey";
			document.getElementById('parution_a').className = "grey";
			document.getElementById('documentaire_a').className = "grey";
			document.getElementById('exposition_a').className = "grey";
			document.getElementById('conference_a').className = "grey";
			document.getElementById('boutique_a').className = "blue";
			$("#menu-droit").hide();
		break;
		
		/* FONDATION - DECOUVERTE */
		case 'expedition':
			document.getElementById('expedition_a').className = "blue";
			//document.getElementById('carte_a').className = "grey";
			document.getElementById('club_a').className = "grey";
			document.getElementById('naturaliste_a').className = "grey";
		break;
		/*
		case 'carte':
			document.getElementById('expedition_a').className = "grey";
			document.getElementById('carte_a').className = "blue";
			document.getElementById('club_a').className = "grey";
			document.getElementById('naturaliste_a').className = "grey";
		break;
		*/
		case 'club':
			document.getElementById('expedition_a').className = "grey";
			//document.getElementById('carte_a').className = "grey";
			document.getElementById('club_a').className = "blue";
			document.getElementById('naturaliste_a').className = "grey";
		break;
		case 'naturaliste':
			document.getElementById('expedition_a').className = "grey";
			document.getElementById('club_a').className = "grey";
			//document.getElementById('carte_a').className = "grey";
			document.getElementById('naturaliste_a').className = "blue";
		break;
		
	}
}

function colorMenu(page)
{
	/* Dans le cas ou la page appartient à la catégorie OCEANOLOGIE */
	if(page == 'societe' || page == 'histoire' || page == 'accueil' || page == 'equipe' || page == 'philosophie' || page == 'locaux' || page == 'presse' || page == 'cartographie' || page == 'expertise' 	|| page == 'location' || page == 'amenagement' || page == 'bathymetrie' || page == 'formation' || page == 'references' || page == 'materiel' || page == 'education' || page == 'recherche' )
	{			
		$("#fondation").html(''+"<a href=\"index.php?page=decouverte_club\"  class=\"fondation\"><img src=\"images/design/menu/fondation_gray.png\" /></a>");
		$("#collection").html(''+"<a href=\"index.php?page=collection_makingof\"  class=\"collection\" ><img src=\"images/design/menu/collection_gray.png\" /></a>");
		if( $("#oceanologie a").attr("class") == "oceanologie" )
		{
			$("#oceanologie a").html("<img src=\"images/design/menu/oceanologie_blue.png\" />");
			$("#oceanologie a").attr("class","oceanologie_hover");
			
			$("#menu-droit").hide();
			$("#menu-centre").hide();
			$("#menu-centre").html("<p id=\"a-propos\"><a id=\"a-propos_a\" \"class=\"a-propos\" onclick=\"javascript:myFade('a-propos');\">ACCUEIL</a></p><p id=\"services\" ><a id=\"services_a\" class=\"services\" onclick=\"javascript:myFade('services');\">SERVICES</a></p><p id=\"references\"><a id=\"references_a\" class=\"references\" href=\"index.php?page=oceanologie_references\" \"onclick=\"javascript:myFade('references');\">R&Eacute;F&Eacute;RENCES</a></p><p id=\"materiel\"><a id=\"materiel_a\" class=\"materiel\" href=\"index.php?page=oceanologie_materiels\" onclick=\"javascript:myFade('materiel');\">MAT&Eacute;RIEL</a></p><p id=\"education\"><a id=\"education-recherche_a\" class=\"education\" onclick=\"javascript:myFade('education-recherche');\">&Eacute;DUCATION / RECHERCHE</a></p>");
			$("#menu-centre").fadeIn("slow");
		}
		
	}else if(page == 'club' || page == 'expedition' || page == 'expedition_naturaliste' || page == 'carte')// la page appartient à la catégorie EXPLORATION
	{
		$("#oceanologie").html(''+"<a href=\"index.php?page=oceanologie_accueil\" class=\"oceanologie\" ><img src=\"images/design/menu/oceanologie_gray.png\" /></a>");
		$("#collection").html(''+"<a href=\"index.php?page=collection_makingof\" class=\"collection\" ><img src=\"images/design/menu/collection_gray.png\" /></a>");
		
		if( $("#fondation a").attr("class") == "fondation" )
		{
			$("#fondation a").html("<img src=\"images/design/menu/fondation_blue.png\" />");
			$("#fondation a").attr("class","fondation_hover");
			
			$("#menu-droit").hide();
			$("#menu-centre").hide();
			
			$("#menu-centre").html("<p id=\"club\"><a id=\"club_a\" href=\"index.php?page=decouverte_club\" class=\"club\" onclick=\"javascript:myFade('club');\">ECOLE DE PLONGEE \"BIO\"</a></p><p id=\"expedition\"><a id=\"expedition_a\" href=\"index.php?page=decouverte_voyage\" class=\"expedition\" onclick=\"javascript:myFade('expedition');\">VOYAGES / DESTINATIONS LOINTAINES</a></p><p id=\"naturaliste\"><a id=\"naturaliste_a\" href=\"index.php?page=decouverte_expedition\" class=\"naturaliste\" onclick=\"javascript:myFade('naturaliste');\">EXPEDITIONS NATURALISTES</a></p>");
			$("#menu-centre").fadeIn("slow");
		}
	}else if(page == 'makingof' || page == 'galerie' || page == 'edition' || page == 'documentaire' || page == 'exposition' || page == 'conference' || page == 'boutique')	//Partie COLLECTION
	{
		$("#oceanologie").html(''+"<a href=\"index.php?page=oceanologie_accueil\" class=\"oceanologie\" ><img src=\"images/design/menu/oceanologie_gray.png\" /></a>");
		$("#fondation").html(''+"<a href=\"index.php?page=decouverte_club\"  class=\"fondation\"><img src=\"images/design/menu/fondation_gray.png\" /></a>");
		if( $("#collection a").attr("class") == "collection" )
		{
			$("#collection a").html("<img src=\"images/design/menu/collection_blue.png\" />");
			$("#collection a").attr("class","collection_hover");
			
			$("#menu-droit").hide();
			$("#menu-centre").hide();
			$("#menu-centre").html("<p id=\"galerie\"><a id=\"galerie_a\" class=\"galerie\" onclick=\"javascript:myFade('galerie');\">PHOTO SOUS-MARINE</a></p><p id=\"parution\" ><a id=\"parution_a\" href=\"index.php?page=collection_edition\" class=\"parution\" onclick=\"javascript:myFade('parution');\">EDITION</a></p><p id=\"documentaire\" ><a id=\"documentaire_a\" href=\"index.php?page=collection_documentaire\" class=\"documentaire\" onclick=\"javascript:myFade('documentaire');\">TV / DOCUMENTAIRE</a></p><p id=\"exposition\" ><a id=\"exposition_a\" href=\"index.php?page=collection_exposition\" class=\"exposition\" onclick=\"javascript:myFade('exposition');\">EXPOSITIONS</a></p><p id=\"conference\" ><a id=\"conference_a\" href=\"index.php?page=collection_conference\" class=\"conference\" onclick=\"javascript:myFade('conference');\">CONFERENCES</a></p><p id=\"boutique\" ><a href=\"index.php?page=collection_boutique\" id=\"boutique_a\" class=\"boutique\" onclick=\"javascript:myFade('boutique');\">BOUTIQUE</a></p>");
			$("#menu-centre").fadeIn("slow");
		}
	}
	
	switch(page)
	{
		/* OCEANOLOGIE */
		/* ACCUEIL */
		case 'societe':
			myFade('a-propos');
			document.getElementById('societe_a').className = "blue";
		break;
		case 'histoire':
			myFade('a-propos');
			document.getElementById('histoire_a').className = "blue";
		break;
			
		case 'accueil':
		break;			
		
		case 'equipe':
			myFade('a-propos');
			document.getElementById('equipe_a').className = "blue";
		break;
			
		case 'philosophie':
			myFade('a-propos');
			document.getElementById('philosophie_a').className = "blue";
		break;
			
		case 'locaux':
			myFade('a-propos');
			document.getElementById('locaux_a').className = "blue";
		break;
			
		case 'presse':
			myFade('a-propos');
			document.getElementById('presse_a').className = "blue";
		break;
			
		/* SERVICES */
		case 'cartographie':
			myFade('services');
			document.getElementById('cartographie_a').className = "blue";
		break;
			
		case 'expertise':
			myFade('services');
			document.getElementById('expertise_a').className = "blue";
		break;
			
		case 'location':
			myFade('services');
			document.getElementById('location_a').className = "blue";
		break;
		
		case 'amenagement':
			myFade('services');
			document.getElementById('amenagement_a').className = "blue";
		break;
		
		case 'bathymetrie':
			myFade('services');
			document.getElementById('bathymetrie_a').className = "blue";
		break;
		
		case 'formation':
			myFade('services');
			document.getElementById('formation_a').className = "blue";
		break;
		
		/* REFERENCES ET MATERIELS */
		case 'references':
			myFade('references');
		break;
		
		case 'materiel':
			myFade('materiel');
		break;
		
		/* RECHERCHE EDUCATION */
		case 'education':
			myFade('education-recherche');
			document.getElementById('education_a').className = "blue";
		break;
			
		case 'recherche':
			myFade('education-recherche');
			document.getElementById('recherche_a').className = "blue";
		break;
		
		/* FONDATION */
		case 'club':
			myFade('club');
			document.getElementById('club_a').className = "blue";
		break;
			
		case 'expedition':
			myFade('expedition');
			document.getElementById('expedition_a').className = "blue";
		break;
			
		case 'expedition_naturaliste':
			myFade('naturaliste');
			document.getElementById('naturaliste_a').className = "blue";
		break;
			
		case 'carte':
			myFade('carte');
		break;
		
		/* COLLECTION */
		/* PHOTO SOUS MARINE */
		case 'makingof':
			myFade('galerie');
			document.getElementById('making_a').className = "blue";
			document.getElementById('galerie_a').className = "blue";
		break;
		case 'galerie':
			myFade('galerie');
			document.getElementById('galerie_a').className = "blue";
			document.getElementById('galerieG_a').className = "blue";
		break;
		/* ! */
		case 'edition':
			myFade('parution');
			document.getElementById('parution_a').className = "blue";
		break;
		
		case 'documentaire':
			myFade('documentaire');
			document.getElementById('documentaire_a').className = "blue";
		break;
		
		case 'exposition':
			myFade('exposition');
		break;
		
		case 'conference':
			myFade('conference');
			document.getElementById('conference_a').className = "blue";
		break;
		
		case 'boutique':
			myFade('boutique');
		break;
		
	}
}


function afficheLarge(url,legende)
{
	$("#div_photo").hide();
	$("#div_legende_histoire").hide();
	var img = '<img src="'+url+'" alt="'+legende+'" width="336" height ="222"/>';
	$("#div_photo").html(img);
	$("#div_legende_histoire").html(legende);
	$("#div_photo").fadeIn(1000);
	$("#div_legende_histoire").fadeIn(1000);
}


function randomBackground()
{
	var X = 1;
	var Y = 16;
	
	var currentLocation =  document.location.href;
	if(currentLocation == 'http://www.andromede-ocean.com/Andromede/index.php?page=collection_galerie')
	{
		$("body").css({
		  'background-image' : 'url(images/design/backgrounds/16.jpg)'
		});
	}else
	{		
		var back = Math.floor(Math.random()*(Y-X))+X;
				
		$("body").css({
		  'background-image' : 'url(images/design/backgrounds/'+back+'.jpg)'
		});
	}
}

function whichNav()
{

    var strChUserAgent = navigator.userAgent;
    var intSplitStart = strChUserAgent.indexOf("(",0);
    var intSplitEnd = strChUserAgent.indexOf(")",0);
    var strChStart = strChUserAgent.substring(0,intSplitStart);
    var strChMid = strChUserAgent.substring(intSplitStart, intSplitEnd);
    var strChEnd = strChUserAgent.substring(strChEnd);
	
    if(strChMid.indexOf("MSIE 7") != -1)
		return 'IE';
    else if(strChMid.indexOf("MSIE 6") != -1)
		return 'IE';
    else if(strChMid.indexOf("MSIE 8") != -1)
		return 'IE';
    else if(strChEnd.indexOf("Firefox/2") != -1)
		return 'FF2';
    else if(strChEnd.indexOf("Firefox") != -1)
		return 'FF';
    else if(strChEnd.indexOf("Netscape/7") != -1)
		return 'NC7';
    else if(strChEnd.indexOf("Netscape") != -1)
		return 'NC';
    else if(strChStart.indexOf("Opera/9") != -1)
		return 'O9';
    else if(strChStart.indexOf("Opera") != -1)
		return 'O';
    else
		return'autre';
}

function fadeBloc()
{
		/*$("#bloc").fadeTo(600,0.05,function()
							{
							});*/
		$("#bloc").css('background-color','#cecece');
}


function fadeBigBloc()
{
	var corps = document.getElementsByTagName("body")[0];
	var a = document.createElement('a');
	a.setAttribute('id','aFade');
	a.setAttribute('onmouseover','javascript:afficheBigBloc();');
	/*$('#bloc').(600,function()
	{
		corps.appendChild(a);
	});*/
	$('#bloc').hide();
	corps.appendChild(a);
}

function afficheBigBloc()
{
	$("#bloc").fadeIn('slow');
	var a = document.getElementById("aFade");
	a.parentNode.removeChild(a);
}

