function valsonda() {
    if (isBlank(document.sonda.mail.value)) {
        alert("insertar e-mail");
        document.sonda.mail.focus();
        return false;
    } else {
        return true;
    }
}


function submitreg(){
    if (isBlank(document.regForm.firstname.value)) {
		alert("insertar nombre");
		document.regForm.firstname.focus();
	} else if (isBlank(document.regForm.lastname.value)) {
		alert("insertar apellidos");
		document.regForm.lastname.focus();
	} else if (isBlank(document.regForm.jobTitle.value)) {
		alert("insertar cargo");
		document.regForm.jobTitle.focus();
    } else if (isBlank(document.regForm.companyName.value)) {
        alert("insertar empresa");
        document.regForm.companyName.focus();
	} else if (isBlank(document.regForm.industry.value)) {
		alert("insertar sector");
		document.regForm.industry.focus();
	} else if (isBlank(document.regForm.username.value)) {
		alert("insertar usuario");
		document.regForm.username.focus();
	} else if (isBlank(document.regForm.password.value)) {
		alert("insertar contraseña");
		document.regForm.password.focus();
	} else if (isBlank(document.regForm.confpassword.value)) {
		alert("insertar confirmación de contraseña");
		document.regForm.confpassword.focus();
    } else if (!isBlank(document.regForm.confpassword.value) && !isBlank(document.regForm.password.value) && document.regForm.confpassword.value!=document.regForm.password.value) {
        alert("password e password di conferma sono diverse");
        document.regForm.confpassword.focus();
    } else if (isBlank(document.regForm.email.value)) {
        alert("insertar e-mail");
        document.regForm.email.focus();
    } else if (!isBlank(document.regForm.email.value) && !isEmail(document.regForm.email.value)) {
        alert("formato de e-mail incorrecto");
        document.regForm.email.focus();
	} else {
        document.regForm.submit();
	}
}

function validateML(op){
	if (isBlank(document.nlForm.mail.value)) {
		alert("introducir correo electrónico");
		document.nlForm.mail.focus();
	} else {
	    document.nlForm.op.value = op;
		document.nlForm.submit();
	}
}

function validateUnsub(op){
	if (isBlank(document.unsubnlForm.mail.value)) {
		alert("introducir correo electrónico");
		document.unsubnlForm.mail.focus();
	} else {
	    document.unsubnlForm.op.value = op;
		document.unsubnlForm.submit();
	}
}

function valsearch() {
    if (isBlank(document.cerca.query.value)) {
        alert("escribir al menos un término para la búsqueda");
        document.cerca.query.focus();
        return false;
    } else {
        if(document.cerca.where[0].checked) {
            w=window.open('http://www.google.com/search?q='+document.cerca.query.value+'&hl=es','google','location=yes,toolbar=yes,directories=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes');
            if (w.opener == null) w.opener = self;
            w.focus();
            return false;
        } else {
            return true;
        }
    }
}
function submitsearch() {
    if (isBlank(document.searchForm.key.value)) {
        alert("escribir al menos un término para la búsqueda");
        document.searchForm.key.focus();
    } else {
        document.searchForm.submit();
    }
}

function validateSignalNl(){
    if (isBlank(document.signalNlForm.mailto.value)) {
        alert("es obligatorio insertar el e-mail del destinatario");
        document.signalNlForm.mailto.focus();
    } else if (isBlank(document.signalNlForm.mailfrom.value)) {
        alert("es obligatorio insertar el e-mail remitente");
        document.signalNlForm.mailfrom.focus();
    } else {
        document.signalNlForm.submit();
    }
}

