$.widget("ui.validationerrordialog", $.ui.dialog, {
	options: {
		validationErrors: { }
	},
	_dialogCreate: $.ui.dialog.prototype._create,
	_create: function() {
		var $this = this;
		this._dialogCreate();
		this.option({
			title: 'Virhe',
			buttons: {
				'OK': function() {
						$(this).validationerrordialog('close');
					}
			}
		})
		this.errorContainer = $('<div class="ui-state-error"></div>').appendTo(this.element);
		$.each(this.options.validationErrors, function(key, value) {
			if (value.message) {
				$this.errorContainer.append($('<p />')
					.append($('<span class="ui-icon ui-icon-alert lefticon"></span>'))
					.append(value.message));
			}
		});
	}
});
