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_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.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_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 sabeNavegador () {
	
	if (BrowserDetect.browser == "Firefox") return "firefox"; 
	else 
    	if (BrowserDetect.browser == "Explorer")
       		if (BrowserDetect.version>=7) return "ie7";
       		else return "ie6";
}
var BrowserDetect = { 
       init: function () { 
          this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; 
          this.version = this.searchVersion(navigator.userAgent) 
             || this.searchVersion(navigator.appVersion) 
             || "an unknown version"; 
          this.OS = this.searchString(this.dataOS) || "an unknown OS"; 
       }, 
    searchString: function (data) { 
       for (var i=0;i<data.length;i++) { 
          var dataString = data[i].string; 
          var dataProp = data[i].prop;

          this.versionSearchString = data[i].versionSearch || data[i].identity; 

          if (dataString) { 

             if (dataString.indexOf(data[i].subString) != -1) 

                return data[i].identity; 

          } 

          else if (dataProp) 

          return data[i].identity; 

       } 

    }, 

    searchVersion: function (dataString) { 

       var index = dataString.indexOf(this.versionSearchString); 

       if (index == -1) return; 

       return parseFloat(dataString.substring(index+this.versionSearchString.length+1)); 

    }, 

    dataBrowser: [ 

       { string: navigator.userAgent, 

          subString: "OmniWeb", 

          versionSearch: "OmniWeb/", 

          identity: "OmniWeb" 

       }, 

    { 

       string: navigator.vendor, 

       subString: "Apple", 

       identity: "Safari" 

    }, 

    { 

       prop: window.opera, 

       identity: "Opera" 

    }, 

    { 

       string: navigator.vendor, 

       subString: "iCab", 

       identity: "iCab" 

    }, 

    { 

       string: navigator.vendor, 

       subString: "KDE", 

       identity: "Konqueror" 

    }, 

    { 

       string: navigator.userAgent, 

       subString: "Firefox", 

       identity: "Firefox" 

    }, 

    { 

       string: navigator.vendor, 

       subString: "Camino", 

       identity: "Camino" 

    }, 

    { // for newer Netscapes (6+) 

       string: navigator.userAgent, 

       subString: "Netscape", 

       identity: "Netscape" 

	}, 

    { 

       string: navigator.userAgent, 

       subString: "MSIE", 

       identity: "Explorer", 

       versionSearch: "MSIE" 

    }, 

    { 

       string: navigator.userAgent, 

       subString: "Gecko", 

       identity: "Mozilla",

       versionSearch: "rv" 

    }, 

    { // for older Netscapes (4-) 

       string: navigator.userAgent, 

       subString: "Mozilla", 

       identity: "Netscape", 

       versionSearch: "Mozilla" 

    } 

    ],

    dataOS : [ 

    { 

       string: navigator.platform, 

       subString: "Win", 

       identity: "Windows" 

    }, 

    { 

       string: navigator.platform, 

       subString: "Mac", 

       identity: "Mac" 

    }, 

    { 

       string: navigator.platform, 

       subString: "Linux", 

       identity: "Linux" 

    } 

] 

};
BrowserDetect.init(); 

