// JavaScript Document

/* jquery toggle */
function toggle(element, speed)
{
	$('#'+element).slideToggle(speed);
}

//Load a page the specified div
function getData(url,targetDiv) {
  $.get(
    url,
    function(data) {
      $('#'+targetDiv).empty().append(data);
    }
  );
}

//Load page using a JavaScript command rather than a link
function getURL(url)
{
	var url;
	window.location.href = url;
}

//Load lists in outline format
function getList(arrow,targetSpan,list,targetDiv)
{
   //variables
   // arrow is the page that contains the arrow image & function to display/hide the list
   var arrow;

   // targetSpan <span> contains the arrow page
   var targetSpan;

   // list is the page of items to be displayed
   var list;

   // targetDiv <div> contains the list page
   var targetDiv;

   //load the appropriate arrow into the specified span
   getData(arrow,targetSpan);

   //load the appropriate list into the specified div
   getData(list,targetDiv);

}

//Allow user to send confirmation before deleting a record
function confirmDelete(url,targetDiv)
{
	var url;
	var targetDiv;
	var cDelete = window.confirm('Are you sure you want to delete this record?');
	
	if (cDelete == true)
	{
		getData(url,targetDiv);
	}
	else
	{
		return false;
	}
}
