function ConfDelete(recordtype)
{
	confirm_message = "Are you sure you want to delete this "+recordtype+" from the system?";
	if ( confirm(confirm_message) )
	{
		return true;
	}
	else
	{
		return false;
	}
}
var newwindow;
function popitup(url)
{
	//alert("called")
	newwindow=window.open(url,'HiPP','height=300,width=600');
	if (window.focus) {newwindow.focus()}
}

// addition for pagination in forum
function show_goto(n) {
	var id;
	var gotos = document.getElementById('gotos');
// alert(gotos.childNodes.length);
	if (0 == gotos.childNodes.length) return false;

	var divs = gotos.getElementsByTagName('div');

	for (var i = 0; i < divs.length; ++i) {
		id = divs[i].id.match(/^goto-(\d+)$/)[1];
		if (n == id)
			divs[i].className = 'goto-visible';
		else
			divs[i].className = 'goto-hidden';
	}

	return false;
}

// Allows IE 5/6 to use a hover state on LIs

// Adds rollover delay for main navigation in other browsers

var currentItem = null;

var classHolder = '';

var timeoutID = 0;

var over = false;



startList = function() {

  if (document.getElementById) {

    var navRoot = document.getElementById("navigation");
    var navItems = navRoot.getElementsByTagName("LI");
	var startListCount = 0

    // Loop though the LIs. use "startListCount" to count as "i" seems to be used somewhere else and causes confusion in IE6 and 7

    for (startListCount=0; startListCount<navItems.length; startListCount++) {
		
      node = navItems[startListCount];

      node.onmouseover=function() {

        over = true;

        window.clearTimeout(timeoutID);

        if (currentItem != this) {

          if (currentItem) {

            currentItem.className = classHolder;

          }

          currentItem = this;

          classHolder = this.className;

          this.className+=" over";

        }

      }

      node.onmouseout=function() {

        over = false;

        timeoutID = window.setTimeout("clearMenu();",800);

      }

    }

  }

}

clearMenu = function() {

  if (!over && currentItem) {

	currentItem.className = classHolder;

	currentItem = null;

  }

}



addEvent = function(obj, evType, fn) { 

	if (obj.addEventListener) { obj.addEventListener(evType, fn, true); return true; } 

	else if (obj.attachEvent) {  var r = obj.attachEvent("on"+evType, fn);  return r;  } 

	else {  return false; } 

}

/* ADD EVENT HANDLERS */

/*addEvent(window, "load", startList)*/

function checkDate() { 
	// Reporting on a date range is only possible for dates starting after 18/02/09

	var dateRange = document.forms.dateRange;

	if ((dateRange.report_from_dd.value == '-') || (dateRange.report_from_mm.value == '-') || (dateRange.report_from_yyyy.value == '-')) {
		alert("Please choose a valid from date.");			
		return false;
	}

	var startDate = new Date();
	startDate.setYear(2009);
	startDate.setMonth(1);
	startDate.setDate(19);

	var selectedDate = new Date();
	selectedDate.setYear(parseInt(dateRange.report_from_yyyy.value));
	selectedDate.setMonth(parseInt(dateRange.report_from_mm.value-1));
	selectedDate.setDate(parseInt(dateRange.report_from_dd.value));

	if (selectedDate.getTime() < startDate.getTime()) {
		alert("Date range reporting is not possible on periods beginning before\n19/02/09. Please choose a date equal to or after this, or choose\n'cumulative statistics to date'.");			
		return false;
	}

	return true;
}



// Date checker for the Banner Reporting
function checkDateBanner() { 
	// Reporting on a date range is only possible for dates starting after 18/02/09

	var dateRange = document.forms.dateRange;

	if ((dateRange.report_from_dd.value == '-') || (dateRange.report_from_mm.value == '-') || (dateRange.report_from_yyyy.value == '-')) {
		alert("Please choose a valid from date.");			
		return false;
	}

	var startDate = new Date();
	startDate.setYear(2009);
	startDate.setMonth(7);
	startDate.setDate(7);

	var selectedDate = new Date();
	selectedDate.setYear(parseInt(dateRange.report_from_yyyy.value));
	selectedDate.setMonth(parseInt(dateRange.report_from_mm.value-1));
	selectedDate.setDate(parseInt(dateRange.report_from_dd.value));

	if (selectedDate.getTime() < startDate.getTime()) {
		alert("Date range reporting is not possible on periods beginning before\n07/08/2009. Please choose a date equal to or after this, or choose\n'cumulative statistics to date'.");			
		return false;
	}

	return true;
}
