/*/////////////////////////////////////////////////////////////////////////////////////////////////////////
// KLASSE LyonessPupup
// EINFACH ERWEITERBARES UND ANPASSBARES POPUP
//////////////////////////////////////////////////////////////////////////////////////////////////////////
/// <reference path="jquery-1.3.2.min-vsdoc.js" />*/
var SubmitTypes = new Array();
(function($) {

	var setDataSwitch = {
		dragStart: "start.draggable",
		drag: "drag.draggable",
		dragStop: "stop.draggable",
		maxHeight: "maxHeight.resizable", minHeight: "minHeight.resizable",
		maxWidth: "maxWidth.resizable",
		minWidth: "minWidth.resizable",
		resizeStart: "start.resizable",
		resize: "drag.resizable",
		resizeStop: "stop.resizable"
	},

	uiDialogClasses =
		'ui-dialog ' +
		'ui-widget ' +
		'ui-widget-content ' +
		'ui-corner-all ';


	$.widget("ui.dialog", {

		_init: function() {

			this.originalTitle = this.element.attr('title');

			var self = this,
			options = this.options,

			title = options.title || this.originalTitle || '&nbsp;',
			titleId = $.ui.dialog.getTitleId(this.element),

			uiDialog = (this.uiDialog = $('<div/>'))
				.appendTo(document.body)
				.hide()
				.addClass(uiDialogClasses + options.dialogClass)
				.css({
					position: 'absolute',
					overflow: 'hidden',
					zIndex: options.zIndex
				})
			/* setting tabIndex makes the div focusable
			setting outline to 0 prevents a border on focus in Mozilla*/
				.attr('tabIndex', -1).css('outline', 0).keydown(function(event) {
					(options.closeOnEscape && event.keyCode
						&& event.keyCode == $.ui.keyCode.ESCAPE && self.close(event));
				})
				.attr({
					role: 'dialog',
					'aria-labelledby': titleId
				})
				.mousedown(function(event) {
					self.moveToTop(false, event);
				}),

			uiDialogContent = this.element
				.show()
				.removeAttr('title')
				.addClass(
					'ui-dialog-content ' +
					'ui-widget-content')
				.appendTo(uiDialog),

			uiDialogTitlebar = (this.uiDialogTitlebar = $('<div></div>'))
				.addClass(
					'ui-dialog-titlebar ' +
					'ui-widget-header ' +
					'ui-corner-all ' +
					'ui-helper-clearfix'
				)
				.prependTo(uiDialog),

			uiDialogTitlebarClose = $('<a href="#"/>')
				.addClass(
					'ui-dialog-titlebar-close ' +
					'ui-corner-all'
				)
				.attr('role', 'button')
				.hover(
					function() {
						uiDialogTitlebarClose.addClass('ui-state-hover');
					},
					function() {
						uiDialogTitlebarClose.removeClass('ui-state-hover');
					}
				)
				.focus(function() {
					uiDialogTitlebarClose.addClass('ui-state-focus');
				})
				.blur(function() {
					uiDialogTitlebarClose.removeClass('ui-state-focus');
				})
				.mousedown(function(ev) {
					ev.stopPropagation();
				})
				.click(function(event) {

					self.close(event);
					return false;
				})
				.appendTo(uiDialogTitlebar),

			uiDialogTitlebarCloseText = (this.uiDialogTitlebarCloseText = $('<span/>'))
				.addClass(
					'ui-icon ' +
					'ui-icon-closethick'
				)
				.text(options.closeText)
				.appendTo(uiDialogTitlebarClose),

			uiDialogTitle = $('<span/>')
				.addClass('ui-dialog-title')
				.attr('id', titleId)
				.html(title)
				.prependTo(uiDialogTitlebar);

			if (options.showLyonessLogo) {
				uiDialogTitle = $('<img src="/internal/public/images/lyoness_logo_white.png" align="right" style="max-height:20px;" />')
					.prependTo(uiDialogTitlebar);
			}

			uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();

			(options.draggable && $.fn.draggable && this._makeDraggable());
			(options.resizable && $.fn.resizable && this._makeResizable());


			this._createButtons(options.buttons, options.advancedFields);
			this._isOpen = false;

			(options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe());
			(options.autoOpen && this.open());

			if (this.element.context.tagName == "IFRAME") {
				this.element
				.removeClass('ui-dialog-content ui-widget-content')
			}

		},

		destroy: function() {

			var options = this.options;

			if (options.noOverlayDeleteOnClose != true) (this.overlay && this.overlay.destroy());

			this.uiDialog.hide();
			this.element
			.unbind('.dialog')
			.removeData('dialog')
			.removeClass('ui-dialog-content ui-widget-content')
			.hide().appendTo('body');
			this.uiDialog.remove();

			(this.originalTitle && this.element.attr('title', this.originalTitle));
		},

		close: function(event) {


			var options = this.options;

			var self = this;

			if (false === self._trigger('beforeclose', event)) {
				return;
			}

			if (options.noOverlayDeleteOnClose != true) (self.overlay && self.overlay.destroy());

			self.uiDialog.unbind('keypress.ui-dialog');

			(self.options.hide
			? self.uiDialog.hide(self.options.hide, function() {
				self._trigger('close', event);
			})
			: self.uiDialog.hide() && self._trigger('close', event));

			if (options.noOverlayDeleteOnClose != true) $.ui.dialog.overlay.resize();

			self._isOpen = false;
		},

		isOpen: function() {
			return this._isOpen;
		},

		/* the force parameter allows us to move modal dialogs to their correct
		position on open*/
		moveToTop: function(force, event) {

			if (this.options.DoNotmoveToTop)
				return;
			if ((this.options.modal && !force)
			|| (!this.options.stack && !this.options.modal)) {
				return this._trigger('focus', event);
			}

			if (this.options.zIndex > $.ui.dialog.maxZ) {
				$.ui.dialog.maxZ = this.options.zIndex;
			}
			(this.overlay && this.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = ++$.ui.dialog.maxZ));

			/*Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
			//  http://ui.jquery.com/bugs/ticket/3193*/
			var saveScroll = { scrollTop: this.element.attr('scrollTop'), scrollLeft: this.element.attr('scrollLeft') };
			this.uiDialog.css('z-index', ++$.ui.dialog.maxZ);
			this.element.attr(saveScroll);
			this._trigger('focus', event);

		},

		openhiddendialog: function() {

			var options = this.options, uiDialog = this.uiDialog;
			uiDialog.show(options.show);
			this.moveToTop(true);
		},

		open: function() {

			if (this._isOpen) { return; }

			var options = this.options,
			uiDialog = this.uiDialog;


			this.overlay = options.modal ? new $.ui.dialog.overlay(this) : null;

			(uiDialog
				.next()
				.length && uiDialog.appendTo('body')
			);


			this._size();
			this._position(options.position);

			if (!options.hidedealogaftergeneration) {
				uiDialog.show(options.show);
			}

			this.moveToTop(true);

			/* prevent tabbing out of modal dialogs*/
			(options.modal && uiDialog.bind('keypress.ui-dialog', function(event) {
				if (event.keyCode != $.ui.keyCode.TAB) {
					return;
				}

				var tabbables = $(':tabbable', this),
				first = tabbables.filter(':first')[0],
				last = tabbables.filter(':last')[0];

				if (event.target == last && !event.shiftKey) {
					setTimeout(function() {
						first.focus();
					}, 1);
				} else if (event.target == first && event.shiftKey) {
					setTimeout(function() {
						last.focus();
					}, 1);
				}
			}));

			/* set focus to the first tabbable element in the content area or the first button
			// if there are no tabbable elements, set focus on the dialog itself*/
			$([])
			.add(uiDialog.find('.ui-dialog-content :tabbable:first'))
			.add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first'))
			.add(uiDialog)
			.filter(':first')
			.focus();

			/*Modification by Erich */
			if (options.selectedButton != null) {
				var buttons = $([]).add(uiDialog.find('.ui-dialog-buttonpane :tabbable')).add(uiDialog);
				if (buttons.length > options.selectedButton)
					buttons[options.selectedButton].focus();
			}
			/*End Modification by Erich */

			this._trigger('open');
			this._isOpen = true;
		},

		_createButtons: function(buttons, advancedFields) {
			var self = this,
			hasButtons = false,
			hasAdvancedFields = false,
			uiDialogButtonPane = $('<div></div>')
				.addClass(
					'ui-dialog-buttonpane ' +
					'ui-widget-content ' +
					'ui-helper-clearfix'
				);

			uiDialogButtonPaneTable = $('<table></table>')
				.addClass(
					'ui-dialog-buttonpane'
				);
			var uiDialogButtonPaneTr = $('<tr></tr>');

			var uiDialogButtonPaneTd = $('<td></td>');

			/* if we already have a button pane, remove it*/
			this.uiDialog.find('.ui-dialog-buttonpane').remove();


			(typeof buttons == 'object' && buttons !== null &&
			$.each(buttons, function() { return !(hasButtons = true); }));

			(typeof advancedFields == 'object' && advancedFields !== null &&
			$.each(advancedFields, function() { return !(hasAdvancedFields = true); }));


			if (hasAdvancedFields) {
				$.each(advancedFields, function(name, field) {
					//uiDialogButtonPaneTd = $('<td style=\" padding-right:6px\"></td>');

					/*.appendTo(uiDialogButtonPane);*/
					field.appendTo(uiDialogButtonPaneTd);


				});
				uiDialogButtonPaneTd.appendTo(uiDialogButtonPaneTr);

			}

			if (hasButtons) {

				uiDialogButtonPaneTd = $('<td></td>');

				$.each(buttons, function(name, fn) {

					$('<button type="button"></button>')
					.addClass(
						'ui-state-default ' +
						'ui-corner-all'
					)
					.text(name)
					.click(function() { fn.apply(self.element[0], arguments); })
					.hover(
						function() {
							$(this).addClass('ui-state-hover');
						},
						function() {
							$(this).removeClass('ui-state-hover');
						}
					)
					.focus(function() {
						$(this).addClass('ui-state-focus');
					})
					.blur(function() {
						$(this).removeClass('ui-state-focus');
					})
					/*.appendTo(uiDialogButtonPane);*/
					.appendTo(uiDialogButtonPaneTd);

				});

				uiDialogButtonPaneTd.appendTo(uiDialogButtonPaneTr);
			}

			if (hasAdvancedFields || hasButtons) {
				uiDialogButtonPaneTr.appendTo(uiDialogButtonPaneTable);
				uiDialogButtonPaneTable.appendTo(uiDialogButtonPane);
				uiDialogButtonPane.appendTo(this.uiDialog);
			}
		},

		_makeDraggable: function() {
			var self = this,
			options = this.options,
			heightBeforeDrag;

			this.uiDialog.draggable({
				cancel: '.ui-dialog-content',
				handle: '.ui-dialog-titlebar',
				containment: 'document',
				start: function() {
					heightBeforeDrag = options.height;
					$(this).height($(this).height()).addClass("ui-dialog-dragging");
					(options.dragStart && options.dragStart.apply(self.element[0], arguments));
				},
				drag: function() {
					(options.drag && options.drag.apply(self.element[0], arguments));
				},
				stop: function() {
					$(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);
					(options.dragStop && options.dragStop.apply(self.element[0], arguments));
					$.ui.dialog.overlay.resize();
				}
			});
		},

		_makeResizable: function(handles) {
			handles = (handles === undefined ? this.options.resizable : handles);
			var self = this,
			options = this.options,
			resizeHandles = typeof handles == 'string'
				? handles
				: 'n,e,s,w,se,sw,ne,nw';

			this.uiDialog.resizable({
				cancel: '.ui-dialog-content',
				alsoResize: this.element,
				maxWidth: options.maxWidth,
				maxHeight: options.maxHeight,
				minWidth: options.minWidth,
				minHeight: options.minHeight,
				start: function() {
					$(this).addClass("ui-dialog-resizing");
					(options.resizeStart && options.resizeStart.apply(self.element[0], arguments));
				},
				resize: function() {
					(options.resize && options.resize.apply(self.element[0], arguments));
				},
				handles: resizeHandles,
				stop: function() {
					$(this).removeClass("ui-dialog-resizing");
					options.height = $(this).height();
					options.width = $(this).width();
					(options.resizeStop && options.resizeStop.apply(self.element[0], arguments));
					$.ui.dialog.overlay.resize();
				}
			})
		.find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');
		},

		_position: function(pos) {
			var wnd = $(window), doc = $(document),
			pTop = doc.scrollTop(), pLeft = doc.scrollLeft(),
			minTop = pTop;

			if ($.inArray(pos, ['center', 'top', 'right', 'bottom', 'left']) >= 0) {
				pos = [
				pos == 'right' || pos == 'left' ? pos : 'center',
				pos == 'top' || pos == 'bottom' ? pos : 'middle'
			];
			}
			if (pos.constructor != Array) {
				pos = ['center', 'middle'];
			}
			if (pos[0].constructor == Number) {
				pLeft += pos[0];
			} else {
				switch (pos[0]) {
					case 'left':
						pLeft += 0;
						break;
					case 'right':
						pLeft += wnd.width() - this.uiDialog.outerWidth();
						break;
					default:
					case 'center':
						pLeft += (wnd.width() - this.uiDialog.outerWidth()) / 2;
				}
			}
			if (pos[1].constructor == Number) {
				pTop += pos[1];
			} else {
				switch (pos[1]) {
					case 'top':
						pTop += 0;
						break;
					case 'bottom':
						pTop += wnd.height() - this.uiDialog.outerHeight();
						break;
					default:
					case 'middle':
						pTop += (wnd.height() - this.uiDialog.outerHeight()) / 2;
				}
			}

			/* prevent the dialog from being too high (make sure the titlebar
			// is accessible)*/
			pTop = Math.max(pTop, minTop);
			this.uiDialog.css({ top: pTop, left: pLeft });
		},

		_setData: function(key, value) {
			(setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value));
			switch (key) {
				case "buttons":
					this._createButtons(value);
					break;
				case "closeText":
					this.uiDialogTitlebarCloseText.text(value);
					break;
				case "dialogClass":
					this.uiDialog
					.removeClass(this.options.dialogClass)
					.addClass(uiDialogClasses + value);
					break;
				case "draggable":
					(value
					? this._makeDraggable()
					: this.uiDialog.draggable('destroy'));
					break;
				case "height":
					this.uiDialog.height(value);
					break;
				case "position":
					this._position(value);
					break;
				case "resizable":
					var uiDialog = this.uiDialog,
					isResizable = this.uiDialog.is(':data(resizable)');

					/* currently resizable, becoming non-resizable*/
					(isResizable && !value && uiDialog.resizable('destroy'));

					/* currently resizable, changing handles*/
					(isResizable && typeof value == 'string' &&
					uiDialog.resizable('option', 'handles', value));

					/* currently non-resizable, becoming resizable*/
					(isResizable || this._makeResizable(value));
					break;
				case "title":
					$(".ui-dialog-title", this.uiDialogTitlebar).html(value || '&nbsp;');
					break;
				case "width":
					this.uiDialog.width(value);
					break;
			}

			$.widget.prototype._setData.apply(this, arguments);
		},

		_size: function() {

			/* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
			* divs will both have width and height set, so we need to reset them
			*/
			var options = this.options;

			/*beginn von karl eingefuegt*/
			if (this.element.context.tagName == "IFRAME") {
				/* reset content sizing*/
				this.element.css({
					height: 0,
					minHeight: 0,
					width: options.width,
					border: '0'
				});
			} else {
				/* reset content sizing*/
				this.element.css({
					height: 0,
					minHeight: 0,
					width: 'auto'
				});
			}

			/*ende von karl eingefügt*/


			/* reset wrapper sizing
			determine the height of all the non-content elements*/
			var nonContentHeight = this.uiDialog.css({
				height: 'auto',
				width: options.width
			})
			.height();

			this.element
			.css({
				minHeight: Math.max(options.minHeight - nonContentHeight, 0),
				height: options.height == 'auto'
					? 'auto'
					: Math.max(options.height - nonContentHeight, 0)
			});
		}
	});

	$.extend($.ui.dialog, {
		version: "1.7.1",
		defaults: {
			autoOpen: true,
			bgiframe: false,
			buttons: {},
			closeOnEscape: true,
			closeText: 'close',
			dialogClass: '',
			draggable: true,
			hide: null,
			height: 'auto',
			maxHeight: false,
			maxWidth: false,
			minHeight: 150,
			minWidth: 150,
			modal: false,
			position: 'center',
			resizable: true,
			show: null,
			showLyonessLogo: true,
			stack: true,
			title: '',
			width: 300,
			zIndex: 1000,

			/*Modification by Erich */
			selectedButton: null,
			/*End Modification by Erich */

			/*Modification by Robert */
			hidedealogaftergeneration: false,
			noOverlayDeleteOnClose: false
			/*End Modification by Robert */
		},

		getter: 'isOpen',

		uuid: 0,
		maxZ: 0,

		getTitleId: function($el) {
			return 'ui-dialog-title-' + ($el.attr('id') || ++this.uuid);
		},

		overlay: function(dialog) {
			this.$el = $.ui.dialog.overlay.create(dialog);
		}
	});

	$.extend($.ui.dialog.overlay, {
		instances: [],
		maxZ: 0,
		events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
		function(event) { return event + '.dialog-overlay'; }).join(' '),
		create: function(dialog) {
			if (this.instances.length === 0) {
				/* prevent use of anchors and inputs
				// we use a setTimeout in case the overlay is created from an
				// event that we're going to be cancelling (see #2804)*/
				setTimeout(function() {
					$(document).bind($.ui.dialog.overlay.events, function(event) {
						var zindex = $(event.target).parents('.ui-dialog').css('zIndex');
						if (zindex == undefined) return true;
						var dialogZ = $(event.target).parents('.ui-dialog').css('zIndex') || 0;
						return (dialogZ > $.ui.dialog.overlay.maxZ);
					});
				}, 1);

				/* allow closing by pressing the escape key*/
				$(document).bind('keydown.dialog-overlay', function(event) {
					(dialog.options.closeOnEscape && event.keyCode
						&& event.keyCode == $.ui.keyCode.ESCAPE && dialog.close(event));
				});

				/* handle window resize*/
				$(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
			}

			var $el = $('<div></div>').appendTo(document.body)
			.addClass('ui-widget-overlay').css({
				width: this.width(),
				height: this.height()
			});

			(dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe());

			this.instances.push($el);
			return $el;
		},

		destroy: function($el) {
			this.instances.splice($.inArray(this.instances, $el), 1);

			if (this.instances.length === 0) {
				$([document, window]).unbind('.dialog-overlay');
			}

			$el.remove();
		},

		height: function() {

			/* handle IE 6*/
			if ($.browser.msie && $.browser.version < 7) {
				var scrollHeight = Math.max(
					document.documentElement.scrollHeight,
					document.body.scrollHeight
				);
				var offsetHeight = Math.max(
					document.documentElement.offsetHeight,
					document.body.offsetHeight
				);

				if (scrollHeight < offsetHeight) {
					return $(window).height() + 'px';
				} else {
					return scrollHeight + 'px';
				}
				/* handle "good" browsers*/
			} else {
				return $(document).height() + 'px';
			}
		},

		width: function() {
			/* handle IE 6*/
			if ($.browser.msie && $.browser.version < 7) {
				var scrollWidth = Math.max(
				document.documentElement.scrollWidth,
				document.body.scrollWidth
			);
				var offsetWidth = Math.max(
				document.documentElement.offsetWidth,
				document.body.offsetWidth
			);

				if (scrollWidth < offsetWidth) {
					return $(window).width() + 'px';
				} else {
					return scrollWidth + 'px';
				}
				/* handle "good" browsers*/
			} else {
				return $(document).width() + 'px';
			}
		},

		resize: function() {
			/* If the dialog is draggable and the user drags it past the
			* right edge of the window, the document becomes wider so we
			* need to stretch the overlay. If the user then drags the
			* dialog back to the left, the document will become narrower,
			* so we need to shrink the overlay to the appropriate size.
			* This is handled by shrinking the overlay before setting it
			* to the full document size.
			*/
			var $overlays = $([]);
			$.each($.ui.dialog.overlay.instances, function() {
				$overlays = $overlays.add(this);
			});

			$overlays.css({
				width: 0,
				height: 0
			}).css({
				width: $.ui.dialog.overlay.width(),
				height: $.ui.dialog.overlay.height()
			});
		}
	});

	$.extend($.ui.dialog.overlay.prototype, {
		destroy: function() {
			$.ui.dialog.overlay.destroy(this.$el);
		}
	});

	this.state = "";

})(jQuery);

