function doIframe(){
	o = document.getElementsByTagName('iframe');
	for(i=0;i<o.length;i++){
		if (/\bautoHeight\b/.test(o[i].className)){
			setHeight(o[i]);
			addEvent(o[i],'load', doIframe);
		}
	}
}

function setHeight(e)
{
	if(e.contentDocument){
		var myheight = e.contentDocument.body.offsetHeight;
		if(myheight < 30){return;}
//		e.height = e.contentDocument.body.offsetHeight;
		var mywidth = e.contentDocument.body.offsetWidth;
		//e.width = e.contentDocument.body.offsetWidth;
		$(e).height(myheight).fadeIn("slow");
		$(e).width(mywidth).fadeIn("slow");
	} else {
		var myheight = e.contentWindow.document.body.scrollHeight;
		if(myheight < 30){return;}
	//	e.height = e.contentWindow.document.body.scrollHeight;
	var mywidth = e.contentWindow.document.body.scrollWidth;
		//e.width = e.contentWindow.document.body.scrollWidth;
		$(e).height(myheight).fadeIn("slow");
		$(e).width(mywidth).fadeIn("slow");
	}
}

function addEvent(obj, evType, fn){
	if(obj.addEventListener)
	{
	obj.addEventListener(evType, fn,false);
	return true;
	} else if (obj.attachEvent){
	var r = obj.attachEvent("on"+evType, fn);
	return r;
	} else {
	return false;
	}
}

if (document.getElementById && document.createTextNode){
 addEvent(window,'load', doIframe);
}
