
function antispam(clase)
{
	var usuario = "info"
	var dominio = "fabalmeria.org"
	document.write("<a class='"+clase+"' href=\"mailto:" + usuario + "@" + dominio + "\">" + usuario + "@" + dominio + "</a>")
}
function desplegar(nombre){
	var capa;
	capa = document.getElementById(nombre);
	
	if (capa.style.display != 'none')
	{
		capa.style.display = 'none';
	}
	else
	{
		capa.style.display = '';
	}
}
function validar_contactar(formulario){
	if ((formulario.nombre.value == "" ) || (formulario.telefono.value == "" )){
		alert("Los campos Nombre y Telefono son obligatorios.");
		return(false);
	}
	else{
		if ((validarEmail(formulario.email.value)) || (formulario.email.value == "")){
			return(true);
		}
		else{
			alert("El email introducido no es valido.");
			return(false);
		}
	}
}

//funcion para validar enviar noticias
function validar_enviar(formulario){
	if ((formulario.Codigo.value == "" ) || (formulario.Nombre.value == "" ) || (formulario.Email.value == "" ) || (formulario.Destinatario.value == "" )){
		alert("Los campos Nombre, Email, Destinatario y Codigo son obligatorios.");
		return(false);
	}
	else{
		if (((validarEmail(formulario.Email.value)) || (formulario.Email.value == "")) && ((validarEmail(formulario.Destinatario.value)) || (formulario.Destinatario.value == ""))){
			return(true);
		}
		else{
			alert("El e-mail introducido no es valido.");
			return(false);
		}
	}
}

function validar_quieresserarbitro(formulario){
	if ((formulario.nombre.value == "" ) || (formulario.fechanacimiento.value == "" ) || (formulario.DNI.value == "" ) || (formulario.domicilio.value == "" ) || (formulario.cp.value == "" ) || (formulario.localidad.value == "" ) || (formulario.provincia.value == "" ) || (formulario.telefono.value == "" )){
		alert("Todos los campos son obligatorios excepto el email.");
		return(false);
	}
	else{
		if ((validarEmail(formulario.email.value)) || (formulario.email.value == "")){
			return(true);
		}
		else{
			alert("El email introducido no es valido.");
			return(false);
		}
	}
}

function validarEmail(TMP){
var posicion;
var mensaje;
	posicion=TMP.indexOf("@");
	switch (posicion)
	{
		case -1:
		return false;
		case 0:
		return false;
		case TMP.length-1:
		return false;
		default:
		TMP=TMP.substr(posicion+1);
		posicion=TMP.indexOf("@");
	if (posicion>-1)
	{
		return false;
	}
		posicion=TMP.indexOf(".");
	if (posicion==-1)
	{
		return false;
	}
	if (posicion==0)
	{
		return false;
	}
		while (posicion>-1)
	{
	if (posicion==TMP.length-1)
	{
		return false;
	}
	TMP=TMP.substr(posicion+1);
	posicion=TMP.indexOf(".");
	}
}
return true;
}
function abrirventana() {
window.open("lssi.html","lssi","toolbar=no,width=545,height=480,menubar=no,status=no,scrollbars=NO,resizable=no,left=0,top=0");
}
function fecha(){
	var mydate=new Date();
	var year=mydate.getYear();
	if (year < 1000)
		year+=1900;
								var day=mydate.getDay();
								var month=mydate.getMonth();
								var daym=mydate.getDate();
								if (daym<10)
								daym="0"+daym;
								var dayarray=new Array("Domingo","Lunes","Martes","Mi&eacute;rcoles","Jueves","Viernes","S&aacute;bado");
								var montharray=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
								document.write(dayarray[day] + " " + daym + " de " + montharray[month] + " del " + year + " ");
}

function imprimir(capa) {

var ventana = window.open("", "", "");
var contenido = "<html><head><title>.:: FABALMERIA ::.</title><link href=\"./css/estilo.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body onload='window.print();window.close();'><div style=\"width:530px; float:left; margin-top:10px;\">" + document.getElementById(capa).innerHTML + "</div></body></html>";

ventana.document.open();
ventana.document.write(contenido);
ventana.document.close();
}

//funcion para desplegar la capa de enviar noticia
function desplegar(nombre){
var capa;

capa = document.getElementById(nombre);

	if (capa.style.display != 'none'){
	capa.style.display = 'none';
	}
	else
	{
	capa.style.display = '';
	}
}