/*
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// KLASSE Generic Dialog
// Allgemeine Dialog Klasse
//////////////////////////////////////////////////////////////////////////////////////////////////////////*/
LyoGenericWindow = function(obj, defaultsin) {

	var self = this;
	this.dialogFrame = null;
	this.caller = obj;
	this.dialogWindow;

	this.defaults = {
		Event: "click",
		bgiframe: false,
		resizable: false,
		Size: {
			Height: 650,
			Width: 900
		},
		modal: false,
		position: 'center',
		title: 'DefWindow',
		showTakeItButton: false,
		showCloseButton: true,
		CloseButtonLabel: TransByMember("Close", "JSArea.GlobalArea"),
		TakeItButtonLabel: TransByMember("TakeIt", "JSArea.GlobalArea"),
		OnSelected: null,
		OnClosed: null,
		showLyonessLogo: true
	};

	$.extend(this.defaults, defaultsin);



	this.CollectAndClose = function(selfin) {

		var data = null;

		if (selfin.DataCollectorFunction != null) data = selfin.DataCollectorFunction();
		if (data != false) {
			var callcose = true;
			if (selfin.defaults.OnSelected != null) callcose = selfin.defaults.OnSelected(data, selfin);
			if (callcose != false) selfin.Close(selfin, false);
		}
	}

	this.Close = function(selfin, doCloseAction) {

		if (doCloseAction == true && selfin.defaults.OnClosed != null) selfin.defaults.OnClosed(null, selfin);
		$(selfin.dialogFrame).dialog('close');
	}

	/* Dialog - Buttons definieren*/
	this.dialogButtons = {};

	this.dialogState = "";

	if (this.defaults.showCloseButton) {
		this.dialogButtons[this.defaults.CloseButtonLabel] = function(event) {
			self.Close(self, true);
		}
	}

	if (this.defaults.showTakeItButton != null && this.defaults.showTakeItButton == true) {
		this.dialogButtons[this.defaults.TakeItButtonLabel] = function(event) {
			self.CollectAndClose(self);
		}
	}

	this.ToggleTakeItButton = function(show) {
		var toggle;
		if (show.toLowerCase() == 'true')
			toggle = '';
		else
			toggle = 'disabled';
		var firstButton = $(".ui-dialog-buttonpane button:contains('" + TransByMember("TakeIt", "JSArea.GlobalArea") + "')");
		firstButton.attr('disabled', toggle);
	}

	this.DataCollectorFunction = function() {
		return null;
	}

	this.dialogFrame = document.createElement("iframe");
	this.dialogFrame.style.border = "none";
	this.dialogFrame.frameBorder = "0";
	this.dialogFrame.style.overflow = "hidden";

	/*gändert von Karl damit alle Paremter hineingereicht werden*/
	if (this.defaults.Size != null && this.defaults.Size.Height > 0)
		this.defaults.height = this.defaults.Size.Height;
	if (this.defaults.Size != null && this.defaults.Size.Width > 0)
		this.defaults.width = this.defaults.Size.Width;

	this.defaults.autoOpen = false;

	var defaultsButtons = this.defaults.buttons;
	if (!this.defaults.buttons)
		this.defaults.buttons = this.dialogButtons;
	else $.extend(this.defaults.buttons, this.dialogButtons);
	this.dialogWindow = $(this.dialogFrame).dialog(this.defaults);

	/*end von Karl gändert*/
	/*
	this.dialogWindow = $(this.dialogFrame).dialog({
	bgiframe: this.defaults.bgiframe,
	resizable: this.defaults.resizable,
	height: this.defaults.Size.Height,
	width: this.defaults.Size.Width,
	modal: this.defaults.modal,
	position: this.defaults.position,
	title: this.defaults.title,
	autoOpen: false,
	buttons: this.dialogButtons
	});
	*/

	if (this.defaults.Event != null && obj != null) {
		$(obj).bind(this.defaults.Event, { Dlg: this }, this.ShowDlg);
	}
}

