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)
{
	alert('ere3');
	alert(CMD);
	var URL = "/Admin/Auto/AJAX/AjaxRemote.aspx?GUID=" + GUID + "&CMD=" + CMD;			
	alert(URL);
	document.getElementById(Div).innerHTML = "";	
	xmlhttp.open("GET", URL, true);
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4) {	
		    Go();
		}
	}
	xmlhttp.send(null)
}	

			
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 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);
}	

function AJAXTextCommand(linkDiv, hiddenDiv, Command, Argument, GUID)
{
    Show(hiddenDiv);
    Hide(linkDiv);
	SendCommand(GUID, Command, Argument);
}	

function SendURL(GUID, CMD)
{
	var URL = "/Admin/AJAX/AjaxRemote.aspx?GUID=" + GUID + "&CMD=" + CMD;			
	AJAXSend(URL);
}

function SendCommand(GUID, Command, Argument)
{
	var URL = "/Admin/AJAX/AjaxCommand.aspx?GUID=" + GUID + "&Command=" + Command + "&Argument=" + Argument;	
   AJAXSend(URL);
}
