function deleteConfirm() {

	confirm_message = "Are you sure you would like to delete this item?";

	if (confirm(confirm_message)) {
		return true;
	}

	return false;
}

function addLoadListener(fn)
{
	if (typeof window.addEventListener != 'undefined')
	{
	window.addEventListener('load', fn, false);
}
else if (typeof document.addEventListener != 'undefined')
{
	document.addEventListener('load', fn, false);
}
else if (typeof window.attachEvent != 'undefined')
{
	window.attachEvent('onload', fn);
}
else
{
	var oldfn = window.onload;
	if (typeof window.onload != 'function')
	{
	window.onload = fn;
	}
	else
	{
	window.onload = function()
	{
	oldfn();
	fn();
	};
	}
	}
}

document.onclick = function(e)
{
  var target = e ? e.target : window.event.srcElement;

  while (target && !/^(a|body)$/i.test(target.nodeName))
  {
    target = target.parentNode;
  }

  if (target && target.getAttribute('rel')
      && target.rel == 'external')
  {
    var external = window.open(target.href);

    return external.closed;
  }
return e;
}


//Used in the search.php page.
function toggleLayer( whichLayer )
{
var full, small, visF, visS;
if( document.getElementById ) // this is the way the standards work
{
  full = document.getElementById( "full_" + whichLayer );
  small = document.getElementById( "small_" + whichLayer );
}
else if( document.all ) // this is the way old msie versions work
{
	  full = document.all( "full_" + whichLayer );
    small = document.all( "small_" + whichLayer );
}
visF = full.style;
visS = small.style;
if (visF.display==''||visF.display=='block')
{
	  visF.display='none';
	  visS.display='block';
}
else
{
	  visF.display='block';
	  visS.display='none';
}

}

function changeDisplay(id) {
	var element = document.getElementById(id);
	if (element.style.display != 'block')
		$("#"+id).show();
	else
		$("#"+id).hide();
}

function changeScheduleDisplay(id) {
	changeDisplay(id);
	if (document.getElementById(id).style.display == "block")
		//document.getElementById('schedule_add_new').scrollTop = document.getElementById('schedule_add_new').offsetTop;
		window.scroll(0, document.getElementById('schedule_add_new').offsetTop);
}

function changeCheckboxStatus(field) {
	list = document.getElementsByName(field);
	for (i = 0; i < list.length; i++)
		if (list[i].checked)
			list[i].checked = false;
		else
			list[i].checked = true;
}

