

function required_fields_ok(formobj)
{	
	
	
	var l_Msg = alertMsg.length;
		var focus_set = false;
		
		
		for (var i = 0; i < fieldRequired.length; i++)
		{
			
			var obj = formobj.elements[fieldRequired[i]];
			if (obj)
			{
				
				switch(obj.type)
				{
					case "select-one":
						if (obj.selectedIndex == -1 || obj.selectedIndex == 0 || obj.options[obj.selectedIndex].text == "")
						{
							alertMsg += " - " + fieldDescription[i] + "\n";
							if (!focus_set) {obj.focus(); focus_set=true;}
						}					
						break;
					case "select-multiple":
						if (obj.selectedIndex == -1)
						{
							alertMsg += " - " + fieldDescription[i] + "\n";
							if (!focus_set) {obj.focus(); focus_set=true;}
						}					
						break;
					case "text":
					case "textarea":
					case "file":
						if (trim(obj.value) == "" || obj.value == null)
						{
							
							alertMsg += " - " + fieldDescription[i] + "\n";
							if (!focus_set) {obj.focus(); focus_set=true;}
						}					
						break;
					default:
				}
				
				if (obj.type == undefined)
				{
					var blnchecked = false;
					for (var j = 0; j < obj.length; j++)
					{
						if (obj[j].checked)
						{
							blnchecked = true;
						}
					}
					if (!blnchecked)
					{
						alertMsg += " - " + fieldDescription[i] + "\n";
					}
				}
			}
		}
		
	
		if (alertMsg.length == l_Msg)
		{
			alertMsg = "Los siguientes campos son obligatorios:\n";		
			return true;
		}
		else
		{
			
			alert(alertMsg);
			alertMsg = "Los siguientes campos son obligatorios:\n";		
			return false;
	}
	
	
	
}