function MakeRequest(type,id)
{
  var xmlHttp = getXMLHttp();
 
  xmlHttp.onreadystatechange = function()
  {
    if(xmlHttp.readyState == 4)
    {
      HandleResponse(xmlHttp.responseText,id,type);
    }
  }
	if(type=='add_buy')
	{
	  xmlHttp.open("GET", "js/ajax.php?type="+type+"&id="+id+"", true);
	  xmlHttp.send(null);
	}
	if(type=='card_info')
	{
	  xmlHttp.open("GET", "js/ajax.php?type="+type+"&id="+id+"", true);
	  xmlHttp.send(null);
	}
	if(type=='add_note')
	{
	  xmlHttp.open("GET", "js/ajax.php?type="+type+"&id="+id+"", true);
	  xmlHttp.send(null);
	}	
	if(type=='note_info')
	{
	  xmlHttp.open("GET", "js/ajax.php?type="+type+"&id="+id+"", true);
	  xmlHttp.send(null);
	}	
	if(type=='search')
	{
	  xmlHttp.open("GET", "js/search.php?type="+type+"&id="+id+"", true);
	  xmlHttp.send(null);
	}
}
function getXMLHttp()
{
  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 HandleResponse(response,id,type)
{
  if(type=='search')
  {
   document.getElementById('search_exit').innerHTML = response;
  }
  else if(type=='card_info')
  {
   document.getElementById('koszyk_short').innerHTML = response;
  }
  else
  {
  document.getElementById('ResponseDiv_'+id+'').innerHTML = response;
  }
  
}
