function ShowPopUp(name)
{
  window.open("http://www.otimed.ru/_dev/popup.php?name="+name,"Window1","menubar=no,toolbar=no,scrollbars=no,location=no,status=no");
  return 0;
}

function ShowFullsizeImage()
{
  var dw   = document.getElementById("img").style.width;
  dw       = dw.substr(0,(dw.length-2));
  var dh   = document.getElementById("img").style.height;
  dh       = dh.substr(0,(dh.length-2));

  var xpos = Math.round((document.body.clientWidth-dw)/2);
  var ypos = Math.round((document.body.clientHeight-dh)/2);
  var size = getPageSizeWithScroll();
  document.getElementById("ol").style.width = size[0];
  document.getElementById("ol").style.height = size[1];
  document.getElementById("ol").style.display = "inline";
  document.getElementById("img").style.left = xpos;
  document.getElementById("img").style.top = ypos;
  document.getElementById("img").style.display = "inline";
}

function HideFullsizeImage()
{
  document.getElementById("ol").style.display = "none";
  document.getElementById("img").style.display = "none";
  window.document.body.scroll = 'auto';
}

function keyPressHandler(e) 
{
var kC  = (window.event) ?  // MSIE or Firefox?
  event.keyCode : e.keyCode;
var Esc = (window.event) ?   
  27 : e.DOM_VK_ESCAPE // MSIE : Firefox
if(kC==Esc) {HideFullsizeImage();}
}


function getPageSizeWithScroll()
{
  if (window.innerHeight && window.scrollMaxY) 
  {
    // Firefox
    yWithScroll = window.innerHeight + window.scrollMaxY;
    xWithScroll = window.width;
  } 
  else if (document.body.scrollHeight > document.body.offsetHeight)
  { 
    // all but Explorer Mac
    yWithScroll = document.body.scrollHeight;
    xWithScroll = document.body.scrollWidth;
  } 
  else 
  { 
    // works in Explorer 6 Strict, Mozilla (not FF) and Safari
     yWithScroll = document.body.offsetHeight;
     xWithScroll = document.body.offsetWidth;
  }
  arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
  //alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
  return arrayPageSizeWithScroll;
}

function getScreenWidth()
{
  if (parseInt(navigator.appVersion)>3) {
   if (navigator.appName=="Netscape") {
     width = window.innerWidth;
   }
   if (navigator.appName.indexOf("Microsoft")!=-1) {
    width = document.body.offsetWidth;
   }
  }
  return width;
}


function SelfDelivery()
{
  address  = document.getElementById("address");
  del0 = document.getElementById("del0");
  del1 = document.getElementById("del1");
  if(del0.checked) 
  {
    address.value = "ул.Пироговская д.53/12";
    address.disabled = true;
  }
  if(del1.checked)
  {
    address.value = "";
    address.disabled = false;
  }
}



function HideAddSuccess()
{
  document.getElementById("add_success1").style.display = "none";
  document.getElementById("add_success2").style.display = "none";
}


function ToggleLogin()
{
  el = document.getElementById("login");

  if (el.className == "login1") {
    var pos= (getScreenWidth()/2)-290;
    el.className = "login2";
    el.style.left = pos; 
  }
  else if (el.className == "login2") {
    setTimeout(HideLogin2(),500);    
  }
}

function HideLogin()
{
  setTimeout(HideLogin2(),500);
}

function HideLogin2()
{
  el = document.getElementById("login");
  el.className = "login1";
}
