var divShow,divWidth,divHeight,divID; // onresize esemeny miatt elmentjuk, hogy az aktualis divnek milyen szelessege es magassaga van.

function imageviewerResize(){
  if ( divShow==1 ) show(divID,divWidth,divHeight);
}

function show(id,w,h){
  var windowWidth,windowHeight,xScroll,yScroll;
  var divTop,divLeft,div;

  // 1. lekerjuk a bongeszo ablak szelesseget es magassagat
  if ( self.innerHeight ){
    if ( document.documentElement.clientWidth ){
      windowWidth = document.documentElement.clientWidth; 
    }else{
        windowWidth = self.innerWidth;
     }
    windowHeight = self.innerHeight;
  }else if ( document.documentElement && document.documentElement.clientHeight ){
     windowWidth = document.documentElement.clientWidth;
     windowHeight = document.documentElement.clientHeight;
   }else if ( document.body ){
      windowWidth = document.body.clientWidth;
      windowHeight = document.body.clientHeight;
    }
  // 2. lekerjuk az aktualis page poziciojat, mennyit scrolloztunk
  if ( self.pageYOffset ){
    yScroll = self.pageYOffset;
    xScroll = self.pageXOffset;
  }else if ( document.documentElement && document.documentElement.scrollTop ){
     yScroll = document.documentElement.scrollTop;
     xScroll = document.documentElement.scrollLeft;
   }else if ( document.body ){
      yScroll = document.body.scrollTop;
      xScroll = document.body.scrollLeft;	
    }
  // 3. a bigimage div left es top poziciojat kiszamitjuk
  divLeft=Math.round(windowWidth/2)-Math.round(w/2);
  divTop=(Math.round(windowHeight/2)-Math.round(h/2))+yScroll;
  if ( divTop<0 ) divTop=0;
  if ( divLeft<0 ) divLeft=0;
  //window.alert(divLeft+' '+divTop);
  // 4. megjelenitjuk a div-et es benne a kepet
  div=document.getElementById('bigimage'+id);
  div.style.width=w+'px';
  div.style.height=h+'px';
  div.style.left=divLeft+'px';
  div.style.top=divTop+'px';
  div.style.display='';
  divWidth=w;
  divHeight=h;
  divID=id;
  divShow=1;
}

function Close(id){
  var div;
  div=document.getElementById('bigimage'+id);
  div.style.display='none';
  divShow=0;
}
