
	function dropDownFixPosition(button, dropdown, reloadcb, width = 300){
		var origparent = null;
		var origsibling = null;

		if(!dropdown) {
			dropdown = $("<div class='mdl-card mdl-shadow--4dp cardpopup'></div>");
		} else {
			origparent = dropdown.parent();
			origsibling = dropdown.prev();
		}

		var overlay = $("<div class='overlay'></div>");
		var dropDownTop = button.offset().top + button.outerHeight();

		if(dropDownTop + dropdown.height() > window.innerHeight){
			dropDownTop -= dropdown.height(); // Nach oben aufploppen
		}
		if(dropDownTop < 0) dropDownTop = 0;

		var left = button.offset().left;
		if (left > window.innerWidth - width) {
			left = window.innerWidth - width;
		}
		if (left < 10) {
			left = 10;
		}
		dropdown.appendTo(overlay);
		dropdown.css('top', dropDownTop + 'px');
		dropdown.css('left', left + 'px');
		dropdown.css('display', 'block');
		dropdown.css('position', 'absolute');
		dropdown.css('z-index', '1001');
		dropdown.css('width', width.toString());

		var changetimer = null;

		if(reloadcb){
			setTimeout(function(){
				dropdown.find('input, select').on('change paste keyup dp.change', function(){
					clearTimeout(changetimer);
					changetimer = setTimeout(reloadcb, 50);
				});

				componentHandler.upgradeElements(dropdown.get(0));
			}, 1);
		}

		dropdown.close = function () {
			overlay.click();
		}

		overlay.click(function(e) {
			if (dropdown.get(0).contains(e.target)) return;

			if (origparent) {
				dropdown.prependTo(origparent);
				if (origsibling) {
					dropdown.insertAfter(origsibling);
				}
				dropdown.hide();
			} else {
				dropdown.remove();
			}
			overlay.remove();

			if (reloadcb) reloadcb();
		});

		$('body').append(overlay);

		return dropdown;
	}
	function handleHTMLOverlay(e, id) {
		var overlayForm = $(id);
		overlayForm.css('pointer-events', 'none');
		overlayForm.css('left', Math.min(window.innerWidth * 0.6 - 12, e.clientX + 12));
		overlayForm.css('top', Math.min(window.innerHeight * 0.6 - 12, e.clientY + 12));
		overlayForm.fadeIn(20);
		return;
	}
	function handleHTMLOverlayFade(e, id) {
		var overlayForm = $(id);
		overlayForm.fadeOut(400);
		return;
	}
	