function absPosition(obj) 
 {
   var x = y = 0;
   while(obj) 
		{
      x += obj.offsetLeft;
      y += obj.offsetTop;
      obj = obj.offsetParent;
    }
   return {x:x, y:y};
 } 
function RandomNumber() 
 {
   today = new Date();
   num   = Math.abs(Math.sin(today.getTime()));
   return num;
 }
function ShowBasket(element, idgoods, idprice, width, height)
 {
   var rand = RandomNumber(); 
   $.get('order.php?rand='+rand, getDataBasket);	 
	 document.getElementById('basket').style.display = "block";  
	 document.getElementById('basket').style.top  = (absPosition(element).y - height) + 'px';
	 document.getElementById('basket').style.left = (absPosition(element).x - width) + 'px';
	 document.getElementById('idGoods').value = idgoods; 
	 document.getElementById('idPrice').value = idprice; 
	return false;
 } 
function HideBasket()
 {
	 document.getElementById('basket').style.display = "none"; 
	return false;
 }    
function MakeOrder()
 {
   rand     = RandomNumber();
   idgoods  = document.getElementById('idGoods').value;
	 idprice  = document.getElementById('idPrice').value;
	 quantity = document.getElementById('quantity').value;
	 $.get('order.php'+'?action=add&id='+idgoods+'&price='+idprice+'&quantity='+quantity+'&rand='+rand, getDataBasket); 
	 return false;
 }
function getDataBasket(data)
 {
   rand = RandomNumber();
   document.getElementById('basket').innerHTML = data;
	 $.get('basket_info.php?rand='+rand, getDataBasketInfo);
 }
function getDataBasketInfo(data)
 {
   document.getElementById('basket_info').innerHTML = data;
 } 
function GetUnits(rubric, subrubric, region, company)
 {
   rand = RandomNumber();
   $.get('/market_suppliers.php?rubric='+rubric+'&subrubric='+subrubric+'&region='+region+'&company='+company+'&'+rand, getUnitsData);
	return false;
 } 
function getUnitsData(data)
 {
	 document.getElementById('suppliers').innerHTML = data; 
 }  
