
	// 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 mensajeRellenaCampos		= "Tienes que rellenar todos los campos antes de enviar el formulario.";
	var mensajeAceptaPolitica		= "Para enviar el formulario debes aceptar la política de privacidad.";
	var mensajeFormatoMailError		= "El e-mail debe tener un formato correcto.";
	var mensajeFormatoCPostalError	= "El codigo postal debe tener un formato correcto.";
	var mensajeEnviadoOk			= "¡Gracias! Se ha enviado el formulario correctamente.";
	var mensajeEnviadoKo			= "¡Lo sentimos! El formulario no se ha podido enviar, ha habido un error. Inténtelo más tarde.";
	*/
	
	var alertVisible = false;
	var loadingVisible = false;
	var bigwebVisible = false;

	function mostrarAlertMensaje ( mensaje )
	{
		if ( alertVisible ) return;
		
		alertVisible = true;
		
		$('alertBlockBody').innerHTML = '<h5>' + mensajeTitleAlerta + '</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 "rellenacampos":
				$('alertBlockBody').innerHTML = '<h5>' + mensajeTitleAlerta + '</h5><p>' + mensajeRellenaCampos + '</p>';
				break;
				
			case "formatoemail":
				$('alertBlockBody').innerHTML = '<h5>' + mensajeTitleAlerta + '</h5><p>' + mensajeFormatoMailError + '</p>';
				break;
				
			case "formatocpostal":
				$('alertBlockBody').innerHTML = '<h5>' + mensajeTitleAlerta + '</h5><p>' + mensajeFormatoCPostalError + '</p>';
				break;
				
			case "formatotelefono":
				$('alertBlockBody').innerHTML = '<h5>' + mensajeTitleAlerta + '</h5><p>' + mensajeFormatoTelefono + '</p>';
				break;
				
			case "politica":
				$('alertBlockBody').innerHTML = '<h5>' + mensajeTitleAlerta + '</h5><p>' + mensajeAceptaPolitica + '</p>';
				break;
				
			case "sendok":
				$('alertBlockBody').innerHTML = '<h5>' + mensajeTitleAlerta + '</h5><p>' + mensajeEnviadoOk + '</p>';
				break;
				
			case "senderror":
				$('alertBlockBody').innerHTML = '<h5>' + mensajeTitleAlerta + '</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 (); })
		} );
	}
	
