﻿function countDown(sec, min) {
    if (min == '00' && sec == '00') {
        $("#countdown").html("00:00").fadeIn(10);
        min = 0;
        sec = 0;
    }
    else {
        if (sec == -01) {
            sec = 59;
            min = min - 1;
        } else {
            min = min;
        }
        if (sec <= 9) { sec = "0" + sec; }
        time = (min <= 9 ? "0" + min : min) + "'" + sec + "\" ";
        $("#countdown").html(time).fadeIn(10).pause(980).fadeOut(10, function() { sec--; countDown(sec, min); });
    }
}

$(document).ready(function() {
    var sec = 59;   // set the seconds
    var min = 14;   // set the minutes
    countDown(sec, min);
});
