function createXMLHttpRequest()
{
   var xmlHttp;
   try
   {
      // Firefox, Opera 8.0+, Safari
      xmlHttp=new XMLHttpRequest();
   }
   catch (e)
   {
      // Internet Explorer
      try
      {
         xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
      catch (e)
      {
         try
         {
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
         }
         catch (e)
         {
            alert("Your browser does not support AJAX!");
            return false;
         }
      }
   }
   return xmlHttp;
}

function order(action, id, amount)
{
   var xmlHttp;
   xmlHttp = createXMLHttpRequest();

   xmlHttp.onreadystatechange=function()
   {
      if(xmlHttp.readyState==4)
      {
         returnObjById('cart_list').innerHTML = xmlHttp.responseText;
      }
   }

   switch(action)
   {
      case 'add':
         xmlHttp.open("GET","cart_content.php?action=add&product_id="+id+"&amount="+amount,true);
         break;
      case 'increase':
         xmlHttp.open("GET","cart_content.php?action=increase&product_id="+id,true);
         break;
      case 'set':
         xmlHttp.open("GET","cart_content.php?action=set&product_id="+id+"&amount="+amount,true);
         break;
      case 'decrease':
         xmlHttp.open("GET","cart_content.php?action=decrease&product_id="+id,true);
         break;
      case 'delete':
         xmlHttp.open("GET","cart_content.php?action=delete&product_id="+id,true);
         break;
   }
   xmlHttp.send(null);
   return false;
}

function returnObjById(id)
{
    if (document.getElementById)
        var returnVar = document.getElementById(id);
    else if (document.all)
        var returnVar = document.all[id];
    else if (document.layers)
        var returnVar = document.layers[id];
    return returnVar;
}