/********************************************************************************
<++  oDOM:    an OBJECT
	 < bIsIE:    a BIT = this.sAgentUser.indexOf('msie') != -1 ? 1:0;
	 < bIsNav:    a BIT = this.sAgentUser.indexOf('mozilla') != -1 && this.sAgentUser.indexOf('compatible') == -1 ? 1:0;
	 < bIsOpr:    a BIT = this.sAgentUser.indexOf('opera') != -1 ? 1:0;
	 < bIsOpr6orLess = window.opera && this.sAgentUser.search(/opera.[1-6]/i) != -1;
	 < iVersion:    an INTEGER
	 < sBrowser:    a STRING (NS | IE | Other)
	 < sOSystem:    a STRING (Mac | Win | Other)
	 < bIsID:    a BIT
	 < bIsAll:    a BIT
	 < bIsLayers:    a BIT
	 < bIsDHTML:    a BIT
	 < vis_hide:    a STRING (hide | hidden) - NS4 used "hide" instead of "hidden"
	 < vis_show:    a STRING (show | visible) - NS4 used "show" instead of "visible"
	 < findDom(parent layer ID, layer ID, style):    a FUNCTION
	 	parent layer ID:  a STRING - used only with Netscape 4 if there is a parent layer (DIV tags are stacked)
		layer ID:  a STRING
		style:  a BIT
	 	returns:  an OBJECT - a CSS object if style is 1
	 < clientWidth():    a FUNCTION
	 	returns:  an INTEGER - width of client window
	 < clientHeight():    a FUNCTION
	 	returns:  an INTEGER - height of client window
	 < pgScrollLeft():    a FUNCTION
	 	returns:  an INTEGER - left scrolling
	 < pgScrollTop():    a FUNCTION
	 	returns:  an INTEGER - top scrolling
	 < pgScrollHeight():    a FUNCTION
	 	returns:  an INTEGER - total vertical scroll length
	 < pgScrollWidth():    a FUNCTION
	 	returns:  an INTEGER - total horizontal scroll length
********************************************************************************/

var oDOM = new checkDOM();

function checkDOM(){
	this.sAgentUser = navigator.userAgent.toLowerCase();
	this.bIsIE = this.sAgentUser.indexOf('msie') != -1 ? 1:0;
	this.bIsNav = this.sAgentUser.indexOf('mozilla') != -1 && this.sAgentUser.indexOf('compatible') == -1 ? 1:0;
	this.bIsOpr = this.sAgentUser.indexOf('opera') != -1 ? 1:0;
	this.bIsOpr6orLess = window.opera && this.sAgentUser.search(/opera.[1-6]/i) != -1;
	this.iVersion = parseInt(navigator.appVersion);  <!--- Is not always the browser version --->
	this.sBrowser = (navigator.appName.indexOf('Netscape') != -1) ? 'NS':(navigator.appName.indexOf('Microsoft Internet Explorer') != -1) ? 'IE':'Other';
	this.sOSystem = (navigator.appName.indexOf('Mac') != -1) ? 'Mac':(navigator.appName.indexOf('Win') != -1) ? 'Win':'Other';
	this.bIsID = (document.getElementById) ? 1:0;
	this.bIsAll = (document.all) ? 1:0;
	this.bIsLayers = ((this.sBrowser == 'NS') && (this.iVersion == 4)) ? 1:0;
	this.bIsDHTML = (this.bIsID || this.bIsAll || this.bIsLayers);
	(this.bIsLayers) ? this.vis_hide = 'hide' : this.vis_hide = 'hidden';
	(this.bIsLayers) ? this.vis_show = 'show' : this.vis_show = 'visible';
	this.findDOM = findDOMfunction;
	this.clientWidth = clientWidthFunction;
	this.clientHeight = clientHeightFunction;
	this.pgScrollLeft = pgScrollLeftFunction;
	this.pgScrollTop = pgScrollTopFunction;
	this.pgScrollHeight = pgScrollHeightFunction;
	this.pgScrollWidth = pgScrollWidthFunction;
	return this;
}

function findDOMfunction(sElementID1, sElementID2, bWithStyle) {
	if(bWithStyle == 1) {
		if(this.bIsID) {
			return(document.getElementById(sElementID2).style);
		} else { 
			if(this.bIsAll) {
				return(document.all[sElementID2].style);
			} else {
				if(this.bIsLayers) {
					if(sElementID1) {
						return(document.layers[sElementID1].layers[sElementID2]);
					}else{
						return(document.layers[sElementID2]);
					}
				}
			}
		}
	} else {
		if(this.bIsID) {
			return(document.getElementById(sElementID2));
		} else { 
			if(this.bIsAll) {
				return(document.all[sElementID2]);
			} else {
				if(this.bIsLayers) {
					if(sElementID1) {
						return(document.layers[sElementID1].layers[sElementID2]);
					}else{
						return(document.layers[sElementID2]);
					}
				}
			}
		}
	}
}

function clientWidthFunction() {
	var x;
	if (self.innerWidth) {
		x = self.innerWidth; // all except Explorer
		if(document.body && document.body.clientWidth < x) {x = document.body.clientWidth} // adjust for scrollbars
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{x = document.documentElement.clientWidth;} // Explorer 6 Strict Mode
	else if (document.body) {x = document.body.clientWidth;} // other Explorers
	return x;
}

function clientHeightFunction() {
	var y;
	if (self.innerHeight) { // all except Explorer
		y = self.innerHeight;
		if(document.body && document.body.clientHeight < y) {y = document.body.clientHeight} // adjust for scrollbars
	}
	else if (document.documentElement && document.documentElement.clientHeight)
	{y = document.documentElement.clientHeight;} // Explorer 6 Strict Mode
	else if (document.body) {y = document.body.clientHeight;} // other Explorers
	return y;
}

function pgScrollLeftFunction() {
	var x;
	if (self.pageXOffset){x = self.pageXOffset;} // all except Explorer
	else if (document.documentElement && document.documentElement.scrollLeft)
	{x = document.documentElement.scrollLeft;} // Explorer 6 Strict
	else if (document.body) {x = document.body.scrollLeft;} // all other Explorers
	return x;
}

function pgScrollTopFunction() {
	var y;
	if (self.pageYOffset) {y = self.pageYOffset;} // all except Explorer
	else if (document.documentElement && document.documentElement.scrollTop)
	{y = document.documentElement.scrollTop;} // Explorer 6 Strict
	else if (document.body) {y = document.body.scrollTop;} // all other Explorers
	return y;
}

function pgScrollHeightFunction() {
	var y;
	var test1 = document.body.scrollHeight;
	var test2 = document.body.offsetHeight;
	if (test1 > test2) {y = document.body.scrollHeight;} // all but Explorer Mac
	else {y = document.body.offsetHeight;} // Explorer Mac; would also work in Explorer 6 Strict, Mozilla and Safari
	return y;
}

function pgScrollWidthFunction() {
	var x;
	var test1 = document.body.scrollWidth;
	var test2 = document.body.offsetWidth;
	if (test1 > test2) {x = document.body.scrollWidth;} // all but Explorer Mac
	else {x = document.body.offsetWidth;} // Explorer Mac; would also work in Explorer 6 Strict, Mozilla and Safari
	return x;
}
