function hide(id)
{
  document.getElementById(id).style.visibility = "hidden";
}

function show(id)
{
  document.getElementById(id).style.visibility = "visible";
}

function changevisibility(id)
{
  if (document.getElementById(id).style.visibility != "visible")
  {
    document.getElementById(id).style.visibility = "visible";
  }
  else
  {
    document.getElementById(id).style.visibility = "hidden";
  }
}


function pagecentered(id)
{

  var innerHeight_ = window.innerHeight ? window.innerHeight : document.documentElement.offsetHeight;
  var obj = document.getElementById(id);
  obj.style.left = ( document.body.clientWidth / 2 - obj.clientWidth / 2 ) + 'px';
  obj.style.top = ( document.documentElement.scrollTop + innerHeight_ / 2 - obj.clientHeight / 2 ) + 'px';

}

function afisha_open(src)
{
  document.getElementById('fnc').style.visibility = 'visible';
  document.getElementById('fnc').innerHTML = "";
  document.getElementById('fnc').innerHTML = "<img src='"+src+"' border=0 style='cursor:hand;' onClick='afisha_close()'>";
}

function afisha_close()
{
  document.getElementById('fnc').style.visibility='hidden';
  document.getElementById('fnc').innerHTML = "";
}

function imgopen(imgf,tit)
{

  rand_id='image'+(Math.round(Math.random()*1000));

  outf="<html>"
 +"<head>"
 +"<title>"+tit+"</title>"
 +"<style>body{margin:0px}</style>"
 +"</head>"
 +"<body leftmargin=0 topmargin=0>"
 +"<img src=\""+imgf+"\">";

  iopen="iwin=self.open('"+imgf+"', '"+rand_id+"', 'width='+(img1.width)+',height='+(img1.height)+',top=0,left=0');"
 +"iwin.document.write('"+outf+"');"
 +"iwin.focus();";

  img1=new Image();
  img1.src=imgf;

  if(img1.width!=0) eval(iopen);

  else
  {
    iwin = self.open('about:blank', 'f'+rand_id, 'width=100,height=100,top=0,left=0');
    iwin.document.write("<html>"
    +"<body>Загрузка...<br>"
    +"<"+"script>"
    +"function imo(img1){"+iopen
    +"self.close();"
    +"}<"+"/script>"
    +"<img src='"+imgf+"' onload='imo(this);'>");
  }
}


