function update_dfa(key) {
  dfa = document.getElementById("dfa");
  //alert(dfa.value);
  v = dfa.value
  //alert(dfa.value.length);
  l = v.length

  switch (key) {
    case "d":
      break;
    case "c":
      if(l > 0) {
        dfa.value = v.substring(0, l-1)
      }
      break;
    case "e":
      if(l > 0) {
        window.location = "http://www.moma.org/wifi/stop/" + v
      }
      break;
    default:
      if(l < 3) {
        dfa.value = v + key;
      } else {
        dfa.value = key;
      }
      break;
  }
}

 addEventListener("load", function()
    {
        setTimeout(updateLayout, 0);
    }, false);

    var currentWidth = 0;
    
    function updateLayout()
    {
        if (window.innerWidth != currentWidth)
        {
            currentWidth = window.innerWidth;

            var orient = currentWidth == 320 ? "profile" : "landscape";
            document.body.setAttribute("orient", orient);
            setTimeout(function()
            {
                window.scrollTo(0, 1);
            }, 100);            
        }
    }

    setInterval(updateLayout, 400);

