// JavaScript Document - Funciones utilizadas en las paginas de la Web Meatze

function mostraraenor()//Todas
{
	document.getElementById("aenor").style.display="inline";
}

function ocultaraenor()//Todas
{
	document.getElementById("aenor").style.display="none";
}

function lineacursos_onmouseover(elem)//subvencionada.php - privada.php
{
	elem.className="over";
}

function lineacursos_onmouseout(elem)//subvencionada.php - privada.php
{
	elem.className="out";
}

function lineacursoscat_onmouseover(elem)//catalogo.php
{
	elem.className="overfondo";
}

function lineacursoscat_onmouseout(elem)//catalogo.php
{
	elem.className="outfondo";
}

function verficha(x,y)//subvencionada.php - privada.php
{
	location.href="curso.php?ncurso="+x+"&pag="+y;
}

function validarinscripcioncurso()//incripcionCursos.php - inscripcionCatalogo.php
{
	var error=false;
	var x=document.getElementById("nombre").value;
	if (x==null || x.length==0 || /^\s+$/.test(x))
	{
		document.getElementById("errornombre").style.display="inline";
		error=true;
	}
	else
	{
		document.getElementById("errornombre").style.display="none";
	}
	x=document.getElementById("apellidos").value;
	if (x==null || x.length==0 || /^\s+$/.test(x))
	{
		document.getElementById("errorapellidos").style.display="inline";
		error=true;
	}
	else
	{
		document.getElementById("errorapellidos").style.display="none";
	}
	x=document.getElementById("direccion").value;
	if (x==null || x.length==0 || /^\s+$/.test(x))
	{
		document.getElementById("errordireccion").style.display="inline";
		error=true;
	}
	else
	{
		document.getElementById("errordireccion").style.display="none";
	}
	x=document.getElementById("localidad").value;
	if (x==null || x.length==0 || /^\s+$/.test(x))
	{
		document.getElementById("errorlocalidad").style.display="inline";
		error=true;
	}
	else
	{
		document.getElementById("errorlocalidad").style.display="none";
	}
	x=document.getElementById("codpostal").value;
	if (x==null || x.length==0 || /^\s+$/.test(x))
	{
		document.getElementById("errorcodpostal").style.display="inline";
		error=true;
	}
	else
	{
		document.getElementById("errorcodpostal").style.display="none";
	}
	x=document.getElementById("telefono").value;
	if (x==null || x.length==0 || /^\s+$/.test(x))
	{
		x=document.getElementById("movil").value;
		if (x==null || x.length==0 || /^\s+$/.test(x))
		{
			document.getElementById("errortelefono").style.display="inline";
			error=true;
		}
		else
		{
			document.getElementById("errortelefono").style.display="none";
		}
	}
	else
	{
		document.getElementById("errortelefono").style.display="none";
	}
	x=document.getElementById("mail").value;
	var expr = /^[0-9a-z_\-\.]+@[0-9a-z\-\.]+\.[a-z]{2,4}$/i;
	if (expr.test(x)) //mail correcto
	{
		document.getElementById("errormail").style.display="none";
	}
	else	//mail incorrecto
	{
		document.getElementById("errormail").style.display="inline";
		error=true;
	}
	if (error==false)
	{
		document.getElementById("form1").submit();
	}
}

function mostrarLopd()//incripcionCursos.php
{
	window.open('LOPD.html','','toolbar=no,location=no,directories=no,status=no,height=400,width=500,left=50,top=50,menubar=no,scrollbars=yes,resizable=no,status=0,alwaysRaised=1');
}

function verfichaonline(x,y)//online.php
{
	location.href="fichaCursoOnline.php?idcurso="+x+"&id="+y+"&pag=fo";
}

function muestraoculta(x)//online.php - catalogo.php
{
	if (document.getElementById("cursos"+x).style.display=="none")
	{
		document.getElementById("cursos"+x).style.display="table";
		document.getElementById("desplegar"+x).src="imagenes/contraer.png";
		document.getElementById("desplegar"+x).title="Ocultar Cursos";
	}
	else
	{
		document.getElementById("cursos"+x).style.display="none";
		document.getElementById("desplegar"+x).src="imagenes/desplegar.png";
		document.getElementById("desplegar"+x).title="Mostrar Cursos";
	}
}

function verfichacat(x,y) //catalogo.php
{
	if (y==0) //curso nuestro
	{
		location.href="curso.php?idcurso="+x+"&pag=nc";
	}
	else	//curso de aulacenter
	{
		location.href="fichaCursoOnline.php?idcurso="+x+"&id="+y+"&pag=nc";
	}	
}

