(function ($) {
	$.fn.extend({
		alertWindow: function (title, close) {
			var me = this;
			var callback = null;

			if (!$(me).data("kendoWindow")) {
				$(me).kendoWindow({
					modal: true,
					width: "400px",
					height: "100px",
					draggable: true,
					resizable: false,
					visible: false,
					close: onclose
				}).data("kendoWindow");
			}

			var onclose = function () {
				if (callback) {
					callback();
				}
			};

			window.showAlert = function (message, header, onClose) {
				var wnd = $(me).data("kendoWindow");
				callback = onClose;
				if (!header) {
					header = title;
				}
				var html = "<input type='button' value='" + close + "' class='k-button' style='width:100px;position:absolute;top:62px;left:292px' onclick=\"$('#" + me.prop('id') + "').data('kendoWindow').close();\" />"
				html = message + html;
				wnd.title(header);
				wnd.content(html);
				wnd.center();
				wnd.open();
			};

			return this;
		}
	});
})(jQuery);
