

function readUrlParam(paramName, coerceInt, asList){
    asList = asList || false;
    var vars = {};
    var q = document.URL.split('?')[1];
    if(q != undefined){
        q = q.split('&');
        for(var i = 0; i < q.length; i++){
            var param = q[i].split('=');
            var name = param[0];
            var value = param[1];
            vars[name] = vars[name] || [];
            vars[name].push(value);
        }
    }
    if (vars.hasOwnProperty(paramName)){
        var paramList = vars[paramName];
        if (coerceInt){
            for (var i = 0; i < paramList.length; i++){
                paramList[i] = parseInt(paramList[i]);
            }
        }
        if (paramList.length == 1 && !asList){
            return paramList[0];
        }
        return paramList;
    }
    return null;
}

function pad(num, size) {
  var s = num+"";
  while (s.length < size) s = "0" + s;
  return s;
}

var po = function(){
  var lastTimestamp = new Date();
  return function(msg){
    var newTimestamp = new Date();
    msg = pad(newTimestamp - lastTimestamp, 5) + ' | ' + msg;
    // lastTimestamp = newTimestamp;
    // $('#test-output').append('<br/>' + msg);
    console.log(msg);
  };
}()
