function showMessage(msg) {
	$.jGrowl(msg, {
		sticky: false,
		glue: 'before',
		speed: 1500,
		easing: 'easeInOutElastic',
		animateOpen: {
			height: 'show',
			width: 'show'
		},
		animateClose: {
			height: 'hide',
			width: 'show'
		}
	});
}

function fpcmsConfirm(msg, action) {
	document.getElementById('fpcms_confirm').innerHTML = msg;
	$("#fpcms_confirm").dialog({
		modal: true,
		overlay: {
			opacity: 0.5,
			background: "black"
		},
		buttons: {
			"Ok": function() {
				$(this).dialog("close");
				eval(action);
			},
			"Cancel": function() {
				$(this).dialog("close");
			}
		}
	});
}

var returnTo = "";
var topFolder = "";
function fpcmsFileSelect(path, returnValueTo) {
    returnTo = returnValueTo;
    topFolder = path;
	fsShowDir(path);
	$("#fpcms_file_select").dialog({
		modal: true,
		height: 500,
		title: "Выбор файла",
		position: "center",
		overlay: {
			opacity: 0.5,
			background: "black"
		},
		buttons: {
			"Cancel": function() {
				$(this).dialog("close");
			}
		}
	});
}

function fsShowDir(path) {
	$("#file_select_frame").load("/admin/file-select/index/path/"+path.replace(/\//g, '@')+"/top/"+topFolder.replace(/\//g, '@'));
}
function fsReturn(file) {
    $("#"+returnTo).val(file);
    $("#fpcms_file_select").dialog("close");
}
