// Comprueba que no sean todos espacios
function vacio(q) {
        for ( i = 0; i < q.length; i++ ) {
                if ( q.charAt(i) != " " ) {
                        return true
                }
        }
        return false
}

//valida que el campo no este vacio y no tenga solo espacios en blanco
function valida() {
	var sendMe = true;
	var b =/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/
	var mensaje = "";
	if ( vacio(document.formulario.nombre.value) == false ||
	vacio(document.formulario.telefono.value) == false  ||
	vacio(document.formulario.correocliente.value) == false ) {
		mensaje = "Existen campos sin completar";
		sendMe = false;
		}
	else if (b.test(document.formulario.correocliente.value) == false) {
		mensaje = "Mail incorrecto";
		sendMe = false;
		}
	if (sendMe) {
		alert("Formulario enviado");
		document.formulario.submit();	
	}
	else alert(mensaje);
}

function popUp(strURL,strType,strHeight,strWidth) {
	var strOptions="";
	if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth;
	if (strType=="fixed") strOptions="height="+strHeight+",width="+strWidth;
	if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
	window.open(strURL, 'newWin', strOptions);
}
