//Ajax script courtesy of w3schools
var xmlHttp

var theDiv

function getOrder(path, resultDiv){
	theDiv = document.getElementById(resultDiv);
	
	if (path.length==0){ 
		theDiv.innerHTML="";
  		return;
	}
	
	xmlHttp = GetXmlHttpObject();
	//alert(xmlHttp);
	if (xmlHttp==null){
		alert ("Your browser does not support AJAX!");
  		return;
	} 
	
	var url=path;
	if (path.indexOf("?") > -1){
		url=url+"&sid="+Math.random();
	}else{
		url=url+"?sid="+Math.random();
	}
	
	//xmlHttp.onreadystatechange = stateChanged();
	xmlHttp.open("GET",url,true);
	//xmlHttp.onreadystatechange = stateChanged();
	xmlHttp.send(null);
	xmlHttp.onreadystatechange = stateChanged;
	//try
	//{
	//theDiv.innerHTML=xmlHttp.responseText;
	//}
	//catch(e)
	//{
	//	alert(e);
	//}
	
	
} 

function stateChanged() { 


if (xmlHttp.readyState==0){ 
		//theDiv.innerHTML=xmlHttp.responseText;
		//alert(xmlHttp.responseText);
	}
if (xmlHttp.readyState==1){ 
		//theDiv.innerHTML=xmlHttp.responseText;
	}
	if (xmlHttp.readyState==2){ 
		//theDiv.innerHTML=xmlHttp.responseText;
		//alert(xmlHttp.responseText);
	}
	if (xmlHttp.readyState==3){ 
		//theDiv.innerHTML=xmlHttp.responseText;  
		//alert(xmlHttp.responseText);
	}
	if (xmlHttp.readyState==4){ 
		theDiv.innerHTML=xmlHttp.responseText;
		//alert(xmlHttp.responseText);
	}
}

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;
}