function loadXMLDoc(url,readyStateFunction,async) 
{
	// branch for native XMLHttpRequest object
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
		req.onreadystatechange = readyStateFunction;
		req.open("GET", url, async);
		req.send(null);
	// branch for IE/Windows ActiveX version
	} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req) {
			if(readyStateFunction) req.onreadystatechange = readyStateFunction;
			req.open("GET", url, async);
			req.send();
		}
	}
}

function changeBasket(ids, cnt)
{
 var url="/add_basket.php?item="+ids+"&cnt="+cnt+"";
 loadXMLDoc(url,null,false);
 response = req.responseXML.documentElement;
 //alert(req.responseText);
 var total = response.getElementsByTagName('count')[0].firstChild.data;
 var totalsum = response.getElementsByTagName('value')[0].firstChild.data;
 var weight = response.getElementsByTagName('weight')[0].firstChild.data;
 var bsk=document.getElementById("basket");
 bsk.style.display='block';
 var bs=document.getElementById("bsum");
 bs.innerHTML=totalsum;
 var bt=document.getElementById("btotal");
 bt.innerHTML=total;
 var bw=document.getElementById("bweight");
 bw.innerHTML=weight;
}

function addItem(objc)
{
 strcnt=objc.value;
 if(strcnt=='')
 {
  cnt=0; 
 }else
  {
   cnt=parseInt(strcnt);
  }
 if(isNaN(cnt))
 {
  return false;
 }
 ids=objc.id.substring(4);
 changeBasket(ids, cnt)
 if(cnt>0)
 {
  objc.value=cnt;
 }else
  {
   objc.value="";
  }
 return true;
}
function nomenu()
{
 if(!window.Event)
 {
  event.cancelBubble = true, 
  event.returnValue = false;
 }
 return false;
}
function block(e)
{
 if(window.Event)
 {
  if (e.which == 2 || e.which == 3) 
   return false;
 }else
  {
   if (event.button == 2 || event.button == 3)
   {
    event.cancelBubble = true, 
    event.returnValue = false;
   }
 return false;
  }
 return false;
}
function blc()
{
 count=document.images.length;
 for(i=0; i<count; i++)
 {
  document.images[i].onmousedown=block;
  document.images[i].oncontextmenu=nomenu;
  document.images[i].onmouseover="return false;";
 }
}

function wop(url)
{
 window.open(url, '_blank', 'width=780');
 return false;
}
function acl(id)
{
 lay=document.getElementById(id);
 lay.style.visibility="hidden";
 return false;
}
function movec(id)
{
 lay=document.getElementById(id);
 if(lay)
 {
  w=(document.body.clientWidth-lay.scrollWidth)/2
  lay.style.left=w;
  w=(document.body.clientHeight-lay.scrollHeight)/2
  lay.style.top=w;
  lay.style.visibility="visible";
  document.cookie="advshow=yes";
 }
}

function move_basket()
{
 var scTop = parseInt(document.body.scrollTop,10);
 var basket_ob=document.getElementById("basket");
 var newpos=45+scTop;
 basket_ob.style.position="absolute";
 basket_ob.style.top=newpos;
}

function loadhtml()
{
 blc();
}
window.onload=loadhtml;
if(navigator.userAgent.indexOf("MSIE")!=-1)
{
 window.onscroll=move_basket;
}
blc();