define(function(require) { return function($) {
	require('../core/jquery.bgiframe.js')($);
	require('./jquery.ui.dialog.js')($);
	var jQuery = $,defaultTitle = 'System Info';
	  $.msg = {
				alert: function(title, content, fn ,options) {
					if(!content) {
						content = title;
						title = defaultTitle;
					}
					if($.isFunction(content)) {
						options = fn;
						fn = content;
						content = title;
						title = defaultTitle;
					}
					if(!$.isFunction(fn)) {
						options = fn;
						fn = null;
					}
					var msg;
					if(content instanceof jQuery) {
						msg = content;
					} else {
						msg = $('<div />').bgiframe().html(content.toString());
					}
					var defaults = {
							title: title,
							modal: true,
							resizable: false,
							closeOnEscape:false,
							buttons: {
								Ok: function() {
									$(this).dialog("close"); 
								}
							},
							close: function() {
								if(fn) fn();
							}
						};
					$.extend(defaults, options);
					msg.dialog(defaults);
				},
				confirm: function(title,content,fn,options) {
					if(!content) {
						content = title;
						title = defaultTitle;
					}
					if($.isFunction(content)) {
						fn = content;
						content = title;
						title = defaultTitle;
					}
					var msg;
					if(content instanceof jQuery) {
						msg = content;
					} else {
						msg = $('<div/>').bgiframe().html(content.toString());
					}
					var result;
					var a = {
							title: title,
							resizable: false,
							modal: true,
							closeOnEscape:false,
							buttons: {Ok: function() {
								result = true;						
								$(this).dialog("close"); 
							},Cancel: function() {
								result = false;
								$(this).dialog("close");
							}
							},
							close: function() {
								if(fn) fn(result);
							}
						};
					$.extend(a, options);
					msg.dialog(a);
				}
			};
}});