/**
 * Close modal dialog JS-action
 *
 * @author Evgueni Palchukovsky <epalchukovsky@swsoft.com>
 * @version $Id: CloseBlockModuleModalFrom.js 18951 2006-09-04 15:16:25Z kkudriavtsev $
 * @since 2006/08/09
 * @package SB
 * @subpackage Modules
 * @copyright (c) 2004-2006, SWsoft
 */
function CloseBlockModuleModalForm(moduleInstance) {
	top.sbBlockModuleEditorDialogObject.hide();
	var FCK = top.FCKeditorAPI.GetInstance('wysiwyg');
	if (FCK) {
		var modFrameId = "moduleInstance_"+moduleInstance;
		var modFrame = FCK.EditorDocument.getElementById(modFrameId);
		var link = modFrame.src.replace(/([^\?]+\?moduleInstance=[^&]+)\.*/, '$1');
		link += '&'+Math.random();

		if (modFrame.contentWindow.document.getElementById('preview')) {
			if (modFrame.contentWindow.document.getElementById('preview').contentWindow.document.getElementById('reloadInProgress')) {
				modFrame.contentWindow.document.getElementById('preview').contentWindow.document.getElementById('reloadInProgress').value = 'true';
			}
		}

		modFrame.src = link;
		FCK.SetBlockModulesEvents();
	}
}
