Ext.BLANK_IMAGE_URL = '../ext/resources/images/default/s.gif';
Ext.namespace('pna');

pna.app = function() {
  var testTime = function() {
      var ut=new Date();
      var h,m,s;
      var time="        ";
      h=ut.getHours();
      m=ut.getMinutes();
      s=ut.getSeconds();
      if(s<=9) s="0"+s;
      if(m<=9) m="0"+m;
      if(h<=9) h="0"+h;
      time+=h+":"+m+":"+s;
      Ext.get('clock').dom.innerHTML = time;
  }

  return {
    tick:     -1,
    init: function(){
      var app = this;
      var fn = this.showTime.createDelegate(this);
      this.tick = window.setTimeout(fn, 1000);
      Ext.select('body').on('unload', function() {
          clearTimeout(this.tick);
      });
    },
    showTime: function(){
      var dt = new Date();          
      Ext.get('clock').update(dt.format('l, F j, Y - g:i:s a, T'));          
      var fn = this.showTime.createDelegate(this);
      this.tick = window.setTimeout(fn, 1000);
    }
  };
}(); // end of app
Ext.onReady(pna.app.init, pna.app);
