function ContainerResizer(options){
	var self = this;	
	this.HTMLObjects=[];
	this.options = {
		topOffset : 0,
		bottomOffset : 0,
		minHeight : 100,
		afterResize : null,
		beforeResize : null
	}
	
	this.init = function(){
		if (window.attachEvent) window.attachEvent("onresize",function(){self.onResize()});
		if (window.addEventListener) window.addEventListener("resize",function(){self.onResize()},false);	
	}

	this.initOptions = function(options){
		for (var i in options)
			this.options[i] = options[i];
	}
	this.initObjects = function(objects){
		for (var i=0; i<objects.length; i++)	
			if (typeof objects[i] == "string"){
				if (document.getElementById(objects[i])) this.HTMLObjects[this.HTMLObjects.length] = document.getElementById(objects[i]);
			}else{
				if (objects[i]) this.HTMLObjects[this.HTMLObjects.length]=  objects[i];
			}
	}
	
	
	this.size = function(){
		var w = 0;
		var h = 0;
		//IE
		if(!window.innerWidth){
		//strict mode
			if(!(document.documentElement.clientWidth == 0)){
				w = document.documentElement.clientWidth;
				h = document.documentElement.clientHeight;
			}
			//quirks mode
			else {
				w = document.body.clientWidth;
				h = document.body.clientHeight;
			}
		}
		//w3c
		else {
			w = window.innerWidth;
			h = window.innerHeight;
		}
		return {width:w,height:h};
	}
	
	this.currentWindowSize = 0;
	this.onResize = function(){
		var h = this.size().height;
		if (Math.abs(this.currentWindowSize-h)>10){
			this.currentWindowSize = h;
			if (this.options.beforeResize) this.options.beforeResize();
			var h = (h-this.options.topOffset-this.options.bottomOffset);
			h = Math.max(this.options.minHeight,h);
			
			for (var i=0; i<this.HTMLObjects.length; i++)
				this.HTMLObjects[i].style.height=h+"px";
			if (this.options.afterResize) this.options.afterResize();	
		}			
	}
	
	this.initOptions(options);	
	this.init();
}