function update(id, cida, a)
{
divid = id;
uid = cida;
action = a;
loader = "loader" + divid;
document.getElementById(loader).style.visibility = 'visible';

xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="basket_upd.php";
url=url+"?id="+id;
url=url+"&cida="+cida;
url=url+"&action="+a;
url=url+"&sid="+Math.random();

xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged()
{ 
if (xmlhttp.readyState==4)
{
txt = "txtHint" + divid;
loader = "loader" + divid;
stuf = "action" + divid;
notesa = "notes" + divid;
nota = "notem" + divid;
if (action == "rem") {
	stufa = "add" + divid;
	stuf = "rem" + divid;
	document.getElementById(stufa).style.visibility = 'visible';
	document.getElementById(stuf).style.visibility = 'hidden';
	document.getElementById(nota).style.visibility = 'hidden';
	document.getElementById(notesa).style.display = 'none';
}


if (action == "add") {
	stufa = "rem" + divid;
	stuf = "add" + divid;
	document.getElementById(stufa).style.visibility = 'visible';
	document.getElementById(stuf).style.visibility = 'hidden';
	document.getElementById(nota).style.visibility = 'visible';
}

//action = action + divid;


//alert(divid);
//document.getElementById(action).style.visibility = 'hidden';  
document.getElementById(loader).style.visibility = 'hidden';  
document.getElementById(txt).innerHTML=xmlhttp.responseText;
updateSatusTop(divid, uid);
}
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}

//// Get staus top 
function updateSatusTop(id, cida)
{

xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="basket.php";
url=url+"?id="+id;
url=url+"&cida="+cida;
url=url+"&sid="+Math.random();

xmlhttp.onreadystatechange=stateChanged3;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged3()
{
if (xmlhttp.readyState==4)
{
txt = "statustop";
//alert(divid);
document.getElementById(txt).innerHTML=xmlhttp.responseText;

}
}


function updateNote(str, id, uid)
{

divid = id;
loader = "loaderNote" + divid;
document.getElementById(loader).style.visibility = 'visible';
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="basket_note.php";
url=url+"?note="+str;
url=url+"&id="+id;
url=url+"&uid="+uid;
url=url+"&sid="+Math.random();

xmlhttp.onreadystatechange=stateChanged2;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged2()
{
if (xmlhttp.readyState==4)
{
txt = "txtNotes" + divid;
loader = "loaderNote" + divid;
notesa = "notes" + divid;
//alert(divid);
setTimeout("document.getElementById(notesa).style.display = 'none';",1000);

document.getElementById(loader).style.visibility = 'hidden'; 
document.getElementById(txt).innerHTML=xmlhttp.responseText;
}
}



