var js6_Sys_CrossBrowser = {

	isIE : document.all && (!window.opera ? 1 : 0),
	isIE5 : (((document.getElementById) && (document.all) && (document.styleSheets)) ? true : false),
	isNetscape : (((document.getElementById) && (!document.all)) ? true : false),
	isMacUser : (navigator.userAgent.indexOf('Mac') > 0) ? true : false,
	isFF : (window.updateCommands && window.XML) ? true : false,
	isFF1 : ((window.updateCommands && window.XML) && (!window.external)) ? true : false,
	isFF2 : ((window.updateCommands && window.XML) && (window.external) && (!window.postMessage)) ? true : false,
	isFF3 : ((window.updateCommands && window.XML) && (window.postMessage)) ? true : false,
	isFFlt3 : ((window.updateCommands && window.XML) && ((!window.postMessage) || (!window.external))) ? true : false,
	isFFlt35 : ((window.updateCommands && window.XML) && (!document.querySelectorAll)) ? true : false,

	Event : function (
		oEvent)
	{
		// fix the event for IE
		if (window.event) {
			oEvent=window.event;
			if (!oEvent.target) {
				oEvent.target = oEvent.srcElement;
			}
			if (!oEvent.stopPropagation) {
				oEvent.stopPropagation = function () {
					this.cancelBubble = true;
				};
			}
			if (!oEvent.preventDefault) {
				oEvent.preventDefault = function () {
					this.returnValue = false;
				};
			}
		}
		return oEvent;
	},

	MousePos : function (
		oEvent)
	{
		var returnValue = new Object();

		oEvent = js6_Sys_CrossBrowser.Event(oEvent);

		if (!js6_Sys_CrossBrowser.isIE && oEvent.pageX) {
			returnValue.x = oEvent.pageX;
			returnValue.y = oEvent.pageY;
		} else if (document.documentElement && document.documentElement.scrollTop) {
			returnValue.x = oEvent.clientX + document.documentElement.scrollLeft;
			returnValue.y = oEvent.clientY + document.documentElement.scrollTop;
		} else {
			returnValue.x = oEvent.clientX + document.body.scrollLeft;
			returnValue.y = oEvent.clientY + document.body.scrollTop;
		}
			
		return returnValue;
	},

	ObjectPos : function (
		iPosX,
		iPosY,
		oObject)
	{
		var returnValue = new Object();
		returnValue.x = iPosX;
		returnValue.y = iPosY;

		var iOffsetPaddingTop = 0;
		var iOffsetScrollTop = 0;
		var iOffsetPaddingLeft = 0;
		var iOffsetScrollLeft = 0;
		if ((oObject) && (oObject.parentNode)) {
			var oOffsetPadding = oObject.parentNode;
			while (oOffsetPadding.offsetParent) {
				iOffsetPaddingTop += oOffsetPadding.offsetTop;
				iOffsetScrollTop += oOffsetPadding.scrollTop;
				iOffsetPaddingLeft += oOffsetPadding.offsetLeft;
				iOffsetScrollLeft += oOffsetPadding.scrollLeft;
				oOffsetPadding = oOffsetPadding.offsetParent;
			}
		}

		returnValue.x -= iOffsetPaddingLeft;
		returnValue.y -= iOffsetPaddingTop;

		//if (js6_Sys_CrossBrowser.isIE) {
			returnValue.x += iOffsetScrollLeft;
			returnValue.y += iOffsetScrollTop;
		//}

		return returnValue;
	},

	MouseObjectPos : function (
		oEvent,
		oObject)
	{
		var oMousePos = js6_Sys_CrossBrowser.MousePos(oEvent);
		var returnValue = js6_Sys_CrossBrowser.ObjectPos(oMousePos.x, oMousePos.y, oObject);

		return returnValue;
	},

	RegisterFunction : function (
		sName,
		fScope)
	{
		if (window.addEventListener) {
			window.addEventListener(sName, fScope, false);
		} else if (window.attachEvent) {
			window.attachEvent('on' + sName, fScope);
		}
	},
	RegisterOnLoadFunction : function (fScope) { js6_Sys_CrossBrowser.RegisterFunction('load', fScope); },
	RegisterOnUnloadFunction : function (fScope) { js6_Sys_CrossBrowser.RegisterFunction('unload', fScope); },
	RegisterOnResizeFunction : function (fScope) { js6_Sys_CrossBrowser.RegisterFunction('resize', fScope); },

	GetElementByName : function (
		sName,
		oObject,
		oWindow)
	{
		if (js6_Sys_CrossBrowser.isIE) {
			var aRet = new Array();

			// fix the getElementByName for IE
			if (('object' == typeof oObject) && (oObject)) {
				if (sName == oObject.getAttribute('name')) {
					aRet.push(oObject);
				}

				if (oObject.childNodes) for (var ii in oObject.childNodes) {
					try {
						aRet = aRet.concat(js6_Sys_CrossBrowser.GetElementByName(sName, oObject.childNodes[ii]));
					} catch (sError) { }
				}
			}

			return aRet;
		} else {
			if (('object' == typeof oWindow) && (oWindow)) {
				return oWindow.document.getElementsByName(sName);
			} else {
				return document.getElementsByName(sName);
			}
		}
	}
};
