
if (!uAgent)
{
	var uAgent = navigator.userAgent;

	isMac = uAgent.indexOf("Mac") > -1;
	isIE  = uAgent.indexOf("MSIE") > -1;
	isIE4 = uAgent.indexOf("IE 4") > -1;
	isIE5 = uAgent.indexOf("IE 5")  > -1;
	isNav = uAgent.indexOf("Mozilla") > -1 && !isIE;
	gtIE4 = (navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4);
}


function outs(str)
{
	document.write(str);
}


function getParam(paraName)
{
	var queryString = self.location.search.substring(1, self.location.search.length);
	var pairArray   = queryString.split("&");
	var resultArray = new Array();

	for (var i=0; i<pairArray.length; i++)
	{
		var tempArray = pairArray[i].split("=");
		if (tempArray[0].toUpperCase() == paraName.toUpperCase())
		{
			resultArray[resultArray.length] = unescape(tempArray[1]);
		}
	}
	
	if (resultArray.length > 0)
		return resultArray;
	else
		return null;
}

function msg(message)
{
	window.status = message;
	return true;
}

function loadSource(descContainer, strLink)
{
	if (descContainer)
		descContainer.location.href = strLink;
}

function copySource(srcContainer, descContainer, isDeleteSource)
{
	if (srcContainer && descContainer)
	{
		descContainer.innerHTML = srcContainer.innerHTML;
	}
	if (isDeleteSource)
	{
		srcContainer.innerHTML = "";
	}
}

function disableSelect(obj)
{
	if (obj)
	{
		obj.onselectstart = _CancelDrag;
		obj.ondragstart = _CancelDrag;
	}
}

function enableSelect(obj)
{
	if (obj)
	{
		obj.onselectstart = _EnableDrag;
		obj.ondragstart = _EnableDrag;
	}
}


// -- Operation Objects ----------------------------------------------------------------------

function stackObject()
{
	this.query = new Array();
	this.push  = _stackObject_push;
	this.pop   = _stackObject_pop;
}


function _stackObject_push(value)
{
	this.query[this.query.length] = value;
}


function _stackObject_pop()
{
	if (this.query.length)
	{
		var popValue = this.query[this.query.length - 1];

		this.query.length--;

		return popValue;
	}
	else
		return null;
}


// -- Array functions ------------------------------------------------------------------------

function arrayAppend(oArray, item)
{
	oArray[oArray.length] = item;
}


function arrayPrepend(oArray, item)
{
	oArray.length++;

	for (var i=oArray.length-1; i>0; i--)
	{
		oArray[i] = oArray[i-1];
	}
	
	oArray[0] = item;
}


function arrayInsertBefore(oArray, index, item)
{
	oArray.length++;
	
	for (var i=oArray.length-1; i>index; i--)
	{
		oArray[i] = oArray[i-1];
	}
	oArray[index] = item;
}


function arrayInsertAfter(oArray, index, item)
{
	oArray.length++;
	
	for (var i=oArray.length-1; i>index+1; i--)
	{
		oArray[i] = oArray[i-1];
	}
	oArray[index+1] = item;
}


function arrayRemove(oArray, index)
{
	if (index < oArray.length)
	{
		for (var i=index; i<oArray.length; i++)
		{
			oArray[i] = oArray[i+1];
		}
		oArray.length--;
	}
}


// -- Environment Information ----------------------------------------------------------------

function getPageScrollWidth()
{
	if (document.all)
		return document.body.scrollLeft;
	else
		return window.pageXOffset;
}

function getPageScrollHeight()
{
	if (document.all)
		return document.body.scrollTop;
	else
		return window.pageYOffset;
}

function getDocumentWidth()
{
	return (document.all ? document.body.scrollWidth - 20 : (getClientWidth() > document.width-16 ? getClientWidth() : document.width-16));
}

function getDocumentHeight()
{
	return (document.all ? document.body.scrollHeight - 20 : (getClientHeight() > document.height-16 ? getClientHeight() : document.height-16));
}

function getClientWidth()
{
	return (document.all ? document.body.clientWidth - 20 : window.innerWidth - 16)
}

function getClientHeight()
{
	return (document.all ? document.body.clientHeight - 20 : window.innerHeight - 16)
}


// -- Common Objects -------------------------------------------------------------------------

function point(x, y, z)
{
	this.x = (x == null ? 0 : x);
	this.y = (y == null ? 0 : y);
	this.z = (z == null ? 0 : z);
	this.set = _point_set;
}

function _point_set(x, y, z)
{
	this.x = (x == null ? this.x : x);
	this.y = (y == null ? this.y : y);
	this.z = (z == null ? this.z : z);
}


// -- Internal Functions ---------------------------------------------------------------------

function _CancelDrag()
{
	if (window.event)
	{
		window.event.cancelBubble = true;
		window.event.returnValue = false;
	}
}

function _EnableDrag()
{
	if (window.event)
	{
		window.event.cancelBubble = false;
		window.event.returnValue = true;
	}
}

function _missingLibrary(libraryName)
{
	alert("Error:  Missing component(s) from " + libraryName.toUpperCase() + ".JS!");
	
	return false;
}

// -------------------------------------------------------------------------------------------