function _Browser()
{
	this.ver = navigator.appVersion;
	this.agent = navigator.userAgent;
	this.dom = document.getElementById ? 1 : 0;
	this.opera5 = (navigator.userAgent.indexOf("Opera") > -1 && document.getElementById) ? 1 : 0;
	this.IE5 = (this.ver.indexOf("MSIE 5") > -1 && this.dom && !this.opera5) ? 1 : 0; 
	this.IE6 = (this.ver.indexOf("MSIE 6") > -1 && this.dom && !this.opera5) ? 1 : 0;
	this.IE7 = (this.ver.indexOf("MSIE 7") > -1 && this.dom && !this.opera5) ? 1 : 0;
	this.IE4 = (document.all && !this.dom && !this.opera5) ? 1 : 0;
	this.IE = this.IE4 || this.IE5 || this.IE6 || this.IE7;
	this.mac = this.agent.indexOf("Mac") > -1;
	this.ns6 = (this.dom && parseInt(this.ver) >= 5) ? 1 : 0; 
	this.ns4 = (document.layers && !this.dom) ? 1 : 0;
	this.Gecko = navigator.userAgent.indexOf('Gecko') != -1;
	this.Safari = navigator.userAgent.indexOf('Safari') != -1;
	//this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this;
}

var oBrowser = _Browser();


function getAbsX(elt) 
{ 
	return (elt.x) ? elt.x : getAbsPos(elt, "Left"); 
}

function getAbsY(elt) 
{ 
	return (elt.y) ? elt.y : getAbsPos(elt, "Top"); 
}

function getAbsPos(elt,which) 
{
	iPos = 0;
	var x = 0;
	while (elt != null) 
	{
		iPos += elt["offset" + which];
		elt = elt.offsetParent;
		if (++x == 200)
		{
			alert('wow...');
			break;
		}
	}
	return iPos;
}		

function mouseOverImage(id, src)
{
	var el = document.getElementById(id);
	if (el.src)
	{
		el.src = src;
	}
}

function mouseOutImage(id, src)
{
	var el = document.getElementById(id);
	if (el.src)
	{
		el.src = src;
	}
}

function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
	{
	    while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
	}
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }

function enterTriggers(linkbutton, e)
{
	if (!e)
		e = window.event;
	if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13))
	{
		if (window.__doPostBack)
		{
			if (window.showSplash)
				showSplash();
			__doPostBack(linkbutton, '');
		}
		return false;
	}
	else
		return true; 
}

function tieButton(sButtonID, e)
{
	if (!e)
		e = window.event;
	if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13))
	{
		var oButton = document.getElementById(sButtonID);
		oButton.click();
		return false;
	} 
	else 
		return true;
}

function trMouseOver(tr)
{
	trSetState(tr, 'Hover');
}

function trMouseOut(tr)
{
	trSetState(tr, '');
}

function trSetState(tr, state)
{
	var i;
	var aCells = tr.getElementsByTagName("td");
	var len = aCells.length;
	for (i = 0; i < len; i++)
	{
		if (aCells[i].parentNode == tr)
		{
			var tbody = tr.parentNode;
			var aRows = tbody.getElementsByTagName("tr");
			var n = aRows.length - 1;
			while (n > 0 && aRows[n].parentNode != tbody)
				n--; 
			if (aRows[n] != tr)
				aCells[i].className = "cmsListRow" + state;
			else
				aCells[i].className = "cmsLastListRow" + state;
		}
	}
}

function addLoadEvent(func) 
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function') 
		window.onload = func;
	else 
	{
		window.onload = function() {
			if (oldonload) 
			{
				oldonload();
			}
			func();
		}
	}
}

function trMouseOverTwo(tr1, tr2)
{
	var aCells = tr1.getElementsByTagName("td");
	var len = aCells.length;
	for (i = 0; i < len; i++)
	{
		if (aCells[i].parentNode == tr1)
			aCells[i].className = "cmsListRow1Hover";
	}
	aCells = tr2.getElementsByTagName("td");
	len = aCells.length;
	for (i = 0; i < len; i++)
	{
		if (aCells[i].parentNode == tr2)
			aCells[i].className = "cmsListRow2Hover";
	}
}

function trMouseOutTwo(tr1, tr2)
{
	var aCells = tr1.getElementsByTagName("td");
	var len = aCells.length;
	for (i = 0; i < len; i++)
	{
		if (aCells[i].parentNode == tr1)
			aCells[i].className = "cmsListRow1";
	}
	aCells = tr2.getElementsByTagName("td");
	len = aCells.length;
	for (i = 0; i < len; i++)
	{
		if (aCells[i].parentNode == tr2)
			aCells[i].className = "cmsListRow2";
	}
}

function OpenWindow(url, name, width, height)
{
	var left = parseInt((screen.availWidth - width) / 2);
	var top = parseInt((screen.availHeight - height) / 2);
	var win = window.open(url, name, "scrollbars=1,width=" + width + ",height=" + height 
							+ ",top=" + top + ",left=" + left + ",toolbar=0,status=0,menubar=0,links=0,resizable=1");
}
