function highlightHash() {

  var h = document.location.hash;
  if (h) {
    if (h.match(/task_\d+/)) {
      h = 'core_' + h.substr(6);
    }
    else {
      if (h.length > 0) {
        h = h.substr(1);
      }
    }

    var el = document.getElementById(h);
    if (el) {
      window.scrollBy(0, -20);
      setTimeout(function() {
        if (el && el.style) {
          el.style.backgroundColor = "#ffff99";
          el.className += " iphoneHighlight";
        }
      }, 50);
      setTimeout(function() {
        if (el && el.style) {
          el.style.backgroundColor = "#ffffff";
        }
      }, 1000);
    }
  }
}

function appendNowToHref() {
  var el = document.getElementById('parentTask_0');
  if (!el) return;

  var links = el.getElementsByTagName('A');

  var d = new Date();
  var now = d.getTime()/1000 - d.getTimezoneOffset() * 60;
  for(var i = 0; i < links.length; i++) {
    links[i].href += "?now=" + now;
  }
  
}

window.onload = function() {
  highlightHash();
  appendNowToHref();
};
