function getDocumentHeight(doc){
	var mdoc=doc||document;
	if (mdoc.compatMode=='CSS1Compat'){
		return mdoc.body.offsetHeight;
	} else {
		if ($.browser.msie) return mdoc.body.scrollHeight;
		else return $(mdoc.body).height();
	}
}

// Set specific variable to represent all iframe tags.
var classeSelecao='', iFrames;

// Resize heights.
function iResize(){
	var iFrameHeight;
	var minIFrameHeight=$(window).height()-296;
	
	// Iterate through all iframes in the page.
	for (var i=0, j=iFrames.length; i<j; i++){
		if((classeSelecao.length>0 && iFrames[i].className==classeSelecao) || classeSelecao.length==0){
			// Get the body height of the iframed content.
			try { iFrameHeight=getDocumentHeight(iFrames[i].contentWindow.document); } catch (e){ return false; }
			
			// Get the body height of the iframed content.
			if(iFrameHeight<minIFrameHeight) iFrameHeight=minIFrameHeight;
			
			// Set inline style height.
			try { iFrames[i].style.height=iFrameHeight+'px'; } catch(e) { return false; }
		}
	}
}

$(document).ready(function(){
	iFrames=document.getElementsByTagName('iframe');
	
	// Start timer when loaded.
	$('iframe').load(function(){
		setTimeout(iResize, 0);
	});
});
