
function hide_kat (id)
  {
  	var obj = document.getElementById(id);
    if (obj.style.display == 'none') obj.style.display = '';
    else obj.style.display = 'none';

  }

function show_img(img,width,height)
	{
	   var a
	   var b
	   var url
	   vidWindowWidth=width;
	   vidWindowHeight=height;
	   a=(screen.height-vidWindowHeight)/5;
	   b=(screen.width-vidWindowWidth)/2;
	   features="top="+a+",left="+b+",width="+vidWindowWidth+",height="+vidWindowHeight+",toolbar=no,menubar=no,location=no,directories=no,scrollbars=no,resizable=no";
	   url="/show.php?img="+img;
	   window.open(url,'',features,true);
	}

function add(msg_num)
  {
       var a
	   var b
	   var url
	   var vidWindowWidth
	   var vidWindowHeight

	   vidWindowWidth=250;
	   vidWindowHeight=30;
	   a=(screen.height-vidWindowHeight)/5;
	   b=(screen.width-vidWindowWidth)/2;

	   features="top="+a+",left="+b+",width="+vidWindowWidth+",height="+vidWindowHeight+",toolbar=no,menubar=no,location=no,directories=no,scrollbars=no,resizable=no";
	   url="/add.php?id_tov="+msg_num;
	   mreplywin = window.open(url,'',features,true);

  }










function add_kol (id)
          {
            var kol = document.getElementById('kol_'+id);
            var div = document.getElementById('div_'+id);
            var url = '/add.php?id_tov=' + id + '&kol=' + kol.value;
                 // Получаем объект XMLHTTPRequest
                 //if(!this.http)
                  {
                   this.http = get_http();
                   this.working = false;
                  }
                 // Запрос
		         if (!this.working && this.http)
		          {
		            var http = this.http;
		            var value;
		            //создаём запрос
		            this.http.open("GET", url, true);
		            //прикрепляем к запросу функцию-обработчик
		            //событий
		            this.http.onreadystatechange = function()
		             {
			            // 4 - данные готовы для обработки
		                if (http.readyState == 4)
		                  {
		                    value = http.responseText;
		                    this.working = false;
			                div.innerHTML = value;
		                  }else
		                  {
		                     // данные в процессе получения,
		                     // можно повеселить пользователя
		                     //сообщениями
		                     // ЖДИТЕ ОТВЕТА
		                  }
		             }
		            this.working = true;
		            this.http.send(null);
		          }
		         if(!this.http)
		          {
		              alert('Ошибка при создании XMLHTTP объекта!')
		          }
          }
		 function get_http()
		  {
		    if (window.XMLHttpRequest) {
		        try {
		            return new XMLHttpRequest();
		        } catch (e){}
		    } else if (window.ActiveXObject) {
		        try {
		            return new ActiveXObject('Msxml2.XMLHTTP');
		        } catch (e){}
		        try {
		            return new ActiveXObject('Microsoft.XMLHTTP');
		        } catch (e){}
		    }
		    return null;
		  }
