function ver(capa) {
	if (document.getElementById(capa).style.display == "block") {
		document.getElementById(capa).style.display = "none";
	} else {
		document.getElementById(capa).style.display = "block";
	}
}

function oculta(capa) {
	document.getElementById(capa).style.display = "none";
}

function validar(){
	if((document.formulario.empresa.value=="")||(document.formulario.ciudad.value=="")||
	(document.formulario.provincia.value=="")||(document.formulario.contacto.value=="")||
	(document.formulario.telefono.value=="")||(document.formulario.email.value=="")||
	(document.formulario.tipoactividad.value==""))
	{
		alert("Rellene todos los campos obligatorios (*)")
		return false;
	}	else if (isEmail(document.formulario.mail.value) == false) {
		alert ('El email que ha introducido no es correcto');
		return false;	
	}
	else
	{
	document.getElementById('formulario').submit();
	}
}


function validar2(){
	if((document.formulario.usuariocri.value=="")||(document.formulario.nombre.value==""))
	{
		alert("Rellene todos los campos obligatorios (*)")
		return false;
	}
	else
	{
	document.getElementById('formulario').submit();
	}
}


function isEmail(str) {

	var result = false

	var theStr = new String(str)

	var index = theStr.indexOf("@");

	if (index > 0) {

		var pindex = theStr.indexOf(".",index);

		if ((pindex > index+1) && (theStr.length > pindex+1))

			result = true;

	}

	return result;

}

