wo = new (function(){});
wo.browser = new (function()
{
	var ua, i, s;
	ua = navigator.userAgent;

	this.isOpera = (ua.indexOf("Opera")!=-1);
	this.agent = ua.toLowerCase();
	this.isMacintosh = (this.agent.indexOf("mac")!=-1);
	this.isIE = (this.agent.indexOf("msie") != -1);
	this.isMacIE = this.isMacintosh && this.isIE;
	this.isNS = document.layers;
	this.isGecko = (this.agent.indexOf("gecko")!=-1);
	this.isMozilla = (this.agent.indexOf("mozilla")!=-1);
	this.isOpera = this.isOpera5 || this.isOpera6 || this.isOpera7 || this.isOpera8;

	this.version = null;

	if (this.isIE)
	{
		s = "MSIE";
		i = ua.indexOf(s);
		this.version = parseFloat(ua.substr(i + s.length));
		return;
	}
	if (this.isNS)
	{
		s = "Netscape6/";
		i = ua.indexOf(s);
		if (i!=-1)
		{
			this.version = parseFloat(ua.substr(i + s.length));
		}
		else
		{
			s = "Netscape";
			i = ua.indexOf(s);
			this.version = parseFloat(ua.substr(i + s.length));
		}
		return;
	}
	if (this.isOpera)
	{
		s = "Opera/";
		i = ua.indexOf(s);
		if (i!=-1)
		{
			this.version = parseFloat(ua.substr(i + s.length));
		}
		else
		{
			s = "Opera ";
			i = ua.indexOf(s);
			this.version = parseFloat(ua.substr(i + s.length));
		}
		return;
	}
	if (this.isGecko)
	{
		this.version = 6.1;
		return;
	}
});

wo.system = new (function()
{
	this.getObjNN4 = function(obj,name)
	{
		var x = obj.layers;
		var foundLayer;
		for (var i=0;i<x.length;i++)
		{
			if (x[i].id == name)
			{
				foundLayer = x[i];
			}
			else if (x[i].layers.length)
			{
				var tmp = this.getObjNN4(x[i],name);
			}
			if (tmp)
			{
				foundLayer = tmp;
			}
		}
		return foundLayer;
	}

	this.getElementLeft = function(Elem)
	{
		if (wo.browser.isNS)
		{
			var elem = this.getObjNN4(document, Elem);
			return elem.pageX;
		}
		else
		{
			if(document.getElementById)
			{
				var elem = document.getElementById(Elem);
			}
			else if (document.all)
			{
				var elem = document.all[Elem];
			}
			var xPos = elem.offsetLeft;
			var tempEl = elem.offsetParent;
			while (tempEl != null)
			{
				xPos += tempEl.offsetLeft;
				tempEl = tempEl.offsetParent;
			}
			return xPos;
		}
	}
	this.getElementTop = function(Elem)
	{
		if (wo.browser.isNS)
		{
			var elem = this.getObjNN4(document, Elem);
			return elem.pageY;
		}
		else
		{
			if(document.getElementById)
			{
				var elem = document.getElementById(Elem);
			}
			else if (document.all)
			{
				var elem = document.all[Elem];
			}
			var yPos = elem.offsetTop;
			var tempEl = elem.offsetParent;
			while (tempEl != null)
			{
				yPos += tempEl.offsetTop;
				tempEl = tempEl.offsetParent;
			}
			return yPos;
		}
	}
	this.getElementHeight = function(Elem)
	{
		if (wo.browser.isNS)
		{
			var elem = this.getObjNN4(document, Elem);
			return elem.clip.height;
		}
		else
		{
			var xPos;
			if(document.getElementById)
			{
				var elem = document.getElementById(Elem);
			}
			else if (document.all)
			{
				var elem = document.all[Elem];
			}
			if (wo.browser.isOpera && wo.browser.version=="5")
			{
				xPos = elem.style.pixelHeight;
			}
			else
			{
				xPos = elem.offsetHeight;
			}
			return xPos;
		}
	}

	this.getElementWidth = function(Elem)
	{
		if (wo.browser.isNS)
		{
			var elem = this.getObjNN4(document, Elem);
			return elem.clip.width;
		}
		else
		{
			var xPos;
			if(document.getElementById)
			{
				var elem = document.getElementById(Elem);
			}
			else if (document.all)
			{
				var elem = document.all[Elem];
			}
			if (wo.browser.isOpera && wo.browser.version=="5")
			{
				xPos = elem.style.pixelWidth;
			}
			else
			{
				xPos = elem.offsetWidth;
			}
			return xPos;
		}
	}
});
