// Simple function queue runner. Just pass me an array of functions and I'll // execute them one by one at the given interval. run_queue = function (funcs, step, speed) { step = step || 0; speed = speed || 500; funcs = funcs || []; if (step < funcs.length) { // execute function funcs[step](); // loop it setTimeout(function () { run_queue(funcs, step + 1, speed); }, speed); } return; };