JavaScript Countdown Timer Background Process
<p>I have certain codes of countdown timer which have been modified as following:</p>

<pre><code>&lt;script language="JavaScript" type="text/JavaScript"&gt;
var Timer;
var TotalSeconds;
var timer_interval;
function CreateTimer(TimerID,Time) {
    Timer = document.getElementById(TimerID);
    window.TotalSeconds = getCookie('Times');
    if(!window.TotalSeconds){
            window.TotalSeconds = Time;
    }
    timer_interval=window.setTimeout(Ticker(),1000);
    window.clearTimeout(timer_interval);
    deleteCookie('Times');
    UpdateTimer();
    window.setTimeout(Ticker(), 1000);
}

 function UpdateTimer() {
    var Seconds = window.TotalSeconds;
    var Hours = Math.floor(Seconds / 3600);
    Seconds -= Hours * (3600);
    var Minutes = Math.floor(Seconds / 60);
    Seconds -= Minutes * (60);
    var TimeStr = LeadingZero(Hours) + ":" + LeadingZero(Minutes) + ":"+LeadingZero(Seconds);
    Timer.innerHTML = "&amp;nbsp;&amp;nbsp;&amp;nbsp;Your Time Slot Temporary Blocked Will Last For : "+ TimeStr;
}

function Ticker() {
    if (window.TotalSeconds &lt;= 0)
    {
            location.href="admin.jsp?action=zerosecond";
            window.clearTimeout(time_interval);
            deleteCookie('Time');
    }
    window.TotalSeconds -= 1;
    setCookie('Times', window.TotalSeconds, 1);
    UpdateTimer();
    window.setTimeout(Ticker(), 1000);
}

function LeadingZero(Time) {
    return (Time &lt; 10) ? "0" + Time : + Time;
}

function setCookie(name,value,days) {
var expires;
if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    expires = "; expires="+date.toGMTString();
}
else {
    expires = "";
}
   document.cookie = name+"="+value+expires+"; path=/";
}

function getCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i &lt; ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0) == ' ') {
        c = c.substring(1,c.length);
    }
    if (c.indexOf(nameEQ) === 0) {
        return c.substring(nameEQ.length,c.length);
    }
 }
  return null;
}

function deleteCookie(name) {
     setCookie(name,"",-1);
}
&lt;/script&gt;
</code></pre>

<p>It works fine on foreground process but not vice versa. So, how can i convert this into background process? Thanks in advance</p>
