Prototype.Browser.IE6=Prototype.Browser.IE && 
  parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5))==6;
Prototype.Browser.IE7=Prototype.Browser.IE && !Prototype.Browser.IE6;
/*
function shadowImages() {
  $$('img.gallery-huge').each(
    function( elem, index ) {
      if (elem.width > elem.height) {
        elem.style.padding = 12+'px';
        elem.style.background = 'url(images/lay-shadow-big.png) no-repeat 100%';
      } else {
        elem.style.padding = 12+'px';
        elem.style.background = 'url(images/lay-shadow-portret.png) no-repeat 100%';
      }
    }
  );

  $$('#gallery-categories img').each(
    function( elem, index ) {
      if (elem.width > elem.height) {
        elem.style.padding = 6+'px';
        elem.style.background = 'url(images/lay-shadow128x86.png) no-repeat 100%';
      } else {
        elem.style.padding = 6+'px';
        elem.style.background = 'url(images/lay-shadow86x134.png) no-repeat 100%';
      }
    }
  );
}
*/
function setBlockSize() {
  var doc = document.documentElement;
  var body = document.body; 
  var content = $('content');
  if (content) {
    var size = content.offsetWidth;
    size = Math.max(69,Math.round((size - 600)));
    content.style.paddingRight = size+'px';
    $$('div#content *').each(
      function( elem, index ) {
        var mr = parseInt(elem.getStyle('marginRight'));
        if (mr < -65) { elem.style.marginRight = -size+'px'; }
        var pr = parseInt(elem.getStyle('paddingRight'));
        if (pr > 65) { elem.style.paddingRight = size+'px'; }
      }
    );
    $$('.paging li.last').each(
      function( elem, index ) {
        elem.style.right = size+'px';
      }
    );
  }
}

function initPage() {
  setBlockSize();
/*  shadowImages();*/
}
function resizeBrowser() {
  if (Prototype.Browser.IE) { 
    setTimeout( 'setBlockSize()', 1 ); 
  } else setBlockSize();  
}

Event.observe( window, 'load', initPage, false );
Event.observe( window, 'resize', resizeBrowser, false );
