// JavaScript Document

	function Carga(direccion) {
		info.document.location = direccion;		
	}


	function Muestra(nombreCapa) {
	
		if (document.getElementById(nombreCapa).style.visibility=="hidden") {
			document.getElementById(nombreCapa).style.position = "relative";
			document.getElementById(nombreCapa).style.left=0;
			document.getElementById(nombreCapa).style.visibility = "visible";
		}
		else {
			document.getElementById(nombreCapa).style.visibility = "hidden";
			document.getElementById(nombreCapa).style.position = "absolute";
			document.getElementById(nombreCapa).style.left=-100;		
		}
	}
	
	function MuestraDia() {

			dows = new Array("Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado");
			months = new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
			now = new Date();
			dow = now.getDay();
			d = now.getDate();
			m = now.getMonth();
			h = now.getTime();
			y = now.getFullYear();
			document.write(dows[dow]+" "+d+" de "+months[m]+" de "+y);	
	}
	
	function Votar(accion) {
		
		direccion = "encuesta/votar.php?accion=" + accion +"&voto=" + formu.respuesta.value;
		window.open(direccion, '', 'width=400, height=270');
		
	}

	function Manda() {
				if (document.formu2.email.value=="") {
					alert("Introduzca su dirección de e-mail");
				}
				else {
					if (checkMail(document.formu2.email.value)) {
					direccion = "registro/registrar.php?email=" + document.formu2.email.value;
					window.open(direccion, '', 'width=200, height=150');
					}
				}
	}

	function abrir(direccion) {	
		window.open(direccion, '', 'width=604, height=500');
	}
	
	function checkMail(cadena) {
			var plant = /[^\w^@^\.^-]+/gi
			if (plant.test(cadena)) {
				 alert(cadena + " contiene caracteres extraños.");
				 return false;
			}
			else{
				 plant =/(^\w+)(@{1})([\w\.-]+$)/i
				 if (plant.test(cadena))
					 return true; 
				 else 
					 alert(cadena + " no es un e-mail valido");
					 return false;
			} 
	}
