function reSizeFrame(frameObj)
{
	reSizeObj(frameObj.document.body, frameObj);
}

function checkWidth(width)
{ //alert(width);
	var maxWidth = 1024;
	if (width > maxWidth)
	{
		//alert("Width: " + width + " > " + maxWidth + "!!!");
		return maxWidth;
	}
	else
	{
		return width;
	}
}

function checkHeight(height)
{ //alert(height);
	var maxHeight = 2000;
	if (height > maxHeight)
	{
		//alert("Height: " + height + " > " + maxHeight + "!!!");
		return maxHeight;
	}
	else
	{
		return height;
	}
}

function reSizeObj(bodyObj, frameObj)
{
	try
	{
//   var oBody = TEST.document.body;
//   var oFrame = document.all("TEST");
		var oBody = bodyObj;
		var oFrame = frameObj;
        var prima="";
		var dopo="";
		
		//alert (oFrame.name + " PRIMA\nWidth- scrollWidth:" + oBody.scrollWidth + " ,offsetWidth:" + oBody.offsetWidth + " ,clientWidth:" + oBody.clientWidth+ " \nHeight " + oBody.scrollHeight + " \noffsetHeight " + oBody.offsetHeight + " clientHeight " + oBody.clientHeight)
		prima=oFrame.name + " PRIMA\nWidth- scrollWidth:" + oBody.scrollWidth + " ,offsetWidth:" + oBody.offsetWidth + " ,clientWidth:" + oBody.clientWidth+ " ,width:" + oFrame.width+ " \nHeight " + oBody.scrollHeight + " , " + oBody.offsetHeight + " , " + oBody.clientHeight+ ", Height:" +oFrame.height;

		oFrame.height = checkHeight(oBody.scrollHeight + (oBody.offsetHeight -  oBody.clientHeight));
		//oBody.height = checkHeight(oBody.scrollHeight + (oBody.offsetHeight -  oBody.clientHeight)+1);

		oFrame.width = checkWidth(oBody.scrollWidth + (oBody.offsetWidth -  oBody.clientWidth));

		//oFrame.style.height = checkHeight(oBody.scrollHeight + (oBody.offsetHeight -  oBody.clientHeight));
		//oFrame.style.width = checkWidth(oBody.scrollWidth + (oBody.offsetWidth -  oBody.clientWidth));

        
		//alert (oFrame.name + " DOPO\nWidth- scrollWidth:" + oBody.scrollWidth + " ,offsetWidth: " + oBody.offsetWidth + " ,clientWidth: " + oBody.clientWidth+ " \nHeight " + oBody.scrollHeight + " , " + oBody.offsetHeight + " , " + oBody.clientHeight);
		dopo=oFrame.name + " DOPO\nWidth- scrollWidth:" + oBody.scrollWidth + " ,offsetWidth:" + oBody.offsetWidth + " ,clientWidth:" + oBody.clientWidth+ " ,width:" + oFrame.width+ " \nHeight " + oBody.scrollHeight + " , " + oBody.offsetHeight + " , " + oBody.clientHeight+ ", Height:" +oFrame.height;
		//alert (prima+"\n"+dopo);
		
//  alert(oFrame.style.height  + "w: " + oFrame.style.width);
	}
	//An error is raised if the IFrame domain != its container's domain
	catch(e)
	{
		window.status = 'Error: ' + e.number + '; ' + e.description;
	}
}

function reSizeObjX(bodyObj, frameObj)
{
	try
	{
//   var oBody = TEST.document.body;
//   var oFrame = document.all("TEST");
		var oBody = bodyObj;
		var oFrame = frameObj;

//  oFrame.style.height = oBody.scrollHeight + (oBody.offsetHeight -  oBody.clientHeight);
	oFrame.style.width = checkWidth(oBody.scrollWidth + (oBody.offsetWidth -  oBody.clientWidth));
//  alert(oFrame.style.height  + "w: " + oFrame.style.width);
	}
	//An error is raised if the IFrame domain != its container's domain
	catch(e)
	{
		window.status = 'Error: ' + e.number + '; ' + e.description;
	}
}

function reSizeObjY(bodyObj, frameObj)
{
	try
	{
//   var oBody = TEST.document.body;
//   var oFrame = document.all("TEST");
		var oBody = bodyObj;
		var oFrame = frameObj;

		oFrame.style.height = checkHeight(oBody.scrollHeight + (oBody.offsetHeight -  oBody.clientHeight));
//   oFrame.style.width = oBody.scrollWidth + (oBody.offsetWidth -  oBody.clientWidth);
//  alert(oFrame.style.height  + "w: " + oFrame.style.width);
	}
	//An error is raised if the IFrame domain != its container's domain
	catch(e)
	{
		window.status = 'Error: ' + e.number + '; ' + e.description;
	}
}

function reSizeWin(winObj)
{
	try
	{
//   var oBody = TEST.document.body;
//   var oFrame = document.all("TEST");
		var oWin = winObj;
		var oBody = winObj.document.body;
		oWin.resizeTo(checkWidth(oBody.scrollWidth + (oBody.offsetWidth - oBody.clientWidth)), checkHeight(oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight)));
//  alert(oFrame.style.height  + "w: " + oFrame.style.width);
	}
	//An error is raised if the IFrame domain != its container's domain
	catch(e)
	{
		window.status = 'Error: ' + e.number + '; ' + e.description;
	}
}

function reSizeWinY(winObj)
{
	try
	{
//   var oBody = TEST.document.body;
//   var oFrame = document.all("TEST");
		var oWin = winObj;
		var oBody = winObj.document.body;
		oWin.resizeTo(checkWidth(oWin.clip.width), checkHeight(oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight)));
//  alert(oFrame.style.height  + "w: " + oFrame.style.width);
	}
	//An error is raised if the IFrame domain != its container's domain
	catch(e)
	{
		window.status = 'Error: ' + e.number + '; ' + e.description;
	}
}

function reSizeWinX(winObj)
{
	try
	{
//   var oBody = TEST.document.body;
//   var oFrame = document.all("TEST");
		var oWin = winObj;
		var oBody = winObj.document.body;
		oWin.resizeTo(checkWidth(oBody.scrollWidth + (oBody.offsetWidth - oBody.clientWidth)), checkHeight(oWin.clip.height));
//  alert(oFrame.style.height  + "w: " + oFrame.style.width);
	}
	//An error is raised if the IFrame domain != its container's domain
	catch(e)
	{
		window.status = 'Error: ' + e.number + '; ' + e.description;
	}
}

