function checkbox(field, box)
	{	
	if (field != "")
		{
		box.checked = 'true';
		}
	else
		{
		box.checked = 'false';		
		}
	}


function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789,.-";
   var strChar;
   var blnResult = true;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }


function validateAmount(name){	
	valid = true;
	if (IsNumeric(name.value) == false) {
		message = "The budget amount entered (" + name.value + ") contains some non-numeric characters (like $).  This amount must contain only numbers and decimal points.";
		alert(message);
		valid = false;	
		}	
	if (valid == false){
		name.value = "";
		name.focus();
		return false;
		}
	}
	
function budgetAmount(name, box){
	validateAmount(name);
	checkbox(name.value, box);
	}
	
function validateactivities()
	{
	
	// Sets OK Variable //
	submitOK = true;
	// Checks Description
		
	if (document.act.description.value == "")
		{
		alert("Please include a description of this activity.");
		submitOK = false;
		}
	
	// Checks Budget
	budvalid = false;
	for (i = 0; i<document.act.budget.length; ++ i)
		{
			if (document.act.budget[i].checked == true)
				{
				budvalid = true;
				}
		}
	
	if (budvalid == false)
		{
		alert("Please check at least one budget source.");
		submitOK = false;
		}

	// Checks Type of Service

	typevalid = false;
	for (i = 0; i<document.act.type.length; ++ i)
		{
			if (document.act.type[i].checked == true)
				{
				typevalid = true;
				}
		}
	
	if (typevalid == false)
		{
		alert("Please check at least one Type of Service.");
		submitOK = false;
		}


	// Checks to make sure SDFS $ is not being used for non-best practice stuff.
	
	if (document.act.budget[0].checked == true)
		{
		if (document.act.evaluation.value == "no")
			{
			alert("If you are using Safe and Drug Free dollars, your activity must be a best practice OR you must complete a waiver form.");
			//submitOK = false;
			}
		}
	
	// Checks Objectives List
	
	planvalid = false;
	for (i = 0; i < document.act.planData.length; ++ i)
		{
			if (document.act.planData[i].checked == true)
				{
				planvalid = true;
				}
		}
	
	if (planvalid == false)
		{
		alert("Please choose at least one set of Baseline Data to associate with this Activity.");
		submitOK = false;
		}
	
	
	//Returns true or false.
	document.formReturn = submitOK;
	return submitOK;
	}