/* Layout functions */

function getBodyHeight() {
	var y;
	if (self.innerHeight) // all except Explorer
		y = self.innerHeight;
	
	// Explorer 6 Strict Mode
	else if (document.documentElement && document.documentElement.clientHeight)
		y = document.documentElement.clientHeight;
	else if (document.body) // other Explorers
		y = document.body.clientHeight;
	
	return y;
}

function getBodyWidth() {
	var x;
	if (self.innerWidth) // all except Explorer
		x = self.innerWidth;
	// Explorer 6 Strict Mode
	else if (document.documentElement && document.documentElement.clientWidth)
		x = document.documentElement.clientWidth;
	else if (document.body) // other Explorers
		x = document.body.clientWidth;
	
	return x;
}

function setEventListener(obj, evt, handler, captures)
{
	if (obj.addEventListener) {	
		obj.addEventListener(evt, handler, captures);
	}
	else if(obj.attachEvent) {
		// IE
		obj.detachEvent('on' + evt, handler);
		obj.attachEvent('on' + evt, handler);
	}
}
function readjustIframe(loadevt) {
	var crossevt=(window.event)? event : loadevt;
	var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement;
	if (iframeroot)
		resizeIframe(iframeroot.id);
} 

function resizeIframe(iframeID) {
	document.body.style.height = getBodyHeight();

	var i = document.getElementById(iframeID);
	var newHeight;

	if (i){
		// Opera
		if(i.contentWindow && i.contentWindow.document.body.scrollHeight) {
			newHeight = i.contentWindow.document.body.scrollHeight + 15;			 
		} 
		 // Firefox
		else if (i.contentDocument && i.contentDocument.height) {
			newHeight = i.contentDocument.height + 26;	
		}
		// IE 
		else if (i.Document && i.Document.body.scrollHeight)
			newHeight = i.Document.body.scrollHeight;

		// minimum height
		if(newHeight == undefined || newHeight == NaN || newHeight < 500)
			newHeight = 500;
		else
			newHeight = newHeight;

		i.style.height = newHeight + 'px'; 
	}
}	



 