function generaTextoImagen (ancho, alto, texto1, texto2, fuente, tamanioFuente, coorX, coorY, colorR, colorG, colorB, fondoR, fondoG, fondoB, angulo, color2R, color2G, color2B, fondo2R, fondo2G, fondo2B, over, out, onClick, alineacion, alinearVert, alinearHor) {
	//generaTextoImagen(50,7,"leer más >", "leer más >", "../fuentes/ARLRDBD.TTF", 7,0, 9, <?php echo $colorR.",".$colorG.",".$colorB; ?>, 300, 300, 300, 0, 51, 51, 51, 300, 300, 300,"", "", "middle", "top", "middle");
	
		var urlParametros1="generaImagenTexto.php?texto="+texto1;
		var urlParametros2="generaImagenTexto.php?texto="+texto2;
		//Ahora vamos componiendo la direccion en funcion de los datos de los que dispongamos
		if (ancho!=0) urlParametros1+="&ancho="+ancho;
		if (alto!=0) urlParametros1+="&alto="+alto;
		if (fuente!="") urlParametros1+="&fuente="+fuente;
		if (coorX!=0) urlParametros1+="&coorX="+coorX;
		if (coorY!=0) urlParametros1+="&coorY="+coorY;
		
		urlParametros1+="&colorR="+colorR;
		urlParametros1+="&colorG="+colorG;
		urlParametros1+="&colorB="+colorB;
		urlParametros1+="&fondoR="+fondoR;
		urlParametros1+="&fondoG="+fondoG;
		urlParametros1+="&fondoB="+fondoB;
		urlParametros1+="&angulo="+angulo;
		if (tamanioFuente!=0) urlParametros1+="&tamanioFuente="+tamanioFuente;
		urlParametros1+="&alinearVert="+alinearVert;
		urlParametros1+="&alinearHor="+alinearHor;
		//Ahroa vamos con la imagen de sustitucion, si es que tenemos que hacerla
		if (texto2!="") {
			if (ancho!=0) urlParametros2+="&ancho="+ancho;
			if (alto!=0) urlParametros2+="&alto="+alto;
			if (fuente!="") urlParametros2+="&fuente="+fuente;
			urlParametros2+="&coorX="+coorX;
			urlParametros2+="&coorY="+coorY;
			urlParametros2+="&colorR="+color2R;
			urlParametros2+="&colorG="+color2G;
			urlParametros2+="&colorB="+color2B;
			urlParametros2+="&fondoR="+fondo2R;
			urlParametros2+="&fondoG="+fondo2G;
			urlParametros2+="&fondoB="+fondo2B;
			urlParametros2+="&angulo="+angulo;
			urlParametros2+="&tamanioFuente="+tamanioFuente;
			urlParametros2+="&alinearVert="+alinearVert;
			urlParametros2+="&alinearHor="+alinearHor;
		}
		//Ahora, en funcion de los parametros construimos
		var orden='<img src="librerias/php/'+urlParametros1+'" alt="'+texto1+'" ';
		//Si tiene alineacion
		if (alineacion!="") orden+=' align="'+alineacion+'" ';
		if ((onClick!="") || (over!="") || (texto2!="")) orden+=' style="cursor:pointer; border:0" ';
		else orden+=' style="border:0" ';		
		//Si tiene over
		if ((texto2!="") && (over!="")) orden+='onMouseOver="this.src=\'librerias/'+urlParametros2+'\'; '+over+';" onMouseOut="'+out+'; this.src=\'librerias/'+urlParametros1+'\'" ';
		else {
			if (texto2!="") orden+='onMouseOver="this.src=\'librerias/'+urlParametros2+'\';" onMouseOut="this.src=\'librerias/'+urlParametros1+'\'" ';
			if (over!="") orden+='onMouseOver="'+over+'" ';
			if (out!="") orden+='onMouseOut="'+out+'" ';
		}
		//Si tiene onclick		
		if (onClick!="") orden+=' onClick="'+onClick+'"'; 		
		orden+='>';

		document.write (orden);
	}
	function escribeProvincias () {

		//Escribe todas las provincias

		document.write ('<option value="-1">Seleccione Provincia</option>');

		//Vamos escribiendo segun el array

		for (var cont=0; cont<listaNombreProvincias.length; cont++) document.write ('<option value="'+listaIdProvincias[cont]+'">'+listaNombreProvincias[cont]+'</option>');

	}

	function Refrescar (que,precede) {

		//Refrescamos en los campos que afecten a otro

		contador=1;

		idProv=document.getElementById(precede).options[document.getElementById(precede).selectedIndex].value;

		//Ya que tenemos el id provincia, solo tenemos que recorrer las localidades y añadir aquellas con el id provincia igual

		document.getElementById(que).length=0;

		document.getElementById(que).disabled=false;

		temporal=new Option("Seleccione una Localidad","-1");

		document.getElementById(que).options[0]=temporal;

		for (var cont=0; cont<listaIdProvinciaLocalidades.length; cont++)

			if (listaIdProvinciaLocalidades[cont]==idProv) {

				temporal=new Option(listaNombreLocalidades[cont],listaIdLocalidades[cont]);

				document.getElementById(que).options[contador++]=temporal;

			}

	}

	function cargaMunicipios (idProv) {

		//Carga los municipios de la provincia cuyo id se le pase

		document.write ('<option value="-1">Seleccione Municipio</option>');

		//Vamos escribiendo segun el array

		for (var cont=0; cont<listaIdProvinciaLocalidades.length; cont++)

			if (listaIdProvinciaLocalidades[cont]==idProv) document.write ('<option value="'+listaIdLocalidades[cont]+'">'+listaNombreLocalidades[cont]+'</option>');

	}

	function escribePaises (seleccion) {

		//Funcion que inserta un combo con los paises

		if (seleccion==false) document.write ('<option value="defecto" selected="selected">Seleccione un pais</option>');

		else document.write ('<option value="defecto">Seleccione un pais</option>');

		for (var cont=0; cont<listaPAI_ISONUMPai_pais.length; cont++) 

			if ((cont==63) && (seleccion)) document.write ('<option value="'+listaPAI_ISONUMPai_pais[cont]+'" selected="selected">'+listaPAI_NOMBREPai_pais[cont]+'</option>');	

			else document.write ('<option value="'+listaPAI_ISONUMPai_pais[cont]+'">'+listaPAI_NOMBREPai_pais[cont]+'</option>');	

	}

	var caracter="1234567890";
	caracter+="QWERTYUIOPASDFGHJKLZXCVBNM";
	caracter+="qwertyuioplkjhgfdsazxcvbnm";
	var numero_caracteres=5;
	var total=caracter.length;
	function generaClaves (id) {
		//Genera una clave o un usuario.
		var clave="";
		for(a=0;a<numero_caracteres;a++) clave+=caracter.charAt(parseInt(total*Math.random(1)));
		document.getElementById(id).value=clave;
	}
	function validarEmail(valor) {
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)) return true;
		else return false;
	}
	function compruebaForm (nombreForm) {
		
		var msg = '';
		
		if (nombreForm=="formNuevoUsuario") { 
			if (document.getElementById('usuario').value=="") msg+="<li>No ha indicado su nombre de usuario</li>";
			if (!validarEmail(document.getElementById("email").value)) msg+="<li>El email no parece v&aacute;lido</li>";
			if (document.getElementById('nombre').value=="") msg+="<li>No ha indicado su nombre</li>";
		} else {
			if (!validarEmail(document.getElementById("email").value)) msg+="<li>El email no parece v&aacute;lido</li>";
			if (document.getElementById('nombre').value=="") msg+="<li>No ha indicado su nombre</li>";
			if (document.getElementById('comentario').value=="") msg+="<li>El campo comentario parece vacio</li>";
		}		
		if (msg!="") {
			document.getElementById('capaAviso').style.height="auto";
			document.getElementById('capaAviso').style.visibility="visible";
			document.getElementById('capaAviso').innerHTML="<div id='contenidoError'>Se han encontrado los siguientes errores: <br><br><center>"+msg+"</center></div>";
		} else document.getElementById(nombreForm).submit();
	}
	function comienzaVirgulilla () {
		////Para comunicar js con as2////
		var isIE = navigator.appName.indexOf("Microsoft") != -1;
		var flashMovie = (isIE) ? window["FlashID"] : document["FlashID"];		
		/////////////////////////////////
		flashMovie.arrancaVir();
	}
	function marcaMenuPrincipal (indice) {
	
		//Devolvemos el color al resto de las opciones
		for (cont=0; cont<subMenuJavasc.length; cont++) {
			document.getElementById("menuPrincipal_"+cont).style.color="#FFFFFF";
			//Ahora tenemos cuidado de que, si hay alguna opcion que debe volver, esperemos a que esta termine antes de lanzar la nueva. Cuando haya terminado la animacion, mandamos escribir el subMenu
			if (parseInt(document.getElementById('menuPrincipal_'+cont).style.width)!=95) {
				abierta=true;
				var subMenuTemporal2=subMenuJavasc[cont].split(";");
				subMenuTemporal2=subMenuTemporal2[1].split("~");
				cierraOpcionesSubMenu(cont,subMenuTemporal2);
				$("#menuPrincipal_"+cont).animate({width:95, height:parseInt(document.getElementById('menuPrincipal_'+cont).offsetHeight)}, "slow", function () { $("#menuPrincipal_"+indice).animate({width:parseInt(document.getElementById('menuPrincipal_'+indice).style.width)+anchosSubMenus[indice], height:parseInt(document.getElementById('menuPrincipal_'+indice).offsetHeight)}, "slow", function () { abriendo=false; abreOpcionesSubMenu(indice,nombreSeccion,subMenuTemporal); }); });
			}
		}
		//Cambiamos ahora el color a la nueva opcion
		document.getElementById("menuPrincipal_"+indice).style.color="#000000";		
	}
	function abreSubMenu (indice) {
		
		//Lo primero es ver si tenemos submenu que abrir o solo lanzamos el cambio de seccion
		var subMenuTemporal=subMenuJavasc[indice].split(";");				
		if (subMenuTemporal[1].length>1) {			
			var abierta=false;
			abriendo=true;
			//Guardamos el nombre de la seccion
			nombreSeccion=subMenuTemporal[0];
			//Sacamos el subMenu
			subMenuTemporal=subMenuTemporal[1].split("~");
			//Devolvemos el color al resto de las opciones
			for (cont=0; cont<subMenuJavasc.length; cont++) {
				document.getElementById("menuPrincipal_"+cont).style.color="#FFFFFF";
				//Ahora tenemos cuidado de que, si hay alguna opcion que debe volver, esperemos a que esta termine antes de lanzar la nueva. Cuando haya terminado la animacion, mandamos escribir el subMenu
				if (parseInt(document.getElementById('menuPrincipal_'+cont).style.width)!=95) {
					abierta=true;
					var subMenuTemporal2=subMenuJavasc[cont].split(";");
					subMenuTemporal2=subMenuTemporal2[1].split("~");
					cierraOpcionesSubMenu(cont,subMenuTemporal2);
					$("#menuPrincipal_"+cont).animate({width:95, height:parseInt(document.getElementById('menuPrincipal_'+cont).offsetHeight)}, "slow", function () { $("#menuPrincipal_"+indice).animate({width:parseInt(document.getElementById('menuPrincipal_'+indice).style.width)+anchosSubMenus[indice], height:parseInt(document.getElementById('menuPrincipal_'+indice).offsetHeight)}, "slow", function () { abriendo=false; abreOpcionesSubMenu(indice,nombreSeccion,subMenuTemporal); }); });
				}
			}

			//Cambiamos ahora el color a la nueva opcion
			document.getElementById("menuPrincipal_"+indice).style.color="#000000";		
			//Ampliamos la opcion pulsada, si es que debe serlo		
			if (!abierta) $("#menuPrincipal_"+indice).animate({width:parseInt(document.getElementById('menuPrincipal_'+indice).style.width)+anchosSubMenus[indice], height:parseInt(document.getElementById('menuPrincipal_'+indice).offsetHeight)}, "slow", function () { abriendo=false; abreOpcionesSubMenu(indice,nombreSeccion,subMenuTemporal); });
		} else {
			//Primero miramos si hay alguna opcion abierta para cerrarla
			for (cont=0; cont<subMenuJavasc.length; cont++) {
				document.getElementById("menuPrincipal_"+cont).style.color="#FFFFFF";
				//Ahora tenemos cuidado de que, si hay alguna opcion que debe volver, esperemos a que esta termine antes de lanzar la nueva. Cuando haya terminado la animacion, mandamos escribir el subMenu
				if (parseInt(document.getElementById('menuPrincipal_'+cont).style.width)!=95) {
					abierta=true;
					var subMenuTemporal2=subMenuJavasc[cont].split(";");
					subMenuTemporal2=subMenuTemporal2[1].split("~");
					cierraOpcionesSubMenu(cont,subMenuTemporal2);
					$("#menuPrincipal_"+cont).animate({width:95, height:parseInt(document.getElementById('menuPrincipal_'+cont).offsetHeight)}, "slow", function () {});
				}
			}
			//Cambiamos ahora el color a la nueva opcion
			document.getElementById("menuPrincipal_"+indice).style.color="#000000";		
			//Y ahora abrimos
			abreContenido(indice,-1);
		}	
	}
	function abreOpcionesSubMenu (indice,textoSeccion,arrays) {
		//Se dedica a abrir las opciones del subMenu	

		for (var cont=0; cont<arrays.length; cont++) {						
			document.getElementById('menuPrincipal_'+indice+'_'+cont).style.display="inline";
			for (var contador=0; contador<arrays[cont].length; contador++) $('#letra_'+indice+'_'+cont+'_'+contador).fadeIn("normal", function () { terminaAnimacion=true; });
		}
	}
	function dejaMarcadoSubMenu (seccion,subSeccion,opciones) {
		
		//$("#menuPrincipal_"+seccion).animate({width:parseInt(document.getElementById('menuPrincipal_'+seccion).style.width)+anchosSubMenus[seccion], height:parseInt(document.getElementById('menuPrincipal_'+seccion).offsetHeight)}, "slow", function () { abriendo=false; });
	}
	function cierraOpcionesSubMenu (indice,arrays) {
		//Se dedica a cerrar las opciones del subMenu		

		for (var cont=0; cont<arrays.length; cont++) {									
			for (var contador=0; contador<arrays[cont].length; contador++) $('#letra_'+indice+'_'+cont+'_'+contador).fadeOut("normal", function () { terminaAnimacion=true; });			
			document.getElementById('menuPrincipal_'+indice+'_'+cont).style.display="none";
		}		
	}
	function actualizaContenido (seccion, subSeccion) {

		//Mostramos el loading
		//$.blockUI({ message: '<img src="imagenes/cargando.gif" />' });
		//Si la opcion es el portfolio, debemos mostrar el menu superior en caso de que no se vea. Si no es el portfolio y se esta mostrando, lo ocultamos.				
		if (seccion=="PORTFOLIO") {
			if (document.getElementById('subMenuSupIzq').style.left==leftMenuSuperior) {
				$("#subMenuSupIzq").animate({left:0}, "slow", function () {});
				$("#subMenuSupDer").animate({left:0}, "slow", function () {});
			}
		} else {
			if (document.getElementById('subMenuSupIzq').style.left!=leftMenuSuperior) {
				$("#subMenuSupIzq").animate({left:parseInt(leftMenuSuperior)}, "slow", function () {});
				$("#subMenuSupDer").animate({left:parseInt(leftMenuSuperior)}, "slow", function () {});
			}
		}
		if (subSeccion=="") {
			$.post("includes/contenido.php", { seccion: seccion }, 			
				function (data) {
					$("#contenidoCuerpo2").html(data);					
				}				
			);
			//Cambiamos ahora el subMenu Superior
			$.post("includes/bandaSubMenu.php", { seccion: seccion }, 
				function (data) {
					$("#subMenuSupIzq").html(data);						
				}
			);
			//Vamos con la parte central de la cabecera
			$.post("includes/cabeceraCentral.php", { seccion: seccion }, 
				function (data) {
					$("#cabeceraCentral").html(data);					
				}
			);
			//Por ultimo, actualizamos la miga de pan
			$.post("includes/migaPan.php", { seccion: seccion }, 
				function (data) {
					$("#pie").html(data);					
				}
			);			
		} else {
			$.post("includes/contenido.php", { seccion: seccion, subSeccion: subSeccion }, 
				function (data) {
					$("#contenidoCuerpo2").html(data);					
				}
			);	
			//Cambiamos ahora el subMenu Superior
			$.post("includes/bandaSubMenu.php", { seccion: seccion, subSeccion: subSeccion }, 
				function (data) {
					$("#subMenuSupIzq").html(data);					
				}
			);
			//Vamos con la parte central de la cabecera
			$.post("includes/cabeceraCentral.php", { seccion: seccion, subSeccion: subSeccion }, 
				function (data) {
					$("#cabeceraCentral").html(data);					
				}
			);
			//Por ultimo, actualizamos la miga de pan
			$.post("includes/migaPan.php", { seccion: seccion, subSeccion: subSeccion }, 
				function (data) {
					$("#pie").html(data);					
				}
			);
		}
		$.unblockUI();
	}
	function abreContenido (indice, subIndice) {
		//Abre la seccion principal que se le indique	

		//Antes de nada tenemos que sacar el nombre de la nueva seccion		
		comienzaVirgulilla();
		var seccionT=subMenuJavasc[indice].split(";");
		var seccion=seccionT[0];
		//Primero cargamos el nuevo contenido en la capa 2 de contenidos
		if (subIndice==-1) actualizaContenido (seccion,"");
		else {
			var subSeccion=seccionT[1].split("~");
			actualizaContenido (seccion,subSeccion[subIndice]);
		}		
	}
	function mueveCapasActualizaContenido () {
		
		//Primero encogemos el cuerpo
		$("#cuerpo").animate({height:0}, "slow", function () {
			//Ahora movemos la linea superior a la derecha			
			document.getElementById('contenidoCuerpo1').style.visibility="hidden";
			$("#lineaSuperiorCuerpo").animate({width:0}, "slow", function () {
				//Ahora mostramos la recarga
				$("#lineaSuperiorCuerpo").animate({width:anchoCuerpo}, "slow", function () {
					//Ahora, volvemos a mostrar el cuerpo
					document.getElementById('contenidoCuerpo1').innerHTML=document.getElementById('contenidoCuerpo2').innerHTML;
					document.getElementById('contenidoCuerpo1').style.visibility="visible";
					$("#cuerpo").animate({height:420}, "slow", function () {});
				});
			});
		});
	}
	function mueveCapasActualizaContenidoTerminaAbajo () {
		
		//Primero encogemos el cuerpo
		$("#cuerpo").animate({height:0}, "slow", function () {
			//Ahora movemos la linea superior a la derecha			
			document.getElementById('contenidoCuerpo1').style.visibility="hidden";
			$("#lineaSuperiorCuerpo").animate({width:0}, "slow", function () {
				//Ahora mostramos la recarga
				
				//Ahora hacemos toda la animacion 
				destinoCabecera=parseInt(document.getElementById("bandaSup").offsetTop)+parseInt(document.getElementById('contenidoCuerpo1').offsetHeight)-40;
				$("#bandaSup").animate({top:destinoCabecera}, "slow", function () {
					document.getElementById("lineaSuperiorCuerpo").style.top=destinoCabecera-10+"px";
					document.getElementById("cuerpo").style.top=parseInt(document.getElementById("cuerpo").offsetTop)-parseInt(document.getElementById("bandaSup").offsetHeight);
					$("#lineaSuperiorCuerpo").animate({width:anchoCuerpo}, "slow", function () {
						//Ahora, volvemos a mostrar el cuerpo
						document.getElementById('contenidoCuerpo1').innerHTML=document.getElementById('contenidoCuerpo2').innerHTML;
						document.getElementById('contenidoCuerpo1').style.visibility="visible";
						$("#cuerpo").animate({height:420}, "slow", function () {});
					});
				});				
			});
		});
	}
	function abreSubSeccion (seccion,subSeccion,opciones) {
		//Abre la subSeccion principal que se le indique		

		opciones=opciones.split("~");
		cierraOpcionesSubMenu (seccion,opciones);
		//Cerramos las opciones
		$("#menuPrincipal_"+seccion).animate({width:95, height:parseInt(document.getElementById('menuPrincipal_'+seccion).offsetHeight)}, "slow", function () {});
		//Mandamos que se quede marcado un pequeño submenu con la opcion elegida
		dejaMarcadoSubMenu(seccion,subSeccion,opciones);
		//Y por ultimo mandamos abrir el contenido
		abreContenido (seccion,subSeccion);
	}
	function muevePaginado (direccion) {
		
		if (direccion=="der") {
			if (paginaSubMenu<paginasTotalesSubMenu) {
				coorFinal=parseInt(document.getElementById('scrollSubMenu').style.left)-680;
				$("#scrollSubMenu").animate({left:coorFinal}, "slow", function () {});
				paginaSubMenu++;
				//Cambiamos ahora el texto que aparece en el control
				document.getElementById('paginas').innerHTML="&nbsp;"+paginaSubMenu+"&nbsp;de&nbsp;"+paginasTotalesSubMenu+"&nbsp;";
			}
		} else {
			if (paginaSubMenu>0) {
				coorFinal=parseInt(document.getElementById('scrollSubMenu').style.left)+680;
				$("#scrollSubMenu").animate({left:coorFinal}, "slow", function () {});
				paginaSubMenu--;
				//Cambiamos ahora el texto que aparece en el control
				document.getElementById('paginas').innerHTML="&nbsp;"+paginaSubMenu+"&nbsp;de&nbsp;"+paginasTotalesSubMenu+"&nbsp;";
			}		
		} 
	}
