function calcHeightX() {
	var win=document.getElementById("contentIFrame")?window:window.top;
	var iframe = win.document.getElementById("contentIFrame");
	if (!iframe) return false;
	var the_height = 0;
	var the_scroll = "no";
	var the_message = null;
	var the_test;
	try {
		the_height = iframe.contentWindow.document.body.scrollHeight;
	} catch (e) {
		the_message = e;
	}
	if (the_height < 100) {
		the_height = "100%";
		the_scroll = "auto";
	} else {
		the_height = the_height+"px";
	}
	iframe.style.height = the_height;
	iframe.scrolling = the_scroll;
	return true;
}
function registerCalcHeight() {
	var iframe = document.getElementById('contentIFrame');
	if (!iframe) return;
	if (iframe.contentWindow.addEventListener) {
		iframe.contentWindow.addEventListener('load',calcHeightX,false);
	} else if (iframe.contentWindow.attachEvent) {
		iframe.onreadystatechange=function (){
			if(iframe.readyState == 'complete' || iframe.readyState == 'loaded'){
				calcHeightX();
			}
		}
	}
	if(iframe.contentWindow && iframe.contentWindow.document && iframe.contentWindow.document.documentElement){
		calcHeightX();
	}
}
function registerCalcHeightWindow() {
	if (window.addEventListener) {
		if (window.opera) {
			if(document.readyState == 'loaded' || document.readyState == 'complete' 
					|| document.readyState == 'statecomplete' || document.readyState == 'stateloaded' ) {
				registerCalcHeight();
			} else {                                                                                                
					window.addEventListener('load',registerCalcHeight,false);                                               
			}    
		} else {
			window.addEventListener('load',registerCalcHeight,false);
		}
	} else if (window.attachEvent) {
		if(document.readyState == 'loaded' || document.readyState == 'complete') {
			registerCalcHeight();
		} else {
			window.attachEvent( "onload", registerCalcHeight );
		}
	} else {
		 registerCalcHeight();
	}
}
registerCalcHeightWindow();		

