var SecondsPerDay=86400;var SecondsPerHour=3600;var Timer=new Array();var timerCNT;var secondsLeft;var serverTime;var onComplete;function setupTimer(d,c,e,b,a){setupTimer2(d,c,e,b,a,"Time Left: ")}function setupTimer2(f,e,h,d,b,g){var c,a;c=e;if(timerCNT==null){timerCNT=0}else{timerCNT++}a=new Date(f);secondsLeft=parseInt((c.getTime()-a.getTime())/1000);Timer[timerCNT]=new PBTimer(null,serverTime,c,secondsLeft,h,d,g);onComplete=b;if(timerCNT==0){setInterval(TimerTick,1000)}}var flag=false;function setupTimer3(f,e,h,d,b,g){var c,a;c=e;timerCNT=0;Timer[timerCNT]=null;a=new Date(f);secondsLeft=parseInt((c.getTime()-a.getTime())/1000);Timer[timerCNT]=new PBTimer(null,serverTime,c,secondsLeft,h,d,g);onComplete=b;if(flag==false){setInterval(TimerTick,1000)}else{}flag=true}function stopTimer(a){clearInterval(a)}function PBTimer(d,b,a,c,g,e,f){this.ServerTime=b;this.Target_dt=a;this.SecondsLeft=c;this.Timer_nm=g;this.element=d;this.format=e;this.text=f;this.StartTimer(this)}PBTimer.prototype.ServerTime=new Date();PBTimer.prototype.Target_dt=new Date();PBTimer.prototype.SecondsLeft=0;PBTimer.prototype.Timer_nm="";PBTimer.prototype.element;PBTimer.prototype.format="long";PBTimer.prototype.StartTimer=function(b,a){};function TimerTick(){var a;for(a=0;a<=timerCNT;a++){UpdateTimer(a)}}function UpdateTimer(c){var k,h,f,j,b;var g=Timer[c];if(!g){return}g.SecondsLeft--;b=g.SecondsLeft;if(b>0){k=parseInt(b/SecondsPerDay);b=b-(k*SecondsPerDay);h=parseInt(b/SecondsPerHour);b=b-(h*SecondsPerHour);f=parseInt(b/60);b=b-(f*60);j=b;if(g.format=="long"){var d=k==1?"day":"days";var i=h==1?"hour":"hours";var e=f==1?"minute":"minutes";var a=j==1?"second":"seconds";document.getElementById(g.Timer_nm).innerHTML=g.text+k+" "+d+", "+h+" "+i+", "+f+" "+e+", "+j+" "+a}else{if(g.format=="short"){if(j<10){j=j}if(f<10){f=f}if(h<10){h=h}document.getElementById(g.Timer_nm).innerHTML=g.text+k+"d "+h+"h "+f+"m "+j+"s"}}}else{document.getElementById(g.Timer_nm).innerHTML="Contest Ended!";if(typeof(onComplete)=="function"){onComplete()}setInterval(TimerTick,1000000000)}document.getElementById(g.Timer_nm).innerHTML=document.getElementById(g.Timer_nm).innerHTML.replace(" 0d "," ")};
