function validateRegEx(regex, input, helpText, helpMessage) {
        // See if the input data validates OK
        if (!regex.test(input)) {
          // The data is invalid, so set the help message and return false
          if (helpText != null)
            helpText.innerHTML = helpMessage;
          return false;
        }
        else {
          // The data is OK, so clear the help message and return true
          if (helpText != null)
            helpText.innerHTML = "";
          return true;
        }
      }
		
      function validateNonEmpty(inputField, helpText) {
        // See if the input value contains any text
        return validateRegEx(/.+/,
          inputField.value, helpText,
          "Por favor ingrese un valor.");
      }
			
			
			function validarPersona(inputField, helpText) {
        // First see if the input value contains data
        if (!validateNonEmpty(inputField, helpText))
          return false;
				
				// See if the input value contains any text
        return validateRegEx(/^[^0-9]+$/,
          inputField.value, helpText,
          "Por favor ingrese un nombre.");
      }
      
      function validarCedula(inputField, helpText) {
      	helpText.innerHTML = 'mensaje';
        // First see if the input value contains data
        if (!validateNonEmpty(inputField, helpText))
          return false;

        // Then see if the input value is a ZIP code
        return validateRegEx(/^(([jJ]|[gG])-?\d{8}-?\d)|(([vV]|[eE])-?\d{5,8})$/,
          inputField.value, helpText,
          "Por favor ingrese una cedula(v-12345)");
      }

      function validarTelefono(inputField, helpText) {
        // First see if the input value contains data
        if (!validateNonEmpty(inputField, helpText))
          return false;

        // Then see if the input value is a phone number
        return validateRegEx(/^\d{4}-\d{7}$/,
          inputField.value, helpText,
          "Por favor ingrese un telefono en este formato (0212-9777890).");
      }

      function validarEmail(inputField, helpText) {
        // First see if the input value contains data
        if (!validateNonEmpty(inputField, helpText))
          return false;

        // Then see if the input value is an email address
        return validateRegEx(/^[\w\.-_\+]+@[\w-]+(\.\w{2,3})+$/,
          inputField.value, helpText,
          "Por favor ingrese un correo electronico valido (jperez@cantv.net).");
      }

      function validarFormulario(form, pagina) {
      	if (
          validarPersona(form["nombre"], document.getElementById('nombre_ayuda')) &&
         // validarCedula(form["cedula"], document.getElementById('cedula_ayuda')) &&
          //validarTelefono(form["telefono"],document.getElementById('telefono_ayuda') )&&
          //validarPersona(form["contacto"], document.getElementById('contacto_ayuda')) &&
          validarEmail(form["email"], document.getElementById('email_ayuda'))
         ) {
          // Submit the order to the server
          form.submit();
        } else {
          alert("Disculpe hay un problema con uno de los campos, corrijalo e intente de nuevo.");
        }
      }
