function comprobar(x){
	respuesta = no_vacio(x)
	respuesta = es_entero(x) && respuesta
	return respuesta
}
function no_vacio(which){
   var pass=true
   var msg=""
   var coma=""

   if (document.images){
      for (i=0;i<which.length;i++){
         var tempobj=which.elements[i]
		 if (!tempobj.name)
		    continue;
			
		 if (tempobj.name.substring(0,4)=="obli"){
            if ( (tempobj.type=="text"||tempobj.type=="textarea"||tempobj.type=="password"||tempobj.type=="file") && tempobj.value==''){
               pass=false
               msg = msg + coma + tempobj.name.substring(4,20)
               coma = ", "
               tempobj.id = 'error'
            }
			else
				tempobj.id = 'normal'
         }
      }   // Fin For
   }

   if (!pass){
      if (msg != ""){
         msg = "Has dejado los campos: " + msg + " en blanco"
         alert(msg)
      }
      return false
   }
   else
      return true
}

function es_entero (which){
   // Esta función se encarga de comprobar que los campos que lo presicen sean enteros
   var pass=true
   var msg=""
   var coma=""

   if (document.images){
      for (i=0;i<which.length;i++){
         var tempobj=which.elements[i]
		 if (!tempobj.name)
		    continue;
			
         if (tempobj.name.substring(0,3)=="num"){
		    valor = tempobj.value
			aux = parseInt(valor);
			if (isNaN(aux)) {
			   pass=false
               msg = msg + coma + tempobj.name.substring(3,20)
               coma = ", "
               tempobj.id = 'error'
			   tempobj.value = 0
            }
         }
      }   // Fin For
   }

   if (!pass){
      if (msg != ""){
         msg = "Los campos: " + msg + " sólo admiten valores numéricos"
         alert(msg)
      }
      return false
   }
   else
      return true
}