<!--
// Validación del modelo básico del formulario de contacto
function validarFormulario(formulario) {
	with (formulario) {
		var ok = true;
		if (ok) ok = validate("must", false, nombre, "campo \"nombre\"");
		if (ok) ok = validate("must", false, apellidos, "campo \"apellidos\"");
		if (ok) ok = validate("must", false, telefono, "campo \"telefono\"");
		if (ok) ok = validate("must", true, movil, "campo \"movil\"");
		if (ok) ok = validate("eMail", true, email, "campo \"e-mail\"");
		/*if (ok) ok = validate("must", false, txtHipotecaPendiente, "campo \"hipoteca pendiente\"");*/
		if (ok) ok = validate("must", true, comentarios, "campo \"comentarios\"");
		if (ok) {
			if (!terminos.checked) {
				ok = false;
				alert("Antes de enviar el formulario es necesario que lea y acepte la política de privacidad.");
			}
		}
	}

	if (ok)	return true;
	else	return false;

}


function validarFormularioVentas(formulario) {
	with (formulario) {
		var ok = true;
		if (ok) ok = validate("must", true, nombre, "campo \"nombre\"");
		if (ok) ok = validate("must", true, telefono, "campo \"telefono\"");
		if (ok) ok = validate("eMail", true, email, "campo \"e-mail\"");
		if (ok) ok = validate("must", true, comentarios, "campo \"comentarios\"");
		if (ok) {
			if (!terminos.checked) {
				ok = false;
				alert("Antes de enviar el formulario es necesario que lea y acepte la política de privacidad.");
			}
		}
	}

	if (ok)	return true;
	else	return false;

}

function validarFormulario2(formulario) {
	with (formulario) {
		var ok = true;
		if (ok) ok = validate("must", true, site_url, "campo \"url\"");
		if (ok) ok = validate("must", true, direccion, "campo \"dirección\"");
		if (ok) ok = validate("must", false, telefono, "campo \"telefono\"");
		if (ok) ok = validate("must", true, movil, "campo \"movil\"");
		if (ok) ok = validate("eMail", true, correo, "campo \"e-mail\"");
		/*if (ok) ok = validate("must", false, txtHipotecaPendiente, "campo \"hipoteca pendiente\"");*/
		if (ok) {
			if ((!KwOpcion[0].checked) && (!KwOpcion[1].checked)) {
				ok = false;
				alert("Antes de continuar es necesario que marque una de las dos opciones.");
			}
		}
	}

	if (ok)	return true;
	else	return false;

}
// Validación del modelo básico del formulario de contacto
function validarFormulario3(formulario) {
	with (formulario) {
		var ok = true;
		if (ok) ok = validate("must", true, nombre, "campo \"nombre\"");
		if (ok) ok = validate("must", false, empresa, "campo \"empresa\"");
		if (ok) ok = validate("must", false, web, "campo \"web\"");
		if (ok) {
			if(plan.value!='') {
				ok=true;
			} else {
				ok=false;
				alert('El campo "plan" es obligatorio. Debe completarlo para continuar.');
			}
		}
		if (ok) ok = validate("must", false, telefono, "campo \"telefono\"");
		if (ok) ok = validate("must", true, movil, "campo \"movil\"");
		if (ok) ok = validate("eMail", true, email, "campo \"e-mail\"");
		/*if (ok) ok = validate("must", false, txtHipotecaPendiente, "campo \"hipoteca pendiente\"");*/
		if (ok) ok = validate("must", false, comentarios, "campo \"comentarios\"");
		if (ok) {
			if (!terminos.checked) {
				ok = false;
				alert("Antes de enviar el formulario es necesario que lea y acepte la política de privacidad.");
			}
		}
	}

	if (ok)	return true;
	else	return false;

}

// Creación del objeto ajax
function ajaxobj() {
  try {
    _ajaxobj = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try {
      _ajaxobj = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
      _ajaxobj = false;
    }
  }
  if (!_ajaxobj && typeof XMLHttpRequest!='undefined') {
    _ajaxobj = new XMLHttpRequest();
  }
  return _ajaxobj;
}

function validarCaptcha(formulario) {

  ajax = ajaxobj();
  // Se abre el canal asincrono
  ajax.open("POST", "http://www.go2jump.com/validarCaptcha.php", true);
  var params = "recaptcha_challenge_field="+formulario.recaptcha_challenge_field.value+"&recaptcha_response_field="+formulario.recaptcha_response_field.value;
//Send the proper header infomation along with the request
   ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   ajax.setRequestHeader("Content-length", params.length);
   ajax.setRequestHeader("Connection", "close");
  ajax.onreadystatechange=function() {
  if (ajax.readyState==4) {
    "resultado"
  var datos = ajax.responseText;
   if (datos=="OK") {
     document.Contacto.action="http://www.go2jump.com/enviar-contacto.php";
	document.Contacto.submit();
   } else {
  	document.getElementById("captchaKO").style.display="block";
     alert("El código de validación del formulario es incorrecto. Por favor, inténtelo de nuevo.");
   }
  }
}
  ajax.send
(params);
}

function validacion(formulario) {
	if(validarFormulario(document.Contacto)){
	    validarCaptcha(document.Contacto);
	}
}
//-->

