function iframeLib() {
}
iframeLib.prototype.getIframeSize=function(node,maxsize) {
	
	var childs=crossBrowserLib.getChilds(node);
	for(var i=0;i<childs.length;i++) {
		var child=childs[i];
		
		var pos=crossBrowserLib.getPageCoords(child);
		
		if (pos.x>=0 && pos.y>=0 && child.offsetWidth && child.offsetHeight) {
			var width=pos.x+child.offsetWidth;
			var height=pos.y+child.offsetHeight;
		//	if (child.tagName=="FORM") alert(child.tagName+" w:"+width);

			if (!maxsize) {
				// maxsize=true;
				var maxsize={width:width,height:height};
			}
			if (width>maxsize.width) {
				maxsize.width=width;
			}
			if (height>maxsize.height) maxsize.height=height;
			
		}
		var maxsize=this.getIframeSize(child,maxsize);
	}	
	

	return maxsize;
}
iframeLib.prototype.autofitIframe=function(iframe)
{ 
	iframe.width=10;
	iframe.height=10;
	var ibody=iframe.contentWindow.document.body;
	var d=iframe.contentWindow.document;
/*var maxsize={width:0,height:0};

	if (isIE)  maxsize.height = d.body.scrollHeight;
	else  maxsize.height=d.body.offsetHeight;
	if (isIE) maxsize.width = d.body.scrollWidth;
	else  maxsize.width=d.body.offsetWidth;
	*/
	var maxsize=this.getIframeSize(ibody,false);	
	if (!maxsize.height) {
		 window.setTimeout(function() { iframeLib.autofitIframe(iframe); }, 1);
	} else {		
		iframe.width=maxsize.width;
		iframe.height=maxsize.height;

		var parent=iframe.parentNode;
		parent.style.width=maxsize.width+"px";
		parent.style.height=maxsize.height+"px";
	}
}

