var PAGEHEIGHT = 585;
var PAGEWIDTH = 585;

function DivScroller(div_id, heightOffset) {
	this.div = document.getElementById(div_id);
	if (this.div==null) {
		alert("Incomplete transmission. Please refresh the page. ["+div_id+"]");
		return;
	}
	this.heightOffset = heightOffset;
	window._divScroller = this;
	window.onresize = function() { _divScroller.update(); }
	this.update();
}

DivScroller.prototype.update = function() {
	var ws = getWindowSize();
	if (ws.height < PAGEHEIGHT || ws.width < PAGEWIDTH) {
		this.div.style.height = "";
	} else {
		this.div.style.height = PAGEHEIGHT - this.heightOffset;
	}
}
//////////////////////////////////////////////////////////////// util
function getWindowSize() {
	var winW = 630, winH = 460;
	if (parseInt(navigator.appVersion)>3) {
	 if (navigator.appName=="Netscape") {
		winW = window.innerWidth-16;
		winH = window.innerHeight-16;
	 }
	 if (navigator.appName.indexOf("Microsoft")!=-1) {
		winW = document.body.offsetWidth-20;
		winH = document.body.offsetHeight-20;
	 }
	}
	return { width: winW, height: winH };
}


