/**

Este fichero permite utilizar las validaciones que se hacian con struts 1.1 
sin tener que cambiar toooodos los formularios

*/

var permitirEnviarSubmit = true;

function submitFormulario(idform) {

		var formulario = document.getElementById(idform);
		
		var nombreform = jcv_retrieveFormName(formulario);
		
		nombreform = nombreform.charAt(0).toUpperCase() + nombreform.slice(1);

		var funcion = "validate" + nombreform + "(formulario)";
				
		//Llamamos a la funcion validateNombreFormulario
		var resultado = false;
		resultado = eval(funcion);
		 
		if (resultado && permitirEnviarSubmit) {
			permitirEnviarSubmit = false;
			formulario.submit();
		}	
	}	
  
   /**
   * Sobreescribimos la funcion de javascript de struts para que resuelva siempre por 
   * nombre
   *
   * Retreive the name of the form
   * @param form The form validation is taking place on.
   */
  jcv_retrieveFormName = function(objFrm){
      var formName;
      if (objFrm.getAttributeNode) {
              formName = objFrm.getAttributeNode("name").value;        
      } else if (form.getAttribute) {
              formName = objFrm.attributes["name"];
      } else {
              formName = objFrm.name;          
      }
      return formName;
  }
