
<!-- ALLOWS ROLLOVER IMAGES -->
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/**
 * Opens a new window with the specified URL
 */
function openNewWindow(urlToOpen)
{
	//set the window to open in the top right
	var newWinWidth = 750;
	var leftPos = screen.width - (newWinWidth + 10);
	var newWindow = window.open(urlToOpen, 'newWindow', 'toolbar=no, menubar=yes, resizable=yes, scrollbars=yes, top=0, left=' + leftPos + ', width=' + newWinWidth + ', height=600');
	newWindow.focus();	
}

/**
 * Function is responsible for showing or hiding a DIV in the page
 */
function showHideDisplay(dispName)
{
	var d1 = document.getElementById(dispName);
	if(d1.style.display == "" || d1.style.display == "block")
	{
		d1.style.display = "none";
	}
	else
	{
		d1.style.display = "block";
	}
}

/**
 * Disables the passed object and changes the appearance of the field
 */
function disableObject(anObj)
{
	anObj.disabled = true;
	anObj.readonly = true;
	anObj.className = "readonly";	
}

/**
 * This method enables the object and changes the appearance of the field. It
 * also sets the focus to the object
 */
function enableObject(anObj)
{
	anObj.disabled = false;
	if(anObj.className == "readonly")
	{
		anObj.className = "";
	}
}

/**
 * This method enables the object and changes the appearance of the field. It
 * also sets the focus to the object
 */
function enableObjectAndFocus(anObj)
{
	anObj.disabled = false;
	if(anObj.className == "readonly")
	{
		anObj.className = "";
	}
	anObj.focus();
}

/**
 * Allows all the checkboxes to be ticked or none of them, depending on
 * the value of the passed checkbox so this call would be on the checkbox you
 * want to use to select all or none of the other checkboxes, e.g.
 * javascript:selectAllOrNothing(this)
 */
function selectAllOrNothing(allChk)
{
	for(b = 0; b < document.forms.length; b++)
	{
		var ele = document.forms[b].elements;
		for(var r = 0; r < ele.length; r++)
		{
			if(ele[r].type == "checkbox" & ele[r].name != allChk.name)
			{
				if(allChk.checked == true)
				{
					ele[r].checked = true;
				}
				else
				{
					ele[r].checked = false;
				}
			}
		}
	}
}

/**
 * Confirms if the user wants to delete the passed record
 */
function confirmDelete()
{
	var conf = confirm("Do you really want to delete this record?");
	if(conf)
	{
		return true;
	}
	else
	{
		return false;
	}
}

/**
 * Expands the recurrence section to show the days and months
 */
function expand(divToExpand)
{
	var cd = document.getElementById(divToExpand);
	cd.style.display = "block";
}

/**
 * Collapses the recurrence section, hiding the days and months
 */
function collapse(divToCollapse)
{
	var cd = document.getElementById(divToCollapse);
	cd.style.display = "none";
}
