function Is() {
	var agent = navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.minor = parseFloat(navigator.appVersion);
	this.ns = ((agent.indexOf('mozilla') != -1) && (agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1) && (agent.indexOf('opera') == -1) && (agent.indexOf('webtv') == -1));
	this.ns2 = (this.ns && (this.major == 2));
	this.ns3 = (this.ns && (this.major == 3));
	this.ns4 = (this.ns && (this.major == 4));
	this.ns6 = (this.ns && (this.major >= 5));
	this.ie = (agent.indexOf("msie") != -1);
	this.ie3 = (this.ie && (this.major < 4));
	this.ie4 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") == -1));
	this.ie5 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") != -1));
	this.ieX = (this.ie && !this.ie3 && !this.ie4);
}

var is = new Is();

function getX(obj) {
  return( obj.offsetParent==null ? obj.offsetLeft : obj.offsetLeft+getX(obj.offsetParent) );
}

function getY(obj) {
  return( obj.offsetParent==null ? obj.offsetTop : obj.offsetTop+getY(obj.offsetParent) );
}

function browserWidth() {
	var width = 0;
	if (typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		width = window.innerWidth;
	} else if (document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight )) {
		//IE 6+ in 'standards compliant mode'
		width = document.documentElement.clientWidth;
	} else if (document.body && ( document.body.clientWidth || document.body.clientHeight )) {
		//IE 4 compatible
		width = document.body.clientWidth;
	}
	return width;
}
function browserHeight() {
	var height = 0;
	if (typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		height = window.innerHeight;
	} else if (document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight )) {
		//IE 6+ in 'standards compliant mode'
		height = document.documentElement.clientHeight;
	} else if (document.body && ( document.body.clientWidth || document.body.clientHeight )) {
		//IE 4 compatible
		height = document.body.clientHeight;
	}
	return height;
}
function TopY() {
  var Y = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    Y = window.pageYOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    Y = document.body.scrollTop;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    Y = document.documentElement.scrollTop;
  }
  return Y;
}

function LeftX() {
  var X = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    X = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    X = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    X = document.documentElement.scrollLeft;
  }
  return X;
}

function helpText(objID,display,objItem) {
	img = 'img_'+objID;
	objImg = document.getElementById(img);
	help = 'help_'+objID;
	objHelp = document.getElementById(help);
	objHelp.style.top = getY(objImg);
	objHelp.style.left = getX(objImg);
	if (objItem.value.length == 0) {
		if (display) {
			objHelp.style.visibility = 'visible';
		} else {
			objHelp.style.visibility = 'hidden';
		}
	} else {
		objHelp.style.visibility = 'hidden';
	}
}

// Highlights required form fields
function ErrHighlight(objItem,message) {
	if (objItem.length) {
		for (i = 0; i < objItem.length; i++) {
			objItem[i].style.backgroundColor = '#FFCC00';
		}
	} else {
		objItem.style.backgroundColor = '#FFCC00';
		objItem.focus();
	}
	if (message.length > 0) {
		alert(message);
	}
	return false;
}
function ErrClear(objItem) {
	objItem.style.backgroundColor = '#FFFFFF';
}
