function getXmlHttp(){
  var xmlhttp;
  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
      xmlhttp = false;
    }
  }
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  return xmlhttp;
}

function addbox (id, ses, count, sale) {
   var xmlhttp = getXmlHttp();
   var current_date = new Date();
   var div = document.getElementById('box');

   xmlhttp.open('GET', 'add_box.php?id='+id+'&ses='+ses+'&count='+count+'&sale='+sale+'&date='+current_date, true);
   xmlhttp.onreadystatechange = function() {
   if (xmlhttp.readyState == 4)
   {
    if(xmlhttp.status == 200)
    {
   div.innerHTML = xmlhttp.responseText;
   var pokupka = document.getElementById('pokupka'+id);
   if(pokupka!=undefined)
   {
   pokupka.innerHTML = "<center><img border=\"0\" src=\"images/box_a.jpg\"><br><font color=\"#008000\">Товар в<br>корзине<font></center>";
   }

    }
   }
 }
xmlhttp.send(null);
}
function showLink(url)
{
var msgWindow;
msgWindow=window.open('http://hattabych.com.ua/foto_big.php?id='+url,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=10,height=10");
if (msgWindow != null && msgWindow.opener == null) msgWindow.opener=window;
msgWindow.focus();
}

function left_menu (id) {
  if(document.getElementById('left_menu_'+id).style.display == 'none')
  {
  document.getElementById('left_menu_'+id).style.display = '';
  }
  else
  {
  document.getElementById('left_menu_'+id).style.display = 'none';
  }
}

function addfoto () {
  var count = document.getElementById('countfoto').value;
  document.getElementById('countfoto').value = eval(count+'+1');

  var newDiv = document.createElement('div');
  newDiv.innerHTML = '<input name=\"userfile'+eval(count+'+1')+'\" type=\"file\" style=\"width=100%\">';
  add_foto.appendChild(newDiv);
}

function showbig (id, url) {

  document.getElementById('tablefoto'+document.getElementById('fotoid').value).bgColor = '#FFFFFF';
  document.getElementById('fotobig').src = 'images/tovar/l'+url;
  document.getElementById('fotoid').value = id;
  document.getElementById('tablefoto'+id).bgColor = '#C81124';
}