var jackpots = JP1;
var jackpotsTotal = 0;	
var jackpotsInc = new Array();

function doTotals(){
	if(incrementTotals==true) setInterval(incTotals, 1000);
	jackpots.splice(15,3);
	for(i in jackpots) jackpotsTotal += Number(jackpots[i]);
	jackpots[15] = jackpotsTotal;
}

function displayTotal(id){
	jackpotsInc[id] = id;
	value = formatTotal(jackpots[id]);
	document.getElementById(id).innerHTML = value;
}

function formatTotal(data){
	data += '';
	x = data.split("");
	xr = x.reverse();
	for(i=0; i<xr.length; i++){
		if(i==0) tmpStr = xr[i];
		else if(i==2){
			tmpStr += ".";
			tmpStr += xr[i];
		}else if(i==5){
			tmpStr += ",";
			tmpStr += xr[i];
		}else if(i==8){
			tmpStr += ",";
			tmpStr += xr[i];
		}else{
			tmpStr += xr[i];
		}
	}
	x = ((tmpStr.split("")).reverse()).join("");
	
	if(currencyAlign=="right") return x + currency;
	else return currency + x;
}

function incTotals(){
	for(i in jackpotsInc){
		jackpots[i] = Number(jackpots[i]) + 26;
		document.getElementById(i).innerHTML = formatTotal(jackpots[i]);
	}
}
