function show_picture(obj, url) {
    leftOffset = $(obj).cumulativeOffset().left + Math.round($(obj).getWidth() / 2);
    topOffset = $(obj).cumulativeOffset().top + Math.round($(obj).getHeight() / 2);

 
    preloadPrevImage = $(new Image());
    preloadPrevImage.observe('load', function(){  

      leftOffset = (screen.width-500)/2;

      //topOffset = (topOffset  - Math.round(preloadPrevImage.height / 2));
      topOffset = 0;
      
      if (leftOffset < 0) { leftOffset = 0; }
      if (topOffset < 0) { topOffset = 0; }
      
      $('image-container').style.left = leftOffset + 'px';
      $('image-container').style.top =  topOffset + 'px';
      $('image-container').style.opacity = 1;
      $('image-container').show();

      $('image-box').writeAttribute('style');
      $('image-box').hide();
      $('image-box').innerHTML = "";
      //*
      $('image-box').style.width = 500 + 'px';
      $('image-box').style.height = 700 + 'px';

      // wstawiamy zdjecie
      $('image-box').insert(preloadPrevImage);
      


      new Effect.Grow ('image-box', {direction: 'center', duration: 1});
      //*/
		});
    
	  preloadPrevImage.src = url; 
}

function hide_container(obj) {
    $('image-container').hide();
} 

function hide_picture() {
    new Effect.Fade('image-container', {duration: 0.2, afterFinish: hide_container});
}

