function findPosition( oLink ) {  //positioning for use w/ menus
  if( oLink.offsetParent ) {
    for( var posX = 0, posY = 0; oLink.offsetParent; oLink = oLink.offsetParent ) {
      posX += oLink.offsetLeft;
      posY += oLink.offsetTop;
    }
    return [ posX, posY ];
  } else {
    return [ oLink.x, oLink.y ];
  }
}

function getPageScrollOffset(){
	var x,y;
	if (self.pageYOffset) {// all except Explorer
		x = self.pageXOffset;
		y = self.pageYOffset;
	}else if (document.documentElement && document.documentElement.scrollTop){// Explorer 6 Strict
		x = document.documentElement.scrollLeft;
		y = document.documentElement.scrollTop;
	}else if (document.body) {// all other Explorers
		x = document.body.scrollLeft;
		y = document.body.scrollTop;
	}
	return [x,y];
}
function getWindowSize(){
	var x,y;
	if (self.innerHeight){ // all except Explorer
		x = self.innerWidth;
		y = self.innerHeight;
	}else if (document.documentElement && document.documentElement.clientHeight){// Explorer 6 Strict Mode
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}else if (document.body){ // other Explorers
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	return [x,y];
}

function getPageSize(){
	var x,y;
	var test1 = document.body.scrollHeight;
	var test2 = document.body.offsetHeight;
	if (test1 > test2){ // all but Explorer Mac
		x = document.body.scrollWidth;
		y = document.body.scrollHeight;
	}else{ // Explorer Mac; would also work in Explorer 6 Strict, Mozilla and Safari
		x = document.body.offsetWidth;
		y = document.body.offsetHeight;
	}
	return [x,y];
}

function addCommas(nStr){ //add commas to a number
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

function removeCommas(str) {
	var aNum = str;
	aNum=aNum.replace(/,/g,"");//remove any commas
	aNum=aNum.replace(/\s/g,"");//remove any spaces

	return aNum;
}

/* AJAX cross browser */
function newRequest() {
	var request = null;
	try { 
		request = new XMLHttpRequest();
	} catch (trymicrosoft) {
		try {
			request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (othermicrosoft) {
			try {
				request = new ActiveObject("Microsoft.XMLHTTP");
			} catch (failed) {
				request = null;
				//alert ("Ajax request failed")
			}
		}
	}
	return request;
}



