
//*---* Include the iBox script

document.write("<script type=\"text/javascript\" src=\"/GLOBAL/ibox/ibox.js\"></scr" + "ipt>");
addLoadEvent(function () { iBox.setPath('/GLOBAL/ibox/'); } );




function addLoadEvent(func)
{
	if (window.attachEvent)
		window.attachEvent("onload", func);
	else if (window.addEventListener)
		window.addEventListener("load", func, false);
	else
		document.addEventListener("load", func, false);
}




//*-----------------------------------------------------------------------------
//		PAGE HEIGHT + WIDTH
//*-----------------------------------------------------------------------------

var pageHeight;
var pageWidth;

function getPageSize()
{
	if (window.innerHeight && window.scrollMaxY)
	{
		pageWidth = window.innerWidth + window.scrollMaxX;
		pageHeight = window.innerHeight + window.scrollMaxY;
	}
	else if (document.body.scrollHeight > document.body.offsetHeight)
	{
		pageWidth = document.body.scrollWidth;
		pageHeight = document.body.scrollHeight;
	}
	else
	{
		pageWidth = document.body.offsetWidth + document.body.offsetLeft;
		pageHeight = document.body.offsetHeight + document.body.offsetTop;
	}
}


function getElementsByClass(searchClass,node,tag)
{
	var classElements = new Array();

	if (node == null)
		node = document;

	if (tag == null)
		tag = '*';

	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)" + searchClass + "(\\s|$)");

	for (var i=0, j=0; i<elsLen; i++)
	{
		if (pattern.test(els[i].className))
		{
			classElements[j] = els[i];
			j++;
		}
	}

	return classElements;
}


function openWin(value)
{
	//*---* Statically declare a container to hold our window objects

	if(typeof openWin.openWindows == 'undefined')
		openWin.openWindows = new Array();


	//*---* If the window is already open, focus it. Otherwise, create it

	if (openWin.openWindows[value] && !openWin.openWindows[value].closed )
		openWin.openWindows[value].focus();
	else
		openWin.openWindows[value] = window.open(value, '_blank' ,'resizable=yes,width=700,height=600,status=no,location=no,toolbar=no,menubar=no,scrollbars=yes');
}


//*-----------------------------------------------------------------------------
//		MAILTO LINKS
//*-----------------------------------------------------------------------------

function m(n,d,s,txt)
{
	if (txt == null)
		document.write('\74'+'a href="mail'+'to\72'+n+'\100'+d+'\56'+s+'">'+n+'\100'+d+'\56'+s+'\74'+'/a'+'\76');
	else
		document.write('\74'+'a href="mail'+'to\72'+n+'\100'+d+'\56'+s+'">'+txt+'\74'+'/a'+'\76');
}


//*-----------------------------------------------------------------------------
//		STRIP SPACES (FROM BEGINNING AND END)
//*-----------------------------------------------------------------------------

function trim(e)
{
	// get the object the event was called on
	var targ = (e.target) ? e.target : e.srcElement;

	// get the value of that field
	test = targ.value;

	// reset the value of the object
	targ.value = test.replace(/^\s+|\s+$/g, "");
}


//*-----------------------------------------------------------------------------
//		CLEAR SELECTIONS ON RADIO BUTTONS OR DROP DOWNS
//*-----------------------------------------------------------------------------

function clearSelections(name)
{
	var obj = document.thisForm[name];
	if (obj.options)
	{
		for (i = 0; i < obj.options.length; i++)
			obj.options[i].selected = false;
	}
	else
	{
		for (i = 0; i < obj.length; i++)
			obj[i].checked = false;
	}
}


//*-----------------------------------------------------------------------------
//		EXPAND OR COLLAPSE AN ELEMENT
//*-----------------------------------------------------------------------------

function show(id)
{
	// show the element
	document.getElementById(id).style.display = "block";
}


function hide(id)
{
	// hide the element
	document.getElementById(id).style.display = "none";
}

function toggleHidden(id, oppositeDiv)
{
    if (document.getElementById(id).style.display == "none") {
        document.getElementById(id).style.display = "block";
        if (document.getElementById(oppositeDiv))
            document.getElementById(id).style.display = "none";
    }
    else {
        document.getElementById(id).style.display = "none";
        if (document.getElementById(oppositeDiv))
            document.getElementById(id).style.display = "block";
    }
}

function expand()
{
	for (var i=0; i<expand.arguments.length; i++)
	{
		var element = document.getElementById(expand.arguments[i]);

		if(!element)
			continue;

		//show the element
		//element.style.display = "block";
		element.style.display = "";

		//enable everything inside
		enableChildren(expand.arguments[i]);
	}

	if(typeof validatorResize == 'function')
		validatorResize();
}


function collapse()
{
	for (var i=0; i<collapse.arguments.length; i++)
	{
		var element = document.getElementById(collapse.arguments[i]);

		if(!element)
			continue;

		//hide the element
		element.style.display = "none";

		//disable everything inside
		disableChildren(collapse.arguments[i]);
	}

	if(typeof validatorResize == 'function')
		validatorResize();
}


function showHide(div, field, doOpposite)
{
	if(document.getElementById(field) == null)
		return;

	var f = document.getElementById(field);
	var	isChecked = false;

	if (f.checked)
		isChecked = true;

	if(doOpposite == null || !doOpposite)
		(isChecked) ? expand(div) : collapse(div);
	else
		(isChecked) ? collapse(div) : expand(div);
}


//*-----------------------------------------------------------------------------
//		UNCHECK ELEMENTS WITHIN AN 'ID' ON A PAGE
//*-----------------------------------------------------------------------------


function getChildren(id)
{
	// mark the parent node
	var object = document.getElementById(id);
	var parent = (object != null) ? object : id;

	// get everything inside it. everything.
	return parent.getElementsByTagName('*');
}


function disableChildren(id)
{
	var children = getChildren(id);

	//loop through and uncheck things
	for (var i=0; i<children.length; i++)
	{

		//now disable it (if it has a type it must be an input field)
		if(children[i].type)
			children[i].disabled = true;

		if(children[i].name && document.getElementById(children[i].name))
			document.getElementById(children[i].name).style.display = "none";
	}
}


function enableChildren(id)
{
	var children = getChildren(id);

	// loop through and uncheck things
	for (var i=0; i<children.length; i++)
	{
		children[i].disabled = false;

		if(children[i].name && document.getElementById(children[i].name))
			document.getElementById(children[i].name).style.display = "";
	}
}


/*
function unCheck(obj)
{
	if (obj.type == "checkbox" || obj.type == "radio")
		obj.checked = false;

	if (obj.type == "text")
		obj.value = "";

	if (obj.type == "select-one" || obj.type == "select-multiple")
		for (j=0; j<obj.length; j++)
			obj.options[j].selected = false;
}
*/


