Location: PHPKode > projects > Care For Kids > careforkids/volunteer/content.inc.php
<script language="javascript" type="text/javascript">
<!--
		// fourie,falkena, Kok, 99
		// ' Student Guide to SA Financial System' 2nd Edition , Thomson.
		
	
	function volunteer_form_confirm()
	{
		sortname();
		telephoneCheck();
	 $telChecknum = document.getElementById("telnum").value;
		// Checks the service form
		if (document.getElementById("lastname").value == "")
		{
			alert("Please enter a last name for the Volunteer.")
			document.getElementById("lastname").focus();
		}
		
		
		else if (document.getElementById("firstname").value == "")
		{
			alert("lease enter a first name for the Volunteer.")
			document.getElementById("firstname").focus();
		}
		
		//Telephone Validation still to be done!!!
			else if ( $telChecknum.length != 10)
		{
			
			alert("Please enter a valid Telephone Number.")
			document.getElementById("telnum").focus();
		}
		
		
		else
		{
			
			document.getElementById("volunteer_form").submit();
			
		}
	
	
	}
function sortname()
	{
	
		 UpperCase(document.getElementById("lastname").value,"last");
		  UpperCase(document.getElementById("firstname").value,"first");
	}	
		
function UpperCase(name,type)
{
var htext, nhtext;
	
	htext= name;
		
	htext=htext.toLowerCase();
	// Just in case they're all caps.
	j=htext.length;
	nhtext="";
	
	for(i=0;i<j;i++)
	{
		if(i==0)
		// To capitalize the first character.
		{
			nhtext=nhtext+htext.substr(i,1).toUpperCase();
		}
		else if(htext.charAt(i)==" ")
		{
		// Checks for the appearance of the space character.
		nhtext=nhtext+htext.substr(i,1);
		// Adds that space character to the string.
		nhtext=nhtext+htext.substr(++i,1).toUpperCase();
		// Capitalizes and adds the next character to the
		// string.
		}
		else if(htext.charAt(i)=="")
		{
		// Checks for the appearance of the newline
	
		nhtext=nhtext+htext.substr(i,1);
		// Adds the newline character to the string.
		nhtext=nhtext+htext.substr(++i,1).toUpperCase();
		// Capitalizes and adds the next character to the
		// string.
		}
		else
		{
			nhtext=nhtext+htext.substr(i,1);
		// Adds the character in a normal way.
		}
	}
	if (type == "last")
	{
	document.getElementById("lastname").value=nhtext;
	}
	else if (type == "first")
	{
	document.getElementById("firstname").value=nhtext;
	}
}
	
	function telephoneCheck()

{
   var ValidChars = "0123456789";
   var Char;
   var $telnum = document.getElementById("telnum").value;
 	var $newTel="";

 i = 0;
   do 
      { 
      Char = $telnum.charAt(i); 
	  if (ValidChars.indexOf(Char) != -1 ) 
         {
         $newTel = $newTel+Char; 
         }
      i++;
	  }
  while  (i < $telnum.length )
  document.getElementById("telnum").value = $newTel;
 }
	
	

	function cancel_form()
	{
	window.location="index.php?action=viewAll&clear=clearAll";
	}
	
	
	
	function delete_form_confirm(name)
	{
		var is_confirmed = confirm("Delete volunteer "+name+" ?");
		if (is_confirmed)
		{
			document.getElementById("delete_form").submit();
		}
	}


function edit_activate()
	{
		document.getElementById("update").disabled = false;
		document.getElementById("edit_details").disabled = true;
		document.getElementById("delete").disabled = true;
		document.getElementById("discard").disabled = false;
		document.getElementById("canceladd").disabled = true;
		document.getElementById("log_service").disabled = true;
		document.getElementById("view_history").disabled = true;
		
		document.getElementById("lastname").readOnly = false;
		document.getElementById("firstname").readOnly = false;
		document.getElementById("firstlanguage").disabled = false;
		document.getElementById("telnum").readOnly = false;
		document.getElementById("address1").readOnly = false;
		document.getElementById("address2").readOnly = false;
		document.getElementById("address3").readOnly = false;
		document.getElementById("address4").readOnly = false;
		document.getElementById("ovcselect").disabled = false;
		document.getElementById("volunteertype").disabled = false;
		
	}

function confirm_discard()
	{
		var conf = confirm("Are you sure you want to discard your changes?");
		if (conf == true) // if user confirms, then reload the edit page
		{ // switch to php to generate the correct volunteerID to load the viewVolunteer section with ...
			<? echo "document.location='".$_SESSION['base_url']."/volunteer/index.php?action=viewVolunteer&volunteerID=".$_REQUEST['volunteerID']."'"; ?>
		} // otherwise do nothing
	}
	
///removing invalid characters	
function pass()
{
escapeSlash('lastname');
escapeSlash('firstname');
escapeSlash('address1');
escapeSlash('address2');
escapeSlash('address3');
escapeSlash('address4');


}

function escapeSlash(type)

{
var inValidChars = "<>;\"\'";
var Char;
var $new="";
   
 if ( type == "lastname")
	{
	var $check = document.getElementById("lastname").value;
	}
else if ( type == "firstname")
	{
	var $check = document.getElementById("firstname").value;
	}
else if ( type == "address1")
	{
	var $check = document.getElementById("address1").value;
	}
else if ( type == "address2")
	{
	var $check = document.getElementById("address2").value;
	}
else if ( type == "address3")
	{
	var $check = document.getElementById("address3").value;
	}
else if ( type == "address4")
	{
	var $check = document.getElementById("address4").value;
	}

  var i= 0 ;
   do 
      { 
      Char = $check.charAt(i); 
	  if (inValidChars.indexOf(Char) == -1 ) 
         {
         $new = $new+Char; 
         }
      i++;
	  }
 while  (i < $check.length )

 if ( type == "lastname")
	{
	document.getElementById("lastname").value = $new;
	}
else if ( type == "firstname")
	{
	document.getElementById("firstname").value = $new;
	}
else if ( type == "address1")
	{
	document.getElementById("address1").value = $new;
	}
else if ( type == "address2")
	{
	document.getElementById("address2").value = $new;
	}
else if ( type == "address3")
	{
	document.getElementById("address3").value = $new;
	}
else if ( type == "address4")
	{
	document.getElementById("address4").value = $new;
	}
	
  
 }
//-->
</script>

