/**
 * Block module editor dialog (modal form) control script
 *
 * @copyright (c) 2004-2006, SWsoft
 */
function SbBlockModuleEditorDialog(dialogId, frameId, frameHolderId) {
	this._dialog = dialog=top.document.getElementById(dialogId);
	this._frame = null;
	this._frameId = frameId;
	this._frameHolder = top.document.getElementById(frameHolderId);
	this._onCloseEventsList = new Array();
}

SbBlockModuleEditorDialog.prototype.show = function(title, viewUrl) {
	this._frameHolder.innerHTML = '<iframe id="'+this._frameId+'" frameborder="0" allowtransparency="true" style="width:610px;height:466px;overflow:hidden;margin:0px;padding:0px;" scrolling="no" src="'+viewUrl+'"></iframe>';
	this._frame = top.document.getElementById(this._frameId);
	this._dialog.setTitle(title);
	this._dialog.show();
}

SbBlockModuleEditorDialog.prototype.hide = function() {
	var result = true;
	for (var i = 0; i < this._onCloseEventsList.length; i++) {
		var method = this._onCloseEventsList[i];
		var res = method();
		if (false == res) {
			result = false;
			break;
		}
	}
	if (result) {
		this._dialog.hide();
		this._frame.contentWindow.document.location.href = '/blank.html';
		this.resetAll();
	}
}

SbBlockModuleEditorDialog.prototype.resetAll = function() {
	this._onCloseEventsList = new Array();
}

SbBlockModuleEditorDialog.prototype.addOnCloseEvent = function(method) {
	this._onCloseEventsList.push(method);
}