// 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());
}


function openQTwin(url, width, height) 
{

	var qtwin = window.open(url, "QuickTime", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width='+width+',height='+height);
	qtwin.focus();
	//qtwin.close();
}

var menuTopOffset = 0;
var menuLeftOffset = 30;
//if (browser.Ie) {
//	menuTopOffset = 0;
//	menuLeftOffset = 30;
//}
	
//if (innerpage) menuTopOffset = 175;

//if (browser.Ie) menuLeftOffset = 75;

// 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)
{
	//alert('GetRealTop: [' + obj.id + '] [' + document.getElementById(obj.id).coords + ']');

	// Use this logic since we are using imagemap and IE and Netscape handles imagemap differently
	/*
	var theCoords = document.getElementById(obj.id).coords.split(',');
	var result = parseInt(theCoords[1], 10);
	*/
	
	/*
	iLeft += parseInt(theCoords[0], 10)
	iTop += parseInt(theCoords[1], 10);
	iLeft += parseInt(theCoords[2], 10)-10;
	iTop += parseInt(theCoords[2], 10)-10;
	*/
	
	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;
}
