
 
function favoritos(direccion,descripcion){
		if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>3)){
	 		window.external.AddFavorite(direccion,descripcion);
    	} else if (navigator.appName=="Netscape") {	
			window.sidebar.addPanel(descripcion,direccion,""); 
		} else { 
        	alert("su navegador no dispone de esta opción");
   		}
  } 

function ValidarComentario(f){
/*var aux=f.cod_uno.value.toUpperCase();
	if(aux==f.cod_dos.value && f.cod_uno.value!="" && f.cod_dos.value!=""){*/
		if(f.nombre.value==""){
			alert("El Nombre no es correcto");
			f.nombre.focus();
			return false;
		}
		if(f.comentario.value==""){
			alert("El Comentario no es correcto");
			f.comentario.focus();
			return false;
		}
	
		if(f.email.value!=""){
			var str=f.email.value;
			var filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
			if (filter.test(str))
				testresults=true;
			else{
				alert("El E-mail no es correcto");
				f.email.focus();
				return false;
			}
		}
		/*return true;
	}else{
		alert("Rellene el codigo de la imagen");
		return false;
	}*/
	
return true;
}

function cambio_color_cuadrado(celda){
	var obj=document.getElementById(celda);
	obj.style.backgroundColor='#006654';
	var obj2=document.getElementById('mapa');
	obj2.src="images/mapa_tiempo/foto_comarca.jpg";
}

function cambio_color_cuadrado_sel(celda){
	var obj=document.getElementById(celda);
	obj.style.backgroundColor='#9C1F2E';
	var obj2=document.getElementById('mapa');
	if(celda=="alacon"){
			obj2.src="images/mapa_tiempo/foto_alacon.jpg";
		}else{
			if(celda=="alloza"){
				obj2.src="images/mapa_tiempo/foto_alloza.jpg";
			}else{
				if(celda=="andorra"){
					obj2.src="images/mapa_tiempo/foto_andorra.jpg";
				}else{
					if(celda=="arino"){
						obj2.src="images/mapa_tiempo/foto_arino.jpg";
					}else{
						if(celda=="crivillen"){
							obj2.src="images/mapa_tiempo/foto_crivillen.jpg";					
						}else{
							if(celda=="ejulve"){
								obj2.src="images/mapa_tiempo/foto_ejulve.jpg";
							}else{
								if(celda=="estercuel"){
									obj2.src="images/mapa_tiempo/foto_estercuel.jpg";
								}else{
									if(celda=="gargallo"){
										obj2.src="images/mapa_tiempo/foto_gargallo.jpg";
									}else{
										if(celda=="oliete"){
											obj2.src="images/mapa_tiempo/foto_oliete.jpg";
										}
									}
								}
							}
						}
					}
				}
			}
		}
}

function cambio_color_menu(celda,enlace_id){
	var obj=document.getElementById(celda);
	var enlace=document.getElementById(enlace_id);
	obj.style.backgroundColor='#9C1F2E';
	enlace.style.color="#FFFFFF";
}
function cambio_color_menu_sel(celda,enlace_id){
	var obj=document.getElementById(celda);
	var enlace=document.getElementById(enlace_id);
	obj.style.backgroundColor='#FFCC66';
	enlace.style.color="#006654";
}

function cambio_color_naranja(celda){
	var obj=document.getElementById(celda);
	obj.style.backgroundColor='#FFCC66';
}
function cambio_color_naranja_claro(celda){
	var obj=document.getElementById(celda);
	obj.style.backgroundColor='#FFF0D1';
}

function cambio_color_amarillo(celda){
	var obj=document.getElementById(celda);
	obj.style.backgroundColor='#FFFF99';
}
function cambio_color_amarillo_claro(celda){
	var obj=document.getElementById(celda);
	obj.style.backgroundColor='#FFFFCC';
}

function iluminar_linea(linea){
	var obj = document.getElementsByName(linea); 
    for (i = 0; i< obj.length; i++) { 
		obj[i].style.backgroundColor='#669900';
		obj[i].style.color='#FFFFFF';
	}
}

function no_iluminar_linea(linea){
	var obj = document.getElementsByName(linea); 
    for (i = 0; i< obj.length; i++) { 
		obj[i].style.backgroundColor='#FFFFFF';
		obj[i].style.color='#000000';
	}
}


