//----------------------
function nuevoAjax(){
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
	  //xmlhttp.overrideMimeType("text/xml"); // peta en OPERA
    } catch (e) {
      xmlhttp = false;
    }
  }
  if(!xmlhttp) document.location.replace("nonavegador.htm");
  return xmlhttp;
}

//----------------------
function cargarContenidoExt(pagina){
	var cargarDatos;
	if (existeCapa(pagina)){
		cargarDatos = false;
	}
	else{
		cargarDatos = true;
	}
		
	// No hemos creado todavia la capa que contiene la pagina, asi pues, la creamos
	if(cargarDatos){
		ArrHistorial.push(pagina);
		miDiv = crearCapaContenido(pagina);
		var ajax = nuevoAjax();
		ajax.open("GET", pagina, true);
		ajax.onreadystatechange = function() {
			if (ajax.readyState==1) {	
				document.getElementById("cargando").style.visibility = "visible";				
			}	
			if (ajax.readyState==4) {	
				if (ajax.status==200 || ajax.status==304){
					miDiv.innerHTML =  ajax.responseText;
					document.getElementById("cargando").style.visibility = "hidden";
				}else if(ajax.status==404){
					miDiv.innerHTML =  "<h1>ERROR 404</h1><br><b>Pagina No encontrada</b><br><br>";
					document.getElementById("cargando").style.visibility = "hidden";		
				}else{
					miDiv.innerHTML =  "<h1>ERROR "+ajax.status+"</h1><br><b>"+ajax.statusText+"</b><br><br>";
					document.getElementById("cargando").style.visibility = "hidden";	
				}
				delete ajax;
			}
		}
		ajax.send(null);
		
	}	// si hay que cargar datos cargadatos
	
	//----
	mostrarCapaActual(pagina);
}
//----------------------
//----------------------


var xtop;
var ArrHistorial= new Array() ;

function initTabs() {
	paginaInicial		= 'secciones/inicio.html';
	cargarContenidoExt(paginaInicial);
	
}

//----------------------
function crearCapaContenido(nombre){	
		miDiv = document.createElement("div");
		miDiv.setAttribute("id", nombre);
		miDiv.setAttribute("name", nombre);	
		miDiv.className = "tabContenedor";
		miDiv.innerHTML = '<br><br><img src="images/wait.gif" alt="Cargando...">';
		padre = document.getElementById("supportingText");
		padre.appendChild(miDiv);		
		return miDiv;
}
//-----------------------
function existeCapa(nomCapa){
	for (var i = 0; i < ArrHistorial.length ; i++){
		if (ArrHistorial[i] == nomCapa){
			return true;
		}
	}
	return false;
}
//----------------
function mostrarCapaActual(pagina){
	for(var i = 0; i < ArrHistorial.length; i++) {
			capaId = document.getElementById(ArrHistorial[i]);
			if(ArrHistorial[i] != pagina ){
				capaId.style.visibility = "hidden";
			}else{
				capaId.style.visibility = "visible";
			}		
	}		
}
//----------------





//----------------------
function cargarContenidoPagina(pagina, capa, bbdd, carpeta_concello){
if(bbdd) pagina+='&bbdd=' + bbdd;
if(carpeta_concello) pagina+='&carpeta_concello=' + carpeta_concello;


		var ajax = nuevoAjax();
		ajax.open("GET", pagina, true);
		ajax.onreadystatechange = function() {
			if (ajax.readyState==1) {	
				document.getElementById("cargando").style.visibility = "visible";				
				document.getElementById(capa).innerHTML = '<img src="images/wait.gif" alt="Cargando...">';
			}	
			if (ajax.readyState==4) {	
				if (ajax.status==200 || ajax.status==304){
					document.getElementById(capa).innerHTML =  ajax.responseText;
					document.getElementById("cargando").style.visibility = "hidden";
					
				}else if(ajax.status==404){
					document.getElementById(capa).innerHTML =  "<h1>ERROR 404</h1><br><b>Pagina No encontrada</b><br><br>";
					document.getElementById("cargando").style.visibility = "hidden";		
				}else{
					document.getElementById(capa).innerHTML =  "<h1>ERROR "+ajax.status+"</h1><br><b>"+ajax.statusText+"</b><br><br>";
					document.getElementById("cargando").style.visibility = "hidden";	
				}
				delete ajax;
			}
		}
		ajax.send(null);
}
//----------------------
//----------------------

//----------------------
function cargarFoto(foto, capa){

		var ajax = nuevoAjax();
		ajax.open("GET", 'verFoto.php?foto=' + foto, true);
		ajax.onreadystatechange = function() {
			if (ajax.readyState==1) {	
				document.getElementById("cargando").style.visibility = "visible";				
			}	
			if (ajax.readyState==4) {	
				if (ajax.status==200 || ajax.status==304){
					document.getElementById(capa).innerHTML =  ajax.responseText;
					document.getElementById("cargando").style.visibility = "hidden";
				}else if(ajax.status==404){
					document.getElementById(capa).innerHTML =  "<h1>ERROR 404</h1><br><b>Pagina No encontrada</b><br><br>";
					document.getElementById("cargando").style.visibility = "hidden";		
				}else{
					document.getElementById(capa).innerHTML =  "<h1>ERROR "+ajax.status+"</h1><br><b>"+ajax.statusText+"</b><br><br>";
					document.getElementById("cargando").style.visibility = "hidden";	
				}
				delete ajax;
			}
		}
		ajax.send(null);
}
//----------------------
//----------------------

//----------------------
//----------------------

function mostrarCapa(nombreCapa){ 
document.getElementById(nombreCapa).style.display="block"; 
} 
function ocultarCapa(nombreCapa){ 
document.getElementById(nombreCapa).style.display="none"; 
} 

function accionCapa(nombreCapa){ 
//Si está abierta la cierra y viceversa
if(document.getElementById(nombreCapa).style.display=="none")  document.getElementById(nombreCapa).style.display="block";
else  document.getElementById(nombreCapa).style.display="none";
} 

function ocultar(capa, micapa, previo){
new Effect.BlindUp(capa);
document.getElementById(micapa).innerHTML ='<img src="' + previo + 'images/abajo.gif" style="cursor:pointer;" onclick="mostrar(\'' + capa + '\', \'' + micapa + '\', \'' + previo + '\')">';
}
function ocultar2(capa){
new Effect.BlindUp(capa);
}

