Ext.ns("AV.QBI");

AV.QBI.DataIntegration =
{
    helpLink: '/Help/Help/AssociationVoice_Help.aspx?topic_full_path=',

    hide: function () {
        this.win.hide();
    },

    show: function () {
        if (!this.win) {
            this.win = new Ext.Window(
			{
			    title: 'Data Integration',
			    width: 820,
			    height: 520,
			    modal: true,
			    shadow: true,
			    layout: 'fit',
			    draggable: false,
			    resizable: false,
			    closeAction: 'hide',
			    tools: [{ id: 'help', handler: this.help }, { id: 'close', handler: this.close}],
			    items:
				[
					{
					    id: 'pnlContainer',
					    xtype: 'panel',
					    border: false
					}
				]
			});

            this.win.on('show', this.onShow, this);
        }

        this.win.show();
    },

    onShow: function () {
        var src = '/DI_access.asp'.concat('?path=').concat(escape(window.document.location.toString())),
				sIfsrc = '<iframe src="' + src + '" width="805" height="490" frameborder="0"></iframe>';

        Ext.get('pnlContainer').update(sIfsrc);
    },

    help: function () {
        window.open(helpLink, '_blank');
    },

    close: function () {
        AV.QBI.DataIntegration.hide();
    }
}