LyoGenericWindow.prototype.ShowDlg = function(e) {
if (e != null) {
	
		e.data.Dlg.dialogWindow.dialog('open');
		e.data.Dlg.dialogWindow.dialog().parents(".ui-dialog:first").find(".ui-dialog-titlebar-close").hide();
		e.data.Dlg.dialogFrame.src = e.data.Dlg.defaults.InitUrl;
	} else {
	
		$(this.dialogFrame).dialog('open');
		$(this.dialogFrame).dialog().parents(".ui-dialog:first").find(".ui-dialog-titlebar-close").hide();
		this.dialogFrame.src = this.defaults.InitUrl;
	}


}
/*
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// KLASSE Pin Dialog
// Leitet von der allgemeinen Dialog Klasse ab
//////////////////////////////////////////////////////////////////////////////////////////////////////////*/

LyoPinWindow = function() { }
LyoPinWindow.Instance = function(namein, caller, defaultsin) {

	this.name = namein;

	this.defaults = {
		title: TransByMember("PinForgotten", "JSArea.GlobalArea"),
		InitUrl: HttpRootPath + "/Controls/PinForgotten/Popup",
		Size: {
			Height: 640,
			Width: 800
		}
	}

	$.extend(this.defaults, defaultsin);
	
	var parentWin = new LyoGenericWindow(caller, this.defaults);
	this.parent = parentWin;
	return parentWin;
}

		
//LyoPinWindow = function(caller, defaultsin) {
//	this.defaults = {
//		title: TransByMember("PinForgotten", "JSArea.GlobalArea"),
//		InitUrl: HttpRootPath + "/Controls/PinForgotten/Popup"
//	}
//	$.extend(this.defaults, defaultsin);
//	this.parent = new LyoGenericWindow(caller, this.defaults)
//}

