/* Fonctions JS - Historial de la Vendée - HOME*/

// Espaces
var cEspace = -1;
var tEspaces = new Array('geologie', 'prehistoire', 'antiquite', 'medieval', 'moderne', 'guerre', 'dixneuvieme', 'contemporaine', 'musee');

// Init
$(document).ready(
	function() 
	{
		// Récupération du paramètre / ancre
		var oEspace = window.location.hash.replace('#', '');
		if (oEspace != '')
		{
			for (var i = 0 ; i < tEspaces.length ; i++)
			{
				if (tEspaces[i] == oEspace) cEspace = (i + 1);
			}
		}
		  
		// Intégration du SWF
	    var flashvars = { 
	        espace: cEspace,
	        urlSkin: 'http://' + window.location.host + '/global/swf/'
	    };	
	    var params = {
	        quality: "high",
	        wmode: "transparent",
	        salign: "b"
	    };
	    swfobject.embedSWF("/global/swf/historial.swf", "ZoneFlash", "460", "277", "8", false, flashvars, params);
		  
		// Initialisation du texte
		showEspace(-1);
		  
	}
);

// Fonction : affichage d'un espace
showEspace = function (iEspace)
{
	if (iEspace != -1)
	{
		var oEspace = tEspaces[iEspace - 1];	
		$('.texteFlash:not(#' + oEspace + 'Anchor)').hide();
		$('#bienvenue').fadeOut();
		$('#' + oEspace + 'Anchor').fadeIn();
	}
	else
	{
		$('.texteFlash').fadeOut();
		$('#bienvenue').fadeIn();
	}
}