﻿
// COMPRUEBA LA RESOLUCIÓN DESDE LA QUE SE VISUALIZA LA WEB, Y ESCOGE UNA HOJA DE ESTILO EN CONSECUENCIA
function resolucion (){ 
  if (screen.height<601) document.write ("<link rel='stylesheet' href='css/estilo_pe.css' type='text/css' media='all'>") 
	else 
		if (screen.height<801) document.write ("<link rel='stylesheet' href='css/estilo_me.css' type='text/css' media='all'>") 
			else 
				document.write ("<link rel='stylesheet' href='css/estilo_gr.css' type='text/css' media='all'>")  
   
} 


// VENTANA DE AVISO LEGAL
function aviso (){ window.open("aviso.html","aviso","width=500,height=400,scrollbars=YES,resizable=YES,directories=NO,location=NO,menubar=NO,status=NO,titlebar=NO,toolbar=NO" ) 
} 


// CONFIGURACIÓN DEL MAPA DE GOOGLE INCRUSTADO EN UNA PÁGINA
function mapa() {
				if (GBrowserIsCompatible()) {
											var map = new GMap2(document.getElementById("mapa"));
											map.setCenter(new GLatLng(42.446200, -2.202050), 15);
											map.addControl(new GLargeMapControl()); 
											map.addControl(new GMapTypeControl());
											var myIcon = new GIcon(G_DEFAULT_ICON);
											myIcon.image = "img/mapicon.png";
											myIcon.iconSize = new GSize(50, 40);
											myIcon.shadow = "img/mapicon_sombra.png";
											myIcon.shadowSize = new GSize(72, 40);
											myIcon.iconAnchor = new GPoint(25, 29);
											myIcon.infoWindowAnchor = new GPoint(25, 14);
	
											var markerOptions = { icon:myIcon };
	
											var marker = new GMarker(map.getCenter(), markerOptions);
											GEvent.addListener(marker, "click", function () { marker.openInfoWindowHtml("Hello"); });
											map.addOverlay(marker);
											}
				}
					
					

					
// CAMBIA UN ELEMENTO DE VISIBLE A INVISIBLE
function cambiar(esto)
{
	vista=document.getElementById(esto).style.display;
	if (vista=='none')
		vista='block';
	else
		vista='none';

	document.getElementById(esto).style.display = vista;
}


// FUNCIONES DE VALIDACIÖN DE CAMPOS DEL FORMULARIO 

// Estas dos comprueban que el campo nombre no está vacío, ni relleno solo con espacios
function vacio(q) {   
        for ( i = 0; i < q.length; i++ ) {   
                if ( q.charAt(i) != " " ) {   
                        return true   
                }   
        }   
        return false   
}   
  
 
function valida(F) {   
           
        if( vacio(F.nombre.value) == false ) {   
                alert("Por favor, indícanos tu nombre.")   
                return false   
        } else {   
                return true   
        }   
} 		


// Esta comprueba que el formato de dirección de corre en el campo email es correcto
function correo(valor) { 
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
			return (true)
		} else {
			alert("Por favor, introduce una dirección de correo válida para que podamos responderte.")
			return (false);
				}


}
           
  
  
   
    






















