/*
 * xwindow.js v1.0
 * ext-js 2.1을 기반으로 작성하였습니다.
 * 
 *  1. 화일이름		: xwindow.js
 *  2. 작성자			: 김상욱
 *  3. 작성일자		: 2008. 07. 28
 *  4. 파일설명		: 윈도우 상자 구현을 위한 스크립트
 *  5. 프로그램 변경 내역
 *     1) 2008.07.28 / 배포 / 최초 포맷 설정
 */

xwindow = function () {
};

xwindow.version = "1.0";
xwindow.dependency = "ext-js 2.1";

/**
 * 윈도우 객체를 생성하여 리턴한다.
 * title : 창 제목
 * width, height : 창의 가로와 세로 크기 (픽셀)
 * contentEl : 내용을 담고 있는 div의 id
 */
xwindow.createWindow = function(title, width, height, contentEl, modal, resizable) {
	if (modal == null) {
		modal = false;
	}
	if (resizable == null) {
		resizable = true;
	}	return new Ext.Window({
		title: title,
		closable: true,
		width: width,
		height: height,
		plain: true,
		layout: 'border',
		closeAction: 'hide',
		modal: modal,
		resizable: resizable,
		items: [
			new Ext.Panel({
				region: 'center',
				border: false,
				contentEl: contentEl
			})
		]
    });
};

xwindow.syncSize = function(win) {
	win.syncSize();	
};

xwindow.setSize = function(win, contentEl) {
	win.setSize(document.getElementById(contentEl).offsetWidth + 15, document.getElementById(contentEl).offsetHeight + 35);
}

xwindow.setAnimateTarget = function(win, target) {
	win.setAnimateTarget(target);
};

/**
 * 윈도우를 보여준다.
 */
xwindow.show = function(win) {
	win.show(this);
};

/**
 * 윈도우를 감춘다.
 */
xwindow.hide = function(win) {
	win.hide(this);
};

xwindow.setPosition = function(win, left, top) {
	win.setPosition(left, top);
};
