/*
 * Vroomtrap
 * Copyright(c) 2008, Nubesoft, LLC.
 */
Ext.namespace('Ext.aboutwindow');
Ext.aboutwindow.aboutwindow = function(){
  var aboutWin;
  var aboutWindowDisabled = true;
  var previousTitle = "";
  return {
    openAboutWindow: function() {
      if (aboutWindowDisabled) {
          aboutWin = new Ext.Window({
            title    : 'About',
            closable : true,
            constrain: true,
            draggable: false,
            resizable: false,
            width    : 484,
            height   : 358,
            plain    : true,
            layout   : 'border',
            items: [
              new Ext.Panel({
                region      : 'center',
                split       : false,
                width       : 468,
                height      : 200,
                buttonAlign : 'right',
                collapsible : false,
                margins     : '0 0 0 0',
                cmargins    : '0 0 0 0',
                bodyStyle   :'padding:0px 0px 0px 0px',
                html        : '<iframe width="472" height="240" align="left" scrolling="no" frameborder="0" src="/about"/>',
                buttons: [{
                  text    : 'Close',
                  handler : function(){
                      aboutWin.close();
                  }
                }]     
              }),
              new Ext.Panel({
                  region      : 'south',
                  closeAction: 'hide',
                  split       : false,
                  width       : 468,
                  height      : 60,
                  collapsible : false,
                  margins     : '0 0 0 0',
                  cmargins    : '0 0 0 0',
                  bodyStyle:'padding:0px 0px 0px 0px',
                  html        : '<iframe width="468px" height="60px" align="left" scrolling="no" frameborder="0" src="/ads/adblock468.html"/>'
              })         
            ],
            listeners : {
              close : function(panel) {
                aboutWindowDisabled = true;
                SWFAddress.back();
                SWFAddress.setTitle(previousTitle);
              }
            }
          });
          previousTitle = SWFAddress.getTitle();
          SWFAddress.setValue("/about");
          SWFAddress.setTitle(Trap.constants.siteTitle+"About");
          
          aboutWin.show();
          aboutWin.center();
          aboutWindowDisabled = false;
      }
    },
    init : function() {}
  }
}();

Ext.onReady(Ext.aboutwindow.aboutwindow.init, Ext.aboutwindow.aboutwindow);
