
function Jackpot(containerID, period) {
	this.container = document.getElementById(containerID);
	if (period) this.period = period;
	this.init();
	this.load();
	this.run();
}

Jackpot.prototype = {
	
	container: null,
	period: 60,
	timeout: null,
	request: null,
	url: "http://topgame-online.com/gs2c/common/feeds/jackpot-summary.jsp?cid=blackjackcasino&lang=en",
	
	init: function() {
		if (window.XMLHttpRequest) {
			try {
				this.request = new XMLHttpRequest();
			} catch (e){}
		} else if (window.ActiveXObject) {
			try {
				this.request = new ActiveXObject('Msxml2.XMLHTTP');
			} catch (e){
				try {
					this.request = new ActiveXObject('Microsoft.XMLHTTP');
				} catch (e){}
			}
		}
	},
	
	run: function () {
		this.timeout = window.setTimeout(this.load, this.period);
	},
	
	load: function ()
	{
		if (this.request) {       
			this.request.open("GET", this.url + "&rand=" + Math.random(), true);
			this.request.onreadystatechange = this.process;
			this.request.send(null);
		}
		this.run();
	},
	 
	process: function ()
	{
	  try {
		if (this.request.readyState == 4) {
			if (this.request.status == 200) {
				var total = this.request.responseXML.getElementsByTagName("total");
				this.container.innerHTML = total.getAttribute("value");
			}
		}
	  }
	  catch( e ) {}
	}
	
}