function checkEmail() {
  if (document.emailForm.username.value == "") {
    iui.showPage(document.getElementById("emailForm"));
  }

}

function setup() {
  for (var i = 0; i < 9; i++) {
    for (var j = 0; j < 9; j++) {
      var tuple = i + "," + j;
      var element = document.getElementById("grid_" + i + j);
      if (element.className.indexOf("given-cell") == -1) { 
        element.textContent = ' ';
        element.onclick = function() { choose(this.id); };
      } else {
        element.onclick = null;
      }
    }
  }
}

function choose(id) {
  var chooser = document.getElementById('chooser-iframe');
  chooser.style.position = 'absolute';
  chooser.style.zIndex = '1';
  chooser.style.display = 'block';
  chooser.contentDocument.id = id;
}

function setValue(position, value) {
  document.getElementById(position).textContent = value;
  document.getElementById("form_" + position).value = value;
}

