function setPing() {
	initXmlHttpRequest(gotData);
	intervalId = window.setInterval("ping()", 60000 ); //600000
}

var waitingForData = false;	

function ping() {
if (!waitingForData)
	{
		waitingForData = true;			
		sendQuerystring('ping.php?ind=1&rnd=' + GenerateRandomPassword(10));	
	}	
}

function setShowMaps(sm) { 
	sendQuerystring('ping.php?sm='+sm+'&rnd=' + GenerateRandomPassword(10));
}

function gotData(data)
{	
	waitingForData = false;
	ecc = document.getElementById('ecco2');
	if (ecc) ecc.innerHTML=data;
}


function GenerateRandomPassword(length)
{
	var allowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
	var password = "";
	
	for (var i = 0; i < length; i++)
	{
		var idx = Math.floor(Math.random() * allowedChars.length);
	
		password += allowedChars.charAt(idx);
	}
	
	return password;
}



/*****************************  XmlHttpRequest  *****************************

Author:	        Luke Breuer, labreuer+xmlhttprequest@gmail.com
Created:        4/19/05
Documentation:  http://luke.breuer.com/xmlhttprequest.aspx


*/

var callbackFunction = null
var http;

/*
This is our event handler for response to our requests.  It simply calls the callback
  function when data is received and complete:
  
Object status:
  0 = uninitialized
  1 = loading
  2 = loaded
  3 = interactive
  4 = complete
*/
function handleHttpResponse(element)
{
	if (http.readyState == 4 && callbackFunction != null)
		callbackFunction(http.responseText);
    
}

/*
Here is where you send a request -- either to the current page (in which 
  case you can simply put in the querystring, with no question mark),
  or to a different page.
  
Usually you want your webserver to process pages sent by XmlHttpRequest
  objects differently than normal requests.  (You would do this by recognizing
  certain variables in the get or post data.
  
This script is asynchronous -- it continues execution immediately after sending
  a request to the webserver.
  
Note that you can do more than just send(null) -- I just don't use more than
  that functionality.  Neither should you, until you get the basic stuff working.
*/
function sendQuerystring(querystringOrUrl) 
{
	http.abort();

	http.onreadystatechange = handleHttpResponse; 
	http.open("GET", (querystringOrUrl.indexOf('?') < 0 ? '?' : '') + querystringOrUrl, true);
	 
	http.send(null);
}

/*
We need this function because of browser nonconformity. 
All you really have to know is that if it returns false, you're screwed.
  (i.e. you can't do cool XmlHttpRequest stuff)
*/
function getXmlHttpObject() 
{
	var xmlhttp;

	/*@cc_on
	@if (@_jscript_version >= 5)
	try
	{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (e)
	{
		try
		{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e)
		{
			xmlhttp = false;
		}
	}
	@else
	xmlhttp = false;
	@end @*/
	
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') 
	{
		try
		{
			xmlhttp = new XMLHttpRequest();
		}
		catch (e)
		{
			xmlhttp = false;
		}
	}
	
	return xmlhttp;
}

/*
Pass the function that should be called when data is received from the server.
  This function should accept a string, which will be whatever the webserver spits out.
Returns true if the XmlHttpRequest object was created successfully -- if it wasn't,
  then you aren't going to be doing any XmlHttpRequest'ing.
*/
function initXmlHttpRequest(callback)
{
	callbackFunction = callback;
	http = getXmlHttpObject();
	

	return http != null;
	
}
