function getPageScroll(){
 
 var yScroll;
 
 if (self.pageYOffset) {
  yScroll = self.pageYOffset;
 } else if (document.documentElement && document.documentElement.scrollTop){  // Explorer 6 Strict
  yScroll = document.documentElement.scrollTop;
 } else if (document.body) {// all other Explorers
  yScroll = document.body.scrollTop;
 }
 
 arrayPageScroll = new Array('',yScroll) 
 return arrayPageScroll;
}

function getPageSize(){
 
 var xScroll, yScroll;
 
 if (window.innerHeight && window.scrollMaxY) { 
  xScroll = document.body.scrollWidth;
  yScroll = window.innerHeight + window.scrollMaxY;
 } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
  xScroll = document.body.scrollWidth;
  yScroll = document.body.scrollHeight;
 } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
  xScroll = document.body.offsetWidth;
  yScroll = document.body.offsetHeight;
 }
 
 
 var windowWidth, windowHeight;
 if (self.innerHeight) { // all except Explorer
  windowWidth = self.innerWidth;
  windowHeight = self.innerHeight;
 } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
  windowWidth = document.documentElement.clientWidth;
  windowHeight = document.documentElement.clientHeight;
 } else if (document.body) { // other Explorers
  windowWidth = document.body.clientWidth;
  windowHeight = document.body.clientHeight;
 } 
 
 // for small pages with total height less then height of the viewport
 if(yScroll < windowHeight){
  pageHeight = windowHeight;
 } else { 
  pageHeight = yScroll;
 }
 
 // for small pages with total width less then width of the viewport
 if(xScroll < windowWidth){ 
  pageWidth = windowWidth;
 } else {
  pageWidth = xScroll;
 }
 

 arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
 return arrayPageSize;
}
 
function setWidth(element,w) {
     element = document.getElementById(element);
      element.style.width = 100 +"%";
   }
function setHeight(element,h) {
    element = document.getElementById(element);
      element.style.height = h +"px";
   }
function setInnerHTML(element,content) {
  element = document.getElementById(element);
   element.innerHTML = content;
   }
function setTop(element,t) {
    element = document.getElementById(element);
      element.style.top = t +"px";
   }
function setLeft(element,t) {
   element = document.getElementById(element);
     element.style.left = t +"px";
}

function start($x_width,$x_height) { 
 
  //hideSelectBoxes();
 
  // stretch overlay to fill page and fade in
  var arrayPageSize = getPageSize();
  setHeight('tlo_block', arrayPageSize[1]);
  setWidth('tlo_block', arrayPageSize[0]);	
  setLeft('tlo_block', 0);	
  setTop('tlo_block', 0);
  //new Effect.Appear('tlo_block', { duration: 0.2, from: 0.0, to: 0.8 });
 
    // calculate top offset for the lightbox and display 
  var arrayPageSize = getPageSize();
  var arrayPageScroll = getPageScroll();
  var lightboxTop = arrayPageScroll[1] + (arrayPageSize[3] / 15)+$x_height;
  
  var ile = (arrayPageSize[0]-$x_width)/2
  
  setLeft('alercik', ile);
  setTop('alercik', lightboxTop);
  //setWidth('tlo_block',800)	
  
 }
 
function galeria(a,b,c) {
//document.getElementById('baner').style.display="none";
document.getElementById('alercik').style.display="block";
document.getElementById('tlo_block').style.display="block";
start(b,0);
if(c==0){
zsrc='images/zdjecia/'+a+'.jpg';
}else if(c==1){
zsrc='images/'+a+'.jpg';
}
document.getElementById('alercik').innerHTML='<table style="border: 1px solid #000000; background-color: #ffffff;"><tr><td style="text-align:left; padding: 1px 1px 1px 1px;"><img src="'+zsrc+'" class="zdj_full" alt="" oncontextmenu="return false" /></td></tr><tr><td style="padding: 1px 2px 2px 1px; text-align: right; cursor: pointer; font-size: 11px; color: #000000; font-weight: bold" onclick="alercik_close();">close</td></tr></table>';
}
 
function alercik_close() {
//document.getElementById('baner').style.display="block";
document.getElementById('alercik').style.display="none";
document.getElementById('tlo_block').style.display="none";
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}