
	// JavaScript Document

	//
	//	funcAlert.js
	//	Fecha de creacion: 1 / 03 / 2011
	//	Descripción: Contiene funciones para las transiciones del desplegable
	//
	
	/*
	// Mensajes de alerta extraidas en los ficheros de idiomas (fileIdiomas)
	var mensajeSubscriuPolEdad	= "Per subscriu-re't has d'acceptar la política de privacitat i tenir més de 13 anys";
	var mensajeContactePolEdad	= "Per contactar has d'acceptar la política de privacitat i tenir més de 13 anys";
	var mensajeValidaEmail		= "El e-mail ha de tenir un format correcte";
	*/
	
	var alertVisible = false;
	var loadingVisible = false;
	var bigwebVisible = false;

	function mostrarAlertMensaje ( mensaje )
	{
		if ( alertVisible ) return;
		
		alertVisible = true;
		
		$('alertBlockBody').innerHTML = '<h5>Alerta</h5><p>' + mensaje + '</p>';
		
		mostrarCapaFondoClaro ();
		
		new Effect.Opacity('alertBlockFixed', { 	
				from: 0, 
				to: 1, 
				duration: 0.7,
				afterUpdate: (function(){ $('alertBlockFixed').style.visibility = 'visible'; })
		} );
	}

	function mostrarAlert ( mensaje )
	{
		if ( alertVisible ) return;
		
		alertVisible = true;

		switch ( mensaje )
		{
			case "mensajeSubscriuPolEdad":
				$('alertBlockBody').innerHTML = '<h5>Alerta</h5><p>' + mensajeSubscriuPolEdad + '</p>';
				break;
				
			case "mensajeContactePolEdad":
				$('alertBlockBody').innerHTML = '<h5>Alerta</h5><p>' + mensajeContactePolEdad + '</p>';
				break;
				
			case "mensajeValidaEmail":
				$('alertBlockBody').innerHTML = '<h5>Alerta</h5><p>' + mensajeValidaEmail + '</p>';
				break;
				
			case "mensajeEnviadoOK":
				$('alertBlockBody').innerHTML = '<h5>Alerta</h5><p>' + mensajeEnviadoOK + '</p>';
				break;
				
			case "mensajeEnviadoKO":
				$('alertBlockBody').innerHTML = '<h5>Alerta</h5><p>' + mensajeEnviadoKO + '</p>';
				break;
				
			default:
				break;
		}
		
		//$('alertBlockContent').innerHTML = '<h5>Aviso del sistema:</h5><p>Estamos locos o que.<br />Gracias!</p>';
		
		mostrarCapaFondoClaro ();
		
		new Effect.Opacity('alertBlockFixed', { 	
				from: 0, 
				to: 1, 
				duration: 0.7,
				afterUpdate: (function(){ $('alertBlockFixed').style.visibility = 'visible'; })
		} );
	}
	
	function ocultarAlert ()
	{
		if ( alertVisible == false ) return;
		
		alertVisible = false;
		
		ocultarCapaFondoClaro ();
		
		new Effect.Opacity('alertBlockFixed', { 	
				from: 1, 
				to: 0, 
				duration: 0.7,
				afterFinish: (function(){ $('alertBlockFixed').style.visibility = 'hidden'; })
		} );
	}
	
	
	// LOADING
	
	function mostrarLoadingMuseu ()
	{
		if ( loadingVisible ) return;
		
		loadingVisible = true;
		
		mostrarCapaFondoClaro ();
		
		new Effect.Opacity('loadingBlockFixed', { 	
				from: 0, 
				to: 1, 
				duration: 0.7,
				afterUpdate: (function(){ $('loadingBlockFixed').style.visibility = 'visible'; })
		} );
	}
	
	function ocultarLoadingMuseu ()
	{
		if ( loadingVisible == false ) return;
		
		loadingVisible = false;
		
		ocultarCapaFondoClaro ();
		
		new Effect.Opacity('loadingBlockFixed', { 	
				from: 1, 
				to: 0, 
				duration: 0.7,
				afterFinish: (function(){ $('loadingBlockFixed').style.visibility = 'hidden'; })
		} );
	}

	// FONDO OSCURO
	
	function mostrarCapaFondoClaro ()
	{
		var arrayPageSize = getTamPagina ();
		$('whiteBlockFixed').style.height = arrayPageSize[1] + 'px';
		
		// Oculta los elementos que están por encima
		ocultarElementosUppers ();
		
		new Effect.Appear ( 'whiteBlockFixed' , { 
				duration: 0.6, 
				from: 0.0, 
				to: 0.5,
				afterUpdate: (function(){ $('whiteBlockFixed').style.visibility = 'visible'; ocultarElementosUppers (); })
		} );
	}
	
	function ocultarCapaFondoClaro ()
	{
		new Effect.Appear ( 'whiteBlockFixed' , { 
				duration: 0.3, 
				from: 0.5, 
				to: 0.0,
				afterFinish: (function(){ $('whiteBlockFixed').style.visibility = 'hidden'; mostrarElementosUppers (); })
		} );
	}
	
