function getBrowserWindowHeight() {
	if (document.documentElement && document.documentElement.clientHeight) {
		return document.documentElement.clientHeight;
	} 
	if (window.innerHeight!=0) {
		return window.innerHeight;
	}
	return false;
}

function getBrowserWindowWidth() {
	if (document.documentElement && document.documentElement.clientWidth) {
		return document.documentElement.clientWidth;
	} 
	if (window.innerHeight!=0) {
		return window.innerWidth;
	}
	return false;
}

function getBrowserScrollTop() {
	if (document.documentElement && document.documentElement.scrollTop) {
		return document.documentElement.scrollTop;
	} else {
		return document.body.scrollTop;
	}
}

function getBrowserScrollLeft() {
	if (document.documentElement && document.documentElement.scrollLeft) {
		return document.documentElement.scrollLeft;
	} else {
		return document.body.scrollLeft;
	}
}


/* works in ie and firefox - not in opera*/
/*function getDocumentHeight() {
	if (document.documentElement.scrollHeight) {
		return document.documentElement.scrollHeight;
	} else if (document.body.scrollHeight){
		return document.documentElement.clientHeight;
	} else {
		return document.body.offsetHeight;
	}
}*/

/*
function getDocumentHeight() {
	if( window.innerHeight && window.scrollMaxY ) {
		// Firefox 
		return window.innerHeight + window.scrollMaxY;
	} else if( document.body.scrollHeight > document.body.offsetHeight ) {
		 // all but Explorer Mac
		return document.body.scrollHeight;
	} else { 
		// works in Explorer 6 Strict, Mozilla (not FF) and Safari
		return document.body.offsetHeight + document.body.offsetTop; 
	}
}*/

function getDocumentHeight() {
	return(document.getElementById('content').offsetHeight);
}
/*
function getDocumentWidth() {
	if (document.documentElement.scrollWidth) {
		return document.documentElement.scrollWidth;
	} else if (document.body.scrollWidth){
		return document.body.scrollWidth;
	} else {
		return document.body.offsetWidth;
	}
}*/

function getDocumentWidth() {
	return(document.getElementById('content').offsetWidth);
}

DivUtils=new Object();

DivUtils.clear=function(divObj) {
	while (divObj.hasChildNodes()) {
		divObj.removeChild(divObj.firstChild);
	}
}

DivUtils.centerOnPage=function(divObj) {
	var horizontalPos=Math.round((getBrowserWindowWidth()-divObj.offsetWidth)/2)+getBrowserScrollLeft();
	if (horizontalPos<0) horizontalPos=0;
	divObj.style.left=horizontalPos+"px";
	var verticalPos=Math.round((getBrowserWindowHeight()-divObj.offsetHeight)/2)+getBrowserScrollTop();
	if (verticalPos<0) verticalPos=0;
	if (verticalPos+divObj.offsetHeight>getDocumentHeight() && getDocumentHeight()>getBrowserWindowHeight()) {
		divObj.style.top=(getDocumentHeight()-divObj.offsetHeight)+"px";
	} else {
		divObj.style.top=verticalPos+"px";
	}
}

DivUtils.centerVerically=function(divObj) {
	var verticalPos=Math.round((getBrowserWindowHeight()-divObj.offsetHeight)/2)+getBrowserScrollTop();
	if (verticalPos<0) verticalPos=0;
	if (verticalPos+divObj.offsetHeight>getDocumentHeight() && getDocumentHeight()>getBrowserWindowHeight()) {
		divObj.style.top=(getDocumentHeight()-divObj.offsetHeight)+"px";
	} else {
		divObj.style.top=verticalPos+"px";
	}
}