/*
** This is the code for the asyncronous java stuff
**
** Pass it the command you want to send to the server and it will call the
** function callbackRef.
**
** If you want to pass a variable to the callback function, set it to userVar.
*/
function doHttp(command, callbackRef, userVar)
{
	var count = 0;

	while(count < 3)
	{
		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') {
		  xmlhttp = new XMLHttpRequest();
		}

		try
		{
			// And to the html request.
			xmlhttp.open("GET", command, true);
			xmlhttp.onreadystatechange=function()
			{
				if (xmlhttp.readyState==4)
				{
					// If there is a callback function, call it
					if (callbackRef != null) callbackRef(xmlhttp, userVar);
				}
			}
			xmlhttp.send(null);
			count = 3;
		}
		catch (e)
		{
			// Yes, this is bad practice but the only exception i am likely to get is 'not initialised' so we just]
			// go round any try again. This fixes the bug where if you click very quickly it stops working!
		}

		count ++;
	}
}
