var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/

if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

function AJAXFetch(URL)
{
	//alert(URL);
	xmlhttp.open("GET", URL,true);
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4) {
			return xmlhttp.responseText;
		}
	}
	xmlhttp.send(null)
}

function getAJAXProducts(URL, Div)
{
	document.getElementById(Div).innerHTML = "";	
	xmlhttp.open("GET", URL, true);
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4) {	
			PutInDiv(xmlhttp.responseText, Div);
		}
	}
	xmlhttp.send(null)
}		

function RunAndPost(CMD, GUID)
{
	var URL = "/Admin/Auto/AJAX/AjaxRemote.aspx?GUID=" + GUID + "&CMD=" + CMD;			
	document.getElementById(Div).innerHTML = "";	
	xmlhttp.open("GET", URL, true);
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4) {	
		    Go();
		}
	}
	xmlhttp.send(null)
}	

		
function PutInDiv2(theText, Div)
{					
    document.getElementById(Div).innerHTML = "";	
	var t = document.createElement('div');
    t.innerHTML = theText;
    document.getElementById(Div).appendChild(t);
}
			
function PutInDiv(theText, Div)
{	
	document.getElementById(Div).innerHTML = theText;					
}
			

function AJAXSend(URL)
{
    try{
	xmlhttp.open("GET", URL,true);	
	xmlhttp.send(null)
	}
	catch (Error) {}
}

function AJAXClick(theImageName, theImage, CMD, GUID)
{
	var NewImage = '/graphics/AJAX/1' + theImage
	MM_swapImage(theImageName,'',NewImage,1);
	SendURL(GUID, CMD);
}	

function GetAJAX(URL, Div)
{		
	xmlhttp.open("GET", URL, true);
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4) {
			PutInDiv(xmlhttp.responseText, Div);
		}
	}
	xmlhttp.send(null)
}

function SendURL(GUID, CMD)
{
	var URL = "/Admin/AJAX/AjaxRemote.aspx?GUID=" + GUID + "&CMD=" + CMD;			
	AJAXSend(URL);
}

function DespatchClick(theImageName, theImage, CMD, GUID, OrderID)
{
	var NewImage = '/graphics/AJAX/1' + theImage
	MM_swapImage(theImageName,'',NewImage,1);	
	var URL = "/Admin/Auto/AJAX/AjaxRemote.aspx?GUID=" + GUID + "&CMD=" + CMD + "&OID=" + OrderID;			
	AJAXSend(URL);
}	