var frmMinWidth;
var frmMinHeight;
var applyMinSize = false;
var frmMaxWidth;
var frmMaxHeight;
var applyMaxSize = false;
function setMinSize(width, height)
{
	frmMinWidth = width;
	frmMinHeight = height
	applyMinSize = true;
}
function setMaxSize(width, height)
{
	frmMaxWidth = width;
	frmMaxHeight = height
	applyMaxSize = true;
}

function resizeIframe(name)
{
	if (name == null || name == "")
	{
		name = "cafemain";
	}
	
	try
	{
		var oBody   = document.frames(name).document.body;
		var oIFrame = document.all(name);
		var frmWidth  = oBody.scrollWidth;
		var frmHeight = oBody.scrollHeight;

		if (applyMinSize)
		{
			frmWidth  = Math.max(frmWidth, frmMinWidth);
			frmHeight = Math.max(frmHeight, frmMinHeight);
		}
		if (applyMaxSize)
		{
			frmWidth  = Math.min(frmWidth, frmMaxWidth);
			frmHeight = Math.min(frmHeight, frmMaxHeight);
		}
		
		oIFrame.style.height = frmHeight;
		oIFrame.style.width = frmWidth;
	}
	catch (e)
	{
		window.status = "IFrame Resize Error";
	}
}

function parentResizeIframe(name)
{
	if (parent && parent != this && parent.resizeIframe != null)
	{
		parent.resizeIframe(name);
	}
}

document.onkeydown = trapRefresh;
function trapRefresh()
{
	if (event.keyCode == 116)
	{
		event.keyCode = 0; 
		event.cancelBubble = true; 
		event.returnValue = false;
		document.location.reload();
	}
}

function parentPlusIframe(name, height)
{
	if (parent && parent != this && parent.plusIframe != null)
	{
		parent.plusIframe(name, height);
	}
}

function plusIframe(name, height) 	{
	if (name == null || name == "")
	{
		name = "cafemain";
	}
	
	try
	{
		var oBody   = document.frames(name).document.body;
		var oIFrame = document.all(name);
		var frmHeight  = oBody.scrollHeight;

		if (applyMinSize)
		{
			frmHeight = Math.max(frmHeight, frmMinHeight);
		}
		if (applyMaxSize)
		{
			frmHeight = Math.min(frmHeight, frmMaxHeight);
		}
		oIFrame.style.height = frmHeight + height;
	}
	catch (e)
	{
		window.status = "IFrame Size Plus Error";
	}
}

function resizepopup() 	{
	var winW = 356, winH = 200;
	winW = 356;
  winH = document.body.scrollHeight;

	if(winH > 550){
		winH = 550;
	}
  window.resizeTo(winW,winH+30);

}

function resizepopup2(wid) 	{
	var winW = wid, winH = 200;
	winW = wid;
  winH = document.body.scrollHeight;

	if(winH > 550){
		winH = 550;
	}
  window.resizeTo(winW,winH+40);

}
