var xmlhttp;
function showEntity(str) {
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	if(str > 0) {
		var url="http://crimson-veil.com/includes/ajax/getEntity.php";
		url=url+"?eType="+str;
		xmlhttp.open("GET",url,true);
		xmlhttp.onreadystatechange=function() {
			if(xmlhttp.readyState==4 && xmlhttp.status == 200) {
				document.getElementById("entityLocation").innerHTML=xmlhttp.responseText;
			}
		}
		xmlhttp.send(null);
	} else {
		document.getElementById("entityLocation").innerHTML="";
		document.getElementById("marketStats").innerHTML="";
	}
}
function showEntityOfferArea(str) {
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="http://crimson-veil.com/includes/ajax/getEntity.php";
	url=url+"?oType="+str;
	xmlhttp.open("GET",url,true);
	xmlhttp.onreadystatechange=function() {
		if(xmlhttp.readyState==4 && xmlhttp.status == 200) {
			document.getElementById("entityLocation").innerHTML=xmlhttp.responseText;
		}
	}
	xmlhttp.send(null);
}
function showEntitySearch(str) {
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="http://crimson-veil.com/includes/ajax/searchMarket.php";
	url=url+"?eType="+str;
	xmlhttp.open("GET",url,true);
	xmlhttp.onreadystatechange=function() {
		if(xmlhttp.readyState==4 && xmlhttp.status == 200) {
			document.getElementById("entityLocation").innerHTML=xmlhttp.responseText;
		} else {
			document.getElementById("entityLocation").innerHTML='<img src="http://crimson-veil.com/images/site/loading_bar.gif" alt="Loading..." />';
		}
	}
	xmlhttp.send(null);
}
function proToolShowEntity(str) {
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="http://crimson-veil.com/includes/ajax/getEntityProd.php";
	url=url+"?eType="+str;
	xmlhttp.open("GET",url,true);
	xmlhttp.onreadystatechange=function() {
		if(xmlhttp.readyState==4 && xmlhttp.status == 200) {
			document.getElementById("entityLocation").innerHTML=xmlhttp.responseText;
			document.getElementById("prodInfoResults").innerHTML='';
		}
	}
	xmlhttp.send(null);
}
function GetXmlHttpObject() {
	try{
		// Opera 8.0+, Firefox, Safari
		return new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			return new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				return new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
}
function ajaxFunction(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	ajaxRequest = GetXmlHttpObject();
	// Create a function that will receive data sent from the server
	ajaxRequest.open('POST', 'addEntity.php');
}
function showListingAddedInfo(str) {
	xmlhttp = GetXmlHttpObject();
	if(xmlhttp == null) {
		alert("Browser does not support http requests.");
		return;
	}
	var url = "http://crimson-veil.com/includes/ajax/getListingAddedInfo.php";
	url=url+"?ltype="+str;
	xmlhttp.onreadystatechange=stateChanged2;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
function stateChanged2() {
	if (xmlhttp.readyState==4 && xmlhttp.status == 200) {
		document.getElementById("listingAddition").innerHTML=xmlhttp.responseText;
	}
}
