	var Modal;
	$(window).resize(
		function() {
			$(Modal).css({top: (($(window).height() / 2) - ($(Modal).outerHeight() / 2)) + 'px', left: (($(window).width() / 2) - ($(Modal).width() / 2)) + 'px'});
		}
	);
	$.Ask = function(Settings) {
		var self = this;
		self.Settings = $.extend({width: '400px', title: null, text: 'Er du sikker?', Callback: function(result) { void(0); }}, Settings);
		self.width = self.Settings.width;
		self.title = self.Settings.title;
		self.text = self.Settings.text;
		self.leftButton = $.extend({text: 'Nej', color: 'red', textColor: '#550000'}, self.Settings.leftButton);
		self.leftButtonText = self.leftButton.text;
		self.leftButtonColor = self.leftButton.color;
		self.leftButtonTextColor = self.leftButton.textColor;
		self.rightButton = $.extend({text: 'Ja', color: 'green', textColor: '#005500'}, self.Settings.rightButton);
		self.rightButtonText = self.rightButton.text;
		self.rightButtonColor = self.rightButton.color;
		self.rightButtonTextColor = self.rightButton.textColor;
		self.Callback = self.Settings.Callback;

		self.Modal = $('<div>' + (self.title !== null ? '<div style="margin-bottom: 24px; font-weight: bold;">' + self.title + '</div>' : '') + self.text + '</div>').css({position: 'fixed', width: self.width, background: '#EEEEEE', border: '1px solid #646464', padding: '10px', textAlign: 'center', opacity: 0}).prependTo($('body')).fadeTo(400, 1);
		self.Left = $('<div><img src="common/graphics/buttons/' + self.leftButtonColor + 'Right.png" alt="" style="vertical-align: middle; float: right; background: #EEEEEE;" /><img src="common/graphics/buttons/' + self.leftButtonColor + 'Left.png" alt="" style="vertical-align: middle; float: left; background: #EEEEEE;" /><div style="padding-top: 4px;">' + self.leftButtonText + '</div></div>').css({height: '24px', width: '175px', float: 'left', marginTop: '20px', cursor: 'pointer', whiteSpace: 'nowrap', color: self.leftButtonTextColor, background: 'url(common/graphics/buttons/' + self.leftButtonColor + 'Background.png)', textAlign: 'center', fontWeight: 'bold'}).click(function() { $(self.Overlay).remove(); $(self.Modal).remove(); self.Callback(false); }).appendTo($(self.Modal));
		self.Right = $('<div><img src="common/graphics/buttons/' + self.rightButtonColor + 'Right.png" alt="" style="vertical-align: middle; float: right; background: #EEEEEE;"/><img src="common/graphics/buttons/' + self.rightButtonColor + 'Left.png" alt="" style="vertical-align: middle; float: left; background: #EEEEEE;" /><div style="padding-top: 4px;">' + self.rightButtonText + '</div></div>').css({height: '24px', width: '175px', float: 'right', marginTop: '20px', cursor: 'pointer', whiteSpace: 'nowrap', color: self.rightButtonTextColor, background: 'url(common/graphics/buttons/' + self.rightButtonColor + 'Background.png)', textAlign: 'center', fontWeight: 'bold'}).click(function() { $(self.Overlay).remove(); $(self.Modal).remove(); self.Callback(true); }).appendTo($(self.Modal));
		$(self.Modal).css({top: (($(window).height() / 2) - ($(self.Modal).outerHeight() / 2)) + 'px', left: (($(window).width() / 2) - ($(self.Modal).width() / 2)) + 'px'});
		self.Overlay = $('<div>&nbsp;</div>').css({position: 'fixed', top: '0px', left: '0px', width: '100%', height: '100%', background: '#000000', opacity: 0}).prependTo($('body')).fadeTo(200, 0.33);

		Modal = self.Modal;

		return self;
	}

	$.Request = function(Settings) {
		var self = this;
		self.Settings = $.extend({width: '400px', spacing: '2em', title: null, text: 'Indtast venligst værdierne herunder.', Elements: new Array({text: null, type: null, height: 'auto', value: '', Validate: function(data) { return true; }}), Callback: function(Result) { void(0); }}, Settings);
		self.leftButton = $.extend({text: 'Annuller', color: 'red', textColor: '#AA0000'}, self.Settings.leftButton);
		self.rightButton = $.extend({text: 'Gem', color: 'green', textColor: '#00AA00'}, self.Settings.rightButton);

		self.Validate = function() {
			var boolResult = true;
			for (intI = 0; intI < self.Settings.Elements.length; intI++) {
				boolResult = (self.Settings.Elements[intI].Reference == null ? true : self.Settings.Elements[intI].Validate(self.Settings.Elements[intI].Reference.val())) && boolResult;
			}
			return boolResult;
		}

		self.Result = function() {
			var Result = new Array();
			for (intI = 0; intI < self.Settings.Elements.length; intI++) {
				(self.Settings.Elements[intI].Reference == null ? void(0) : Result.push(self.Settings.Elements[intI].Reference.val()));
			}
			return Result;
		}

		self.Modal = $('<div>' + (self.Settings.title !== null ? '<div style="margin-bottom: 24px; font-weight: bold; text-align: center;">' + self.Settings.title + '</div>' : '') + '<div style="margin-bottom: 24px; text-align: center;">' + self.Settings.text + '</div></div>').css({position: 'fixed', width: self.Settings.width, background: '#000000', border: '1px dashed #FFFFFF', padding: '10px', opacity: 0}).prependTo($('body')).fadeTo(400, 1);
		for (intI = 0; intI < self.Settings.Elements.length; intI++) {
			thisElement = $.extend({text: null, type: null, height: 'auto', value: '', Validate: function(data) { return true; }}, self.Settings.Elements[intI]);
			if (thisElement.type == null) {
				self.Settings.Elements[intI].Reference = null;
				$('<div style="margin-bottom: ' + self.Settings.spacing + ';">' + thisElement.text + '</div>')
											.appendTo($(self.Modal));				
			}
			else if (thisElement.type == 'input') {
				self.Settings.Elements[intI].Reference = $('<input type="text" value="' + thisElement.value + '" />')
										.keyup(	function() {
												if (self.Validate()) {
													self.Right.remove();
													self.Right = self.Valid.click(	function() {
																		if (self.Validate()) {
																			$(self.Overlay).remove();
																			$(self.Modal).remove();
																			self.Settings.Callback(self.Result());
																		}
																	}
																)
																.appendTo($(self.Modal));
												}
												else {
													self.Right.remove();
													self.Right = self.Invalid.appendTo(self.Modal);
												}
											}
										)
										.change(function() {
												if (self.Validate()) {
													self.Right.remove();
													self.Right = self.Valid.click(	function() {
																		if (self.Validate()) {
																			$(self.Overlay).remove();
																			$(self.Modal).remove();
																			self.Settings.Callback(self.Result());
																		}
																	}
																)
																.appendTo($(self.Modal));
												}
												else {
													self.Right.remove();
													self.Right = self.Invalid.appendTo(self.Modal);
												}
											}
										)
										.appendTo($('<div style="margin-bottom: ' + self.Settings.spacing + ';">' + thisElement.text + '</div>')
											.appendTo($(self.Modal)));
			}
			else if (thisElement.type == 'textarea') {
				self.Settings.Elements[intI].Reference = $('<textarea style="display: block; width: 100%; height: ' + thisElement.height  + ';">' + thisElement.value + '</textarea>')
										.keyup(	function() {
												if (self.Validate()) {
													self.Right.remove();
													self.Right = self.Valid.click(	function() {
																		if (self.Validate()) {
																			$(self.Overlay).remove();
																			$(self.Modal).remove();
																			self.Settings.Callback(self.Result());
																		}
																	}
																)
																.appendTo($(self.Modal));
												}
												else {
													self.Right.remove();
													self.Right = self.Invalid.appendTo(self.Modal);
												}
											}
										)
										.change(function() {
												if (self.Validate()) {
													self.Right.remove();
													self.Right = self.Valid.click(	function() {
																		if (self.Validate()) {
																			$(self.Overlay).remove();
																			$(self.Modal).remove();
																			self.Settings.Callback(self.Result());
																		}
																	}
																)
																.appendTo($(self.Modal));
												}
												else {
													self.Right.remove();
													self.Right = self.Invalid.appendTo(self.Modal);
												}
											}
										)
										.appendTo($('<div style="margin-bottom: ' + self.Settings.spacing + ';">' + thisElement.text + '</div>')
											.appendTo($(self.Modal)));

			}
		}

		self.Close = $('<input type="button" value="X" />')
				.css({float: 'right', cursor: 'pointer', color: self.leftButton.textColor, fontWeight: 'bold'})
				.click(	function() {
						$(self.Overlay).remove();
						$(self.Modal).remove();
						self.Settings.Callback(false);
					}
				)
				.prependTo($(self.Modal));

		self.Left = $('<input type="button" value="' + self.leftButton.text + '" />')
				.css({width: '175px', float: 'left', cursor: 'pointer', color: self.leftButton.textColor, fontWeight: 'bold'})
				.click(	function() {
						$(self.Overlay).remove();
						$(self.Modal).remove();
						self.Settings.Callback(false);
					}
				)
				.appendTo($(self.Modal));

		self.Valid = $('<input type="button" value="' + self.rightButton.text + '" />')
				.css({width: '175px', float: 'right', cursor: 'pointer', color: self.rightButton.textColor, fontWeight: 'bold'});

		self.Invalid = $('<input type="button" value="' + self.rightButton.text + '" />')
				.css({width: '175px', float: 'right', cursor: 'not-allowed', color: '#666666', fontWeight: 'bold'});

		if (self.Validate()) {
			self.Right = self.Valid.click(	function() {
								if (self.Validate()) {
									$(self.Overlay).remove();
									$(self.Modal).remove();
									self.Settings.Callback(self.Result());
								}
							}
						)
						.appendTo($(self.Modal));
		}
		else {
			self.Right = self.Invalid.appendTo($(self.Modal));
		}

		$(self.Modal).css({top: (($(window).height() / 2) - ($(self.Modal).outerHeight() / 2)) + 'px', left: (($(window).width() / 2) - ($(self.Modal).width() / 2)) + 'px'});
		self.Overlay = $('<div>&nbsp;</div>')
				.css({position: 'fixed', top: '0px', left: '0px', width: '100%', height: '100%', background: '#000000', opacity: 0})
				.prependTo($('body'))
				.fadeTo(200, 0.33);

		Modal = self.Modal;

		return self;
	}

	$.Box = function(Settings) {
		var self = this;
		self.Settings = $.extend({width: '400px', height: 'auto', title: null, text: '', Callback: function() { void(0); }}, Settings);
		self.width = self.Settings.width;
		self.height = self.Settings.height;
		self.title = self.Settings.title;
		self.text = self.Settings.text;
		self.button = $.extend({text: 'Ok', textColor: '#FFFFFF'}, self.Settings.button);
		self.buttonText = self.button.text;
		self.buttonColor = self.button.color;
		self.buttonTextColor = self.button.textColor;
		self.Callback = self.Settings.Callback;

		self.Modal = $('<div>' + (self.title !== null ? '<div style="margin-bottom: 24px; font-weight: bold;">' + self.title + '</div>' : '') + self.text + '</div>').css({position: 'fixed', width: self.width, height: self.height, background: '#000000', border: '1px dashed #FFFFFF', padding: '10px', opacity: 0, textAlign: 'center'}).prependTo($('body')).fadeTo(400, 1);
		self.Button = $('<input type="button" value="' + self.buttonText + '" />').css({width: '175px', marginTop: '20px', marginLeft: 'auto', marginRight: 'auto', cursor: 'pointer', color: self.buttonTextColor, fontWeight: 'bold'}).click(function() { $(self.Overlay).remove(); $(self.Modal).remove(); self.Callback(); }).appendTo($(self.Modal));
		$(self.Modal).css({top: (($(window).height() / 2) - ($(self.Modal).outerHeight() / 2)) + 'px', left: (($(window).width() / 2) - ($(self.Modal).width() / 2)) + 'px'});
		self.Overlay = $('<div>&nbsp;</div>').css({position: 'fixed', top: '0px', left: '0px', width: '100%', height: '100%', background: '#000000', opacity: 0}).prependTo($('body')).fadeTo(200, 0.33);

		Modal = self.Modal;

		return self;
	}

