/*
 * Precarga de imágenes
 * JMGarcia 2010/12/08
 */
function precarga() {
  var d=document; 
  if(d.images){ 
  	if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=precarga.arguments; 
	for(i=0; i<a.length; i++)
    	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
// ------ Fin de precarga ------------------------------------

/*
	addLoadEvent()
	Adds event to window.onload without overwriting currently assigned onload functions.
	Function found at Simon Willison's weblog - http://simon.incutio.com/
*/
function addLoadEvent(func)
{	
	var oldonload = window.onload;
	if (typeof window.onload != 'function')
    	window.onload = func;
	else
	{
		window.onload = function()
		{
			oldonload();
			func();
		}
	}
}
// ------ Fin de addLoadEvent ------------------------------------

/*
	showit()	-> Mostrar una capa
	closeit()	-> Ocultar una capa
	cambio()	-> Cambiar la visibilidad de una capa
	Cambiar la visibilidad de capas.
*/
function showit(capa)
{ 
	if (document.getElementById)
		if (document.getElementById(capa))
			document.getElementById(capa).style.visibility = "visible";
} 

function closeit(capa)
{
	if (document.getElementById)
		if (document.getElementById(capa))
			document.getElementById(capa).style.visibility = "hidden";
}

var capa;
function cambio(idCapa)
{
	if (document.layers) capa = eval("document." + idCapa);
	if (document.all) capa = eval(idCapa + ".style");
	if (document.getElementById) capa = eval('document.getElementById("' + idCapa + '").style');

	if ((capa.visibility == "hidden") || (capa.visibility == "hide"))
  		capa.visibility = (document.layers) ? "show" : "visible" ;
	else
  		capa.visibility = (document.layers) ? "hide" : "hidden" ;
}
// ------ Fin de funciones para cambiar la visibilidad de capas ------------------------------------

/*
	abrirVentana()
	Abrir un pop up del consejo asesor Javier G Pollavieja.
*/
function abrirVentana(fichero, w, h, scr)
{
	var nueva = window.open(fichero, '_nueva','toolbar=no,location=no,directories=no,status=no,menubar=no, scrollbars=' + scr + ',resizable=no,width=' + w + ',height=' + h);
	nueva.focus();
	return false;
}
// ------ Fin de función para abrir el pop up del consejo asesor Javier G Pollavieja ------------------------------------

// Función que abre las ventanas de la exposición virtual ------------------------------------ /
function abrirVentana2(fichero, w, h, scr, Resize, TopPosition, LeftPosition, nombreVentana)
{	//Además t permit indicar la posición

	eval(nombreVentana + "=window.open(fichero, nombreVentana,'toolbar=no,location=no,directories=no,status=no,menubar=no, scrollbars=' + scr + ',resizable=' + Resize +',width=' + w + ',height=' + h + ',top=' + TopPosition + ',left=' + LeftPosition);");
	eval(nombreVentana + ".focus();");
	return false;
}
//----------------------------------------------------------------------


/*
	validarEmail -> Comprobar si el correo electrónico es correcto
	Funciones de validación.
*/
function validarEmail(valor) 
{
	if(valor!='')
	{
  		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor))
		{
    		return (true);
		}
		else 
		{
    		alert("La dirección de email es incorrecta.");
    		return (false);
  		}
	}
	else
	{
		return (true);
	}
}
// ------ Fin de funciones de validación ------------------------------------ 


//////////////////////////////////////////////////////////////////////////////////////////////
// Función que abre capa oculta para ofrecer mas texto //

			function leerMas(oEnlace)
			{
				var bOcultarIntroduccion = oEnlace.title != '< Volver';
				var strCapaMostrable = (bOcultarIntroduccion ? 'mas_informacion' : 'informacion');
				var strCapaOcultable = (strCapaMostrable == 'mas_informacion' ? 'informacion' : 'mas_informacion');
				
				if (document.getElementById(strCapaMostrable))
					document.getElementById(strCapaMostrable).style.display = 'block'; 
				if (document.getElementById(strCapaOcultable))
					document.getElementById(strCapaOcultable).style.display = 'none'; 
			}
			
///////////////////////////////////////////////////////////////////////////////////////			
