var nav4 = window.Event ? true : false;
function acceptNum(evt)
{     
	var key = nav4 ? evt.which : evt.keyCode;
	return (key <= 13 || (key >= 48 && key <= 57));
}
wn=0;
function DetectaTecla(tecla)
{
	if (tecla==17) 
		wn=1; 
	else
		wn=0;
}
function Logo()
{
	if (wn==1) 
		document.location='admin/index.php'; 
}
function checkemail(email)
{
	var ind1, ind2, ind3;
	ind1 = email.indexOf('@');
	ind2 = email.indexOf('.');
	ind3 = email.lastIndexOf('@');
	if ((ind1<=0) || (ind2<ind1) || (ind3 != ind1))
		  return true;
	else
		 return false;
}
function comprobar()
{
	if (document.acceso.usuario.value == "")
	{
		alert ("Debe introducir su nombre de usuario");
		return false;
	}
	else
	{
		if (document.acceso.pass.value == "")
		{
			alert ("Debe introducir la clave de acceso");
			return false;
		}
		else
		{
			window.document.acceso.submit();
			return true;
		}
	}
}
function contacto()
{
	if (document.contacte.nombre.value == "")
	{
		alert ("Debe introducir su nombre");
		return false;
	}
	else
	{
		if (document.contacte.email.value == "")
		{
			alert ("Debe introducir su E-MAIL");
			return false;
		}
		else
		{
			if (checkemail(document.contacte.email.value))
			{
				alert("Debe introducir una direccion de E-MAIL valida");
				return false;
			}
			else
			{
				if (document.contacte.comentarios.value == "")
				{
					alert ("Debe introducir su mensaje");
					return false;
				}
				else
				{
					window.document.contacte.submit();
					return true;
				}
			}
		}
	}
}
//Administracion
function altaclaves()
{
	if (document.altaclave.usuario.value == "")
	{
		alert ("Debe introducir el nombre de usuario");
		return false;
	}
	else
	{
		if (document.altaclave.clave.value == "")
		{
			alert ("Debe introducir la clave de acceso");
			return false;
		}
		else
		{
			window.document.altaclave.submit();
			return true;
		}
	}
}
function eventos()
{
	if (document.altaevento.nombre.value == "")
	{
		alert ("Debe introducir el nombre del evento");
		return false;
	}
	else
	{
		if (document.altaevento.comentario.value == "")
		{
			alert ("Debe introducir un comentario");
			return false;
		}
		else
		{
			window.document.altaevento.submit();
			return true;
		}
	}
}
function deleventos()
{
	if (document.delevento.nombre.value == "")
	{
		alert ("Debe seleccionar el evento a eliminar");
		return false;
	}
	else
	{
		if (confirm("¿SEGURO QUE DESEA ELIMINAR ESTE EVENTO?\nESTE PROCESO ES IRREVERSIBLE !!!"))
		{
			window.document.delevento.submit();
			return true;
		}
		else
		{
			return false;	
		}
	}
}
function contactoup()
{
	if (document.contacte.comentarios.value == "")
	{
		alert ("Debe introducir el comentario de contacto");
		return false;
	}
	else
	{
		window.document.contacte.submit();
		return true;
	}
}