var tamanioFuenteMin=5;
var tamanioFuenteMax=15;
var tamanioFuenteActual=10;

function gestionaTamanio (direccion) {
	
	if (direccion=="-") {
		if (tamanioFuenteActual>=tamanioFuenteMin) tamanioFuenteActual--;					
	} else {
		if (tamanioFuenteActual<=tamanioFuenteMax) tamanioFuenteActual++;
	}
	document.body.style.fontSize=(tamanioFuenteActual/10)+"em";
}	
function agregar () { 
	
	if (window.sidebar&&window.sidebar.addPanel) window.sidebar.addPanel("Libreria Praga","http://www.libreriapraga.com",""); 
	else window.external.AddFavorite("http://www.libreriapraga.com","Libreria Praga");
}
/***PARA LOS TARGET BLANK***
function fix_external_links() {
	$ES('a').each(function(el) {
		if (el.getProperty('rel') == 'external') {
			el.addEvent('click', function(e) {
				e = new Event(e);
				e.stop();
				window.open(this.getProperty('href'));
			}.bind(el));
		}
	});
}
 
window.addEvent('domready', function() {
	fix_external_links();
});
***************************/
function cierraSubMenu (numElementos) {

	if (numElementos==0) numElementos=numElementosMenuIzq;
	for (cont=0; cont<numElementos; cont++) {
		document.getElementById("subMenuLatIzq"+cont).style.visibility='hidden';
		document.getElementById("elementoMenuLateral"+cont).style.width="160px";		
		document.getElementById("elementoMenuLateral"+cont).style.color="#000";
		document.getElementById("elementoMenuLateral"+cont).style.backgroundColor="#FFF";
		document.getElementById("elementoMenuLateral"+cont).style.backgroundPosition="left";
		document.getElementById("elementoMenuLateral"+cont).style.backgroundRepeat="no-repeat";
		document.getElementById("elementoMenuLateral"+cont).style.backgroundImage="url(imagenes/fondoMenuIzq.jpg)";
	}
}
function muestraSubMenu (indice, numElementos) {
	
	for (cont=0; cont<numElementos; cont++) {
		document.getElementById("subMenuLatIzq"+cont).style.visibility='hidden';
		document.getElementById("elementoMenuLateral"+cont).style.width="160px";		
		document.getElementById("elementoMenuLateral"+cont).style.color="#000";
		document.getElementById("elementoMenuLateral"+cont).style.backgroundColor="#FFF";
		document.getElementById("elementoMenuLateral"+cont).style.backgroundPosition="left";
		document.getElementById("elementoMenuLateral"+cont).style.backgroundRepeat="no-repeat";
		document.getElementById("elementoMenuLateral"+cont).style.backgroundImage="url(imagenes/fondoMenuIzq.jpg)";
	}
	
	document.getElementById("elementoMenuLateral"+indice).style.width="214px";		
	document.getElementById("elementoMenuLateral"+indice).style.color="#FFF";
	document.getElementById("elementoMenuLateral"+indice).style.backgroundColor="#F6A800";
	document.getElementById("elementoMenuLateral"+indice).style.backgroundPosition="left";
	document.getElementById("elementoMenuLateral"+indice).style.backgroundRepeat="no-repeat";
	document.getElementById("elementoMenuLateral"+indice).style.backgroundImage="url(imagenes/fondoMenuIzqOver.jpg)";
	
	document.getElementById("subMenuLatIzq"+indice).style.visibility='visible';
}
/*** PARA REDONDEAR ESQUINAS DE CAPAS***/
function lanzaRedondeoCapas () {	
	if(!NiftyCheck()) return;
	Rounded("div.subMenuIzqCuerpoLargo","transparent","#F6A800","big");
	Rounded("div.subMenuIzqCuerpo","transparent","#F6A800","big");
	Rounded("div.contenidoSubMenuIzq","#F6A800","#FFFFFF","big");	
	Rounded("div.contenidoSubMenuIzqLargo","#F6A800","#FFFFFF","big");		
	//Rounded("div.contenidoSubMenuSuperior","#FFFFFF","#BD052D","big");	
	//Rounded("div.subMenuSuperiorAbiertoDer","#BD052D","#FFFFFF","big");	
}
function compruebaFormulario (listaCamposObligatorios, textosWebCampos, tipos, nombreFormulario, seMuestraEnAlerta) {
	//Comprueba los campos que se le pasen del formulario que se le pase
	
	var mensaje="";
	
	for(cont=0; cont<listaCamposObligatorios.length; cont++) {
		switch (tipos[cont]) { 
			case "text":
				if (document.getElementById(listaCamposObligatorios[cont]).value=="") 
					if (seMuestraEnAlerta) mensaje+="No ha completado el campo "+textosWebCampos[cont]+"\n";
					else mensaje+="<li>No ha completado el campo <b>"+textosWebCampos[cont]+"</b></li>";
			break;
			case "select":
				if ((document.getElementById(listaCamposObligatorios[cont]).value=="defecto") || (document.getElementById(listaCamposObligatorios[cont]).value==-1) || (document.getElementById(listaCamposObligatorios[cont]).value=="")) 
					if (seMuestraEnAlerta) mensaje+="No ha seleccionado ninguna opcion del campo "+textosWebCampos[cont]+"\n";
					else mensaje+="<li>No ha seleccionado ninguna opcion del campo <b>"+textosWebCampos[cont]+"</b>";
			break;
			case "checkboxAutorizacion":
				if (!document.getElementById(listaCamposObligatorios[cont]).checked) 
					if (seMuestraEnAlerta) mensaje+="Debe aceptar las condiciones de uso\n";
					else mensaje+="<li>Debe aceptar las condiciones de uso</li>";
			break;			
			case "radio":
				if (document.getElementById(listaCamposObligatorios[cont]).value=="") 
					if (seMuestraEnAlerta) mensaje+="No ha seleccionado ninguna opción del campo "+textosWebCampos[cont]+"\n";
					else mensaje+="<li>No ha seleccionado ninguna opción del campo <b>"+textosWebCampos[cont]+"</b></li>";
			break;
			case "email":
				if ((document.getElementById(listaCamposObligatorios[cont]).value=="") || (!validarEmail(document.getElementById(listaCamposObligatorios[cont]).value))) 
					if (seMuestraEnAlerta) mensaje+="El email indicado en le campo "+textosWebCampos[cont]+" no parece válido\n";
					else mensaje+="<li>El email indicado no parece válido</li>";
			break;
			case "textarea":
				if (document.getElementById(listaCamposObligatorios[cont]).value=="") 
					if (seMuestraEnAlerta) mensaje+="No ha completado el campo "+textosWebCampos[cont]+"\n";
					else mensaje+="<li>No ha completado el campo <b>"+textosWebCampos[cont]+"</b></li>";
			break;
		}
	}	
	if (mensaje!="") {		
		if (seMuestraEnAlerta) alert (mensaje);
		else {
			document.getElementById('capaAviso').style.height="auto";
			document.getElementById('capaAviso').style.visibility="visible";
			document.getElementById('capaAviso').style.marginBottom="30px";
			document.getElementById('capaAviso').innerHTML="<div id='contenidoError'>Se han encontrado los siguientes errores: <br><br><center>"+mensaje+"</center></div>";
		}
	} else document.getElementById(nombreFormulario).submit();
}
/***************************************/
/*********** SCROLL **************/
function bajaScrollInterno (capa, contenido, estado) {		
	if (estado) {
		var destino=parseInt(document.getElementById(contenido).offsetHeight)-parseInt(document.getElementById(capa).style.height);		
		$("#"+contenido).animate({top:-destino}, "slow", function () {});
	} else $("#"+contenido).stop();
}
function subeScrollInterno (capa, contenido, estado) {
	
	if (estado) $("#"+contenido).animate({top:0}, "slow", function () {});
	else $("#"+contenido).stop();
}
/*********************************/
