setupClock = function()
{

  $("h3").html("<time>" + formatTime(moment())+ "</time>");
  setInterval(function() {
    $("h3").html("<time>" + formatTime(moment()) + "</time>");
    table.updateNowLine();
  }, 250);
}

setTableRedraw = function()
{
  setInterval(table.draw(), 1000*60*30)
}

setupLocalZone = function()
{
  $("h4").text(moment().format("Z"));
  $("h5").text(moment.tz.guess());
  table.rows.push(moment.tz.guess());
  table.rows.push("UTC");
}

initSimpleInputs = function()
{
  $("#displayWindow").val(24);
  $("#displayWindow").on("change", table.updateWidth);
  $("#earlyLateToggle").prop("checked", true);
  $("#earlyLateToggle").on("change", table.toggleColorCode);
  $("#intervalA").on("change", table.setInterval);
  $("#intervalB").on("change", table.setInterval);
  $("#shareRawText").on("click", interval.copyText)
}

window.zones = moment.tz.names();
window.options =
{
  formatSelector: "24H",
  windowSelector: "aroundNow",
  colorCoding: true
}

window.updateFuncs = [table.draw]

$(document).ready(function()
{
  setupLocalZone();
  setupClock();
  setTableRedraw();
  searchbar.init();
  table.resetSliders();
  initOption("#formatSelector");
  initOption("#windowSelector");
  initSimpleInputs();
  table.draw();
})
