function email(u, s) {
  document.write('<a href=\"mailto:'+u+'@'+s+'\" class="ah">'); 
  document.write(u+'@'+s+'</a>');
  return;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function scroll(dx) {
  window.content.scrollBy(dx,0);
}

function showPic(n) {
  s = "/cgi-bin/showpic.cgi?dir=beer&id=p"+n+"b";
  var w = window.open(s,'foto',"scrollbar,resizable,height=740");
  w.focus();
}

function showPicture(s) {
  var i = 0 + s;
  var pw = arr[i*6 + 1];
  var ph = arr[i*6 + 2];
  var ww = pw + 40;
  var wh = ph + 90;
  var parms = "width=" + ww + ",height=" + wh + ",top=100,left=100,scrollbars=no";
  newWin = window.open("blank.htm", s, parms, true);
  newWin.document.writeln('<HTML><HEAD><TITLE>'+s+'.jpg</TITLE>');
  newWin.document.writeln('<STYLE TYPE="text/css">');
  newWin.document.writeln('<!--  .bg { background: #FFF700; }');
  newWin.document.writeln('A:LINK, A:VISITED {color: #CCCCCC;font-family: Arial, Helvetica, sans-serif;font-size: 9pt;text-decoration: none}');
  newWin.document.writeln('A:HOVER {color: #FF0000;font-family: Arial, Helvetica, sans-serif;font-size: 9pt;text-decoration: none}');
  newWin.document.writeln('--></STYLE>');
  newWin.document.writeln('</HEAD><BODY BGCOLOR="#000000" marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" onKeyPress="if (event.keyCode==27) window.close();"><CENTER><BR><TABLE BORDER="1" BORDERCOLOR="#CCCCCC"><TR><TD>');
  newWin.document.writeln('<IMG SRC="i/'+s+'.jpg" width="'+pw+'" height="'+ph+'"><BR></TD></TR>');
  newWin.document.writeln('<TR><TD><center><a href="javascript: window.close()">Закрыть</a></center></TD></TR></TABLE></BODY></HTML>');
  newWin.document.close();
};

var objHref;

function setPic(obj, href) {
  var img = MM_findObj(obj);
  objHref = img.src;
  img.src = href;
};

function setPicBack(obj) {
  var img = MM_findObj(obj);
  img.src = objHref;
};

