
var request;
var queryString; 


// create the variables to send via ajax

function sendData() {
	var url="/xmlfeeds/networkinfo.xml";
	httpRequest("POST",url,true);
	}
	

// note the main ajax functions sit in /include/javascript/ajax.js
// the following function waits for the response then runs the function getDocInfo and passes the xml information to it
// else it runs the scoller function which just shows the daily message
	

function handleResponse(){
	if(request.readyState == 4) {
		if(request.status == 200) {
			var doc = request.responseXML;
			var info = getDocInfo(doc);
			}
	}	
}

//the following function extracts the data from the xml feed and places it into the tickerText node 

function getDocInfo(doc) {
var root = doc.documentElement;
var nds;
var onlinePlayers;
var playersInTournaments;
var activeTournaments;
var realTables;
var realPlayers;

 if (root.hasChildNodes()) {
 	nds = root.childNodes;
	for (var i = 0; i < nds.length; i++) {
			if (nds[i].nodeName == 'onlineplayers') {
				onlinePlayers = nds[i].firstChild.nodeValue;
				}
			if (nds[i].nodeName == 'totalactivetables') {
				totalactivetables = nds[i].firstChild.nodeValue;
				}
		}
		mydiv = document.getElementById("onlineStats");
			mydiv.innerHTML="<p>Players Online: <strong>" + onlinePlayers + "</strong><br/>Active Tables: <strong>" + totalactivetables + "</strong></p>";
					
	} 
}




