// JavaScript Document
var xmlHttp;

function showBuy(str) { 
	xmlHttp = GetXmlHttpObject();
	if (xmlHttp == null) {
	  alert ("Browser does not support HTTP Request");
	  return;
	} 
	var url = "buy_process.php";
	url = url + "?q=" + str;
	url = url + "&sid=" + Math.random();
	xmlHttp.onreadystatechange = stateChanged ;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

/*function stateChanged() { 
//alert('stateChanged');
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
	  document.getElementById("other2_results_content").innerHTML = xmlHttp.responseText;
	}
}*/

function stateChanged() {
// On the page, you forgot to define divUpdate!
var divUpdate=document.getElementById('other2_results');
// we use the div inside called inject_content to push our
// data, and not results itself
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
	  document.getElementById("other2_results_content").innerHTML =
xmlHttp.responseText;
//hesido - update when xmlhttp data is injected, making sure an error is not thrown (by checking for scrollupdate method)
if(divUpdate!=null&&divUpdate.scrollUpdate) divUpdate.scrollUpdate();
	}
}

function GetXmlHttpObject(){
var xmlHttp = null;
try {
 // Firefox, Opera 8.0+, Safari
 xmlHttp = new XMLHttpRequest();
 }
catch (e) {
 //Internet Explorer
 try  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
