function doc_loaded() {
  if(document.getElementById('main').offsetHeight <= window.innerHeight)
    document.getElementById('main').style.height = '100%';
}

function mouse_over(what) {
  what.className += '_hover';
}

function mouse_out(what) {
  if(what.className.indexOf('_hover') > 0)
    what.className = what.className.substr(0,what.className.indexOf('_hover'));
}

function open_image(href) {
  if(href != null) {
    new_window = window.open("","","width=400,height=400,resizable,scrollbars=no,status=0");
    
    new_window.document.open("text/html", "replace");
    new_window.document.writeln('<html>');
    new_window.document.writeln('  <head>');
    new_window.document.writeln('    <script src="scripts.js" language="JavaScript"></script>');
    new_window.document.writeln('  </head>');
    new_window.document.writeln('  <body onload="fit_image()" style="margin:0;padding:0;">');
    new_window.document.writeln('    <img src="'+href+'" onclick="window.close()">');
    new_window.document.writeln('  </body>');
    new_window.document.writeln('</html>');
    new_window.document.close();
  }
    
  
}

function fit_image() {
  if(window.innerWidth) {
    iWidth = window.innerWidth;
    iHeight = window.innerHeight;
  }
  else {
    iWidth = document.body.clientWidth;
    iHeight =document.body.clientHeight;
  }
  iWidth = document.images[0].width - iWidth;
  iHeight = document.images[0].height - iHeight;
  window.resizeBy(iWidth, iHeight);
};

