//<script type="text/javascript">
/*************************************************************************
This code sets the height of an iFrame in an ancestor document
up to 3 generations above the calling document

Ensure that the iFrame in the HTML document has an ID not just a name
*************************************************************************/
function setAncestorIframeHeight(id, ancestor) {
	var newHeight=document.body.scrollHeight + 50;

	if (newHeight < 500) newHeight=500;
	//alert(newHeight);

	if (ancestor == 0 && document.getElementById(id)) {
		document.getElementById(id).height=newHeight;
		return true;
	}
	else if (ancestor == 1 && parent.document.getElementById(id)) {
		parent.document.getElementById(id).height=newHeight;
		return true;
	}
	else if (ancestor == 2 && parent.parent.document.getElementById(id)) {
		parent.parent.document.getElementById(id).height=newHeight;
		return true;
	}
	else if (ancestor == 3 && parent.parent.parent.document.getElementById(id)) {
		parent.parent.parent.document.getElementById(id).height=newHeight;
		return true;
	}
	else {
		alert('Could not set iFrame height');
		return false;
	}
} 
//</script>
