function winH() {
   if (window.innerHeight)
      /* NN4 a kompatibilní prohlížeče */
      return window.innerHeight;
   else if
   (document.documentElement &&
   document.documentElement.clientHeight)
      /* MSIE6 v std. režimu - Opera a Mozilla
      již uspěly s window.innerHeight */
      return document.documentElement.clientHeight;
   else if
   (document.body && document.body.clientHeight)
      /* starší MSIE + MSIE6 v quirk režimu */
      return document.body.clientHeight;
   else
      return null;
}

function winW() {
   if (window.innerWidth)
      /* NN4 a kompatibilní prohlížeče */
      return window.innerWidth;
   else if
   (document.documentElement &&
   document.documentElement.clientWidth)
      /* MSIE6 v std. režimu - Opera a Mozilla
      již uspěly s window.innerWidth */
      return document.documentElement.clientWidth;
   else if
   (document.body && document.body.clientWidth)
      /* starší MSIE + MSIE6 v quirk režimu */
      return document.body.clientWidth;
   else
      return null;
}
function windowchangeControl ()
{
	//o 20px;
		iControlSize=20;
		window.moveBy(0,-1*(iControlSize/2));
		window.resizeBy(0,iControlSize);
}
function windowchange(iWidth,iHeight,iPage)
{
	testWindowPage(iPage);
	iWindowWidth=winW();
	iWindowHeight=winH();

	iPositionLeft=0;
	if (window.screenX)
		iPositionLeft=window.screenX;
	else if(window.screenLeft)
		iPositionLeft=window.screenLeft;

	iPositionTop=0;
	if (window.screenY)
		iPositionTop=window.screenY;
	else if(window.screenTop)
		iPositionTop=window.screenTop;

	if (iWidth>iWindowWidth)
	{
		iMyWidth = (screen.availWidth - iWidth ) / 2 ;
		window.moveTo(iMyWidth,iPositionTop);
		iResizeBy=iWidth-iWindowWidth;
		window.resizeBy(iResizeBy,0);

		if (window.screenX)
			iPositionLeft=window.screenX;
		else if(window.screenLeft)
			iPositionLeft=window.screenLeft;
	}
	//o 20px;
	iHeight+=20;
	if (iHeight>iWindowHeight)
	{
		iMyHeight = (screen.availHeight - iHeight ) / 2 ;
		window.moveTo(iPositionLeft,iMyHeight);
		iResizeBy=iHeight-iWindowHeight;
		window.resizeBy(0,iResizeBy);
	}
	return true;
}
function testWindowPage(iPage)
{
	sHref=opener.location.href;
	aParams=sHref.split("?",2);
	if (!aParams[1] || aParams[1].indexOf('pageshowing')==-1)
	{
		if (iPage==1)
			return true;
		if (!aParams[1])
			sHref+='?pageshowing='+iPage;
		else
			sHref+='&pageshowing='+iPage;
		opener.location.href=sHref;
	}
	else
	{
		re2=/pageshowing=(\d+)/g; 
		sHrefNew=sHref.replace(re2,'pageshowing='+iPage);
		if (sHrefNew!=sHref)
			opener.location.href=sHrefNew;
	}
	return true;
}