<?php
	
	include_once($_SESSION['base_dir']."/classes/volunteer.inc.php");
	include_once($_SESSION['base_dir']."/classes/ovc_group.inc.php");
	include_once($_SESSION['base_dir']."/classes/volunteer_type.inc.php");	
	
	// Sort 2d Array
	// Limitation - Must edit 2nd last line of function - array_multisort to have correct no of keys at end
	// SYNTAX: TwoDSort(name of 2d array,name of index to be sorted, asc / desc, str / int) 
	// Not case sensitive
	function TwoDSort($arr,$sortBy,$sortOrder,$sortType)
	{
		if (strtolower($sortOrder) == "asc")
		{
			$sO = SORT_ASC;
		}
		else if (strtolower($sortOrder) == "desc")
		{
			$sO = SORT_DESC;
		}
		if (strtolower($sortType) == "str")
		{
			$sT = SORT_STRING;
		}
		else if (strtolower($sortType) == "int")
		{
			$sT = SORT_NUMERIC;
		}
		//Finds all the categories in the array
		$keyNames = array_keys($arr);
		$c = 0;
		// keyLeft has the chosen sort category removed
		for ($i=1;$i<count($keyNames);$i++)
		{
			if ($keyNames[$i] != $sortBy)
			{
				$keyLeft[$c] = $keyNames[$i];
				$c++;
			}
		}
		
		if (count($arr[$sortBy]) != 0)
		{
		array_multisort($arr[$sortBy], $sO, $sT, $arr[$keyLeft[0]],$arr[$keyLeft[1]],$arr[$keyLeft[2]],$arr[$keyLeft[3]],$arr[$keyLeft[4]],$arr[$keyLeft[5]],$arr[$keyLeft[6]],$arr[$keyLeft[7]]);
		return $arr;
		}
	}
	
	if ($_REQUEST['action'] == 'viewAll')
	{
		// Main heading and top button row
		echo "<h2>Volunteer Administration</h2>";
		echo "<div id='top_buttons'>";
		echo "<form class='formbuttons' name='nav_add' action='".$_SESSION['base_url']."/volunteer/index.php' method='post'>";
		echo "<input class='button' type='submit' name='nav' value='Add New '>";
		echo "<input type='hidden' name='action' value='add'>";
		echo "</form>";


 		echo "<form class='formbuttons' name='nav_help' target='help_window' action='".$_SESSION['base_url']."/help/index.php' method='get'>";
		echo "<input class='button' type='submit' name='help' value='Help' />";
		echo "<input type='hidden' name='chapter' value='volunteermanagement' />";
		echo "<input type='hidden' name='section' value='search'>";
		echo "</form>";

		echo "</div>";

		if ($_SESSION['vol_msg_disp'] == true)
		{
			echo "<p class='message'>".$_SESSION['vol_msg']."</p>";
			$_SESSION['vol_msg_disp'] = false;
		}

		// If clearText button is clicked, delete all filtering session vars so $details reverts to all record and shows only active
		if ($_REQUEST['clear'] == 'clearAll')
		{
			unset($_SESSION['volStart']);
			unset($_SESSION['volFiltered']);
			unset($_SESSION['volSorted']);
			unset($_SESSION['volSortBy']);
			unset($_SESSION['volNoShown']);
			$_SESSION['volShowAll'] = false;
		}
		if (!isset($_SESSION['volStart']))
		{
			$_SESSION['volStart'] = '0';
			$_SESSION['volDepth'] = '0';
		}
		if (!isset($_SESSION['volNoShown']))
		{
			$_SESSION['volNoShown'] = '10';
		}
		if ($_REQUEST['direction'] == 'next')
		{
			unset($_SESSION['volSorted']);
			unset($_SESSION['volSortBy']);
			$_SESSION['volStart'] = $_SESSION['volDepth'];
		}
		if ($_REQUEST['direction'] == 'previous')
		{
			unset($_SESSION['volSorted']);
			unset($_SESSION['volSortBy']);
			$_SESSION['volDepth'] = $_SESSION['volStart'];
			$_SESSION['volDepth']--;
		}
		// if no sorting stipulated then set defaults - Surname Ascending
		if (!isset($_SESSION['volSortBy']))
		{
			$_SESSION['volSortBy'] = "lastName";
			$_SESSION['volLastSortBy'] = "";
			$_SESSION['volOrder'] = "ASC";
			$_REQUEST['sortType'] = "str";
		}

		$results = Volunteer::getAllVolunteers();
		$ovcgrp = new Group;
		$volType = new VolunteerType;
		// 2d array structure
		$details = array(array("volunteerID" => "","lastName" => "","firstName" => "","telNum" => "","church" => "","community" => "","volunteerType" => "","firstLang" => "","isActive" => ""));
		$count = 0; 

		// Populating a 2d array using volunteer info
		if (count($results)>0)
		{
			foreach($results as $result)
			{
				
				$ovcgrp->getGroup($result->ovcgrpID);
				$volType->getVolunteerType($result->volunteerTypeID);
				if (($_SESSION['ovcgrpID'] == $result->ovcgrpID) || ($_SESSION['ovcgrpID'] == "0"))
				{
					$details['volunteerID'][$count] = $result->volunteerID;
					$details['lastName'][$count] = $result->lastName;
					$details['firstName'][$count] = $result->firstName;
					$details['volunteerType'][$count] = $volType->name;
					$details['firstLang'][$count] = $result->firstLanguage;
					$details['telNum'][$count] = $result->telNum;
					$details['church'][$count] = $ovcgrp->church;
					$details['community'][$count] = $ovcgrp->community;
					$details['isActive'][$count] = $result->isActive;
					$count++;
				}
			}
		}
		$details = TwoDSort($details,'lastName','asc','str');
		
		// If filtering has been done, replace $details (which is all info) with filtered info
		if (isset($_SESSION['volFiltered']))
		{
			$details = $_SESSION['volFiltered'];
		}
		$_SESSION['volDetails'] = $details;
		if (count($details['lastName']) != 0)
		{
			// Form for filtering choices
			echo "<div id='search'>";
			echo "<form class='formbuttons' name='filtering' action='".$_SESSION['base_url']."/volunteer/index.php' method='get'>";
			echo "Search for ";
			echo "<input type='text' name='filter' value=''>";
			echo " in ";
			echo "<SELECT name='category'>";
			echo "<OPTION SELECTED value='lastName'> Surname";
			echo "<OPTION value='firstName'> First Name";
			echo "<OPTION value='volunteerType'> Type";
			echo "<OPTION value='firstLang'> First Language";
			echo "<OPTION value='telNum'> Telephone Number";
			echo "<OPTION value='church'> Church";
			if (($_SESSION['accessLevel'] == '1') || ($_SESSION['accessLevel'] == '3'))
			{
				echo "<OPTION value='community'> Community";
			}
			echo "</SELECT>";
			echo " &nbsp; &nbsp; Show:  ";
			if ($_SESSION['volShowAll'])
			{
				echo "<input type='checkbox' name='showAll' checked='true'>";
			}
			else
			{
				echo "<input type='checkbox' name='showAll'>";
			}
			echo " Removed Volunteers (<img src='".$_SESSION['base_url']."/images/redFlag.gif'>)";
			echo "<br><br>";
			echo "Display ";
			$choices = array('10','30','50','100','500');
			echo "<SELECT name='numberRecords'>";
			for ($k=0;$k<5;$k++)
			{
				echo "<OPTION value='".$choices[$k]."'";
				if ($choices[$k] == $_SESSION['volNoShown'])
				{
					echo " selected='selected'";
				}
				echo ">".$choices[$k];
			}
			echo "</SELECT> records / page &nbsp; &nbsp; &nbsp; ";
			echo "<input class='button' type='submit' name='filter_button' value='Perform Search'>";
			echo " ";
			echo "<input type='hidden' name='action' value='filtered'>";
			echo "</form> ";
			// Clear All form
			echo "<form class='formbuttons' name='clearForm' action='".$_SESSION['base_url']."/volunteer/index.php' method='get'>";
			echo "<input class='button' type='submit' name='clearText' value='Clear Results'>";
			echo "<input type='hidden' name='action' value='viewAll'>";
			echo "<input type='hidden' name='clear' value='clearAll'>";
			echo "</form>";
			echo "</div>";
	
			echo "<div id='main_content'>";
			// Start of child info grid
			echo "<table class='grid'>";
			echo "<tr>";
			echo "<th width='100'>";
			echo "<a href='".$_SESSION['base_url']."/volunteer/index.php?action=sorting&sortBy=lastName&sortType=str'>Surname </a>";
			if ($_SESSION['volSortBy'] == 'lastName')
			{
				if ($_SESSION['volOrder'] == 'ASC')
				{
					echo "<img src='".$_SESSION['base_url']."/images/arrowSortUp.gif'>";
				}
				else
				{
					echo "<img src='".$_SESSION['base_url']."/images/arrowSortDown.gif'>";
				}
			}
			echo "</th>";
			echo "<th width='100'>";
			echo "<a href='".$_SESSION['base_url']."/volunteer/index.php?action=sorting&sortBy=firstName&sortType=str'>First Name </a>";
			if ($_SESSION['volSortBy'] == 'firstName')
			{
				if ($_SESSION['volOrder'] == 'ASC')
				{
					echo "<img src='".$_SESSION['base_url']."/images/arrowSortUp.gif'>";
				}
				else
				{
					echo "<img src='".$_SESSION['base_url']."/images/arrowSortDown.gif'>";
				}
			}
			echo "</th>";
			echo "<th width='100'>";
			echo "<a href='".$_SESSION['base_url']."/volunteer/index.php?action=sorting&sortBy=volunteerType&sortType=str"."'>Type </a>";
			if ($_SESSION['volSortBy'] == 'volunteerType')
			{
				if ($_SESSION['volOrder'] == 'ASC')
				{
					echo "<img src='".$_SESSION['base_url']."/images/arrowSortUp.gif'>";
				}
				else
				{
					echo "<img src='".$_SESSION['base_url']."/images/arrowSortDown.gif'>";
				}
			}
			echo "</th>";
			echo "<th width='150'>";
			echo "<a href='".$_SESSION['base_url']."/volunteer/index.php?action=sorting&sortBy=firstLang&sortType=str"."'>First Language</a>";
			if ($_SESSION['volSortBy'] == 'firstLang')
			{
				if ($_SESSION['volOrder'] == 'ASC')
				{
					echo "<img src='".$_SESSION['base_url']."/images/arrowSortUp.gif'>";
				}
				else
				{
					echo "<img src='".$_SESSION['base_url']."/images/arrowSortDown.gif'>";
				}
			}
			echo "</th>";
			echo "<th width='100'>";
			echo "<a href='".$_SESSION['base_url']."/volunteer/index.php?action=sorting&sortBy=telNum&sortType=str"."'>Telelephone Number </a>";
			if ($_SESSION['volSortBy'] == 'telNum')
			{
				if ($_SESSION['volOrder'] == 'ASC')
				{
					echo "<img src='".$_SESSION['base_url']."/images/arrowSortUp.gif'>";
				}
				else
				{
					echo "<img src='".$_SESSION['base_url']."/images/arrowSortDown.gif'>";
				}
			}
			echo "</th>";
			echo "<th width='210'>";
			echo "<a href='".$_SESSION['base_url']."/volunteer/index.php?action=sorting&sortBy=church&sortType=str"."'>Church </a>";
			if ($_SESSION['volSortBy'] == 'church')
			{
				if ($_SESSION['volOrder'] == 'ASC')
				{
					echo "<img src='".$_SESSION['base_url']."/images/arrowSortUp.gif'>";
				}
				else
				{
					echo "<img src='".$_SESSION['base_url']."/images/arrowSortDown.gif'>";
				}
			}
			echo "</th>";
			echo "<th width='100'>";
			echo "<a href='".$_SESSION['base_url']."/volunteer/index.php?action=sorting&sortBy=community&sortType=str"."'>Community </a>";
			if ($_SESSION['volSortBy'] == 'community')
			{
				if ($_SESSION['volOrder'] == 'ASC')
				{
					echo "<img src='".$_SESSION['base_url']."/images/arrowSortUp.gif'>";
				}
				else
				{
					echo "<img src='".$_SESSION['base_url']."/images/arrowSortDown.gif'>";
				}
			}
			echo "</th>";
			echo "</tr>";
			$col = 1;
			if (!isset($_SESSION['volSorted']))
			{
				// Beginning of hitcounter logic for determining depth
				$hitCounter = 0;
				while ($hitCounter < $_SESSION['volNoShown'])
				{
					// Only want to display Active users
					if (!$_SESSION['volShowAll'])
					{
						if ($details['isActive'][$_SESSION['volDepth']] == 1)
						{
							$hitCounter++;
						}
						if ($_REQUEST['direction'] == 'previous')
						{
							$_SESSION['volDepth']--;
						}
						else
						{
							$_SESSION['volDepth']++;
						}
					}
					// Viewing all volunteers so don't need to match check. Depth is same as number of records 
					else
					{
						$hitCounter = $_SESSION['volNoShown'];
						if ($_REQUEST['direction'] == 'previous')
						{
							$_SESSION['volDepth'] = $_SESSION['volDepth'] - $_SESSION['volNoShown'];
						}
						else
						{
							$_SESSION['volDepth'] = $_SESSION['volDepth'] + $_SESSION['volNoShown'];
						}
					}
					if ($_SESSION['volDepth'] == count($details['lastName']))
					{
						$hitCounter = $_SESSION['volNoShown'];
					}
				}
			}
			// If viewing all volunteers and on last page then depth is simply total number of records
			if (($_SESSION['volShowAll']) && ($_SESSION['volDepth'] > count($details['lastName'])))
			{
				$_SESSION['volDepth'] = count($details['lastName']);
			}
			// If using 'previous' tab then depth is one off (due to dec at top) and start and depth values the wrong way round
			if ($_REQUEST['direction'] == 'previous')
			{
				$_SESSION['volDepth']++;
				$placeholder = $_SESSION['volDepth'];
				$_SESSION['volDepth'] = $_SESSION['volStart'];
				$_SESSION['volStart'] = $placeholder;
			}
			// Sets record set to sorted set just before outputting. After outputting sets it back to original again.
			if (isset($_SESSION['volSorted']))
			{
				$details = $_SESSION['volSorted'];
			}
			// Outputing Details
			for ($i=$_SESSION['volStart'];$i<$_SESSION['volDepth'];$i++)
			{
				if (!$_SESSION['volShowAll'])
				{			
					if ($details['isActive'][$i] == 1)
					{
						if ($col == 1)
						{
							$col = 2;
						}
						else 
						{
							$col = 1;
						}		
						echo "<tr>";
						echo "<td class='data$col'>";
						echo "<a href='".$_SESSION['base_url']."/volunteer/index.php?action=viewVolunteer&volunteerID=".$details['volunteerID'][$i]."'>";
						echo $details['lastName'][$i]."</a>";
						echo "</td>";
						echo "<td class='data$col'>";
						echo $details['firstName'][$i];
						echo "</td>";
						echo "<td class='data$col'>";
						echo $details['volunteerType'][$i];
						echo "</td>";
						echo "<td class='data$col'>";
						echo $details['firstLang'][$i];
						echo "</td>";
						echo "<td class='data$col'>";
						echo $details['telNum'][$i];
						echo "</td>";
						echo "<td class='data$col'>";
						echo $details['church'][$i];
						echo "</td>";
						echo "<td class='data$col'>";
						echo $details['community'][$i];
						echo "</td>";
						echo "</tr>";
					}
				}
				else
				{
					if ($col == 1)
					{
						$col = 2;
					}
					else 
					{
						$col = 1;
					}		
					echo "<tr>";
					echo "<td class='data$col'>";
					if ($details['isActive'][$i] == 0)
					{
						echo "<img src='".$_SESSION['base_url']."/images/redFlag.gif'>  ";
					} 
					echo "<a href='".$_SESSION['base_url']."/volunteer/index.php?action=viewVolunteer&volunteerID=".$details['volunteerID'][$i]."'>";
					echo $details['lastName'][$i]."</a>";
					echo "</td>";
					echo "<td class='data$col'>";
					echo $details['firstName'][$i];
					echo "</td>";
					echo "<td class='data$col'>";
					echo $details['volunteerType'][$i];
					echo "</td>";
					echo "<td class='data$col'>";
					echo $details['firstLang'][$i];
					echo "</td>";
					echo "<td class='data$col'>";
					echo $details['telNum'][$i];
					echo "</td>";
					echo "<td class='data$col'>";
					echo $details['church'][$i];
					echo "</td>";
					echo "<td class='data$col'>";
					echo $details['community'][$i];
					echo "</td>";
					echo "</tr>";		
				}
			}
			echo "</table>";
			
			// Returns $details to 'orginal' pre-sorted state
			if (isset($_SESSION['volFiltered']))
			{
				$details = $_SESSION['volFiltered'];
			}
			else
			{
				$details = $_SESSION['volDetails'];
			} 
	
			// Beginning of page checks and calculating all the numbers for "Showing X - Y of Z"
			// Checks if at the start of the record set. 
			$firstPage = false;
			if (!$_SESSION['volShowAll'])
			{
				$checker = $_SESSION['volStart'];
				do
				{
					if ($checker == 0)
					{
						$firstPage = true;
					}
					$checker--;
					if ($details['isActive'][$checker] == 1)
					{
						$firstPage = false;
						$checker = -1;
					}
				}
				while ($checker >= 0);
			}
			else
			{
				if ($_SESSION['volStart'] == 0)
				{
					$firstPage = true;
				}
			}
			// Checks if at end of record set. If only showing active, assume it is the last page and then check to see if its not.
			if (!$_SESSION['volShowAll'])
			{
				$lastPage = true;
				$checker = $_SESSION['volDepth'];
				do
				{
					if ($checker == count($details['lastName']))
					{
						$checker++;
					}
					else
					{
						if ($details['isActive'][$checker] == 1)
						{
							$lastPage = false;
							$checker = count($details['lastName']);
						}
						$checker++;
					}
				}
				while ($checker < count($details['lastName']));
			}
			else
			{
				if ($_SESSION['volDepth'] >= count($details['lastName']))
				{
					$lastPage = true;
				}
			}
	
			echo "<table>";
			echo "<tr>";
			echo "<td class='grid_previous'>";
			// If so disables left tab
			if ($firstPage)
			{
				$_SESSION['volStartingRecord'] = 1;
			}
			else
			{
				echo "<a href='".$_SESSION['base_url']."/volunteer/index.php?action=viewAll&direction=previous'> Previous </a>";
			}
			echo "</td>";
			echo "<td class='grid_records'>";
			// Checking size of record set
			if ($_SESSION['volShowAll'])
			{
				$totalRecords = count($details['lastName']);
			}
			else
			{
				$totalRecords = 0;
				for ($j=0;$j<count($details['lastName']);$j++)
				{
					if ($details['isActive'][$j] == 1)
					{
						$totalRecords++;
					}
				}
			}		
			// Checks if direction is previous and NOT the first page (Important) 
			if (($_REQUEST['direction'] == 'previous') && (!$firstPage))
			{
				$_SESSION['volStartingRecord'] = $_SESSION['volStartingRecord'] - $_SESSION['volNoShown'];
			}
			// Direction forward
			if ($_REQUEST['direction'] == 'next')
			{
				$_SESSION['volStartingRecord'] = $_SESSION['volStartingRecord'] + $_SESSION['volNoShown'];
			}	
			echo "Showing ".$_SESSION['volStartingRecord']." - ";
			// If last page then top end is obviously the total numbers of records
			if (!$lastPage)
			{
				echo $_SESSION['volStartingRecord'] + $_SESSION['volNoShown'] - 1;
			}
			else
			{
				echo $totalRecords; 		
			}
			echo " of ".$totalRecords;
			echo "</td>";
			echo "<td class='grid_next'>";
			//Checks if at the end of the record set. If so disables right tab
			if (!$lastPage)
			{
				echo "<a href='".$_SESSION['base_url']."/volunteer/index.php?action=viewAll&direction=next'> Next </a>";
			}
			echo "</td>";
			echo "</tr>";
			echo "</table>";
			echo "</div>";
		}
		else
		{
			$c = new Group();
			$c->getGroup($_SESSION['ovcgrpID']);
			echo "<div id='main_content'>";
			if ($_SESSION['ovcgrpID'] == 0)
			{
				echo "At present there are no volunteers on record that live in any community";
			}
			else
			{
				echo "At present there are no volunteers on record that live in ".$c->community;
			}
			echo "<br><br>";
			echo "Volunteers can be entered using the 'Add New' Button above";
			echo "</div>";
		}
	}

	else if ($_REQUEST['action'] == 'filtered')
	{
		$filtered = array(array("volunteerID" => "","lastName" => "","firstName" => "","telNum" => "","church" => "","community" => "","volunteerType" => "","firstLang" => "","isActive" => ""));
		$_SESSION['volNoShown'] = $_REQUEST['numberRecords'];
		$c = 0;
		$clear = "";
		$match = false;
		unset($_SESSION['volStart']);
		unset($_SESSION['volSorted']);
		unset($_SESSION['volSortBy']);
		for ($i=0;$i<count($_SESSION['volDetails']['lastName']);$i++)
		{
			// Take substring of chosen categoty at the length of the filter word and compare it to the filter choice
			if (strncasecmp($_SESSION['volDetails'][$_REQUEST['category']][$i],$_REQUEST['filter'],strlen($_REQUEST['filter'])) == 0)
			{
				$filtered['volunteerID'][$c] = $_SESSION['volDetails']['volunteerID'][$i];
				$filtered['lastName'][$c] = $_SESSION['volDetails']['lastName'][$i];
				$filtered['firstName'][$c] = $_SESSION['volDetails']['firstName'][$i];
				$filtered['volunteerType'][$c] = $_SESSION['volDetails']['volunteerType'][$i];
				$filtered['firstLang'][$c] = $_SESSION['volDetails']['firstLang'][$i];
				$filtered['telNum'][$c] = $_SESSION['volDetails']['telNum'][$i];
				$filtered['church'][$c] = $_SESSION['volDetails']['church'][$i];
				$filtered['community'][$c] = $_SESSION['volDetails']['community'][$i];
				$filtered['isActive'][$c] = $_SESSION['volDetails']['isActive'][$i];
				$c++;
				$match = true;
			}
		}
		if (!$match)
		{
			$_SESSION['vol_msg_disp'] = true;
			$_SESSION['vol_msg'] = "Your search did not return any results - showing all records.";
			$clear = 'clearAll';
		}
		$_SESSION['volFiltered'] = $filtered;
		// To check track of whether or not the Show Removed Children box has been checked
		if (isset($_REQUEST['showAll']))
		{
			 $_SESSION['volShowAll'] = true;
		}
		else
		{
			$_SESSION['volShowAll'] = false;
		}
		echo "<script language = 'javascript'>document.location='".$_SESSION['base_url']."/volunteer/index.php?action=viewAll&clear=".$clear."';</script>";
	} 
	
	else if ($_REQUEST['action'] == 'sorting')
	{
		// if session variables are set, then store the previous sortby and assign the new
		$_SESSION['volLastSortBy'] = $_SESSION['volSortBy'];
		$_SESSION['volSortBy'] = $_REQUEST['sortBy'];
		// if lastsortby and sortby are the same, then flip the value of the ASC/DESC
		if ($_SESSION['volLastSortBy'] == $_SESSION['volSortBy'])
		{
			if ($_SESSION['volOrder'] == "ASC")
			{
				$_SESSION['volOrder'] = "DESC";
			}
			else $_SESSION['volOrder'] = "ASC";
		}
		else
		{
			// otherwise, the sort must be ASC
			$_SESSION['volOrder'] = "ASC";
		}
		$sorted = array(array("volunteerID" => "","lastName" => "","firstName" => "","telNum" => "","church" => "","community" => "","volunteerType" => "","firstLang" => "","isActive" => ""));
		$c = 0;
		// Creating smaller array out just the records in the current page section (e.g 8 - 15)
		for ($i=$_SESSION['volStart'];$i<$_SESSION['volDepth'];$i++)
		{
			$sorted['volunteerID'][$i] = $_SESSION['volDetails']['volunteerID'][$i];
			$sorted['lastName'][$i] = $_SESSION['volDetails']['lastName'][$i];
			$sorted['firstName'][$i] = $_SESSION['volDetails']['firstName'][$i];
			$sorted['volunteerType'][$i] = $_SESSION['volDetails']['volunteerType'][$i];
			$sorted['firstLang'][$i] = $_SESSION['volDetails']['firstLang'][$i];
			$sorted['telNum'][$i] = $_SESSION['volDetails']['telNum'][$i];
			$sorted['church'][$i] = $_SESSION['volDetails']['church'][$i];
			$sorted['community'][$i] = $_SESSION['volDetails']['community'][$i];
			$sorted['isActive'][$i] = $_SESSION['volDetails']['isActive'][$i];
		}

		$sorted = TwoDSort($sorted,$_SESSION['volSortBy'],$_SESSION['volOrder'],$_REQUEST['sortType']);

		// php in its infinite wisdom shifts the indexing of the array up to 0 if there are empty spaces. So if the record 
		// set was for 8 - 15 it could be shifted up to 0 - 7. This destroys the outputting logic as all my counters are
		// based the position of the records in terms of the full 2d array. so such childSorted starts as a copy
		// of the full 2d array and then gets the current page records overwritten with sorted ones.
		$_SESSION['volSorted'] = $_SESSION['volDetails'];
		for ($i=$_SESSION['volStart'];$i<$_SESSION['volDepth'];$i++)
		{
			$_SESSION['volSorted']['volunteerID'][$i] = $sorted['volunteerID'][$c];
			$_SESSION['volSorted']['lastName'][$i] = $sorted['lastName'][$c];
			$_SESSION['volSorted']['firstName'][$i] = $sorted['firstName'][$c];
			$_SESSION['volSorted']['volunteerType'][$i] = $sorted['volunteerType'][$c];
			$_SESSION['volSorted']['telNum'][$i] = $sorted['telNum'][$c];
			$_SESSION['volSorted']['firstLang'][$i] = $sorted['firstLang'][$c];
			$_SESSION['volSorted']['church'][$i] = $sorted['church'][$c];
			$_SESSION['volSorted']['community'][$i] = $sorted['community'][$c];
			$_SESSION['volSorted']['isActive'][$i] = $sorted['isActive'][$c];
			$c++;
		}
		echo "<script language = 'javascript'>document.location='".$_SESSION['base_url']."/volunteer/index.php?action=viewAll&sortBy=sorting';</script>";
	}
	
	else if ($_REQUEST['action'] == 'add')
	{
		// Add a new Volunteer

		echo "<h2>Add a Volunteer</h2>";

		echo "<div id='top_buttons'>";

		echo "<form class='formbuttons' name='nav_help' target='help_window' action='".$_SESSION['base_url']."/help/index.php' method='get'>";
    echo "<input class='button' type='submit' name='help' value='Help' />";
		echo "<input type='hidden' name='chapter' value='volunteermanagement' />";
		echo "<input type='hidden' name='section' value='add'>";
		echo "</form>";

		echo "</div>";
		echo "<div id='main_content'>";
		echo "<table class= 'form'>";
		echo "<form name='volunteer_form' id='volunteer_form' action='".$_SESSION['base_url']."/volunteer/index.php' method='post'>";
		echo "<th>Volunteer Details</th>";
		echo "<tr>";
		echo "<td class='data1'>First Name</td><td class='data1'><input type='text' name='firstname' id='firstname'  onblur= 'javascript: sortname()' onkeyup= 'javascript: pass();'></td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td class='data2'>Last Name</td><td class='data2'><input type='text' name='lastname' id='lastname' onblur= 'javascript: sortname()' onkeyup= 'javascript: pass();' ></td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td class='data1'>First Language</td><td class='data1'><select  id='firstlanguage' name='firstlanguage' >";
			// All eleven official languages!!
			
			echo "<option value='English'";
			echo ">";	
			echo "English";
			echo "</option>";
			echo "<option value='Afrikaans'"; 
			echo " >";
			echo "Afrikaans";
			echo "</option>";
			echo "<option value='isiXhosa'";
			echo ">";
			echo "isiXhosa";
			echo "</option>";
			echo "<option value='isiZulu'";
			echo ">";
			echo "isiZulu";
			echo "</option>";
			echo "<option value='isiNdebele'";
			echo ">";
			echo "isiNdebele";
			echo "</option>";
			echo "<option value='Sepedi'";
			echo ">";
			echo "Sepedi";
			echo "</option>";
			echo "<option value='Sesotho'";
			echo ">";
			echo "Sesotho";
			echo "</option>";
			echo "<option value='Setswana'";
			echo ">";
			echo "Setswana";
			echo "</option>";
			echo "<option value='siSwati'";
			echo ">";
			echo "siSwati";
			echo "</option>";
			echo "<option value='Tshivenda'";
			echo ">";
			echo "Tshivenda";
			echo "</option>";
			echo "<option value='Xitsonga'";
			echo ">";
			echo "Xitsonga";
			echo "</option>";
			
		echo "</select></td>";
		echo "</tr>";

		echo "<tr>";
		echo "<td class='data2'>Telephone Number</td><td class='data2'><input type='text' name='telnum' id='telnum' onblur= 'javascript: telephoneCheck();' onkeyup='javascript: telephoneCheck();'></td>";
		echo "</tr>";
		
		echo "<tr>";
		echo "<td class='data1'>Address Line 1</td><td class='data2'><input type='text' name='address1' id='address1' onkeyup= 'javascript: pass();'></td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td class='data2'>Address Line 2</td><td class='data2'><input type='text' name='address2' id='address2' onkeyup= 'javascript: pass();'></td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td class='data1'>Address Line 3</td><td class='data1'><input type='text' name='address3' id='address3' onkeyup= 'javascript: pass();'></td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td class='data2'>Address Line 4</td><td class='data2'><input type='text' name='address4' id='address4' onkeyup= 'javascript: pass();'></td>";
		echo "</tr>";
		
		// now, use the static method in the ovcgrp class to get the ovcgroup names
		$results = Group::getAllGroups();
		echo "<tr>";
		echo "<td class='data1'>Church</td><td class='data1'><select id='ovcselect' name='ovcselect' >";
		
		foreach ($results as $result)
		{
			echo "<option value='".$result->ovcgrpID."'>".$result->church."</option>";
		}
		echo "</select></td>";
		echo "</tr>";
		
		// now, get Volunteer Types
		$results = VolunteerType::getAllActiveVolunteerType();
		echo "<tr>";
		echo "<td class='data2'>Volunteer Type</td><td class='data2'><select id='volunteertype' name='volunteertype' >";
		
		foreach ($results as $result)
		{
			echo "<option value='".$result->volunteerTypeID."'>".$result->name."</option>";
		}
		echo "</select></td>";
		echo "</tr>";
		
		echo "<tr>";
    	echo "<td >";
		echo "</td>";
		echo "<td >";
		echo "<input class = 'button' type='button' name='addvolunteer' value='Save'  onClick='javascript: volunteer_form_confirm();'>";
		echo "<input class = 'button' type='button' name='cancel' value='Cancel' onclick='javascript: cancel_form();'>";
		echo "</td>";
		echo "</tr>";
		echo "<input  type='hidden' name='action' value='addvolunteer'>";
    	echo "</form>";
		echo "</table>";
		echo "</div>";
	}

	else if ($_REQUEST['action'] == 'addvolunteer')
	{
		//formatting today's date to insert into mySql
		$date= date ("Y-m-d");
		$_SESSION['vol_msg_disp'] = true;
		$_SESSION['vol_msg'] = "Volunteer ".$_REQUEST['firstname']." ".$_REQUEST['lastname']." added.";
				
		// create an instance of the volunteer class
		$v = new Volunteer;
		// fill it with the new service info
		$v->setVolunteer($_REQUEST['firstname'],$_REQUEST['lastname'],$_REQUEST['firstlanguage'],$_REQUEST['telnum'],$_REQUEST['address1'],$_REQUEST['address2'],$_REQUEST['address3'],$_REQUEST['address4'],$_REQUEST['ovcselect'],$_REQUEST['volunteertype'],$date);
		// write to the database
		$v->saveVolunteer();
		// redirect the user to the initial grid edit page with a confirmation message
		echo "<script language = 'javascript'>document.location='".$_SESSION['base_url']."/volunteer/index.php?action=viewAll&clear=clearAll';</script>";
		
	}

	else if ($_REQUEST['action'] == 'viewVolunteer')
	{

		$v = new Volunteer;
		$v->getVolunteer($_REQUEST['volunteerID']);
		$_SESSION['volID'] = $_REQUEST['volunteerID'];


		echo "<h2>Update Volunteer Details</h2>";
		echo "<div id='top_buttons'>";
		echo "<input class='button' type='button' name='log_service' id='log_service' value='Log Services' onclick='javascript: document.location=\"".$_SESSION['base_url']."/serviceVisit/index.php\";'";
		if ($v->isActive == '0')
		{
			echo " disabled='disabled'";
		}
		echo ">";
		echo "&nbsp;";
		echo "<input class='button' type='button' name='view_history' id='view_history' value='View History' onclick='javascript: document.location=\"".$_SESSION['base_url']."/volunteer_history/index.php\";'";
		echo ">";
		echo "&nbsp;";
		
		echo "<input class='button' type='button' name='edit_details' id='edit_details' value='Edit Details' onclick='javascript: edit_activate();'";
		if ($v->isActive == '0')
		{
			echo " disabled='disabled'";
		}
		echo ">";
		echo "&nbsp;";
		echo "<input class='button' type='button' name='delete' id='delete' value='Delete' onclick='javascript:delete_form_confirm(\"".$v->lName."\");'";
		if ($v->isActive == '0')
		{
			echo " disabled='disabled'";
		}
		echo ">";
		echo "&nbsp;";

		echo "<form class='formbuttons' name='delete_form' id='delete_form' action='".$_SESSION['base_url']."/volunteer/index.php' method='post'>";
   		echo "<input type='hidden' name='action' value='delete'>";
  		echo "</form>";
		echo "&nbsp;";


 		echo "<form class='formbuttons' name='nav_help' target='help_window' action='".$_SESSION['base_url']."/help/index.php' method='get'>";
    	echo "<input class='button' type='submit' name='help' value='Help' />";
		echo "<input type='hidden' name='chapter' value='volunteermanagement' />";
		echo "<input type='hidden' name='section' value='view'>";
		echo "</form>";

		echo "<input class='button' type='button' name='canceladd' id='canceladd' value='Exit' onClick='javascript: document.location=\"".$_SESSION['base_url']."/volunteer/index.php?action=viewAll&clear=clearAll\";'>";
		echo "<form name='volunteer_form' id='volunteer_form' action='".$_SESSION['base_url']."/volunteer/index.php' method='post'>";

		echo "<input type='hidden' name='volunteerID' value='".$_REQUEST['volunteerID']."'>";
		echo "<input type='hidden' name='action' value='update'>";
		echo "</div>";
		//echo "<br />";
		echo "<div id='main_content'>";
		echo "<table class= 'form'>";
		
		echo "<th>";
		if ($v->isActive == 0)
		{
			echo "<img src='".$_SESSION['base_url']."/images/redFlag.gif'>  ";
		}
		echo $v->lName.", ".$v->fName;
		echo "</th>";
		
		if ($v->isActive == 0)
		{
			echo "<tr>";
			echo "<td class='data2'>";
			$date_arr = explode("-",$v->dateDeleted);
			$dateDeleted = $date_arr[2]."-".$date_arr[1]."-".$date_arr[0];
			echo "<b> <center> Deleted on ".$dateDeleted."</center> </b>";
			echo "</td>";
			echo "</tr>";
		}		
		
		echo "<tr>";
		echo "<td class = 'data1'>First Name</td><td class ='data1'><input type='text' name='firstname' id='firstname' value='".$v->fName."' readonly='readonly' onblur= 'javascript: sortname()' onkeyup= 'javascript: pass();'></td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td class = 'data2'>Last Name</td><td class ='data1'><input type='text' name='lastname' id='lastname' value='".$v->lName."' readonly='readonly' onblur= 'javascript: sortname()' onkeyup= 'javascript: pass();'></td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td class='data1'>First Language</td><td class='data2'><select id='firstlanguage' name='firstlanguage' disabled='disabled' >";
			// All eleven official languages!!
			echo "<option value='English'";
			if ($v->firstLang == 'English')
			{
				echo " selected='selected'";
			}
			echo ">";	
			echo "English";
			echo "</option>";
			echo "<option value='Afrikaans'"; 
			if ($v->firstLang == 'Afrikaans')
			{
				echo " selected='selected'";
			}
			echo " >";
			echo "Afrikaans";
			echo "</option>";
			echo "<option value='isiXhosa'";
			if ($v->firstLang== 'isiXhosa')
			{
				echo " selected='selected'";
			}
			echo ">";
			echo "isiXhosa";
			echo "</option>";
			echo "<option value='isiZulu'";
			if ($v->firstLang== 'isiZulu')
			{
				echo " selected='selected'";
			}
			echo ">";
			echo "isiZulu";
			echo "</option>";
			echo "<option value='isiNdebele'";
			if ($v->firstLang== 'isiNdebele')
			{
				echo " selected='selected'";
			}
			echo ">";
			echo "isiNdebele";
			echo "</option>";
			echo "<option value='Sepedi'";
			if ($v->firstLang== 'Sepedi')
			{
				echo " selected='selected'";
			}
			echo ">";
			echo "Sepedi";
			echo "</option>";
			echo "<option value='Sesotho'";
			if ($v->firstLang== 'Sesotho')
			{
				echo " selected='selected'";
			}
			echo ">";
			echo "Sesotho";
			echo "</option>";
			echo "<option value='Setswana'";
			if ($v->firstLang== 'Setswana')
			{
				echo " selected='selected'";
			}
			echo ">";
			echo "Setswana";
			echo "</option>";
			echo "<option value='siSwati'";
			if ($v->firstLang== 'siSwati')
			{
				echo " selected='selected'";
			}
			echo ">";
			echo "siSwati";
			echo "</option>";
			echo "<option value='Tshivenda'";
			if ($v->firstLang == 'Tshivenda')
			{
				echo " selected='selected'";
			}
			echo ">";
			echo "Tshivenda";
			echo "</option>";
			echo "<option value='Xitsonga'";
			if ($v->firstLang == 'Xitsonga')
			{
				echo " selected='selected'";
			}
			echo ">";
			echo "Xitsonga";
			echo "</option>";
		echo "</select></td>";
		echo "</tr>";
		
		
		echo "<tr>";
		echo "<td class='data2'>Tel Num</td><td class='data1'><input type='text' name='telnum' id='telnum' value='".$v->telNum."' readonly='readonly' onblur= 'javascript: telephoneCheck();' onkeydown='javascript: telephoneCheck();' ></td>";
		echo "</tr>";
		echo "<td class='data1'>Address Line 1 </td><td class='data1'><input type='text' name='address1' id='address1' value='".$v->add1."' readonly='readonly' onkeyup= 'javascript: pass();'></td>";
		echo "</tr>";
		echo "<td class='data2'>Address Line 2</td><td class='data1'><input type='text' name='address2' id='address2' value='".$v->add2."' readonly='readonly' onkeyup= 'javascript: pass();'></td>";
		echo "</tr>";
		echo "<td class='data1'>Address Line 3</td><td class='data1'><input type='text' name='address3' id='address3' value='".$v->add3."' readonly='readonly' onkeyup= 'javascript: pass();'></td>";
		echo "</tr>";
		echo "<td class='data2'>Address Line 4</td><td class='data1'><input type='text' name='address4' id='address4' value='".$v->add4."' readonly='readonly' onkeyup= 'javascript: pass();'></td>";
		echo "</tr>";
				
		$results = Group::getAllGroups();
		echo "<tr>";
		echo "<td class='data1'>Church</td><td class='data2'><select id='ovcselect' name='ovcselect' disabled='disabled'>";
		
		foreach ($results as $result)
		{
			echo "<option value='".$result->ovcgrpID."'";  
			if ($result->ovcgrpID == $v->oID)
			{
				echo " selected='selected'";
			}
			echo ">";
			echo $result->church;
		    echo "</option>";
		
		}
		echo "</select></td>";
		echo "</tr>";
		
		// now, get Volunteer Types
		$results = VolunteerType::getAllActiveVolunteerType();
		echo "<tr>";
		echo "<td class='data2'>Volunteer Type</td><td class='data2'><select id='volunteertype' name='volunteertype' disabled='disabled'>";
		
		foreach ($results as $result)
		{
			echo "<option value='".$result->volunteerTypeID. "'";
			if ($result->volunteerTypeID == $v->vtID)
			{
				echo " selected='selected'";
			}
			echo ">";
			echo"$result->name";
			echo"</option>";
		}
		echo "</select></td>";
		echo "</tr>";
		
		echo "<tr>";
    	echo "<td>";
		echo "</td>";
		echo "<td>";
		echo "<input class='button' type='button' name='update' id='update' value='Save' onclick='javascript: volunteer_form_confirm();' disabled='disabled'>";
		echo "<input class='button' type='button' name='discard' id='discard' value='Discard Changes' onClick='javascript: confirm_discard();' disabled='disabled'>";
   		echo "</form>";
   		echo "</td>";
		echo "</tr>";
		echo "</table>";
		echo "</div>";
	}

	else if ($_REQUEST['action'] == 'delete')
	{
		$date = date("Y-m-d");
		$v = new Volunteer();
		$v->getVolunteer($_SESSION['volID']);
		$v->isActive = 0;
		$v->dateDeleted = $date;
		// write to the database
		$v->updateVolunteer();
		$_SESSION['vol_msg_disp'] = true;
		$_SESSION['vol_msg'] = "Volunteer ".$v->fName." ".$v->lName." has been deleted.";
		// redirect the user to the initial grid edit page with a confirmation message
		echo "<script language = 'javascript'>document.location='".$_SESSION['base_url']."/volunteer/index.php?action=viewAll&clear=clearAll';</script>";
	}

	else if ($_REQUEST['action'] == 'update')
	{
		// create an instance of the Service class
		$v = new Volunteer();
		// fill it with the info corresponding to the given Group id
		$v->getVolunteer($_SESSION['volID']);
		// set the new values
		$v->fName = $_REQUEST['firstname'];
		$v->lName = $_REQUEST['lastname'];
		$v->firstLang = $_REQUEST['firstlanguage'];
		$v->telNum = $_REQUEST['telnum'];
		$v->add1 = $_REQUEST['address1'];
		$v->add2 = $_REQUEST['address2'];
		$v->add3 = $_REQUEST['address3'];
		$v->add4 = $_REQUEST['address4'];
		$v->oID = $_REQUEST['ovcselect'];
		$v->vtID = $_REQUEST['volunteertype'];
		$_SESSION['vol_msg_disp'] = true;
		$_SESSION['vol_msg'] = "Volunteer ".$v->fName." ".$v->lName." has been updated.";

		// write to the database
		$v->updateVolunteer();
		// redirect the user to the initial grid edit page with a confirmation message
		echo "<script language = 'javascript'>document.location='".$_SESSION['base_url']."/volunteer/index.php?action=viewAll&clear=clearAll';</script>";
	}

	else
	{
		echo "<p class='error'>Application Error: Please contact your system administrator.";
	}
?>


 
Return current item: Care For Kids