It's a simple matter of detecting if the value is too small and, if it is, prefix it yourself.
Something like replacing:
strMsg = strMsg.replace("$SECONDS$", ((Math.floor(seconds))%60).toString());
with:
var secs_str = ((Math.floor(seconds)) % 60).toString();
if (secs_str.length < 2) {
strMsg = strMsg.replace("$SECONDS$", "0" + secs_str);
} else {
strMsg = strMsg.replace("$SECONDS$", secs_str);
}
Note I haven't tested that code but you should get the basic idea.