// popup JavaScript



//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(){
			if(document.getElementById('show-dialog-btn')){
            	showBtn = Ext.get('show-dialog-btn');
            	showBtn.on('click', this.showDialog, this);
			};
			if(document.getElementById('show-dialog-btn2')){
				showBtn2 = Ext.get('show-dialog-btn2');
    	        showBtn2.on('click', this.showDialog, this);
			};
        },
        // ポップアップウィンドウの設定と処理
        showDialog : function(){
            if (!dialog) {
                dialog = new Ext.BasicDialog("preview-dlg", {
                        autoTabs:true,
                        width:620,
                        height:470,
                        shadow:true,
                        minWidth:100,
                        minHeight:10,
                        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);

