
//window.onResize="updateBgDivHeight();";

function updateBgDivHeight() {
	inHeight = 0;
	if (window.innerHeight) {
		inHeight = window.innerHeight;
	} else if (document.documentElement.clientHeight && document.documentElement.clientHeight > 0) {
		inHeight = document.documentElement.clientHeight;
	} else if (document.body.clientHeight) {
		inHeight = document.body.clientHeight;
	} else return;
	//-----------------------------------------------
	frameHeight = getContentFrameHeight() + 265;
	inHeight    = inHeight - 21;
	
	divOut = document.getElementById('out_div');
	
	if (inHeight > frameHeight ) {
		divOut.style.height = inHeight + 'px';
	} else {
		divOut.style.height = frameHeight + 'px';
	}
	
	//alert(inHeight + ':' + frameHeight + ":" + divOut.style.height);
}

function getContentFrameHeight() {
	frame = document.getElementById('ContentFrame');
    innerDoc = (frame.contentDocument) ? frame.contentDocument 
                                       : frame.Document;
    obj = (frame.style) ? frame.style : frame;

    newHeight = (document.all)?innerDoc.body.scrollHeight + 40
                              :innerDoc.body.offsetHeight + 16 + 20 + 5;
    // here we limit the minimal height to 300px
    // because of VertLine_Top&Bot images
    if (newHeight < 300) { newHeight = 300; } 
	newHeight = 545;
    return newHeight;
}

function fitToContent() {
   
  try {
     newHeight = getContentFrameHeight();
     
     td = document.getElementById('ContentTD');
     td.height = newHeight;
     
     newHeight = newHeight - 151; //sum of bot+top images
     
     td = document.getElementById('leftFill');
     td.height = newHeight;
     td = document.getElementById('rightFill');
     td.height = newHeight;
     
     updateBgDivHeight();
  } catch(err) { window.status = err.message; }

}