function mostrarImagen(url, titulo, alt, nombreVentana) {
//	img = null;
	var img = new Image();
	img.src = url;
	// Las dimensiones con las que se abre la ventana (iguales a las de la imagen) corresponden al área interna, sin tener en cuenta los bordes y demás, por lo que las dimensiones reales serán ligeramente mayores y no estará exactamente centrada
	// En Windows XP SP2 no es posible deshabilitar la barra de estado
	ventana = window.open('mostrar_imagen.php?url=' + escape(url) + '&tit=' + escape(titulo) + '&alt=' + escape(alt), nombreVentana, 'width=300, height=300, left=' + (screen.width - 300) / 2 + ', top=' + (screen.height - 300) / 2 + ', scrollbars=0, resizable=0, toolbar=0, status=0, menubar=0');
	ventana.focus();
}

function abrirFichero(URL) {
	// Muestra las ventanas centradas horizontalmente, con unas dimensiones del 80% de las de la pantalla y sin barra de direcciones
	window.open(URL, null, 'location=no, toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes, top=20, left=' + (screen.width * 0.1) + ', width=' + (screen.width * 0.8) + ', height=' + (screen.height * 0.8));
}

function abrirLibro(URL, nombreVentana, opener) {
	// Muestra la ventana centrada horizontalmente y sin barra de direcciones
	var ventana = window.open(URL, nombreVentana, 'location=no, toolbar=no, menubar=no, scrollbars=yes, resizable=no, top=20, left=' + (screen.width - 586) / 2 + ', width=586, height=' + (screen.height * 0.8));
	ventana.focus();
	if (opener) ventana.opener = opener;
}

function abrirEmergente(URL, nombreVentana, ancho, alto, altoMaximo) {
	if (!ancho) ancho = 586;
	if (!alto) alto = screen.height * 0.8;
	if (alto > altoMaximo) alto = altoMaximo;
	// Muestra la ventana centrada horizontalmente y sin barra de direcciones
	var ventana = window.open(URL, nombreVentana, 'location=no, toolbar=no, menubar=no, scrollbars=yes, resizable=no, top=' + (screen.height - alto) / 2 + ', left=' + (screen.width - ancho) / 2 + ', width=' + ancho + ', height=' + alto);
	ventana.focus();
}

function abrirEnObras(URL, nombreVentana) {
	// Muestra la ventana centrada horizontalmente y sin barra de direcciones
	var ventana = window.open(URL, nombreVentana, 'location=no, toolbar=no, menubar=no, scrollbars=yes, resizable=no, top=20, left=' + (screen.width - 586) / 2 + ', width=586, height=558');
	ventana.focus();
}

function abrirVentEmerg(URL, nombreVentana) {
	ancho = 350;
	alto = 275;
	// Muestra la ventana centrada horizontalmente y sin barra de direcciones
	var ventana = window.open(URL, nombreVentana, 'location=no, toolbar=no, menubar=no, scrollbars=yes, resizable=no, top=' + (screen.height - alto) * 0.666666 + ', left=' + (screen.width - ancho) / 2 + ', width=' + ancho + ', height=' + alto);
	if (ventana) {
		ventana.focus();
	} else {
		alert("Por favor, permita las ventanas emergentes para mostrar correctamente la página");
	}
}

function abrirEnPrincipal(URL) {
	// Abre un enlace en la ventana original de Collado Mediano o en una nueva en caso de estar cerrada aquella
	if (window.opener.closed) {
		ventana = window.open(URL, '_blank', '');
		ventana.focus();
	} else {
		window.opener.document.location.href=URL;
		window.opener.focus();
	}
	window.close();
}

function precargarImagenes() {
	var d = document;
	if (d.images) {
		if(!d.MM_p) d.MM_p = new Array();
		var i, j = d.MM_p.length, a = precargarImagenes.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];
			}
		}
	}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function transformar(imagen1, imagen2) {
	imagen1.filters.blendTrans.Apply();
	imagen1.src = imagen2;
	imagen1.filters.blendTrans.Play();
}

var imgActual = 0;
var avance = true;
var temporizador;

function avanzar() {
	if (!avance) {
		window.clearTimeout(temporizador);
		avance = true;
	}
	if (imgActual < numImags) {
		imgActual++;
		if (document.all) {
			document.images.transformacion.style.filter = "blendTrans(duration=" + durTrans[imgActual] + ")";
			document.images.transformacion.filters.blendTrans.Apply();
		}
		document.images.transformacion.src = imags[imgActual];
		if (document.all){
			document.images.transformacion.filters.blendTrans.Play();
		}
		temporizador = window.setTimeout('avanzar()', durTrans[imgActual] + durParada[imgActual]);
	}
}

function retroceder() {
	if (avance) {
		window.clearTimeout(temporizador);
		avance = false;
	}
	if (imgActual > 0) {
		imgActual--;
		if (document.all) {
			document.images.transformacion.style.filter = "blendTrans(duration=" + durTrans[imgActual] + ")";
			document.images.transformacion.filters.blendTrans.Apply();
		}
		document.images.transformacion.src = imags[imgActual];
		if (document.all){
			document.images.transformacion.filters.blendTrans.Play();
		}
		temporizador = window.setTimeout('retroceder()', durTrans[imgActual] + durParada[imgActual]);
	}
}

function MM_controlSound(x, _sndObj, sndFile) { //v3.0
	var i, method = "", sndObj = eval(_sndObj);
	if (sndObj != null) {
		if (navigator.appName == 'Netscape') method = "play";
		else {
			if (window.MM_WMP == null) {
				window.MM_WMP = false;
				for(i in sndObj) if (i == "ActiveMovie") {
					window.MM_WMP = true; break;
				}
			}
			if (window.MM_WMP) method = "play";
			else if (sndObj.FileName) method = "run";
		}
	}
	if (method) eval(_sndObj+"."+method+"()");
	// Si no está instalado el Windows Media Player no queremos que se reproduzca el sonido en una ventana aparte
//	else window.location = sndFile;
}