function init_zoekterm(label_id, term_id) {
  var label = document.getElementById(label_id);
  var field = document.getElementById(term_id);
  
  label.style.display = "block";
  
  if (field.value !== '') {
    hideLabel(label, true);
  }

  // Set handlers to show and hide labels.
  field.onfocus = function () {
    hideLabel(label, true);
  };
  field.onblur = function () {
    if (this.value === '') {
      hideLabel(label, false);
    }
  };
  label.onclick = function() {
    hideLabel(label, true);
    field.focus();
  }
}

function init_zoekbutton() {
  var b = document.getElementById('searchbutton');
  b.onmouseover = function () {
    this.style.backgroundPosition = "bottom";
  };
  b.onmouseout = function() {
    this.style.backgroundPosition = "top";
  }
}

function hideLabel(label, hide) {
  label.style.textIndent = (hide) ? '-2000px' : '0px';
}

function init() {
  init_zoekterm('zoeklabel', 'zoekterm');
  init_zoekbutton();
}

onload = init;