function DynDiv (layer, height, func) {
	this.layer = layer;
	document.documentElement.style.overflow = "hidden";
	this.HEIGHT_MODIFICATOR = height;
	this.condition_function = func;
	this.isOn = false;
	this.doLayout();
	this.originalHeight = "";
}

DynDiv.enabledCount = 0;

/*void*/ DynDiv.prototype.doLayout = function() {
	if (this.condition_function()) {
		if (!this.isOn)
			this.turnOn();
		this.setMaxAvailHeight();
	} else
	{
		if (this.isOn)
			this.turnOff();
	}
}

/*void*/ DynDiv.prototype.turnOn = function() {
	this.isOn = true;
	this.originalHeight = this.layer.style.height;
}

/*void*/ DynDiv.prototype.turnOff = function() {
	this.isOn = false;
	this.layer.style.height = "";
}

/*number*/ DynDiv.prototype.getMaxAvailHeight = function() {
	if (document.all) {
		var height = document.documentElement.clientHeight - this.HEIGHT_MODIFICATOR;
	} else {
		var height = window.innerHeight - this.HEIGHT_MODIFICATOR;
	}
	return height;
}

/*void*/ DynDiv.prototype.setMaxAvailHeight = function () {
	this.layer.style.height = this.getMaxAvailHeight() + "px";
	if (document.getElementById('main_default_cont').offsetHeight < this.getMaxAvailHeight()) {
		document.getElementById('main_default_cont').style.height = this.getMaxAvailHeight()-4 + "px";
	}
	
	
}