function ObtenerDatos(datos,divID) { 
	var obj = document.getElementById(divID); 
	var peticion = false; 
	if (window.XMLHttpRequest) { 
    	peticion = new XMLHttpRequest(); 
    } else if (window.ActiveXObject) { 
        peticion = new ActiveXObject("Microsoft.XMLHTTP"); 
	}
	if(peticion) { 
		var url=datos;
     	peticion.open("GET", url);   //
     	peticion.onreadystatechange = function()  { 
        	/*if (peticion.readyState == 1) { 
				obj.innerHTML="<img src='images/cargando.jpg' alt=cargando width='601' height='447'>";
		   	}*/
			if (peticion.readyState == 4) { 
         		obj.innerHTML = peticion.responseText;
		   	} 
     	} 
		peticion.send(null); 
	}
	
}


/*function MostrarFilas(Fila) { 
var elementos = document.getElementsByName(Fila); 
    for (i = 0; i< elementos.length; i++) { 
        if(navigator.appName.indexOf("Microsoft") > -1){ 
               var visible = 'block'; 
        } else { 
               var visible = 'table-row'; 
        } 
elementos[i].style.display = visible; 
        } 
} 
  
function OcultarFilas(Fila) { 
    var elementos = document.getElementsByName(Fila); 
    for (k = 0; k< elementos.length; k++) { 
         elementos[k].style.display = "none"; 
    } 
} */ 



function validarmail(f){
		if(f.nombre.value==""){
			alert("Debes rellenar el nombre");
			f.nombre.focus();
			return false;
		}
		if(f.texto.value==""){
			alert("Debes rellenar la consulta");
			f.nombre.focus();
			return false;
		}
		if(f.email.value!=""){
			var str=f.email.value;
			var filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
			if (filter.test(str))
				testresults=true;
			else{
				alert("El E-mail no es correcto");
				f.email.focus();
				return false;
			}
		}
		if(f.cod_uno.value==""){
			alert("Debes introducir el código de la imagen");
			f.cod_uno.focus();
			return false;
		}
		if(!f.proteccion.checked){
			alert("Debes leer y aceptar las condiciones de la Ley de Protección de Datos");
			return false;
		}
		return true;
}



//////////Codigo galeria fotografica/////////////

function ObtenerDatosGaleria(divID,id,pos) { 
	var imagen = document.getElementById("id_imagen");

	if(pos!="no"){
		imagen.value=pos;
	}
	var obj = document.getElementById(divID); 
	var peticion = false; 
	if (window.XMLHttpRequest) { 
    	peticion = new XMLHttpRequest(); 
    } else if (window.ActiveXObject) { 
        peticion = new ActiveXObject("Microsoft.XMLHTTP"); 
	}
	if(peticion) { 
		var url='galeria_auxiliar.php?id=' + id;
     	peticion.open("GET", url);   //
     	peticion.onreadystatechange = function()  { 
        	if (peticion.readyState == 4) { 
         		obj.innerHTML = peticion.responseText;
		   	} 
     	} 
		peticion.send(null); 
	}
}

function bucle(){
	var imagen = document.getElementById("id_imagen");
	
	if(imagen.value<9){
		imagen.value=eval(imagen.value + "+ 1");
	} else {
		imagen.value=0;
	}
	aux=imagen.value;
	return aux;
}

var matriz=new Array(9);

function MoverFoto() { 
	var cadena=document.getElementById("sw");
	var aux2;
	var aux=cadena.value;
	
	for(i=0;i<10;i++){
		if(aux.substr(0,1)!=""){
			if(aux.substr(2,1)!="" && aux.substr(2,1)!="-"){
				matriz[i]=aux.substr(0,3);
				aux=aux.substr(4);
			}else{
				if(aux.substr(1,1)!="" && aux.substr(1,1)!="-"){
					matriz[i]=aux.substr(0,2);
					aux=aux.substr(3);
				}else{
					matriz[i]=aux.substr(0,1);
					aux=aux.substr(2);
				}
			}			
		}else{
			matriz[i]="";
		}
	}
if(matriz[2]!=""){
		setInterval("aux2=bucle();if(eval(matriz[aux2]!='')){ObtenerDatosGaleria('foto', eval(matriz[aux2]),'no');}else{ObtenerDatosGaleria('foto', eval(matriz[0]),'0');}",4000);
}
}

//////////Fin codigo galeria fotografica/////////////