// Function for loading source in left & right frame
function loadMain() {
  var rightPos=location.search.indexOf('right=')+6;
  if (rightPos>5) {
    var mainURL=location.search.substring(rightPos,location.search.length);
    if (mainURL.indexOf('&')>-1) {
      mainURL=mainURL.substring(0,mainURL.indexOf('&'))
    }
    mainURL=unescape(mainURL);
    if (typeof(location.replace)!='undefined') {
      self.frames.right.location.replace(mainURL)
    } else self.frames.right.location.href=mainURL
  }
  var leftPos=location.search.indexOf('left=')+5;
  if (leftPos>4) {
    var mainURL=location.search.substring(leftPos,location.search.length);
    if (mainURL.indexOf('&')>-1) {
      mainURL=mainURL.substring(0,mainURL.indexOf('&'))
    }
    mainURL=unescape(mainURL);
    if (typeof(location.replace)!='undefined') {
      self.frames.left.location.replace(mainURL)
    } else self.frames.left.location.href=mainURL
  }
}

function showImage(width, height, link) {
  var imgWndw;

  var w = width + 20;
  if (w > screen.availWidth - 55) w = screen.availWidth - 50;
  var h = height;
  if (h > screen.availHeight - 55) h = screen.availHeight - 50;
  imgWndw = window.open('',link.target,'width=' + w + 
          ',height=' + h + ',toolbar=no,menubar=no,location=no,status=no,'+
          'resizable=yes,scrollbars=yes,left=5,top=5');
  with (imgWndw.document){
    open();
    write('<?xml version="1.0" encoding="windows-1251"?>\n'+
          '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n' +
          '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru" lang="ru">\n'+
          '<html><head><title>'+link.title+'</title>'+
          '</head><body leftmargin="0" topmargin="0" '+
          'rightmargin="0" bottommargin="0" marginwidth="0" '+
          'style="margin:0;padding:0;position:fixed;overflow:none;" '+
          'marginheight="0"><img src="'+link.href+'" border="0" '+
          ' alt="'+link.title+'" title="'+link.title+'"/></body></html>');
    close();
  }
  return false
}