function mostrar(capa, micapa, previo){
new Effect.BlindDown(capa);
document.getElementById(micapa).innerHTML ='<img src="' + previo + 'images/arriba.gif" style="cursor:pointer;" onclick="ocultar(\'' + capa + '\', \'' + micapa + '\', \'' + previo + '\')">';
}

function mostrar2(capa){
new Effect.BlindDown(capa);
}

function minimizar(capa, micapa, caja, previo){
new Effect.BlindUp(capa);
document.getElementById(micapa).innerHTML ='<div class="derecha"><img src="' + previo + 'images/icon_close.gif" style="cursor:pointer;" onclick="new Effect.Puff(\'' + caja + '\')"></div><div class="derecha"><img src="' + previo + 'images/icon_restore.gif" style="cursor:pointer;" onclick="maximizar(\'' + capa + '\', \'' + micapa + '\', \'' + caja + '\',\'' + previo + '\')"></div>';
}

function maximizar(capa, micapa, caja, previo){
new Effect.BlindDown(capa);
document.getElementById(micapa).innerHTML ='<div  class="derecha"><img src="' + previo + 'images/icon_close.gif" style="cursor:pointer;" onclick="new Effect.Puff(\'' + caja + '\')"></div><div  class="derecha"> <img src="' + previo + 'images/icon_mini.gif" style="cursor:pointer;" onclick="minimizar(\'' + capa + '\', \'' + micapa + '\', \'' + caja + '\', \'' + previo + '\')"></div>';
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////script por Tunait 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////script por Tunait 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////script por Tunait 
var ventana 
var cont=0 

function abreFoto(cual,titulo) { 
if(cont==1){ventana.close();ventana=null} 
var centro1=(screen.width)/2 - 200;
var centro2=(screen.height)/2 - 200;
ventana=window.open('','ventana','width=500,height=300,top='  +  centro2 + ',left='  +  centro1 + ',resizable=yes,scrollbars=no') 
ventana.document.write('<html><head><title>' + titulo + '</title></head><body style="overflow:hidden" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" scroll="no" onUnload="opener.cont=0" ><img src="' + cual + '" onLoad="opener.redimensionar(this.width, this.height)" alt="'+titulo+'" onclick="window.close()" style="cursor:pointer; "></body></html>') 
ventana.document.close() 
cont++ 
} 

var ventana3
var cont3=0 

function abreFlash(cual, alt) { 
if(cont==1){ventana2.close();ventana=null} 
ventana2=window.open('','ventana2','width=350,height=300,top=0,left=0,resizable=yes,scrollbars=no') ;
htmlF='<script>';
htmlF+='var video = false; ';
htmlF+='function mostrar(elVideo)    { ';
htmlF+='    if (video != false)    document.getElementById("media").removeChild(video); ';
htmlF+='    video = document.createElement("embed"); ';
htmlF+='    video.src = elVideo; ';
htmlF+='    video.controls = "pausebutton"; ';
htmlF+='    video.controller = "true"; ';
htmlF+='    document.getElementById("media").appendChild(video); ';
htmlF+='} ';
htmlF+='</script> ';
htmlF+='</head>';
htmlF+='<body style="overflow:hidden" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" scroll="no" onUnload="opener.cont2=0"  onLoad="mostrar(\'' + cual + '\')">';
htmlF+='<div id=media style="height:auto; width:auto; "> </div> ';

	
ventana2.document.write('<html><head><title>' + alt + '</title>' + htmlF + '</body></html>') 
ventana2.focus();
ventana2.document.close() 
cont2++ 
} 


function redimensionar(ancho,alto) { 
ventana.resizeTo(ancho+12,alto+28) 
 //centra la ventana. Eliminar si no se quiere centrar el popup 
} 

var ventana2
var cont2=0 
function abre360(imagen, alt){
if(cont2==1){ventana2.close();ventana2=null} 
ventana2=window.open('','ventana2','width=500,height=250,top=0,left=0,resizable=yes,scrollbars=no') 
			html='<div align="center">';
              html+=' <applet name="360 ContaLocal" code="uPixScreen.class" archive="360/uPixScreen.jar" width=500 height=250>';
                 html+=' <PARAM NAME=licenseFile VALUE="360/_psk2.ext">';
                 html+=' <PARAM NAME=customizationFile VALUE="360/Default.cfg">';
                 html+=' <PARAM NAME=title VALUE="' + alt + '">';
                 html+=' <PARAM NAME=titlePos VALUE="0">';
                 html+=' <PARAM NAME=viewType VALUE="1">';
                 html+=' <PARAM NAME=autoPan VALUE="yes">';
                 html+=' <PARAM NAME=autoPanSpeed VALUE="10">';
                 html+=' <PARAM NAME=startYaw VALUE="38">';
                 html+=' <PARAM NAME=startPitch VALUE="0">';
                 html+=' <PARAM NAME=startFOV VALUE="54">';
                 html+=' <PARAM NAME=partialStitch VALUE="no">';
                 html+=' <PARAM NAME=horFov VALUE="360">';
				 html+=' <PARAM NAME=hq VALUE=1 >';
                 html+=' <PARAM NAME=url VALUE="' + imagen + '" >';
              html+=' </applet>';
			html+='</div>';			

ventana2.document.write('<html><head><title>' + alt + '</title></head><body style="overflow:hidden" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" scroll="no" onUnload="opener.cont=0" >' + html + '</body></html>') 
ventana2.document.close() ;
cont2++ ;

}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////script por Tunait 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////script por Tunait 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////script por Tunait 


//----------------------
function cargarXML2(_XML, capa, pagina){
//Cojemos la parte de _XML hasta el 2º / : _XML=../concello1/secciones/1.xml, cojemos ../concello1/ para concatenarlo para abrir otras secciones
uno=_XML.indexOf('/','3');
previo=_XML.substring(0,uno+1);
carpeta_concello=_XML.substring(3, uno);


		var ajax = nuevoAjax();
		ajax.open("GET", _XML, true);
		ajax.onreadystatechange = function() {
			if (ajax.readyState==1) {	
				document.getElementById("cargando").style.visibility = "visible";	
				
				//document.getElementById(capa).innerHTML = '<br><br><img src="images/wait.gif" alt="Cargando...">';
			}	
			if (ajax.readyState==4) {	
				if (ajax.status==200 || ajax.status==304){
					xml= ajax.responseXML;
					
					
	
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

xml_=xml.documentElement;

document.getElementById(capa).innerHTML='';

//Titulo de la seccion
html='';
document.getElementById('quickSummary').innerHTML='<p class="p1"><span>' + xml_.getAttribute("encabezado") + '</span></p>';		
document.getElementById(capa).innerHTML +=  html;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////// Cargamos las subsecciones, fotos, enlaces, informacion en sus capas correspondientes /////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Recorre todas las subsecciones
html_subseccion='';
subseccion=xml_.getElementsByTagName('subsecciones')[0];
vienede=subseccion.getAttribute("vienede");

//Pomemos su eitqete
nombre_secc=subseccion.getAttribute("nombresub");

if(nombre_secc=="") nombre_secc="SUBSECCIONES";
document.getElementById('nombre_subsecciones').innerHTML='' + nombre_secc + '';

nombre_secc=xml_.getAttribute("nombresecc")
document.getElementById('nombresecc').innerHTML='' + nombre_secc + '';

if(vienede!=0) html_subseccion+='<div class="subsubmenu"><a href="javascript:cargarXML2(\'' + previo + 'secciones/' + vienede + '.xml\', \'supportingText\', 1)"><img border=0 src="' + previo + 'images/atras.gif" align="left">../</a></div>';
html_subseccion+='<div  id="larchives"><ul>';


for(i=0;i<subseccion.getElementsByTagName('subseccion').length;i++){
	subsec=subseccion.getElementsByTagName('subseccion')[i].getAttribute("nombre");
	src=subseccion.getElementsByTagName('subseccion')[i].getAttribute("src");
	html_subseccion+='<li><a href=\"javascript:cargarXML2(\'' + previo + 'secciones/' +  src + '\', \'supportingText\', 1);\">' + subsec  + '</a></li>';
}
html_subseccion+='</ul></div>';
document.getElementById('subsecciones').innerHTML=html_subseccion;


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Recorre todas las fotos se la seccion
html_fotos='<table width="100%" align=center cellpaddin=2 cellspacing=0 border=0>';

fotazas=xml_.getElementsByTagName('fotosseccion')[0];

nombre_fot=fotazas.getAttribute("nombrefot");

if(nombre_fot=="") nombre_fot="FOTOS";
document.getElementById('nombre_fotos').innerHTML='' + nombre_fot + '';

for(i=0;i<fotazas.getElementsByTagName('imagenes').length;i++){
	//Vemos si la foto se pone pqueña o grande
				mini=fotazas.getElementsByTagName('imagenes')[0].getAttribute("mini");
				if(mini=="si") directorio="minifotos";
				else directorio="fotos";

					//Vemos la funcion de la foto
					funcion='';
					enlacenormal=fotazas.getElementsByTagName('imagenes')[i].getAttribute("enlacenormal");
					enlaceseccion=fotazas.getElementsByTagName('imagenes')[i].getAttribute("enlaceseccion");
					enlaceflash=fotazas.getElementsByTagName('imagenes')[i].getAttribute("enlaceflash");
					enlacepopup=fotazas.getElementsByTagName('imagenes')[i].getAttribute("enlacepopup");
					archivo=fotazas.getElementsByTagName('imagenes')[i].getAttribute("archivo");
					alt=fotazas.getElementsByTagName('imagenes')[i].getAttribute("alt");
					borde4=fotazas.getElementsByTagName('imagenes')[i].getAttribute("borde");
				
					if(enlacenormal!="") funcion='window.open(\'http://' + enlacenormal + '\'); return false;';
					if(enlaceseccion!="") funcion='cargarXML2(\'' + previo + 'secciones/' + enlaceseccion + '\', \'supportingText\', 1)';
					if(enlacepopup!="") funcion='abreFoto(\'' + previo + 'fotos/' + archivo + '\', \'' + alt + '\')';
					if(enlaceflash!=0) funcion='abreFlash(\'' + previo + 'flash/videos/' + enlaceflash + '\', \'' + alt + '\')';

html_fotos+='<tr><td align="center"><div  class="contenedorfoto"><img src="' + previo + '/' + directorio +'/' + archivo + '" style="cursor:pointer; " onClick="' +  funcion + '" border=' + borde4 + '></div></td></tr>'
}
html_fotos+='</table>';
document.getElementById('imagenes_capa').innerHTML=html_fotos;

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Recorre todas los enlaces de la seccion
html_enlaces='<div  id="larchives"><ul>';

enlacesseccion=xml_.getElementsByTagName('enlacesseccion')[0];
//Pomemos su eitqete
nombre_enl=enlacesseccion.getAttribute("nombrelink");
if(nombre_enl=="") nombre_enl="ENLACES";
document.getElementById('nombre_enlaces').innerHTML='' + nombre_enl + '';

for(i=0;i<enlacesseccion.getElementsByTagName('webseccion').length;i++){
				//Vemos la funcion del enlace
				funcion='';
				enlacenormal=enlacesseccion.getElementsByTagName('webseccion')[i].getAttribute("enlacenormal");
				enlaceseccion=enlacesseccion.getElementsByTagName('webseccion')[i].getAttribute("enlaceseccion");
				enlaceflash=enlacesseccion.getElementsByTagName('webseccion')[i].getAttribute("enlaceflash");
				enlace360=enlacesseccion.getElementsByTagName('webseccion')[i].getAttribute("enlace360");
				alt=enlacesseccion.getElementsByTagName('webseccion')[i].getAttribute("alt");
				frase=enlacesseccion.getElementsByTagName('webseccion')[i].getAttribute("frase");
				
				if(enlacenormal!="") funcion='window.open(\'http://' + enlacenormal + '\'); return false;';
				if(enlaceseccion!="") funcion='cargarXML2(\'' + previo + 'secciones/' + enlaceseccion + '\', \'supportingText\', 1)';
				if(enlace360!="") funcion='abre360(\'' + previo + '' + enlace360 + '\')';
				if(enlaceflash!=0) funcion='abreFlash(\'' + previo + 'flash/videos/' + enlaceflash + '\', \'' + alt + '\')';

			html_enlaces+='<li><a href="#" onClick="' + funcion + '" title="' + alt + '">' + frase + '</a></li>';
}
html_enlaces+='</ul></div>';
document.getElementById('enlaces_capa').innerHTML=html_enlaces;

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Recorre todas la informacion adicional
html_info='';

infoseccion=xml_.getElementsByTagName('info')[0];
//Pomemos su eitqete
nombre_inf=infoseccion.getAttribute("nombre");
if(nombre_inf=="") nombre_inf="INFO";
document.getElementById('nombre_info').innerHTML='' + nombre_inf + '';

for(i=0;i<infoseccion.getElementsByTagName('dato').length;i++){
				titulo=infoseccion.getElementsByTagName('dato')[i].getAttribute("titulo");
				contenido=infoseccion.getElementsByTagName('dato')[i].getAttribute("contenido");
				html_info+='<div id="benefits"><div class="titlat"><b>' + titulo  + '</b></div>' + contenido + '</div>';
				
}

document.getElementById('info_capa').innerHTML=html_info;





///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////// CREAMOS LA BARRA DE RUTA  //////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Recorre todas las secciones de la ruta
html_ruta='';
ruta_seccion=xml_.getElementsByTagName('ruta')[0];
seccionprin=ruta_seccion.getAttribute("seccionprin");
html_ruta+=seccionprin.toUpperCase() + ' > ';
for(i=ruta_seccion.getElementsByTagName('sec').length-1;i>=0;i--){
	id_cada_ruta=ruta_seccion.getElementsByTagName('sec')[i].getAttribute("id");
	nombre_cada_ruta=ruta_seccion.getElementsByTagName('sec')[i].getAttribute("nom_ruta");
	html_ruta+='<a href=\"javascript:cargarXML2(\'' + previo + 'secciones/' +  id_cada_ruta + '.xml\', \'supportingText\', 1);\">' + nombre_cada_ruta  + '</a>';
	//Si no es la ultima se pone la >
	if(i>0) html_ruta+=' > ';
}
document.getElementById('ruta').innerHTML=html_ruta;




				
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


//Vemos si las cajas se cojen de otra seccion
otro_xml=xml_.getAttribute("otroxml");
	
	//Si tiene otro_xml lo cargamos sólo para las cajas
	if(otro_xml!=0){
		dir_xml='../' + carpeta_concello + '/secciones/' + otro_xml + '.xml';
		generaCajas(dir_xml, capa, pagina);
	}
	
	id_seccion_gral=xml_.getAttribute("id_seccion_gral");
	//Si tiene otro_xml lo cargamos sólo para las cajas
	if(id_seccion_gral!=0){
		dir_xml_gral='../concello3/secciones/' + id_seccion_gral + '.xml';
		generaCajas(dir_xml_gral, capa, pagina);
	}


		/////////////////////////////////////////////////////////////////////////////////////////////////					
					generaCajas(_XML, capa, pagina);
					
					
					document.getElementById("cargando").style.visibility = "hidden";
				}else if(ajax.status==404){
					document.getElementById(capa).innerHTML =  "<h1>ERROR 404</h1><br><b>Pagina No encontrada</b><br><br>";
					document.getElementById("cargando").style.visibility = "hidden";		
				}else{
					document.getElementById(capa).innerHTML =  "<h1>ERROR "+ajax.status+"</h1><br><b>"+ajax.statusText+"</b><br><br>";
					document.getElementById("cargando").style.visibility = "hidden";	
				}
				delete ajax;
			}
		}
		ajax.send(null);
}


//----------------------
function generaCajas(_XML, capa, pagina){

		var ajax = nuevoAjax();
		ajax.open("GET", _XML, true);
		ajax.onreadystatechange = function() {
			if (ajax.readyState==1) {	
				document.getElementById("cargando").style.visibility = "visible";				
				//document.getElementById(capa).innerHTML = '<br><br><img src="images/wait.gif" alt="Cargando...">';
			}	
			if (ajax.readyState==4) {	
				if (ajax.status==200 || ajax.status==304){
					xml= ajax.responseXML;
					
					
	
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

xml_=xml.documentElement;



html='';

//Vemos la pagina q tenemos q ver a 10 cajas por pagina
	total_cajas=xml_.getElementsByTagName('caja').length;
	inicio=pagina*10-10;
	fin=pagina*10;
	//si fin es mayor q el numero de cajas el fin es el numero de cajas
	if(fin>total_cajas) fin=total_cajas;

////////////////////////////////////////////////////////////////////////////Recorre todas las cajas
////////////////////////////////////////////////////////////////////////////Recorre todas las cajas
////////////////////////////////////////////////////////////////////////////Recorre todas las cajas
for(i=inicio;i<fin;i++){
	// -----------------------------------Encabezado y controles -------------------------------------------
	//Datos de la caja
	id=xml_.getElementsByTagName('caja')[i].getAttribute("id");
	titulo=xml_.getElementsByTagName('caja')[i].getAttribute("titulo");
	subtitulo=xml_.getElementsByTagName('caja')[i].getAttribute("subtitulo");
	fuente=xml_.getElementsByTagName('caja')[i].getAttribute("fuente");
	fechac=xml_.getElementsByTagName('caja')[i].getAttribute("fechac");
	fechasi=xml_.getElementsByTagName('caja')[i].getAttribute("fechasi");
	fechaa=xml_.getElementsByTagName('caja')[i].getAttribute("fechaa");
	resaltar=xml_.getElementsByTagName('caja')[i].getAttribute("resaltar");// si no
	botones=xml_.getElementsByTagName('caja')[i].getAttribute("botones");// si no
	minimizado=xml_.getElementsByTagName('caja')[i].getAttribute("minimizado");// si no
	
	//Encbezado
	if(resaltar=="si") clase="cajaresaltada";
	else clase="caja";
	html+='<div id="explanation"><div id="caja' + id + '" class="' + clase + '">';
	html+='<div><h3><span>' + titulo;
	
	if(fechasi=='si') html+=' (' + fechac  + ')';
	
	html+='</span></h3>';
	
	//Controles (si botones = si)
	
		html+='<div  class="derecha" id="controles' + id + '" style="hight:10px;width:45px">';
		
		if(botones=='si') html+='<div class="derecha"><img src="' + previo + 'images/icon_close.gif" style="cursor:pointer;" onclick="new Effect.Puff(\'caja' + id + '\')"></div><div class="derecha"><img src="' + previo + 'images/icon_mini.gif" style="cursor:pointer;" onclick="minimizar(\'subcaja' + id + '\', \'controles' + id + '\', \'caja' + id + '\', \'' + previo + '\')"></div>';		
		
		

		html+='</div></div>';
	
	
	//Subtitulo si lo hay
	if(subtitulo!=''){
		html+='<em>' + subtitulo + '</em><br clear="all" />';
	}
			//PRUEBA DE BOTONES PARA MAYOR TAMÑO DE TEXTO
		html+='<div class="derecha"><img src="' + previo + 'images/tipo_peque.gif" style="cursor:pointer;" onClick="agranda(\'subcaja' + id + '\', 12)"><img src="' + previo + 'images/tipo_normal.gif" style="cursor:pointer;" onClick="agranda(\'subcaja' + id + '\', 14)"><img src="' + previo + 'images/tipo_grande.gif" style="cursor:pointer;" onClick="agranda(\'subcaja' + id + '\', 18)"></div><br style="clear:both" />';

	//Parte superior de la caja
	html+='<div id=\'subcaja' + id + '\' name=\'subcaja' + id + '\' >';
	
	//Cuerpo y si hay fotos se pone la 1ª
		//Vemos si hay fotos
			fotos=xml_.getElementsByTagName('fotos')[i];
			numfotos=fotos.getElementsByTagName('imagen').length;
			hayfoto=false;
			if(numfotos>0){
				hayfoto=true;
				//Vemos la funcion de la foto
				funcion='';
				enlacenormal=fotos.getElementsByTagName('imagen')[0].getAttribute("enlacenormal");
				enlaceseccion=fotos.getElementsByTagName('imagen')[0].getAttribute("enlaceseccion");
				enlacepopup=fotos.getElementsByTagName('imagen')[0].getAttribute("enlacepopup");
				enlace360=fotos.getElementsByTagName('imagen')[0].getAttribute("enlace360");
				archivo=fotos.getElementsByTagName('imagen')[0].getAttribute("archivo");
				alt=fotos.getElementsByTagName('imagen')[0].getAttribute("alt");
				borde3=fotos.getElementsByTagName('imagen')[0].getAttribute("borde");

//Vemos si la foto se pone pqueña o grande
				mini=fotos.getElementsByTagName('imagen')[0].getAttribute("mini");
				if(mini=="si") directorio="minifotos";
				else directorio="fotos";
				
				if(enlacenormal!="") funcion='window.open(\'http://' + enlacenormal + '\'); return false;';
				if(enlaceseccion!="") funcion='cargarXML2(\'' + previo + 'secciones/' + enlaceseccion + '\', \'supportingText\', 1)';
				if(enlacepopup!="") funcion='abreFoto(\'' + previo + 'fotos/' + archivo + '\', \'' + alt + '\')';
				if(enlace360!="") funcion='abre360(\'' + previo + '360/' + enlace360 + '\', \'' + alt + '\')';

html+='<img class="contenedorfoto" src="' + previo + '/' + directorio + '/' + archivo + '" alt=\'' + fotos.getElementsByTagName('imagen')[0].getAttribute("alt") + '\'  hspace="4" vspace="4" border=' + borde3 + ' align="' + fotos.getElementsByTagName('imagen')[0].getAttribute("alinear") + '" style="cursor:pointer; " onClick="' + funcion + '">';
if(mini!="si") html+='<br clear="all">';
			}
			
		//Ahora se pone el cuerpo (lo parseará php, aunq tendría q interpretarlo javascript con una funcion)
		var corpo=xml_.getElementsByTagName('cuerpo')[i];
		//if(corpo.hasChildNodes()) cuerpon=corpo[i].firstChild.data;
		if(corpo.hasChildNodes()) cuerpo=corpo.childNodes[0].nodeValue;
		else cuerpo='';
		html+=cuerpo;
		html+='<br clear="all" />';
		//Si hay foto y no hay cuerpo ponermos una capa para q qede hueco
		//if(hayfoto && cuerpo=='') html+='<div style="width:100%; height:130px">&nbsp;</div>';
		
		//Si es una 360 aqui es donde iria el codigo
		if(xml_.getElementsByTagName('tressesenta')[i].getAttribute("src")!=""){
			src=xml_.getElementsByTagName('tressesenta')[i].getAttribute("src");
			alto=xml_.getElementsByTagName('tressesenta')[i].getAttribute("alto");
			ancho=xml_.getElementsByTagName('tressesenta')[i].getAttribute("ancho");
			velocidad=xml_.getElementsByTagName('tressesenta')[i].getAttribute("velocidad");
			nombrefla=xml_.getElementsByTagName('tressesenta')[i].getAttribute("nombret");
			
			
			html+='<div align="center">';
              html+=' <applet name="360 ContaLocal" code="uPixScreen.class" archive="360/uPixScreen.jar" width=' + ancho + ' height=' + alto + ' >';
                 html+=' <PARAM NAME=licenseFile VALUE="360/_psk2.ext">';
                 html+=' <PARAM NAME=customizationFile VALUE="360/Default.cfg">';
                 html+=' <PARAM NAME=title VALUE="' + nombrefla + '">';
                 html+=' <PARAM NAME=titlePos VALUE="0">';
                 html+=' <PARAM NAME=viewType VALUE="1">';
                 html+=' <PARAM NAME=autoPan VALUE="yes">';
                 html+=' <PARAM NAME=autoPanSpeed VALUE="' + velocidad + '">';
                 html+=' <PARAM NAME=startYaw VALUE="38">';
                 html+=' <PARAM NAME=startPitch VALUE="0">';
                 html+=' <PARAM NAME=startFOV VALUE="54">';
                 html+=' <PARAM NAME=partialStitch VALUE="no">';
                 html+=' <PARAM NAME=horFov VALUE="360">';
                 html+=' <PARAM NAME=url VALUE="' + previo + '360/' + src + '" >';
				 html+=' <PARAM NAME=hq VALUE=1 >';
              html+=' </applet>';
			html+='</div>';			
		}
		
		
		//Si hay algo en flas se pone aqui
		if(xml_.getElementsByTagName('flash')[i].getAttribute("src")!=""){
			src=xml_.getElementsByTagName('flash')[i].getAttribute("src");
			alto=xml_.getElementsByTagName('flash')[i].getAttribute("alto");
			ancho=xml_.getElementsByTagName('flash')[i].getAttribute("ancho");
			
			html+='<div align="center">';
			html+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width=' + ancho + ' height=' + alto + '>';
		    html+='<param name="movie" value="' + previo + 'flash/' + src + '">';
    		html+='<param name="quality" value="high">';
    		html+='<embed src="' + previo + 'flash/' + src + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width=' + ancho + ' height=' + alto + '></embed>';
  			html+='</object>';
			html+='</div>';
		}
		
		
		//Vemos si tiene enlaces
			enlaces=xml_.getElementsByTagName('enlaces')[i];
			nom_enlaces=xml_.getElementsByTagName('enlaces')[i].getAttribute("nombre");
			if(nom_enlaces=="") nom_enlaces="ENLACES";
			numenlaces=enlaces.getElementsByTagName('web').length;
			if(numenlaces>0){
				//Si abierto=si o abierto=no
				if(xml_.getElementsByTagName('enlaces')[i].getAttribute("abierto")=="si"){
					imag="arriba";
					func="ocultar";
					disp="visible";
				}
				else{
					imag="abajo";
					func="mostrar";
					disp="none";
				}

		html+='<div class="nifty" id="enlaces">';
		html+='<div class="cajita">';
		html+='<h4><span>' + nom_enlaces + '</span></h4>';
		html+='<div class="derecha" id="derecha' + id + '"><img src="' + previo + 'images/' + imag + '.gif" style="cursor:pointer;" onclick="' + func + '(\'enlaces' + id + '\', \'derecha' + id + '\', \'' + previo + '\')"></div>';
		html+='</div>';
		html+='<div class="demo" id="enlaces' + id + '" style="display:' + disp + '">';
			for(s=0;s<numenlaces;s++){
				//Vemos la funcion del enlace
				funcion='';
				enlacenormal=enlaces.getElementsByTagName('web')[s].getAttribute("enlacenormal");
				enlaceseccion=enlaces.getElementsByTagName('web')[s].getAttribute("enlaceseccion");
				enlace360=enlaces.getElementsByTagName('web')[s].getAttribute("enlace360");
				enlaceflash=enlaces.getElementsByTagName('web')[s].getAttribute("enlaceflash");
				alt=enlaces.getElementsByTagName('web')[s].getAttribute("alt");
				frase=enlaces.getElementsByTagName('web')[s].getAttribute("frase");
				
				if(enlacenormal!="") funcion='window.open(\'http://' + enlacenormal + '\'); return false;';
				if(enlaceseccion!="") funcion='cargarXML2(\'' + previo + 'secciones/' + enlaceseccion + '\', \'supportingText\', 1)';
				if(enlace360!="") funcion='abre360(\'' + previo + '360/' + enlace360 + '\', \'' + alt + '\')';
				if(enlaceflash!="") funcion='abreFlash(\'' + previo + 'flash/videos/' + enlaceflash + '\', \'' + alt + '\')';
				html+='<img src="' + previo + '/images/enlaces.gif"> <a href="#" onClick="' + funcion + '" title="' + alt + '">' + frase + '</a> <br />';
			}//Fin del for q recorre los enlaces
		//Cerramos la caja de los enlaces
		html+='</div>';
		html+='</div>';

		}//Fin del if de si existen enlaces
		
		//Vemos si existen fotos
		nom_fotos=xml_.getElementsByTagName('fotos')[i].getAttribute("nombre");
		if(nom_fotos=="") nom_fotos="FOTOS";
			if(numfotos>1){
				//Si abierto=si o abierto=no
				if(xml_.getElementsByTagName('fotos')[i].getAttribute("abierto")=="si"){
					imag="arriba";
					func="ocultar";
					disp="visible";
				}
				else{
					imag="abajo";
					func="mostrar";
					disp="none";
				}

				html+='<div  style="display:block; " id="fotos">';
				html+='<div class="cajita">';
				html+='<h4><span>' + nom_fotos + '</span></h4>';
				html+='<div class="derecha" id="derechai' + id + '"><img src="' + previo + 'images/' + imag + '.gif" style="cursor:pointer;" onclick="' + func + '(\'imagenes' + id + '\', \'derechai' + id + '\', \'' + previo + '\')"></div>';
				html+='</div>';
				html+='<div class="demo" id="imagenes' + id + '" style="display:' + disp + '">';
				for(s=1;s<numfotos;s++){

					//Vemos la funcion de la foto
					funcion='';
					enlacenormal=fotos.getElementsByTagName('imagen')[s].getAttribute("enlacenormal");
					enlaceseccion=fotos.getElementsByTagName('imagen')[s].getAttribute("enlaceseccion");
					enlacepopup=fotos.getElementsByTagName('imagen')[s].getAttribute("enlacepopup");
					enlace360=fotos.getElementsByTagName('imagen')[s].getAttribute("enlace360");
					enlaceflash=fotos.getElementsByTagName('imagen')[s].getAttribute("enlaceflash");
					archivo=fotos.getElementsByTagName('imagen')[s].getAttribute("archivo");
					alt=fotos.getElementsByTagName('imagen')[s].getAttribute("alt");
					borde2=fotos.getElementsByTagName('imagen')[s].getAttribute("borde");
					

					if(enlacenormal!="") funcion='window.open(\'http://' + enlacenormal + '\'); return false;';
					if(enlaceseccion!="") funcion='cargarXML2(\'' + previo + 'secciones/' + enlaceseccion + '\', \'supportingText\', 1)';
					if(enlacepopup!="") funcion='abreFoto(\'' + previo + 'fotos/' + archivo + '\', \'' + alt + '\')';
					if(enlace360!="") funcion='abre360(\'' + previo + '360/' + enlace360 + '\', \'' + alt + '\')';
					if(enlaceflash!="") funcion='abreFlash(\'' + previo + 'flash/videos/' + enlaceflash + '\', \'' + alt + '\')';
					html+='<div  class="contenedorfoto"><img src="' + previo + 'minifotos/' + archivo + '"  hspace="1" vspace="2" border=' + borde2 + '  style="cursor:pointer; " alto="' + alt + '" onClick="' +  funcion + '"></div>'
				}
				html+='</div>';
				html+='</div>';
			}//Fin del if de si existen fotos
		
		
		
		//Vemos si existen archivos adjuntos
			adjuntos=xml_.getElementsByTagName('adjuntos')[i];
			numadjuntos=adjuntos.getElementsByTagName('archivo').length;
			nom_adjuntos=xml_.getElementsByTagName('adjuntos')[i].getAttribute("nombre");
			if(nom_adjuntos=="") nom_adjuntos="ARCHIVOS ADJUNTOS";
			
			if(numadjuntos>0){
				//Si abierto=si o abierto=no
				if(xml_.getElementsByTagName('enlaces')[i].getAttribute("abierto")=="si"){
					imag="arriba";
					func="ocultar";
					disp="visible";
				}
				else{
					imag="abajo";
					func="mostrar";
					disp="none";
				}

		html+='<div class="nifty" id="archivos_adjuntos1">';
		html+='<b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>';
		html+='<div class="cajita">';
		html+='<div class="izquierda"><h4><span>' + nom_adjuntos + '</span></h4></div>';
		html+='<div class="derecha" id="derechaa' + id + '"><img src="' + previo + 'images/' + imag + '.gif" style="cursor:pointer;" onclick="' + func + '(\'adjuntos' + id + '\', \'derechaa' + id + '\', \'' + previo + '\')"></div>';
		html+='</div>';
		html+='<div class="demo" id="adjuntos' + id + '" style="display:' + disp + '"><ul>';
		for(s=0;s<numadjuntos;s++){
			icono=adjuntos.getElementsByTagName('archivo')[s].getAttribute("icono");
			src=adjuntos.getElementsByTagName('archivo')[s].getAttribute("src");
			texto=adjuntos.getElementsByTagName('archivo')[s].getAttribute("texto");
			alt=adjuntos.getElementsByTagName('archivo')[s].getAttribute("alt");
			tamano=adjuntos.getElementsByTagName('archivo')[s].getAttribute("tamano");
			html+='<li><img src="' + previo + 'images/iconos/' + icono + '.gif" alt="' + alt + '"> <a href="control/descarga.php?carpeta_concello=' + carpeta_concello + '&archivo=' + src + '" target="_blank" title="' + alt + '">' + texto + ' (' + tamano + ')</a></li>';
		}//Fin del for de los archivos adjuntos
		html+='</ul></div>';
		html+='</div>';
			}//Fin de si existen archivos adjuntos
		
		
//Fin de la caja
html+='</div>';
html+='</div>';
html+='</div>';
}

///////////////////////////////////////// Paginacion Inferior///////////////////////////////////////////////////
	html+='<div align="center">';
	if(pagina>1){
		paginaa=pagina - 1;
		html+='<a href="javascript:cargarXML2(\'' + previo + '' + _XML + '\', \'supportingText\', ' + paginaa + ')">&lt;&lt;Anterior | </a>';
		
	}
	if(total_cajas>fin){
		paginas=pagina + 1;
		html+='<a href="javascript:cargarXML2(\'' + previo + '' + _XML + '\', \'supportingText\', ' + paginas + ')">Siguiente&gt;&gt;</a>';
	}
	html+='</div>';
		

		/////////////////////////////////////////////////////////////////////////////////////////////////					
					
					//alert(html);
					document.getElementById(capa).innerHTML +=  html;
					document.getElementById("cargando").style.visibility = "hidden";
					
				}else if(ajax.status==404){
				alert('ERROR')
				}else{
				alert('ERROR')
				}
				delete ajax;
			}
		}
		ajax.send(null);
}





//----------------------
//----------------------
//----------------------
function cargarSecciones(_XML, capa){
uno=_XML.indexOf('/','3');
previo=_XML.substring(0,uno+1);

		var ajax = nuevoAjax();
		ajax.open("GET", _XML, true);
		ajax.onreadystatechange = function() {
			if (ajax.readyState==1) {	
				document.getElementById("cargando").style.visibility = "visible";				
				document.getElementById(capa).innerHTML = '<br><br><img src="images/wait.gif" alt="Cargando...">';
			}	
			if (ajax.readyState==4) {	
				if (ajax.status==200 || ajax.status==304){
					xml= ajax.responseXML;
					

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
html='';
xml_=xml.documentElement;


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////MENU LATERAL PRINCIPAL ///////////////////////////////////////////////////////////////////

html+='<div id="benefits"><div id="masterdiv">';

//Recorre todas las cajas
for(i=0;i<xml_.getElementsByTagName('seccion').length;i++){
	seccion=xml_.getElementsByTagName('seccion')[i].getAttribute("nombre");
	
	html+='<div class="menutitle" onclick="SwitchMenu(\'sub' + i + '\')">' +  seccion + '</div>';
	html+='<span class="submenu" id="sub' + i + '">';
	
	subseccion=xml_.getElementsByTagName('seccion')[i];
	numsubsecciones=subseccion.getElementsByTagName('subseccion').length;

	for(s=0;s<numsubsecciones;s++){
	subsec=subseccion.getElementsByTagName('subseccion')[s].getAttribute("nombre");
	src=subseccion.getElementsByTagName('subseccion')[s].getAttribute("src");
	html+='<div class="subsubmenu"><a href="javascript:cargarXML2(\'' + previo + 'secciones/' +  src + '\', \'supportingText\', 1)">' + subsec  + '</a></div>';
	}
	
	html+='</span>';
	
}

html+='</div></div>';

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////MENU SUPERIOR PRINCIPAL ///////////////////////////////////////////////////////////////////
//cargarContenidoPagina('menu.php?lang=' + id, 'navegador');
//activateMenu('nav');
/////////////////////////////////////////////////////////////////////////////////////////////////					
					
					document.getElementById(capa).innerHTML =  html;
					document.getElementById("cargando").style.visibility = "hidden";
				}else if(ajax.status==404){
					document.getElementById(capa).innerHTML =  "<h1>ERROR 404</h1><br><b>Pagina No encontrada</b><br><br>";
					document.getElementById("cargando").style.visibility = "hidden";		
				}else{
					document.getElementById(capa).innerHTML =  "<h1>ERROR "+ajax.status+"</h1><br><b>"+ajax.statusText+"</b><br><br>";
					document.getElementById("cargando").style.visibility = "hidden";	
				}
				delete ajax;
			}
		}
		ajax.send(null);
}
//----------------------
//----------------------



////////////////////////////////////////////////////////////////////////////////////////////////////////
// Esta funcion guarda un icono en la barra de iconos al ocultarlo

function iconos(caja, carpeta_concello){
	//1º cojemos lo q hay dentro de iconos
	var contenido=document.getElementById('iconos').innerHTML;
		
	if(caja=="secciones"){
		var alt=document.getElementById('nombresecc').innerHTML;
		document.getElementById('iconos').innerHTML+="<div class=\"izquierda\" name=\"iconos_secciones\" id=\"iconos_secciones\"><img src=\"../" + carpeta_concello + "/images/icono_secciones.gif\" alt=\"" + alt + "\" style=\"cursor:pointer\" onClick=\"mostrar2('secciones_dd');iconosNo('secciones')\"></div>"
	}
	if(caja=="subsecciones"){
		var alt=document.getElementById('nombre_subsecciones').innerHTML;
		document.getElementById('iconos').innerHTML+="<div class=\"izquierda\" name=\"icono_subsecciones\" id=\"icono_subsecciones\"><img src=\"../" + carpeta_concello + "/images/icono_subsecciones.gif\" alt=\"" + alt + "\" style=\"cursor:pointer\" onClick=\"mostrar2('subsecciones_dd');iconosNo('subsecciones')\"></div>"
	}
	if(caja=="fotos"){
		var alt=document.getElementById('nombre_fotos').innerHTML;
		document.getElementById('iconos').innerHTML+="<div class=\"izquierda\" name=\"icono_fotos\" id=\"icono_fotos\"><img src=\"../" + carpeta_concello + "/images/icono_fotos.gif\" alt=\"" + alt + "\" style=\"cursor:pointer\" onClick=\"mostrar2('imagenes_dd');iconosNo('fotos')\"></div>"
	}
	if(caja=="enlaces"){
		var alt=document.getElementById('nombre_enlaces').innerHTML;
		document.getElementById('iconos').innerHTML+="<div class=\"izquierda\" name=\"icono_enlaces\" id=\"icono_enlaces\"><img src=\"../" + carpeta_concello + "/images/icono_enlaces.gif\" alt=\"" + alt + "\" style=\"cursor:pointer\" onClick=\"mostrar2('enlaces_dd');iconosNo('enlaces')\"></div>"
	}
	if(caja=="info"){
		var alt=document.getElementById('nombre_info').innerHTML;
		document.getElementById('iconos').innerHTML+="<div class=\"izquierda\" name=\"icono_info\" id=\"icono_info\"><img src=\"../" + carpeta_concello + "/images/icono_info.gif\" alt=\"" + alt + "\" style=\"cursor:pointer\" onClick=\"mostrar2('cajainfo');iconosNo('info')\"></div>"
	}
	if(caja=="buscador"){
		var alt=document.getElementById('nombre_buscador').innerHTML;
		document.getElementById('iconos').innerHTML+="<div class=\"izquierda\" name=\"icono_buscador\" id=\"icono_buscador\"><img src=\"../" + carpeta_concello + "/images/icono_buscador.gif\" alt=\"" + alt + "\" style=\"cursor:pointer\" onClick=\"mostrar2('cajabuscador');iconosNo('buscador')\"></div>"
	}
	
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Este funcion kita el icono correspondiente

function iconosNo(caja){
	
	if(caja=="secciones"){
	oDiv=document.getElementById("iconos_secciones");
	oDiv.parentNode.removeChild(oDiv);
	}
	if(caja=="subsecciones"){
	oDiv2=document.getElementById("icono_subsecciones");
	oDiv2.parentNode.removeChild(oDiv2);
	}
	if(caja=="fotos"){
	oDiv3=document.getElementById("icono_fotos");
	oDiv3.parentNode.removeChild(oDiv3);
	}
	if(caja=="enlaces"){
	oDiv4=document.getElementById("icono_enlaces");
	oDiv4.parentNode.removeChild(oDiv4);
	}
	if(caja=="info"){
	oDiv5=document.getElementById("icono_info");
	oDiv5.parentNode.removeChild(oDiv5);
	}
	if(caja=="buscador"){
	oDiv6=document.getElementById("icono_buscador");
	oDiv6.parentNode.removeChild(oDiv6);
	}
}

function resalta(palabra, tiempo){
	setTimeout("resalta2('"+ palabra + "')", tiempo);

}

function aleatorio(inferior,superior){ 
   numPosibilidades = superior - inferior 
   aleat = Math.random() * numPosibilidades 
   aleat = Math.floor(aleat) 
   return parseInt(inferior) + aleat 
} 

function dame_color_aleatorio(){ 

   hexadecimal = new Array("B6D3EA","B6EAC8","EAE7B6","EAC3B6","EAB6D3", "C7B6EA", "F1EF5D", "9FF15D", "EB908B", "8C90DC", "95F86A") 
   color_aleatorio = "#"; 
 
      posarray = aleatorio(0,hexadecimal.length) 
      color_aleatorio += hexadecimal[posarray] 
	 // alert(color_aleatorio);
  
   return color_aleatorio 
} 


function resalta2(palabra){
	var texto="";
	color=dame_color_aleatorio();
	var encontro=0;
var donde=0;
valor=palabra;//caja de texto con id="tt"///
reemplazar=RegExp(valor,"i");
if(texto==""){texto=document.getElementById('supportingText').innerHTML};
txt=texto.split(">");
for (x=0;x<txt.length;x++){
desde=(txt[x].indexOf("<")!=-1)?txt[x].indexOf("<"):0;
tempP=txt[x].slice(0,desde);
tempU=txt[x].slice(desde);
tempPx=tempP.split(" ");
for(y=0;y<tempPx.length;y++){
if(tempPx[y].search(reemplazar)!=-1 && tempPx[y].length==valor.length){
tempPx[y]="<span style=\u0022background-Color:"  + color + ";\u0022>"+tempPx[y]+"</span>";
encontro+=1;
}
}
txt[x]=tempPx.join(" ")+tempU;
}
document.getElementById('supportingText').innerHTML=txt.join(">");
alert((encontro==0)?"No se encontro ''"+valor+"'' en el texto, quiza sea el nombre de alguna foto o destino de algun enlace":"Se encontraton "+encontro+" coincidencias de  la palabra''"+valor+"''");

}

function agranda(capa, tamano){
var obj = document.getElementById(capa);
obj.style.fontSize = tamano;
}
	
function abreVentana(direccion, alto, ancho){
	var ventana_
	var ancho= screen.availWidth - 10;
	var alto= screen.availHeight - 30;
	ventana_=window.open(direccion,"Ventana_","top=0,left=0,width=" + ancho + ",height=" + alto + ",resizable=yes , scrollbars=yes, dependent=yes")
	ventana_.moveTo(0,0)
	ventana_.focus()
}

function fechaMayorOIgualQue(fec0, fec1){ 
    var bRes = false; 
    var sDia0 = fec0.substr(0, 2); 
    var sMes0 = fec0.substr(3, 2); 
    var sAno0 = fec0.substr(6, 4); 
    var sDia1 = fec1.substr(0, 2); 
    var sMes1 = fec1.substr(3, 2); 
    var sAno1 = fec1.substr(6, 4); 
    if (sAno0 > sAno1) bRes = true; 
    else { 
     if (sAno0 == sAno1){ 
      if (sMes0 > sMes1) bRes = true; 
      else { 
       if (sMes0 == sMes1) 
        if (sDia0 >= sDia1) bRes = true; 
      } 
     } 
    } 
    return bRes; 
   } 
