    //A utility function that returns true if a string contains only a whitespace
	//characters
	function isblank(s)
	{	if (s.length==0)//added to return true if the field doesn't have information
		{return true;}
		for(var i=0;i<s.length;i++)
		{
			
			var c = s.charAt(i);
			if((c!=' ') && (c!='\n') && (c!='\t'))
		        return false;
			
			return true;	
		}
	}	

	function verify(f)
	{
		var msg;
		var empty_fields = "";
		var errors=""; 	

		for(var i=0;i<f.length;i++)
		{
			var e=f.elements[i];
			if(((e.type=="text")||(e.type=="textarea")) && !e.optional)
			{
				//first check if the field is empty
				if((e.value==null) || (e.value=="") || isblank(e.value))
				{
                    if(e.description!=null && e.description!="")
                    {
                        empty_fields+="\n        " + e.description;
                    }
                    else
                    {
                        empty_fields+="\n        " + e.name;
                    }
					continue;
				}
			}
			
            //check for select
            if(e.type=="select-one" && !e.optional)
            {
                if(e.selectedIndex == -1)
                {
                    if(e.description!=null && e.description!="")
                    {
                        empty_fields+="\n        " + e.description;
                    }
                    else
                    {
                        empty_fields+="\n        " + e.name;
                    }
					continue;
                }
                else
                {
                    if(e.options[e.selectedIndex].value=="")
                    {
                        if(e.description!=null && e.description!="")
                        {
                            empty_fields+="\n        " + e.description;
                        }
                        else
                        {
                            empty_fields+="\n        " + e.name;
                        }
    					continue;
    				}
                }
            }
            
            
			//now check for fields that are supposed to be numeric
			if ((e.numeric || (e.min!=null) || (e.max!=null)) && (!isblank(e.value) || !e.optional))
			{
				var v = parseFloat(e.value);
				if(isNaN(v) || ((e.min!=null)&&(v<e.min)) || ((e.max!=null)&&(v>e.max)))
				{
                    if(e.description!=null && e.description!="")
                    {
                        errors+="- El campo " + e.description + " debe ser numerico";
                    }
                    else
                    {
                        errors+="- El campo " + e.name + " debe ser numerico";
                    }
					if(e.min!=null)
						errors+=" mayor que " + e.min;
					if(e.min!=null && e.max!=null)
						errors+=" menor que " + e.max;
					else if(e.max!=null)
						errors+=" menor que " + e.max;
					errors+=".\n";
				}
			}
		}	


		//Now, if there were any errors, display the messages, and return false to prevent
		//the form from being submitted. Otherwise return true.

		if(!empty_fields && !errors)
			return true;
		
		msg =  "-------------------------------------------------------------\n";
		msg += "La forma no fue enviada por los siguientes errores.\n";
		msg += "Por favor corrija estos errores y vuelva a enviar.\n";
		msg += "-------------------------------------------------------------\n\n";

		if (empty_fields)
		{
			msg += " - Los siguientes campos requeridos estan vacíos:\n" + empty_fields + "\n";
			if(errors) msg += "\n";
		}

		msg += errors;
		alert(msg);	
		return false;
	}