function getWindowWidth() 
{
var myWidth = 0;
if( typeof( window.innerWidth ) == 'number' )
  {
  //Non-IE
  myWidth = window.innerWidth;
  }
  else if( document.documentElement &&  document.documentElement.clientWidth )
  	{
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    }
    else if( document.body && document.body.clientWidth)
      {
      //IE 4 compatible
      myWidth = document.body.clientWidth;
      }
  return(myWidth);
}

function getWindowHeight() 
{
var myHeight = 0;
if( typeof( window.innerHeight ) == 'number' )
  {
  //Non-IE
  myHeight = window.innerHeight;
  }
  else if( document.documentElement &&  document.documentElement.clientHeight )
  	{
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
    }
    else if( document.body && document.body.clientHeight)
      {
      //IE 4 compatible
      myHeight = document.body.clientHeight;
      }
  return(myHeight);
}

function getScrollY() 
{
var scrOfY = 0;
if( typeof( window.pageYOffset ) == 'number' )
  {
  //Netscape compliant
  scrOfY = window.pageYOffset;
  } 
  else if( document.body && document.body.scrollTop) 
  	{
    //DOM compliant
    scrOfY = document.body.scrollTop;
    } 
    else if(document.documentElement && document.documentElement.scrollTop)
      {
      //IE6 standards compliant mode
      scrOfY = document.documentElement.scrollTop;
      }
return (scrOfY);
}

function start_efekt(nr)
{
var w1 = document.getElementById('w1');
var w2 = document.getElementById('w2');
var w3 = document.getElementById('w3');
var w4 = document.getElementById('w4');
var df = document.getElementById('dfotka');

var window_width=getWindowWidth();
var window_height=getWindowHeight();
var offset_top=getScrollY();

w = fotkiw[nr];
h = fotkih[nr];

l = (window_width - w)/2;
t = (window_height - h)/2; 
t=t+offset_top;

if(!document.all)
  {
  poprawkaw4=20;
//  heightw2='100%';
  }
  else 
    {
    poprawkaw4=0;
//    heightw2=window_height-h-t+'px';
    }

w1.style.left='0px';
w1.style.width='100%';
w1.style.top='0px';
w1.style.height=t+'px';
w1.style.visibility='visible';

w2.style.left='0px';
w2.style.width='100%';
w2.style.top=(t+h)+'px';
w2.style.height=t+'px';
//w2.style.height=heightw2;
w2.style.visibility='visible';

w3.style.left='0px';
w3.style.width=l+'px';
w3.style.top=t+'px';
w3.style.height=h+'px';
w3.style.visibility='visible';

w4.style.left=(l+w)+'px';
w4.style.width=(l-poprawkaw4)+'px';
w4.style.top=t+'px';
w4.style.height=h+'px';
w4.style.visibility='visible';

df.style.left=l+'px';
df.style.top=t+'px';
df.style.width=w+'px';
df.style.height=(h+30)+'px';
df.style.visibility='visible';
df.innerHTML='<img src="'+fotki[nr]+'" width="'+w+'" height="'+h+'">';

if(nr > 0)
  {
  df.innerHTML=df.innerHTML+'<div style="position: absolute; z-index: 99; left: 20px; top: '+(h+5)+'px;"><span class="galnav" onclick="start_efekt('+(nr-1)+')">&lt;&lt; Prev</span></div>';
  }
if(nr < (fotki.length - 1))
  {
  df.innerHTML=df.innerHTML+'<div style="position: absolute; z-index: 99; left: '+(w-100)+'px; top: '+(h+5)+'px;"><span class="galnav" onclick="start_efekt('+(nr+1)+')">Next &gt;&gt;</span></div>';
  }
}

function stop_efekt()
{
var w1 = document.getElementById('w1');
var w2 = document.getElementById('w2');
var w3 = document.getElementById('w3');
var w4 = document.getElementById('w4');
var df = document.getElementById('dfotka');

w1.style.visibility='hidden';
w2.style.visibility='hidden';
w3.style.visibility='hidden';
w4.style.visibility='hidden';
df.style.visibility='hidden';
}
