<!--

var msg = "";
var missing = "";
var invNum = "";
function validate(frm)
	{
		for(i=0; i<frm.elements.length; i++)
		{
			var el = frm.elements[i];
			if (el.required)
				{
				if(isEmpty(el))
					{
					missing += "\n   - " + el.name;
					}
					frm.elements[i].focus();
				}
			if (el.numeric)
				{
				if(!isNumeric(el))
					{
					invNum += "\n   -" + el.name + "  -  " + '"' + el.value  + '"' + "  is not a valid number";
					frm.elements[i].focus();
					}
					
				}
			}
			
		// build output message
		if (missing.length != 0 || invNum.length != 0)
			{
			if (missing.length !=0)
			{
				msg += "\nThe following fields are required:\n";
				msg += missing + "\n";
			}
			if (invNum.length != 0)
			{
				msg += "________________________\n\n You entered incorrect numeric data: \n";
				msg += invNum;
			}
		errMsg(msg);
			msg = ""; missing = ""; invNum = ""
			return false;
			}
			else
			{
			return true;
			}
		}

			
		function isEmpty(field)
		{
			str = field.value;
			if(str == "")
			{
				return true;
			}
			else
			{
				for (j=0 ; j<str.length ; j++ )
				{
					if(str.charAt(j) != " ")
						
					return false;
				}
			}
					return true;
		}

		
		function isNumeric(field)
			{
				var errCount = 0;
				var numdecs = 0;
				var nummins = 0;
				for(j=0; j<field.value.length; j++)
				{
					c = field.value.charAt(j);
					if((c >= 0 && c <= 9) || (c =="." || c=="-"))
					{
					if(c==".") numdecs++;
					if(c=="-") nummins++;
					}
					else
					{
						errCount++;
					}
				}
					if(errCount > 0 || numdecs > 1 || nummins > 1)
					{
					return false;
					}
				return true;
			}


			function stripNonDigits(str)
			{
				newStr = "";
				for(j=0; j<str.length; j++)
					{
					c = str.charAt(j);
					if(c >= "0" && c <= "9")
						{
						newStr += c;
						}
					}
					return newStr;
			}
				
				function errMsg(msg)
				{
					var theMsg = "";									
					theMsg += msg;
					
					alert(theMsg);
				}

	//-->