var timeoutHandle;
function countdown(minutes,stat) {
    var seconds = 60;
    var mins = minutes;
    if(getCookie("minutes")&&getCookie("seconds")&&stat)
    {
         var seconds = getCookie("seconds");
         var mins = getCookie("minutes");
    }
    function tick() {
        var counter = document.getElementById("demo");
        setCookie("minutes",mins,1);
        setCookie("seconds",seconds,1);
        var current_minutes = mins-1
        seconds--;
        counter.innerHTML = 
        current_minutes.toString() + ":" + (seconds < 10 ? "0" : "") + String(seconds);
        //save the time in cookie
        if(current_minutes.toString()== 30)
        {
            $("#myModal").modal();
        }
        if( seconds > 0 ) {
            timeoutHandle=setTimeout(tick, 1000);
        } else {
            if(mins > 1){
               /* countdown(mins-1);   never reach “00″ issue solved:
                  Contributed by Victor Streithorst */    
               setTimeout(function () { countdown(parseInt(mins)-1,false); }, 1000);
            }
        }
    }
    tick();
}
function setCookie(cname,cvalue,exdays) {
    if(exdays > 0)
    {
    var d = new Date();
    d.setTime(d.getTime() + (exdays*24*60*60*1000));
    var expires = "expires=" + d.toGMTString();
    document.cookie = cname+"="+cvalue+"; "+expires;
    }else{
        var expires="expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;";
        document.cookie = cname+"="+cvalue+"; "+expires;
    }
}
 function getCookie(cname) {
    var name = cname + "=";
    var ca = document.cookie.split(';');
    for(var i=0; i<ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1);
        if (c.indexOf(name) == 0) {
            return c.substring(name.length, c.length);
        }
    }
    return "";
}
countdown(60,true);
$("li a").click(function(){
    var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++)
$.cookie("minutes", null, { path: '/' });
$.cookie("seconds", null, { path: '/' });
});
I have two variables in above code. When I am trying to logout, both variables which are previously set in cookie, are not going to reset. Please let me know what I am doing wrong here. Thanks in advance.
 
     
    