//dimensiune header + footer
minHeight = 135;

//resolutia minima pentru care nu apare scroll pe toata pagina
minRes = 200;

iFrameName = "mainFrame";
indexPage = "Default.aspx";

function getWinHeight(doc) 
{
  	var winHeight = 0;
  	if( typeof( doc.window.innerHeight ) == 'number' )
	{
		//Non-IE
  		winHeight = doc.window.innerHeight;
  	}
	else if( doc.document.documentElement &&
           ( doc.document.documentElement.clientHeight ) )
	{
  		//IE 6+ in 'standards compliant mode'
  		winHeight = doc.document.documentElement.clientHeight;
	}
  	else if( doc.document.body && ( doc.document.body.clientHeight ) ) 
	{	
    	//IE 4 compatible
    	winHeight = doc.document.body.clientHeight;
	}
 	return winHeight;
}

function resize(main, iFrame)
{
	iFrameObj = main.document.getElementById(iFrameName);
	iFrameObj.style.height = "0"; 
	iFrameDocHeight = iFrame.document.body.height||iFrame.document.body.scrollHeight;
	winHeight = getWinHeight(main);
	if(winHeight > minHeight)
		{
		iFrameRH = Math.min(iFrameDocHeight, winHeight-minHeight);
		iFrameRH = Math.max(iFrameRH, minRes);
		}
	if (iFrameRH) iFrameObj.style.height = iFrameRH + "px";
}

function resizeFrame()
{
	if (window!=parent)
		resize(parent, this);
		else
		{
			page = window.location.href;
			//alert(page);
			page = page.substring(page.lastIndexOf("/") + 1);
			try
			{
				indexPage = level + indexPage;
			}
			catch (exc){}
			try
			{
				page = path + page;
			}
			catch (exc){}
			window.location.href = indexPage + "?childPage=" + page;
		}
}

function resizeChild()
{
	resize(this, window.frames[iFrameName]);
}
function loadPage()
{
	address = window.location.href;
	index = address.indexOf("childPage=");
	if (index>0)
		{
		 address = address.substring(index+10);
		 window.document.getElementById('mainFrame').src = address;
		// alert(address);
		}
}

function moveTo(sPage)
{
	document.location.href = sPage;
}
