/*
 * Copyright 2006 Grant Zanetti
 */

function getOffsetLeft(obj)
{
	var o = 0;

	while (obj)
	{
		o += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	return(o);
}

function getOffsetTop(obj)
{
	var o = 0;

	while (obj)
	{
		o += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return(o);
}

function pageHeight()
{
	var h;

	if (!document.all)
		h = window.innerHeight;
	else
		h = document.documentElement.offsetHeight;
	
	return(h);
}

function pageWidth()
{
	var w;

	if (!document.all)
		w = window.innerWidth;
	else
		w = document.documentElement.offsetWidth;
	
	return(w);
}

function decodeForXML(string)
{
	string = string.replace(/&amp;/g, '&');
	string = string.replace(/&gt;/g, '>');
	string = string.replace(/&lt;/g, '<');

	return(string);
}

function encodeForXML(string)
{
	string = string.replace(/&/g, '&amp;');
	string = string.replace(/>/g, '&gt;');
	string = string.replace(/</g, '&lt;');

	string = string.replace(/&/g, '%26');
	string = string.replace(/;/g, '%3B');

	return(string);
}

