// browser detection
var browser = new Browser();

function Browser()
{
	this.Win32 = (navigator.platform == "Win32");
	this.FiltersAndBehaviors = /MSIE ((5\.5)|[6789])/.test(navigator.userAgent) && this.Win32;
	this.Gecko = /Gecko/.test(navigator.userAgent);
	this.Ie =  /MSIE [456789]/.test(navigator.userAgent);
	this.CSS2 = this.FiltersAndBehaviors && this.Gecko;
	this.Mac = /mac/.test(navigator.userAgent.toLowerCase());
}


// get generic object
function utilGetObject(objName)
{
	var obj; 
	if (typeof(objName) == "object")
	{
		obj = objName;
	}
	else
	{
		if (browser.Gecko||browser.Ie)
		{
			obj = document.getElementById(objName);
		}
		else
		{
			obj = null;
		}
	}
	return obj;
}

function GetRealLeft(obj)
{
	var result = obj.offsetLeft;
	var parent = obj.offsetParent;
	while (parent != null)
	{
		result += parent.offsetLeft;
		parent = parent.offsetParent;
	}
	if(browser.Ie&&browser.Mac)
	{
		result += parseInt(document.body.leftMargin);
	}
	return result;
}

function GetRealTop(obj)
{
	var result = obj.offsetTop;
	var parent = obj.offsetParent;
	while (parent != null)
	{
		result += parent.offsetTop;
		parent = parent.offsetParent;
	}
	if(browser.Ie&&browser.Mac)
	{
		result += parseInt(document.body.topMargin);
	}
	return result;
}