function getBrowserWindowHeight() {
  var docElement=document.documentElement;
  return self.innerHeight || (docElement && docElement.clientHeight) || document.body.clientHeight;
}

function getBrowserWindowWidth() {
  var docElement=document.documentElement;
  return self.innerWidth || (docElement && docElement.clientWidth) || document.body.clientWidth;
}

function getBrowserScrollTop() {
  var docElement=document.documentElement;
  return self.pageYOffset || (docElement && docElement.scrollTop) || document.body.scrollTop;
}

function getBrowserScrollLeft() {
  var docElement=document.documentElement;
  return self.pageXOffset || (docElement && docElement.scrollLeft) || document.body.scrollLeft;
}

function getDocumentHeight() {
	return Math.max(document.body.scrollHeight,document.body.offsetHeight);
}

DivUtils=new Object();

DivUtils.clear=function(divObj) {
	while (divObj.hasChildNodes()) {
		divObj.removeChild(divObj.firstChild);
	}
}

DivUtils.centerOnPage=function(divObj) {
	divObj.style.left=(Math.round((getBrowserWindowWidth()-divObj.offsetWidth)/2)+getBrowserScrollLeft())+"px";
	var verticalPos=Math.round((getBrowserWindowHeight()-divObj.offsetHeight)/2)+getBrowserScrollTop();
	if (verticalPos+divObj.offsetHeight>getDocumentHeight()) {
		divObj.style.top=(getDocumentHeight()-divObj.offsetHeight)+"px";
	} else {
		divObj.style.top=verticalPos+"px";
	}
}