function ResizeFrame(iframe) {
var line = 0;

	if (navigator.appName == "Netscape")
	{
		try
		{
		
		var totalHeight = 0;
		var maxWidth = 0;
		var maxOffsetLeft = 0;
		var maxOffsetTop = 999;
		
		var e = iframe.contentDocument.getElementsByTagName("form")[0].childNodes;;
		for(var i=0;i<e.length;i++)
		{
			//if(e[i].parentNode.nodeName != "FORM") continue;
			if(e[i].id == "calendar") continue;
			if(e[i].id == "overDiv") continue;
			if(!e[i].scrollWidth) continue;
			if(!e[i].scrollHeight) continue;
      
			totalHeight = totalHeight + e[i].scrollHeight;
			
			if(e[i].scrollWidth > maxWidth)
				maxWidth = e[i].scrollWidth;
			
			if(e[i].offsetLeft > maxOffsetLeft)
				maxOffsetLeft = e[i].offsetLeft;
			
			if(e[i].offsetTop < maxOffsetTop)
				maxOffsetTop = e[i].offsetTop;
		}

		if(maxWidth == 0) maxWidth = 600;
		if(totalHeight == 0) totalHeight = 800;		

		if(maxOffsetTop < 10) maxOffsetTop = 10;
		
		var iframeWidth = maxWidth + (3 * maxOffsetLeft);
		var iframeHeight = totalHeight + (3 * maxOffsetTop);

		/* If overlib engaged */
		var overDiv = iframe.contentDocument.getElementById("overDiv");
		if(overDiv)
		{
			var overDivWidth = overDiv.scrollWidth + overDiv.offsetLeft + (2 *maxOffsetLeft);
			var overDivHeight = overDiv.scrollHeight + overDiv.offsetTop + (2 * maxOffsetTop)

			if(iframeWidth < overDivWidth)
				iframeWidth = overDivWidth;
			if(iframeHeight < overDivHeight)
				iframeHeight = overDivHeight;	
		}	
		
		var calendar = iframe.contentDocument.getElementById("calendar");
		if(calendar)
		{
			var calendarDivWidth = calendar.scrollWidth + calendar.offsetLeft + (2 * maxOffsetLeft);
			var calendarDivHeight = calendar.scrollHeight + calendar.offsetTop + (2 * maxOffsetTop)

			if(iframeWidth < calendarDivWidth)
				iframeWidth = calendarDivWidth;
			if(iframeHeight < calendarDivHeight)
				iframeHeight = calendarDivHeight;	
		}
    
    if(iframeHeight < 600) iframeHeight = 600;
		
		iframe.height = iframeHeight;
		iframe.width =  iframeWidth;
		
		
		var parent = iframe.parentNode;
		if(parent)
		 {
		 while(parent.nodeName != "TD")
			{
			if(!parent.parentNode) break;
			parent = parent.parentNode;
			}
		}
		
		if(parent.nodeName == "TD")
		{
			parent.style.width = iframeWidth + 30;
			parent.style.height = iframeHeight + 25;
		}
		
		var shadowDiv = this.document.getElementById("shadow");
		var contentPaneDiv = this.document.getElementById("ContentPane");
		if(shadowDiv)
		{
			shadowDiv.style.width = iframeWidth + 4;
			shadowDiv.style.height = iframeHeight + 12;
		}
		
		if(contentPaneDiv)
		{
			contentPaneDiv.style.width = iframeWidth;
			contentPaneDiv.style.height = iframeHeight;
		}
		
		

		}
		catch(Exception) 
		{
			iframe.height = 600;
			iframe.width = 800;
		}
	}
	else
	{
		try
		{
			var totalHeight = 0;
			var maxWidth = 0;
			var maxOffsetLeft = 10;
			var maxOffsetTop = 999;
			
			
			var e = document.frames(iframe.id).document.getElementsByTagName("form")[0].childNodes;
			for(var i=0;i<e.length;i++)
			{
      
        //alert(i+':'+e[i].nodeName+'='+e[i].scrollWidth);
				//if(e[i].parentNode.nodeName != "FORM") continue;
				if(e[i].id == "calendar") continue;
				if(e[i].id == "overDiv") continue;
				if(!e[i].scrollWidth) continue;
				if(!e[i].scrollHeight) continue;
				
				/*alert(e[i].nodeName  + e[i].scrollWidth);
				if(e[i].childNodes[0])
					alert(e[i].childNodes[0].nodeName  + e[i].childNodes[0].scrollWidth);*/
          
               
				
				totalHeight = totalHeight + e[i].scrollHeight;
				if(e[i].scrollWidth > maxWidth)
					maxWidth = e[i].scrollWidth;
				if(e[i].offsetLeft > maxOffsetLeft)
					maxOffsetLeft = e[i].offsetLeft;
				if(e[i].offsetTop < maxOffsetTop)
					maxOffsetTop = e[i].offsetTop;
			}
			
			if(maxWidth == 0) maxWidth = 600;
			if(totalHeight == 0) totalHeight = 800;
			
			var iframeWidth = maxWidth + (3 * maxOffsetLeft);
			var iframeHeight = totalHeight + (3 * maxOffsetTop);
      
			/* If overlib engaged */
			var overDiv = document.frames(iframe.id).document.getElementById("overDiv");
			if(overDiv)
			{
				var overDivWidth = overDiv.scrollWidth + overDiv.offsetLeft + (2 * maxOffsetLeft);
				var overDivHeight = overDiv.scrollHeight + overDiv.offsetTop + (2 * maxOffsetTop)

				if(iframeWidth < overDivWidth)
					iframeWidth = overDivWidth;
				if(iframeHeight < overDivHeight)
					iframeHeight = overDivHeight;	
			}
			var calendar = document.frames(iframe.id).document.getElementById("calendar");
			if(calendar)
			{
				var calendarDivWidth = calendar.scrollWidth + calendar.offsetLeft + (2 * maxOffsetLeft);
				var calendarDivHeight = calendar.scrollHeight + calendar.offsetTop + (2 * maxOffsetTop)

				if(iframeWidth < calendarDivWidth)
					iframeWidth = calendarDivWidth;
				if(iframeHeight < calendarDivHeight)
					iframeHeight = calendarDivHeight;	
			}	
      
      if(iframeHeight < 600) iframeHeight = 600;

			iframe.style.height = iframeHeight;
			iframe.style.width = iframeWidth;
				
			var shadowDiv = this.document.getElementById("shadow");
			var contentPaneDiv = this.document.getElementById("ContentPane");
			if(shadowDiv)
			{
				shadowDiv.style.width = iframeWidth + 4;
				shadowDiv.style.height = iframeHeight;
			}
			
			if(contentPaneDiv)
			{
				contentPaneDiv.style.width = iframeWidth;
				contentPaneDiv.style.height = iframeHeight;
			}
		}
		catch(Exception) 
		{
			iframe.style.height = 600;
			iframe.style.width = 800;
		}
	}
}

function ResizeIFrames() {
	var e=this.document.getElementsByTagName("iframe");
	
	// var e= document.frames;
	for(var i=0;i<e.length;i++)
	{
		try {ResizeFrame(e[i]);} catch(Exception) {}
	}
}