function $(A){return document.getElementById(A)}var scripts=document.getElementsByTagName("script");var myscript=scripts[scripts.length-1];var baseurl="http://www.winajackpot.com/jackpots/new_jackpotjs.php?xmlfilename=";var totaljackpoturl="casinostotal";var tickingPeriod=120*1000;var downloadInterval=119*1000;var updateInterval=2500;var startPercent=99;var TickerList=[];var EmptyFunc=function(){};var HLComm=function(url){this.initialize=function(url){var frame,container;if("".replace(/^$/,function(){return"x"})!="x"){var div=document.createElement("div");with(div.style){height=width=border="0px";visibility="hidden";position="absolute"}document.body.appendChild(div);div.innerHTML='<iframe src=""></iframe>';frame=div.firstChild;container=div}else{frame=document.createElement("iframe");document.body.appendChild(frame);container=frame}with(container.style){height=width=border="0px";visibility="hidden";position="absolute"}for(var i=0;i<window.frames.length;i++){if(window.frames[i]==frame){frame=window.frames[i];break}}this.frame=frame;this.url=url};this.sendRealRequest=function(tickername){var frame=this.frame;var doc;if(frame.contentDocument){doc=frame.contentDocument}else{if(frame.contentWindow){doc=frame.contentWindow.document}else{if(frame.document){doc=frame.document}}}if(!doc){setTimeout(function(){arguments.callee(tickername)},100);return }doc.open();doc.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><script type="text/javascript" src="'+this.url+"\"><\/script></head><body onLoad=\"var d='';try{d=xmlstring}catch(e){}window.parent.TickerList["+tickername+'].handleResponse(d)"></body></html>');doc.close()};this.initialize(url)};var Ticker=function(A){this.tickerStartSum=0;this.tickerEndSum=0;this.tickerStartTime=0;this.ticking=true;this.counter=0;this.errmsg="-";this.xml=baseurl;this.downloadTime=0;this.setup=false;this.initialize=function(B){if(!B.info){return }this.currency=(B.currency?B.currency.toLowerCase():"usd");this.info=B.info;switch(B.info){case 1:if(!B.game||(B.local==1&&!B.casino)){return }this.countElement="game";if(B.casino){this.casino=B.casino.toLowerCase()}this.game=B.game.toLowerCase();this.xml+=(B.local==1?(this.casino+"_"):"");this.xml+=this.game;this.setup=true;break;case 2:if(!B.casino){return }this.countElement="casinototal";this.casino=B.casino.toLowerCase();this.xml+=this.casino;this.setup=true;break;case 4:this.xml+=totaljackpoturl;this.local=(B.local==1||B.local==0?B.local:2);this.setup=true;break;case 5:if(!B.group){return }this.countElement="game";this.group=B.group.toLowerCase();this.xml+="group_"+this.group;this.setup=true;break;default:return }this.setup=true;if(B.type=="count"||B.type=="sum"){this.ticking=false;this.type=B.type;if(this.type=="count"){this.sign="";this.signpos=""}}this.comm=new HLComm(this.xml);this.name=window.TickerList.length;window.TickerList[window.TickerList.length]=this};this.attachToTextBox=function(B){this.textbox=$(B)};this.debugTextBox=function(B){this.debug=$(B)};this.SetCurrencySign=function(B){if(this.type!="count"){this.sign=B}};this.SetCurrencyPos=function(B){if(this.type!="count"){this.signpos=B}};this.requestJackpot=function(){this.comm.sendRealRequest(this.name)};this.handleResponse=function(E){this.errmsg="-";var D=this.tickerEndSum;var G=0;var B=0;var K,H;K=this.parseFromString(E);if(K){if(this.info==4&&this.local==2){var I=this.findTargetNodes(K);if(I&&I.length>0){D=0;for(var F=0;F<I.length;F++){var C=I[F];var J=0;if(this.type=="sum"){J=parseFloat(C.getAttribute("wins"),10)}else{if(this.type=="count"){J=parseFloat(C.getAttribute("winc"),10)}else{if(C.firstChild&&C.firstChild.nodeValue){J=parseFloat(C.firstChild.nodeValue,10)}}}if(!isNaN(J)){D+=J}G+=(isNaN(parseFloat(C.getAttribute("seed"),10))?0:parseFloat(C.getAttribute("seed"),10));B+=(isNaN(parseFloat(C.getAttribute("step"),10))?0:parseFloat(C.getAttribute("step"),10))}if(D==0){D=this.tickerEndSum}if(typeof this.sign=="undefined"){this.sign=I[0].getAttribute("sign");if(this.sign.length>1){this.sign=" "+this.currency.toUpperCase();this.signpos=1}}if(typeof this.signpos=="undefined"){this.signpos=I[0].getAttribute("pos")}}}else{H=this.findTargetNode(K);if(H){if(this.type=="sum"){D=parseFloat(H.getAttribute("wins"),10)}else{if(this.type=="count"){D=parseFloat(H.getAttribute("winc"),10)}else{if(H.firstChild&&H.firstChild.nodeValue){D=parseFloat(H.firstChild.nodeValue,10)}}}if(isNaN(D)){D=this.tickerEndSum}if(typeof this.sign=="undefined"){this.sign=H.getAttribute("sign");if(this.sign.length>1){this.sign=" "+this.currency.toUpperCase();this.signpos=1}}if(typeof this.signpos=="undefined"){this.signpos=H.getAttribute("pos")}G=parseFloat(H.getAttribute("seed"),10);B=parseFloat(H.getAttribute("step"),10);if(isNaN(G)){G=0}if(isNaN(B)){B=0}}}}this.setJackpot(D,G,B);if(this.loadListener&&this.loadListener.onload){this.loadListener.onload(this)}};this.findTargetNodes=function(B){var F=B;var C=[];if(this.type=="count"){return B.getElementsByTagName("total")}var D=F.getElementsByTagName("amount");for(var E=0;E<D.length;E++){if(D[E].getAttribute("currency").toLowerCase()==this.currency){C.push(D[E])}}return C};this.findTargetNode=function(C){var F=C;var H;if(this.info==4){var G=false;var B=C.getElementsByTagName("total");for(var E=0;E<B.length;E++){if(B[E].getAttribute("local")==this.local){F=B[E];G=true}}if(!G){return false}if(this.type=="count"){return F}}if(this.type=="count"){H=F.getElementsByTagName(this.countElement)[0]}else{var D=F.getElementsByTagName("amount");for(var E=0;E<D.length;E++){if(D[E].getAttribute("currency").toLowerCase()==this.currency){H=D[E];break}}}return H};this.parseFromString=function(D){var B={};if(typeof (DOMParser)!="undefined"){var B=(new DOMParser()).parseFromString(D,"text/xml")}else{try{B=new ActiveXObject("Microsoft.XMLDOM");B.async=false;B.loadXML(D)}catch(C){B.err=1;B.errmsg=C}}if(D==""||B.err==1){this.errormsg=B.errmsg;return false}return B};this.setJackpot=function(C,B,D){if(this.tickerEndSum==0||C<this.tickerEndSum){if(D>0){this.tickerStartSum=Math.max(C-D*tickingPeriod/1000,B)}else{this.tickerStartSum=Math.max(C*startPercent/100,B)}}else{this.tickerStartSum=this.getJackpot()}this.tickerEndSum=C;this.tickerStartTime=(new Date()).getTime();if(this.debug){var E="";if(this.info==1){E+="GameTicker: "+this.game+"/"+(this.casino?this.casino:"global")+"/"+this.currency}if(this.info==2){E+="CasinoTicker: "+this.casino+"/"+this.currency}if(this.info==4){E+="TotalTicker: "+(this.local==2?"(local+global) ":(this.local==1?"(local) ":"global "))+this.currency}if(this.info==5){E+="GroupTicker: "+this.group+"/"+this.currency}if(this.type){E+=" - "+this.type}if(this.errmsg=="-"){this.debug.innerHTML=E+"<br>StartSum: "+this.tickerStartSum+"<br>EndSum: "+this.tickerEndSum+"<br>"+this.xml}else{this.debug.innerHTML=E+"<br>"+this.errmsg+"<br>counter: "+this.counter}}};this.getJackpot=function(){var B=(new Date()).getTime();if(this.tickerStartTime==0){return 0}if(!this.ticking){return this.tickerEndSum}if(B>this.tickerStartTime+tickingPeriod){return this.tickerEndSum}else{return this.tickerStartSum+(this.tickerEndSum-this.tickerStartSum)*(B-this.tickerStartTime)/tickingPeriod}};this.updateJackpot=function(){var B=(new Date()).getTime();if(this.counter==0){if(navigator&&navigator.userAgent&&((navigator.userAgent.toLowerCase()).indexOf("opera")!=-1)){setTimeout(this.requestJackpot.bind(this),100)}this.counter=this.counter+1;this.downloadTime=B;this.requestJackpot();return }if(B>this.downloadTime+downloadInterval){this.counter=this.counter+1;this.downloadTime=B;this.requestJackpot();return }return false};this.showJackpot=function(){var E=this.getJackpot();var B="";if(this.type!="count"){E=Math.round(E*100)/100+"";var G=1;var C=E.indexOf(".");if(C>=0){B=E.substring(C);C--}else{C=E.length-1}for(var D=C;D>=0;D--){B=E.substr(D,1)+B;if((G==3)&&(D!=0)){B=","+B;G=1}else{G++}}if(E.match(/^\d+\.\d$/)){B=B+"0"}if(E.match(/^\d+$/)){B=B+".00"}}if(E>0){text=(this.signpos!=0?B+this.sign:this.sign+B)}if(E>0&&this.type=="count"){text=B}try{this.textbox.innerHTML=text}catch(F){}topTickers.updateTotals()};this.tick=function(){if(!this.setup||!this.textbox){return false}if(this.tickerStartTime!=0&&!this.ticking){this.showJackpot();return false}this.updateJackpot();this.showJackpot();this.bind=function(){var B=this.tick,D=$A(arguments),C=D.shift();return function(){return B.apply(C,D.concat($A(arguments)))}};setTimeout(this.bind(this),updateInterval)};this.initialize(A)};function $A(C){if(!C){return[]}if(C.toArray){return C.toArray()}var B=C.length||0,A=new Array(B);while(B--){A[B]=C[B]}return A}var TopTickers=function(A,C,B){this.spanBase=A;this.textBase=C;this.games=B;this.updateTotals=function(){var E=0;for(var D=0;D<this.games.length;D++){try{E+=parseFloat($("jackpot_amount_"+D).innerHTML.replace(/[^0-9\.]/g,""))}catch(F){}}E=Math.round(E*100)/100;totalString=E+"";if(totalString.match(/\./)&&!totalString.match(/\.[0-9]{2}/)){totalString+="0"}else{if(!totalString.match(/\./)){totalString+=".00"}}totalString=totalString.split("").reverse().join("");totalString=totalString.replace(/([0-9]{3})(?=[0-9]+)/g,"$1,");
		var jpt = isNaN(E)?"UPDATING":"$"+totalString.split("").reverse().join("");
		$("jackpot_amount_total").innerHTML = jpt;
		if (typeof(updateJackpot) != "undefined") updateJackpot(jpt);
};this.sortTickers=function(D){return D.sort(function(F,E){return E.tickerEndSum-F.tickerEndSum})};this.attachTickers=function(){var D=new Array();this.loadCounter=this.games.length-1;for(var E=0;E<this.games.length;E++){if(this.games[E].id){var F=new Ticker({info:1,casino:"mansion",game:this.games[E].id,currency:"usd"});F.fullGameName=this.games[E].title;F.loadListener=this;F.updateJackpot();D.push(F)}}this.tickers=D;this.run()};this.onload=function(D){this.loadCounter--;D.loadListener=false;if(this.loadCounter>0){return }this.run()};this.enable=function(){this.attachTickers()};this.run=function(){if(this.tickers){var E=this.sortTickers(this.tickers);for(var D=0;(D<5)&&(D<E.length)&&(D<5);D++){var F=E[D];F.attachToTextBox(this.spanBase+D);$(this.textBase+D).innerHTML=F.fullGameName;F.tick()}E=false}}};var games=new Array({id:"grel",title:"Gold Rally"},{id:"bl",title:"Beach Life"},{id:"bls",title:"Casinosaurus"},{id:"drts4",title:"Ugga Bugga"},{});var topTickers=new TopTickers("jackpot_amount_","jackpot_text_",games);topTickers.enable();

