var vScrollingContent, sHeight, cHeight, defaultScrollingContentHeight=360;
function resizeScrollingContent(){
	if (vScrollingContent.length){
		cHeight=self.innerHeight?self.innerHeight:((document.documentElement&&document.documentElement.clientHeight)?document.documentElement.clientHeight:document.body.clientHeight);
		for (var i=0;i<vScrollingContent.length;i++){
			vScrollingContent[i].style.height=getScrollingContentHeight(sHeight,cHeight,vScrollingContent[i].oHeight)+"px";
		}
	}else{
		if (window.removeEventListener){
			window.removeEventListener("resize",resizeScrollingContent,false);
		}else if (window.detachEvent){
			window.detachEvent("onresize",resizeScrollingContent);
		}
	}
}
function captureScrollingContent(){
	vScrollingContent=new Array();
	var n, i=0;
	while (document.getElementById("scrollingContent"+i)){
		n=vScrollingContent.length;
		vScrollingContent[n]=document.getElementById("scrollingContent"+i);
		vScrollingContent[n].oHeight=vScrollingContent[n].offsetHeight;
		vScrollingContent[n].style.height=defaultScrollingContentHeight+"px";
		i++;
	}
	sHeight=document.body.offsetHeight<document.body.scrollHeight?document.body.offsetHeight:document.body.scrollHeight;
}
function getScrollingContentHeight(sHeight,cHeight,oHeight){
	var height=defaultScrollingContentHeight;
	if (sHeight<cHeight){
		height=Math.min(
			oHeight,
			Math.floor(defaultScrollingContentHeight+((cHeight-sHeight)/vScrollingContent.length))
		);
	}
	return Math.max(defaultScrollingContentHeight,height);
}
function setDefaultScrollingContentHeight(v){
	defaultScrollingContentHeight=!isNaN(v=parseInt(v))?v:defaultScrollingContentHeight;
}
if (window.addEventListener){
	window.addEventListener("load",function(){captureScrollingContent();resizeScrollingContent();},false);
	window.addEventListener("resize",resizeScrollingContent,false);
}else if (window.attachEvent){
	window.attachEvent("onload",function(){captureScrollingContent();resizeScrollingContent();});
	window.attachEvent("onresize",resizeScrollingContent);
}