//$.fn.showPinDialog = function(linkID) {
//	var defaults = {
//		Size: {
//			Height: 640,
//			Width: 800
//		}
//	}

//	var _pinWindow = new LyoPinWindow(document.getElementById(linkID), defaults);
//	
//}

/*
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// KLASSE History Dialog
// Leitet von der allgemeinen Dialog Klasse ab, dient zur anzeige der historisierung
//////////////////////////////////////////////////////////////////////////////////////////////////////////*/

LyoHistoryWindow = function(caller, defaultsin) {
	this.defaults = {
		title: TransByMember("History", "JSArea.GlobalArea"),
		InitUrl: HttpRootPath + "Note/Popup",
		Size: {
			Height: 650,
			Width: 900
		}
	}
	this.defaults.InitUrl += "?EntityId=" + defaultsin.Id + "&NoteType=" + defaultsin.NoteType;

	$.extend(this.defaults, defaultsin);
	this.parent = new LyoGenericWindow(caller, this.defaults);
}


$.fn.showHistoryDialog = function(defaultsin) {
	this.each(function(i, obj) {
		$(document).ready(function() {
			var _LyoHistoryWindow = new LyoHistoryWindow(obj, defaultsin);
		});
	});

}

/*
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// KLASSE FileUpload Dialog
// Leitet von der allgemeinen Dialog Klasse ab, dient zur Anzeige des FileUploads
//////////////////////////////////////////////////////////////////////////////////////////////////////////*/
LyoFileUploadWindow = function() { }
LyoFileUploadWindow.Instance = function(name, caller, defaultsin, onSelected) {
	this.defaults = {
		title: TransByMember("Datei Hochladen", "JSArea.GlobalArea"),
		InitUrl: HttpRootPath + "/Controls/UploadForm/Popup",
		OnSelected: onSelected,
		showTakeItButton: true,
		Size: {
			Height: 200,
			Width: 400
		}
	}
	this.defaults.InitUrl += "?EntityId=" + defaultsin.EntityID + "&FileUsageID=" + defaultsin.FileUsageID +
		"&Path=" + defaultsin.Path + "&Name=" + name;

	$.extend(this.defaults, defaultsin);
	var parentWin = new LyoGenericWindow(caller, this.defaults);
	this.parent = parentWin;
	top[name] = parentWin;

	return parentWin;
}
LyoFileUploadWindow.GetExistingInstance = function(name) {
	return top[name];
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////
// KLASSE DealerInvoiceDetail - PrintInvoice
// Öffnet ein PopUp mit dem in Navision generierten Pdf
//////////////////////////////////////////////////////////////////////////////////////////////////////////
LyoBillDetailPrint = function() { }
LyoBillDetailPrint.Instance = function(namein, caller, defaultsin) {
	this.name = namein;

	this.defaults = {
		InitUrl: HttpRootPath + "Dealers/BillDetail/PrintInvoice",
		title: TransByMember("PrintDealerInvoice", "JSArea.GlobalArea"),
		InvoiceID: null
	}

	$.extend(this.defaults, defaultsin);
	this.defaults.InitUrl = this.defaults.InitUrl + "?invoiceID=" + this.defaults.InvoiceID;

	var parentWin = new LyoGenericWindow(namein, this.defaults);
	this.parent = parentWin;
	return parentWin;
}

LyoBillDetailPrint.GetExistingInstance = function(name) {
	return LyoReportWindow.GetInstanzeByName(name);
}

/*
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// KLASSE Kunden Information
// Zeigt Daten, Addressen und Erreichbarkeiten eines Kunden
//////////////////////////////////////////////////////////////////////////////////////////////////////////*/
LyoCustomerInformation = function() { }
LyoCustomerInformation.Instance = function(namein, caller, defaultsin) {
	
	this.defaults = {
		Titel: TransByMember("CustomerInformation", "JSArea.GlobalArea"),
		InitUrl: HttpRootPath + "Controls/CustomerInformation/Find",
		title: TransByMember("Kunden Information", "JSArea.GlobalArea"),
		Size: {
			Height: 580,
			Width: 550
		}
	}
	this.defaults.InitUrl += "?EntityId=" + defaultsin.EntityID + "&Name=" + namein;
	$.extend(this.defaults, defaultsin);

	var parentWin = new LyoGenericWindow(caller, this.defaults);
	this.parent = parentWin;
	return parentWin;
}
LyoCustomerInformation.GetExistingInstance = function(name) {
	return top[name];
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////
// KLASSE Händler Information
// Zeigt Daten, Addressen und Erreichbarkeiten eines Händlers
//////////////////////////////////////////////////////////////////////////////////////////////////////////
LyoDealerInformation = function() { }
LyoDealerInformation.Instance = function(namein, caller, defaultsin) {

    this.name = namein;

    this.defaults = {
        InitUrl: HttpRootPath + "Controls/DealerInformation/Find",
        title: TransByMember("DealerInformation", "JSArea.GlobalArea"),
        Size: {
            Height: 300,
            Width: 400
        },
        ValuesFromFields: false,
        EntityID: null
    }

    $.extend(this.defaults, defaultsin);

    this.defaults.InitUrl += "?Name=" + this.name;

    this.defaults.InitUrl += "&entityId=" + this.defaults.EntityID;

    var parentWin = new LyoGenericWindow(caller, this.defaults);
    this.parent = parentWin;

    return parentWin;
}

LyoDealerInformation.GetExistingInstance = function(name) {
    return top[name];
}

/*
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// KLASSE BigImagePreview
// Zeigt ein Storebild in groß an und man kann sogar blättern
//////////////////////////////////////////////////////////////////////////////////////////////////////////*/
LyoBigImagePreview = function() { }
LyoBigImagePreview.Instance = function(namein, caller, defaultsin) {

	this.defaults = {
		title: TransByMember("LyonessStore", "JSArea.GlobalArea"),
		InitUrl: HttpRootPath + "Store/Catalog/BigImagePreview",
		ItemNumber: '',
		InternalCount: '',
		Size: {
			Height: 520,
			Width: 470
		}
	}
	$.extend(this.defaults, defaultsin);

	this.defaults.InitUrl += "?itemNumber=" + defaultsin.ItemNumber + "&internalCount=" + defaultsin.InternalCount;
	
	var parentWin = new LyoGenericWindow(caller, this.defaults);
	this.parent = parentWin;
	return parentWin;
}

LyoBigImagePreview.GetExistingInstance = function(name) {
	return top[name];
}

/*
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// KLASSE Message Box
// Leitet von der allgemeinen Dialog Klasse ab, dient zur anzeige von Messageboxen
//////////////////////////////////////////////////////////////////////////////////////////////////////////*/

function createEnum(type, flags) {
	for (var i in type.prototype) {
		type[i] = type.prototype[i];
	}
	type.__enum = true;
	type.__flags = flags;
}

MessageBoxButton = function() {
	throw new Error("constructor not implemented. this is a static enum");
}

MessageBoxButton.prototype = {
	OK: { text: TransByMember("Ok", "JSArea.GlobalArea") },
	Cancel: { text: TransByMember("Cancel", "JSArea.GlobalArea") },
	Retry: { text: TransByMember("Retry", "JSArea.GlobalArea") },
	Abort: { text: TransByMember("Abort", "JSArea.GlobalArea") },
	Ignore: { text: TransByMember("Ignore", "JSArea.GlobalArea") },
	Yes: { text: TransByMember("Yes", "JSArea.GlobalArea") },
	No: { text: TransByMember("No", "JSArea.GlobalArea") }
}

createEnum(MessageBoxButton);

MessageBoxButtons = function() {
	throw new Error("constructor not implemented. this is a static enum");
}

MessageBoxButtons.prototype = {
	OK: { buttons: [MessageBoxButton.OK], defaultButton: MessageBoxButton.OK }, /*Das Meldungsfeld enthält die Schaltfläche OK. */
	OKCancel: { buttons: [MessageBoxButton.OK, MessageBoxButton.Cancel], defaultButton: MessageBoxButton.OK }, /*Das Meldungsfeld enthält die Schaltflächen OK und Abbrechen. */
	AbortRetryIgnore: { buttons: [MessageBoxButton.Abort, MessageBoxButton.Retry, MessageBoxButton.Ignore], defaultButton: MessageBoxButton.Retry }, /*Das Meldungsfeld enthält die Schaltflächen Abbrechen, Wiederholen und Ignorieren. */
	YesNoCancel: { buttons: [MessageBoxButton.Yes, MessageBoxButton.No, MessageBoxButton.Cancel], defaultButton: MessageBoxButton.Cancel }, /*Das Meldungsfeld enthält die Schaltflächen Ja, Nein und Abbrechen. */
	YesNo: { buttons: [MessageBoxButton.Yes, MessageBoxButton.No], defaultButton: MessageBoxButton.No },  /*Das Meldungsfeld enthält die Schaltflächen Ja und Nein. */
	RetryCancel: { buttons: [MessageBoxButton.Retry, MessageBoxButton.Cancel], defaultButton: MessageBoxButton.Cancel} /*Das Meldungsfeld enthält die Schaltflächen Wiederholen und Abbrechen. */
}

createEnum(MessageBoxButtons);

MessageBoxType = function() {
	throw new Error("constructor not implemented. this is a static enum");
}
MessageBoxType.prototype = {
	Info: { title: TransByMember("Information", "JSArea.GlobalArea"), icon: "MsgBoxIconInfo" }, /*Informationsbox*/
	Advise: { title: TransByMember("Advise", "JSArea.GlobalArea"), icon: "MsgBoxIconAdvise" }, /*Hinweisbox*/
	Error: { title: TransByMember("Error", "JSArea.GlobalArea"), icon: "MsgBoxIconError"} /*Fehlerbox*/
}
createEnum(MessageBoxType);



LyoMessageBox = function(caller, defaultsin) {

	this.defaults = {
		Size: {
			Height: "auto",
			Width: 350
		},
		autoopen: false,
		bgiframe: true,
		bindMethod: this.ShowBox,
		titleText: null,
		resizable: false,
		messagetext: null,
		messageboxtype: MessageBoxType.Info,
		messageBoxButtons: MessageBoxButtons.OK,
		Event: "click",
		modal: true,
		position: 'center',
		title: null,
		ResultCallback: {
			onOk: null,
			onCancel: null,
			onRetry: null,
			onAbort: null,
			onIgnore: null,
			onYes: null,
			onNo: null
		},
		selectedButton: null
	}

	$.extend(this.defaults, defaultsin);
	

	if (IsNullOrEmpty(this.defaults.title)) {
		this.defaults.title = this.defaults.messageboxtype.title;
	}

	this.dlgWnd = document.createElement("div");
	this.dlgWnd.id = "dialog";

	this.table = document.createElement("table");
	this.table.classname = "msgTable"
	this.row = this.table.insertRow(0);

	this.icon = document.createElement("div");
	this.icon.className = this.defaults.messageboxtype.icon;
	this.cell1 = this.row.insertCell(0);
	this.cell1.appendChild(this.icon);
	this.cell1.setAttribute("width", "40px");
	this.cell1.align = "Left";
	this.cell1.vAlign = "Top";

	this.cell2 = this.row.insertCell(1);
	this.cell2.innerHTML = this.defaults.messagetext;
	this.cell2.align = "Left";
	this.cell2.vAlign = "Top";
	this.cell2.style.padding = "5px 0 0 0;";

	this.dlgWnd.appendChild(this.table);

	this.dialogFrame = this.dlgWnd;
	this.dialogFrame.dialogOwner = this;
	this.caller = caller;


	this._saved_caller_onclick = null;

	/* onclick attribut des DOM elements wird gespeichert und gegen ein return false ersetzt*/
	if (caller != null) {
		this._saved_caller_onclick = caller.onclick;
		this.caller.onclick = function() { return false; };
	}


	/* Dialog - Buttons definieren*/
	this.dialogButtons = {};
	if (this.defaults.messageBoxButtons != null) {
		if (this.defaults.selectedButton == null && this.defaults.messageBoxButtons.defaultButton != null) {
			this.defaults.selectedButton = this.defaults.messageBoxButtons.defaultButton;
		}

		for (x in this.defaults.messageBoxButtons.buttons) {
			var curIdx = (this.defaults.messageBoxButtons.buttons.length - 1) - x;

			if (this.defaults.messageBoxButtons.buttons[curIdx] == this.defaults.selectedButton) {
				this.selectedButtonIdx = x;
			}
			this.dialogButtons[this.defaults.messageBoxButtons.buttons[curIdx].text] = function(e) {
				$(this).dialog('close');
				var but = this.dialogOwner.defaults.messageBoxButtons.buttons;
				for (idx in but) {
					if (but[idx].text == e.currentTarget.innerHTML) {
						this.dialogOwner.onFinish(but[idx], this);
						return;
					}
				}
			}
		}
	}

	this.onFinish = function(dialogResult, dialog) {

		var callbackReturn;

		switch (dialogResult) {
			case MessageBoxButton.OK:
				if (this.defaults.ResultCallback.onOk != null) {
					callbackReturn = this.defaults.ResultCallback.onOk(dialog);
				}
				break;
			case MessageBoxButton.Cancel:
				if (this.defaults.ResultCallback.onCancel != null) {
					callbackReturn = this.defaults.ResultCallback.onCancel(dialog);
				}
				break;
			case MessageBoxButton.Retry:
				if (this.defaults.ResultCallback.onRetry != null) {
					callbackReturn = this.defaults.ResultCallback.onRetry(dialog);
				}
				break;
			case MessageBoxButton.Abort:
				if (this.defaults.ResultCallback.onAbort != null) {
					callbackReturn = this.defaults.ResultCallback.onAbort(dialog);
				}
				break;
			case MessageBoxButton.Ignore:
				if (this.defaults.ResultCallback.onIgnore != null) {
					callbackReturn = this.defaults.ResultCallback.onIgnore(dialog);
				}
				break;
			case MessageBoxButton.Yes:
				/*alert("YES WE CAN");*/
				if (this.defaults.ResultCallback.onYes != null) {
					callbackReturn = this.defaults.ResultCallback.onYes(dialog);
				}
				break;
			case MessageBoxButton.No:
				/*alert("OHHH NO");*/
				if (this.defaults.ResultCallback.onNo != null) {
					callbackReturn = this.defaults.ResultCallback.onNo(dialog);
				}
				break;
			default:
				/*alert("NO IDEA");*/
				break;
		}

		/* wenn der callback ein true zurückgegeben hat*/
		if (callbackReturn != false && this._saved_caller_onclick != null) {

			this.caller.onclick = this._saved_caller_onclick; 		/* wird das DOM Attribut onclick wieder hergestellt*/

			var onClick = $(this.caller).click; 					/* der jQuery click event gesichert*/
			$(this.caller).unbind("click"); 						/* der jQuery click event gelöscht*/
			this.caller.click(); 									/* ein click auf den button im originalzustand (vor dem boxbinding) ausgeführt*/
			$(this.caller).bind("click", onClick); 					/* und der boxbinded zustand wieder hergestellt*/
			this.caller.onclick = function() { return false; }

		}

		if (callbackReturn != false && (this._saved_caller_onclick == null || this._saved_caller_onclick == undefined)) {
			if (this.caller != null) {
				this.caller.onclick = function() { return true; }
				this.caller.click();
			}
		}
	}

	this.dialogWindow = $(this.dialogFrame).dialog({
		bgiframe: this.defaults.bgiframe,
		resizable: this.defaults.resizable,
		height: this.defaults.Size.Height,
		width: this.defaults.Size.Width,
		modal: this.defaults.modal,
		position: this.defaults.position,
		title: this.defaults.title,
		autoOpen: false,
		buttons: this.dialogButtons,
		selectedButton: this.selectedButtonIdx
	});
	if (caller != null) {
		$(caller).bind(this.defaults.Event, { Dlg: this }, this.ShowBox);
	}
}

LyoMessageBox.prototype.ShowBox = function(e) {
	e.data.Dlg.ShowDialogBox(e.data.Dlg);
}

LyoMessageBox.prototype.ShowDialogBox = function(dlg) {
	dlg.dialogWindow.dialog('open').parents(".ui-dialog:first").find(".ui-dialog-titlebar-close").hide();
}


$.fn.InfoBox = function(defaultsin) {
	this.each(function(i, obj) {
		$(document).ready(function() {
			var defaults = {
				messageboxtype: MessageBoxType.Info
			}
			$.extend(defaults, defaultsin);
			var _LyoMessageBox = new LyoMessageBox(obj, defaults);
		});
	});
}
function InfoBox(defaultsin) {
	var defaults = {
		messageboxtype: MessageBoxType.Info		
	}
	$.extend(defaults, defaultsin);
	var _LyoMessageBox = new LyoMessageBox(null, defaults);
	_LyoMessageBox.ShowDialogBox(_LyoMessageBox);
}


$.fn.ErrorBox = function(defaultsin) {
	this.each(function(i, obj) {
		$(document).ready(function() {
			var defaults = {
				messageboxtype: MessageBoxType.Error
			}
			$.extend(defaults, defaultsin);
			var _LyoMessageBox = new LyoMessageBox(obj, defaults);
		});
	});
}
function ErrorBox(defaultsin) {
	var defaults = {
		messageboxtype: MessageBoxType.Error
	}
	$.extend(defaults, defaultsin);
	var _LyoMessageBox = new LyoMessageBox(null, defaults);
	_LyoMessageBox.ShowDialogBox(_LyoMessageBox);
}

$.fn.AdviseBox = function(defaultsin) {
	this.each(function(i, obj) {
		$(document).ready(function() {
			var defaults = {
				messageboxtype: MessageBoxType.Advise
			}
			$.extend(defaults, defaultsin);
			var _LyoMessageBox = new LyoMessageBox(obj, defaults);
		});
	});
}
function AdviseBox(defaultsin) {
	var defaults = {
		messageboxtype: MessageBoxType.Error
	}
	$.extend(defaults, defaultsin);
	var _LyoMessageBox = new LyoMessageBox(null, defaults);
	_LyoMessageBox.ShowDialogBox(_LyoMessageBox);
}

function WebSiteMessageBox(defaultsin) {
	var defaults = {
	messageboxtype: MessageBoxType.Info
	}
	$.extend(defaults, defaultsin);
	var _LyoMessageBox = new LyoGenericWindow(null, defaults);
	return _LyoMessageBox;

}


WebSiteMessageBox = function(caller, defaultsin) {

	this.WebSiteMessageBoxState = "";
	this.WebSiteMessageBoxMessageID = defaultsin.messageID;

	if (defaultsin.messageID == null || defaultsin.messageID == "") {
		alert("WebSiteMessageBox->messageID darf nicht leer sein!");
		return;
	}

	if (defaultsin.id == null || defaultsin.id == "") {
		alert("WebSiteMessageBox->id darf nicht leer sein!");
		return;
	}
	else {
		defaultsin.id = "WebSiteMessageBox_" + defaultsin.id;
	}
	if (window[defaultsin.id] != null) {
		return;
	}
	else
		window[defaultsin.id] = "1";


	var self = this;
	var lyoGenericWindow = null;
	var state = "";
	var closeButtonName = TransByMember("Close", "JSArea.GlobalArea");

	this.defaults = {
		title: TransByMember("Info", "JSArea.GlobalArea"),
		InitUrl: "https://www.google.at",
		modal: true,
		Size: {
			Height: 500,
			Width: 745
		},
		DoNotmoveToTop: true,
		showCloseButton: false,
		buttons: {}
	}

	
	$.extend(this.defaults, defaultsin);
	this.lyoGenericWindow = new LyoGenericWindow(caller, this.defaults);

	$(this.lyoGenericWindow.dialogFrame).attr('style', 'width:100%');
	$(this.lyoGenericWindow.dialogFrame).attr('style', 'height:100%');


	this.lyoGenericWindow.ShowDlg();
	lyoGenericWindow = this.lyoGenericWindow;


	this.Close = function() {
		if (self.WebSiteMessageBoxState != "")
			self.lyoGenericWindow.Close(lyoGenericWindow, true);
		else
			alert("you must select!");

	}

	this.GetConfirmationParams = function() {
	
		return { messageID: self.defaults.messageID,
		    customerID: self.defaults.customerID,
		    lotteryID: self.defaults.lotteryID,
			webSiteMessageBoxState: self.WebSiteMessageBoxState
		};

	}


}

WebSiteMessageBoxLottery = function(caller, defaultsin) {
    var chkid = 'WebSiteMessageBoxLotteryBtnChk' + defaultsin.id;
    var btnChk = '<input style=\"border:0;\"  name=\"' + chkid + '\" id=\"' + chkid + '\" type=\"checkbox\" />';
    var id = 'WebSiteMessageBoxLotteryLblChk' + defaultsin.id;
    var label_chk = $('<Div  id=\"' + id + '\">' + defaultsin.label_Chk + '</Div>');


    var checkBox = $(btnChk);
    var self = this;
    var table = $('<table class=\"advancedFields\" style=\"width:100%\" ><tr></tr></table>');

   
    
    var td = $('<td>' + btnChk + '</td>');
    //btnChk.appendTo(td);
    $('tr', table).append(td);



    var td1 = $('<td style=\"width:100%;\"  ></td>');
    label_chk.appendTo(td1);
    $('tr', table).append(td1);

    this.defaults = {
        advancedFields: { "advancedFields": table
    },
          Size: {
            Height: 605,
            Width: 520
        },
        buttons: {}

    };

    $.extend(this.defaults, defaultsin);


    this.defaults.buttons[defaultsin.lbl_btn_yes] = function(e) { self.webSiteMessageBox.WebSiteMessageBoxState = 'yes'; if ($('#' + chkid)[0].checked) { self.webSiteMessageBox.Close(); } else { alert(defaultsin.label_mustCheck) } };
    this.defaults.buttons[defaultsin.lbl_btn_no] = function(e) { self.webSiteMessageBox.WebSiteMessageBoxState = 'no'; self.webSiteMessageBox.Close(); };
    this.webSiteMessageBox = new WebSiteMessageBox(caller, this.defaults);

    this.webSiteMessageBox.Close = function() {

        $.post(this.defaults.confirmationurl, this.GetConfirmationParams());
        this.lyoGenericWindow.Close(this.lyoGenericWindow, true);
    }

    return this.webSiteMessageBox;
}



WebSiteMessageBoxWithRadio = function(caller, defaultsin) {
var self = this;
    var id = 'WebSiteMessageBoxWithCheckBoxYes' + defaultsin.id;
    var name = 'WebSiteMessageBoxWithCheckBox' + defaultsin.id;
    var radio = $('<Input name=\"' + name + '\" id=\"' + id + '\" type=\"radio\"></Input>');

    $(radio).bind("change", this, function(e) { e.data.webSiteMessageBox.WebSiteMessageBoxState = "yes"; });

    if (!defaultsin.label_yes_no)
        defaultsin.label_yes_no = "";

    var label_yes_no = $('<Div id=\"label_yes_no\">' + defaultsin.label_yes_no + '</Div>');

    var label = $('<Div id=\"label_yes\">' + TransByMember("Yes", "JSArea.GlobalArea") + '</Div>');
    var table = $('<table  class=\"advancedFields\"><tr></tr></table>');
    var tdLabel = $('<td style=\"width:50px\" >&nbsp;</td>');

    var td = $('<td ></td>');
    label_yes_no.appendTo(td);
    $('tr', table).append(td);
    $('tr', table).append(tdLabel);
    td = $('<td ></td>');
    label.appendTo(td);
    $('tr', table).append(td);
    td = $('<td></td>');
    radio.appendTo(td);
    $('tr', table).append(td);
    td = $('<td></td>');
    $('tr', table).append(td);

    id = 'WebSiteMessageBoxWithCheckBoxNo' + defaultsin.id;
    radio = $('<Input name=\"' + name + '\" id=\"' + id + '\" type=\"radio\"></Input>');

    $(radio).bind("change", this, function(e) { e.data.webSiteMessageBox.WebSiteMessageBoxState = "no"; });

    label = $('<Div id=\"label_no\">' + TransByMember("No", "JSArea.GlobalArea") + '</Div>');

    label.appendTo(td);
    $('tr', table).append(td);
    td = $('<td></td>');
    radio.appendTo(td);
    $('tr', table).append(td);
    td = $('<td ></td>');
    $('tr', table).append(td);

   
    this.defaults = {
        advancedFields: { "advancedFields": table
    },
         buttons: { }
    };
    var closeButtonName = TransByMember("Close", "JSArea.GlobalArea");
    this.defaults.buttons[closeButtonName] = function(e) { self.webSiteMessageBox.Close(); };
    
    $.extend(this.defaults, defaultsin);
    this.webSiteMessageBox = new WebSiteMessageBox(caller, this.defaults);

    this.webSiteMessageBox.Close = function() {

        $.post(this.defaults.confirmationurl, this.GetConfirmationParams());
        this.lyoGenericWindow.Close(this.lyoGenericWindow, true);
    }

    return this.webSiteMessageBox;
}

WebSiteMessageBoxWithCheckBox = function(caller, defaultsin) {
	var self = this;
	var id = 'WebSiteMessageBoxWithCheckBoxYes' + defaultsin.id;
	var checkbox = $('<Input name=\"' + id + '\" id=\"' + id + '\" type=\"checkbox\"></Input>');

	$(checkbox).bind("click", this, function(e) { if (this.checked) e.data.webSiteMessageBox.WebSiteMessageBoxState = "yes"; else e.data.webSiteMessageBox.WebSiteMessageBoxState = "no"; });

	var label = $('<Div id=\"label_checkBox\"><nobr>' + TransByMember("WebSiteMmessageDontShowMessageAgain", "JSArea.CustomerArea") + '</nobr></Div>');
	var table = $('<table class=\"advancedFields\"><tr><td></td></tr></table>');
	var td = $('<td ></td>');
	label.appendTo(td);
	$('tr', table).append(td);
	td = $('<td></td>');
	checkbox.appendTo(td);
	$('tr', table).append(td);
	td = $('<td style="width:100%;"></td>');
	$('tr', table).append(td);

	this.defaults = {
		advancedFields: { "advancedFields": table },
		buttons: {}
	};


	$.extend(this.defaults, defaultsin);
	var closeButtonName = TransByMember("Close", "JSArea.GlobalArea");
	this.defaults.buttons[closeButtonName] = function(e) { self.webSiteMessageBox.Close(); };
	this.webSiteMessageBox = new WebSiteMessageBox(caller, this.defaults);

	this.webSiteMessageBox.Close = function() {
		//var x = y;
		$.post(this.defaults.confirmationurl, this.GetConfirmationParams());

		this.lyoGenericWindow.Close(this.lyoGenericWindow, true);

		//this.lyoGenericWindow.dialogFrame.html('');
		//this.lyoGenericWindow.dialogWindow.dialogFrame.html('')
		this.lyoGenericWindow.dialogWindow.context.src = '';
		//nicht die schönste Lösung, aber das video hat weitergespielt.
		//muß ma besser machen
		//$('.ui-dialog').html('');
	}


	return this.webSiteMessageBox;
}

EasterEggContinue = function(foundCount, defaultsin, caller, statusChecked) {
    var self = this;
    var id = 'EasterEggContinueChk' + defaultsin.id;
    var status = '';
    if (statusChecked)
        status = "checked";

    var changed = false;
    var checkbox = $('<Input name=\"' + id + '\" id=\"' + id + '\" ' + status + ' type=\"checkbox\"></Input>');
    $(checkbox).bind("click", this, function(e) { changed = true; if (this.checked) self.webSiteMessageBox.WebSiteMessageBoxState = "yes"; else self.webSiteMessageBox.WebSiteMessageBoxState = "no"; });


    var conditionslink = '<a target=\"blank\" href=\"' + defaultsin.conditionsURL + '\">' + TransByMember("game_popup_conditions", "JSArea.GlobalArea") + '&nbsp;&raquo;</a>';
    var continueLable = TransByMember("game_popup_continueplay", "JSArea.GlobalArea") + '&nbsp;/&nbsp;' + TransByMember("game_popup_eggs_collected", "JSArea.GlobalArea");

    var table = $('<table class=\"advancedFields\"><tr></tr></table>');
    var td = $('<td style=\"width:100%\" >' + conditionslink + '</td>');
    $('tr', table).append(td);

    var tr = $('<tr></tr>');
    td = $('<td></td>');


    tr = $('<tr></tr>');
    td = $('<td></td>');
    td.appendTo(tr);

    var tableInner = $('<table class=\"advancedFields\"></table>');
    var trInner = $('<tr></tr>');

    var tdInner = $('<td></td>');
    tdInner.append(checkbox);
    tdInner.appendTo(trInner);

    tdInner = $('<td></td>');
    tdInner.append(continueLable + ':&nbsp;' + foundCount); //<span>continueLable' + ':&nbsp;' + '</span><span style=\"font-weight:bold;\">' + foundCount + '<span>');
    tdInner.appendTo(trInner);
    trInner.appendTo(tableInner);
    tableInner.appendTo(td);
    td.appendTo(tr);
    tr.appendTo(table);
    tr.appendTo(table);



    this.defaults = {
        advancedFields: { "advancedFields": table },
        buttons: {},
        Size: {
            Height: 460,
            Width: 460
        }
    };


    $.extend(this.defaults, defaultsin);
    var closeButtonName = TransByMember("Close", "JSArea.GlobalArea");
    this.defaults.buttons[closeButtonName] = function(e) {

               
       
        if (changed) {
            if (checkbox[0].checked)
                self.webSiteMessageBox.WebSiteMessageBoxState = "yes";
            else self.webSiteMessageBox.WebSiteMessageBoxState = "no";
            $.post(self.defaults.confirmationurl, self.webSiteMessageBox.GetConfirmationParams());
        }
        self.webSiteMessageBox.Close();
    };
    this.webSiteMessageBox = new WebSiteMessageBox(caller, this.defaults);

    this.webSiteMessageBox.Close = function() {


        this.lyoGenericWindow.Close(this.lyoGenericWindow, true);
    }


    return this.webSiteMessageBox;
}

WebSitePrintBox = function(reportType, queryStringParams, defaultsin) {


	var id = "WebSitePrintBox_";
	if (reportType == null || reportType == "") {
		alert("WebSitePrintBox->reportType darf nicht leer sein!");
		return;
	}
	else {
		id = "WebSitePrintBox_" + reportType;
	}

	window[id] = "1";


	var self = this;
	var lyoGenericWindow = null;
	var state = "";
	var closeButtonName = TransByMember("Close", "JSArea.GlobalArea");

	this.defaults = {
		title: TransByMember("Info", "JSArea.GlobalArea"),
		InitUrl: "/internal/Handlers/Reports.ashx?type=" + reportType + queryStringParams,
		modal: true,
		Size: {
			Height: 760,
			Width: 860
		},
		DoNotmoveToTop: true,
		showCloseButton: true,
		buttons: {}
	}

	if (defaultsin != null)
		$.extend(this.defaults, defaultsin);


	//this.defaults.buttons[closeButtonName] = function(e) { self.Close(); };

	this.lyoGenericWindow = new LyoGenericWindow(null, this.defaults);

	$(this.lyoGenericWindow.dialogFrame).attr('style', 'width:100%');
	$(this.lyoGenericWindow.dialogFrame).attr('style', 'height:100%');


	this.lyoGenericWindow.ShowDlg();
	lyoGenericWindow = this.lyoGenericWindow;

	return lyoGenericWindow;

}


OnlinePositioningAgbBox = function(defaultsin) {

	var self = this;
	var lyoGenericWindow = null;

	this.defaults = {
		title: TransByMember("Rules", "JSArea.GlobalArea"),
		InitUrl: "/internal/Customers/Matrix/ShowOnlinePositioningAgbBox",
		modal: true,
		Size: {
			Height: 200,
			Width: 500
		},
		DoNotmoveToTop: false,
		showCloseButton: true,
		showTakeItButton: true,
		TakeItButtonLabel: TransByMember("Continue", "JSArea.GlobalArea")
	}

	if (defaultsin != null)
		$.extend(this.defaults, defaultsin);

	this.lyoGenericWindow = new LyoGenericWindow(null, this.defaults);

	this.lyoGenericWindow.ShowDlg();
	lyoGenericWindow = this.lyoGenericWindow;

	return lyoGenericWindow;
}

StoreLightbox = function(defaultsin) {

    var self = this;
    var lyoGenericWindow = null;

    this.defaults = {
        title:"",// TransByMember("store", "JSArea.GlobalArea"),
        InitUrl: "",
        modal: true,
        Size: {
            Height: 500,
            Width: 500
        },
        DoNotmoveToTop: false,
        showCloseButton: true,
        showTakeItButton: false

    }

        if (defaultsin != null)
            $.extend(this.defaults, defaultsin);
        

    this.lyoGenericWindow = new LyoGenericWindow(null, this.defaults);

    this.lyoGenericWindow.ShowDlg();
    lyoGenericWindow = this.lyoGenericWindow;

    return lyoGenericWindow;
}


/*
//Beispiel
InformationPopup = function() { }
InformationPopup.Instance = function(namein, caller, defaultsin) {
	
this.name = namein;

this.defaults = {
InitUrl: HttpRootPath + "Controls/DepositDetail/Find",
title: TransByMember("InformationPopup", "JSArea.GlobalArea"),
Size: {
Height: 300,
Width: 550
}
}

$.extend(this.defaults, defaultsin);
var parentWin = new LyoGenericWindow(caller, this.defaults);
this.parent = parentWin;
return parentWin;
}

InformationPopup.GetExistingInstance = function(name) {
return top[name];
}
*/