(function($) {
	$.fn.infoMsg = function() {
		var infoDiv = $('<div>').attr('class', 'ui-widget '+$(this).attr('class')).html(
			$('<div>').attr('class', 'ui-state-highlight ui-corner-bottom').html(
				$('<p>')
					.append($('<span>').attr('class', 'ui-icon ui-icon-info'))
					//.append($('<strong>').text('Alert: '))
					.append($(this).html())
			)
			.append($('<div>')
				.attr('class', 'closeMessage')
				.html('close')
				.button({
					icons: {
			            primary: 'ui-icon-circle-close'
			        },
			        text: false
				}).click(function() {
					$($(this).closest('.flash')[0]).fadeOut();
				})
			)
		);
		$(this).replaceWith(infoDiv);
		return infoDiv;
	}
})(jQuery);

(function($) {
	$.fn.errorMsg = function() {
		var errorDiv = $('<div>').attr('class', 'ui-widget '+$(this).attr('class')).html(
			$('<div>').attr('class', 'ui-state-error ui-corner-bottom').html(
				$('<p>')
					.append($('<span>').attr('class', 'ui-icon ui-icon-alert'))
					.append($('<strong>').text('Alert: '))
					.append($(this).html())
			)
			.append($('<div>')
				.attr('class', 'closeMessage')
				.html('close')
				.button({
					icons: {
			            primary: 'ui-icon-circle-close'
			        },
			        text: false
				}).click(function() {
					$($(this).closest('.flash')[0]).fadeOut();
				})
			)
		);
		$(this).replaceWith(errorDiv);
		return errorDiv;
	}
})(jQuery);
