//Ext用インラインフレーム高さ自動調整
function getHeight(id, name) {
    document.getElementById(id).height = parent.frames[name].document.body.scrollHeight;
}

var PopupWindow = function(){
    // dialog:ポップアップウィンドウ本体
    // showBtn:ポップアップウィンドウを表示するためのボタン
    var dialog, showBtn;
    return {
        init : function(){
            showBtn = Ext.get('show-dialog-btn');
            showBtn.on('click', this.showDialog, this);
        },
        // ポップアップウィンドウの設定と処理
        showDialog : function(){
            if (!dialog) {
                dialog = new Ext.BasicDialog("preview-dlg", { 
                        autoTabs:true,
                        width:350,
                        height:350,
                        shadow:true,
                        minWidth:100,
                        minHeight:100,
                        proxyDrag:true
                });
                dialog.addKeyListener(27, dialog.hide, dialog);
                dialog.addButton('最小化', dialog.collapse, dialog);
                dialog.addButton('終了', dialog.hide, dialog);
            }
            dialog.show(showBtn.dom);
        }
    };
}();
Ext.onReady(PopupWindow.init, PopupWindow, true);

