var strFormat = "$HOURS$:$MINUTES$:$SECONDS$";
strMsg = strMsg.replace("$DAYS$", ((Math.floor(seconds/86400))%100000).toString());
strMsg = strMsg.replace("$HOURS$", (100 + (Math.floor(seconds/3600))%24).toString().substring(1));
strMsg = strMsg.replace("$MINUTES$", (100 + (Math.floor(seconds/60))%60).toString().substring(1));
strMsg = strMsg.replace("$SECONDS$", (100 + (Math.floor(seconds))%60).toString().substring(1));
Но вообще: говнокод.