
	moment.tz.setDefault('Europe/Berlin');
	
		function date_filter(win, dataview, col, title, locale, dateformat_moment, reload, allowEmpty) {
			var changed = false;
			var aktMonat = moment().format('M');
			var aktQuartal = moment().quarter();
			var aktJahr = moment().format('YYYY');

			/* Grid-Container für Überschrift und _Alle_ */
			var headerContainer = $('<div class="mdl-grid fop-floatsorter"></div>');
			win.append(headerContainer);
			
			/* Grid-Container für Radio-Buttons */
			var gridContainer = $('<div class="mdl-grid"></div>');
			win.append(gridContainer);

			/* Grid-Container für Input-Feld Tag */
			var gridContainerInputTag = $('<div class="mdl-grid"></div>');
			win.append(gridContainerInputTag);

			/* Grid-Container für Input-Feld Woche */
			var gridContainerInputWeek = $('<div class="mdl-grid"></div>');
			win.append(gridContainerInputWeek);

			/* Grid-Container für Input-Felder Monat */
			var gridContainerInputMonat = $('<div class="mdl-grid"></div>');
			win.append(gridContainerInputMonat);

			/* Grid-Container für Input-Felder Quartal */
			var gridContainerInputQuartal = $('<div class="mdl-grid"></div>');
			win.append(gridContainerInputQuartal);
			
			/* Grid-Container für Input-Feld Jahr */
			var gridContainerInputJahr = $('<div class="mdl-grid"></div>');
			win.append(gridContainerInputJahr);

			/* Grid-Container für Input-Felder Von-Bis */
			var gridContainerInputVonBis = $('<div class="mdl-grid"></div>');
			win.append(gridContainerInputVonBis);

			/* die Radio-Buttons */
			var alleBtn = $('<label class="mdl-radio mdl-js-radio"> <input type="radio" class="mdl-radio__button" name="options" value="1" checked>  <span class="mdl-radio__label">' + window.i18n_alle + '</span></label>');
			headerContainer.append($('<div class="mdl-cell mdl-cell--2-col"></div>').append(alleBtn));

			var keineBtn = $('<label class="mdl-radio mdl-js-radio"> <input type="radio" class="mdl-radio__button" name="options" value="1" checked>  <span class="mdl-radio__label">' + window.i18n_leere + '</span></label>');
			headerContainer.append($('<div class="mdl-cell mdl-cell--2-col"></div>').append(keineBtn));
			
			var tagBtn = $('<label class="mdl-radio mdl-js-radio"> <input type="radio" class="mdl-radio__button" name="options" value="2" checked>  <span class="mdl-radio__label">' + window.i18n_tag + '</span></label>');
			gridContainer.append($('<div class="mdl-cell mdl-cell--2-col"></div>').append(tagBtn)); 
			
			var weekBtn = $('<label class="mdl-radio mdl-js-radio"> <input type="radio" class="mdl-radio__button" name="options" value="2" checked>  <span class="mdl-radio__label">' + window.i18n_woche + '</span></label>');
			gridContainer.append($('<div class="mdl-cell mdl-cell--2-col"></div>').append(weekBtn)); 
			
			var vonbisBtn = $('<label class="mdl-radio mdl-js-radio"> <input type="radio" class="mdl-radio__button" name="options" value="3">  <span class="mdl-radio__label">' + window.i18n_zeitraum + '</span></label>');
			gridContainer.append($('<div class="mdl-cell mdl-cell--2-col"></div>').append(vonbisBtn));
			
			var monthBtn = $('<label class="mdl-radio mdl-js-radio"> <input type="radio" class="mdl-radio__button" name="options" value="4">  <span class="mdl-radio__label">' + window.i18n_monat + '</span></label>');
			gridContainer.append($('<div class="mdl-cell mdl-cell--2-col"></div>').append(monthBtn));
			
			var quartalBtn = $('<label class="mdl-radio mdl-js-radio"> <input type="radio" class="mdl-radio__button" name="options" value="5">  <span class="mdl-radio__label">' + window.i18n_quartal + '</span></label>');
			gridContainer.append($('<div class="mdl-cell mdl-cell--2-col"></div>').append(quartalBtn));

			var jahrBtn = $('<label class="mdl-radio mdl-js-radio"> <input type="radio" class="mdl-radio__button" name="options" value="6">  <span class="mdl-radio__label">' + window.i18n_jahr + '</span></label>');
			gridContainer.append($('<div class="mdl-cell mdl-cell--2-col"></div>').append(jahrBtn));

			/* das Input-Feld des DateTimePicker für einen Tag */
			var tagPicker = $('<input type=\'text\' class="mdl-textfield__input">')
			.datetimepicker({locale: locale, format: dateformat_moment})
			.on('dp.change', function (e) {
				if (!e.date) {
					if (allowEmpty) {
						query['range_min_' + dataview + '_' + col] = '';
						query['range_max_' + dataview + '_' + col] = '';
					} else {
						delete query['range_min_' + dataview + '_' + col];
						delete query['range_max_' + dataview + '_' + col];
					}
				} else {
					e.date.hours(0);
					e.date.minutes(0);
					e.date.seconds(0);
					e.date.milliseconds(0);
					query['range_min_' + dataview + '_' + col] = e.date.unix();
					query['range_max_' + dataview + '_' + col] = e.date.unix() + 24*60*60-1;
				}
				delete query['page_' + dataview];
				changed = true;
				reload();
			});
			
			/* Tages-Datum in gridContainerInputTag hängen */
			var tag = $('<div class="mdl-textfield mdl-js-textfield"></div>');
			tag.append(tagPicker);
			var tagInput = tag.find('input');
			
			gridContainerInputTag.append('<div class="mdl-cell mdl-cell--2-col">' + window.i18n_tag + '</div>');
			gridContainerInputTag.append($('<div class="mdl-cell mdl-cell--4-col"></div>').append(tag));
			
			/* die Input-Felder für Woche */
			var week = $('<div class="mdl-textfield mdl-js-textfield" id="quartal"> <input class="mdl-textfield__input" type="number" pattern="[0-9]{1-2}"><span class="mdl-textfield__error">Keine gültige KW!</span> </div>');
			var weekInput = week.find('input');
						
			gridContainerInputWeek.append('<div class="mdl-cell mdl-cell--2-col">Woche</div>');
			
			var minusBtnWeek = $('<button class="mdl-button mdl-js-button mdl-button--icon"><i class="material-icons">remove_circle_outline</i></button>');
			gridContainerInputWeek.append($('<div class="mdl-cell mdl-cell--1-col"></div>').append(minusBtnWeek)); 
			
			gridContainerInputWeek.append($('<div class="mdl-cell mdl-cell--3-col"></div>').append(week)); 

			var plusBtnWeek = $('<button class="mdl-button mdl-js-button mdl-button--icon"><i class="material-icons">add_circle_outline</i></button>');
			gridContainerInputWeek.append($('<div class="mdl-cell mdl-cell--1-col"></div>').append(plusBtnWeek)); 
	
			var weekJahr = $('<div class="mdl-textfield mdl-js-textfield"> <input class="mdl-textfield__input" type="number" pattern="[0-9]{4}"><span class="mdl-textfield__error">Eingabe ist keine Zahl!</span> </div>');
			var weekJahrInput = weekJahr.find('input');
				
			gridContainerInputWeek.append('<div class="mdl-cell mdl-cell--2-col">Jahr</div>');
			gridContainerInputWeek.append($('<div class="mdl-cell mdl-cell--3-col"></div>').append(weekJahr)); 
						
			/* die Input-Felder der DateTimePicker */
			var vonPicker = $('<input type=\'text\' class="mdl-textfield__input">')
			.datetimepicker({locale: locale, format: dateformat_moment})
			.on('dp.change', function (e) {
				if (!e.date) {
					if (allowEmpty) {
						query['range_min_' + dataview + '_' + col] = '';
					} else {
						delete query['range_min_' + dataview + '_' + col];
					}
				} else {
					e.date.hours(0);
					e.date.minutes(0);
					e.date.seconds(0);
					e.date.milliseconds(0);
					query['range_min_' + dataview + '_' + col] = e.date.unix();
					if (query['range_max_' + dataview + '_' + col] < query['range_min_' + dataview + '_' + col]) {
						var temp = query['range_max_' + dataview + '_' + col];
						query['range_max_' + dataview + '_' + col] = query['range_min_' + dataview + '_' + col];
						query['range_min_' + dataview + '_' + col] = temp;
						vonPicker.data('DateTimePicker').date(new Date(1000*query['range_min_' + dataview + '_' + col]));
						bisPicker.data('DateTimePicker').date(new Date(1000*query['range_max_' + dataview + '_' + col]));
					}
				}
				delete query['page_' + dataview];
				changed = true;
				reload();
			});
			
			
			/* von-Datum in gridContainerInput hängen */
			var von = $('<div class="mdl-textfield mdl-js-textfield"></div>');
			von.append(vonPicker);
			var vonInput = von.find('input');
			
			gridContainerInputVonBis.append('<div class="mdl-cell mdl-cell--2-col">' + window.i18n_von + '</div>');
			gridContainerInputVonBis.append($('<div class="mdl-cell mdl-cell--4-col"></div>').append(von));
						
			var bisPicker = $('<input type=\'text\' class="mdl-textfield__input">')
			.datetimepicker({locale: locale, format: dateformat_moment})
			.on('dp.change', function (e) {
				if (!e.date) {
					if (allowEmpty) {
						query['range_max_' + dataview + '_' + col] = '';
					} else {
						delete query['range_max_' + dataview + '_' + col];
					}
				} else {
					e.date.hours(0);
					e.date.minutes(0);
					e.date.seconds(0);
					e.date.milliseconds(0);
					query['range_max_' + dataview + '_' + col] = e.date.unix() + 24*60*60-1;
					if (query['range_max_' + dataview + '_' + col] < query['range_min_' + dataview + '_' + col]) {
						var temp = query['range_max_' + dataview + '_' + col];
						query['range_max_' + dataview + '_' + col] = query['range_min_' + dataview + '_' + col];
						query['range_min_' + dataview + '_' + col] = temp;
						vonPicker.data('DateTimePicker').date(new Date(1000*query['range_min_' + dataview + '_' + col]));
						bisPicker.data('DateTimePicker').date(new Date(1000*query['range_max_' + dataview + '_' + col]));
					}
				}
				delete query['page_' + dataview];
				changed = true;
				reload();
			});
			
			/* bis-Datum in gridContainerInput hängen */
			var bis = $('<div class="mdl-textfield mdl-js-textfield"></div>');
			bis.append(bisPicker);
			var bisInput = bis.find('input');
			
			gridContainerInputVonBis.append('<div class="mdl-cell mdl-cell--2-col">' + window.i18n_bis  + '</div>');
			gridContainerInputVonBis.append($('<div class="mdl-cell mdl-cell--4-col"></div>').append(bis));
			
			/* die Input-Felder für Monat */
			var monat = $('<div class="mdl-textfield mdl-js-textfield" id="monat"> <input class="mdl-textfield__input" type="number" pattern="[0-9]+"><span class="mdl-textfield__error">Kein gültiger Monat (nur 1..12 erlaubt)!</span></div>');
			var monatInput = monat.find('input');
			// monatInput.val() <- lesen
			// monatInput.val('3') <- setzen
						
			gridContainerInputMonat.append('<div class="mdl-cell mdl-cell--2-col">' + window.i18n_monat + '</div>');
		
			var minusBtnMonat = $('<button class="mdl-button mdl-js-button mdl-button--icon"><i class="material-icons">remove_circle_outline</i></button>');
			gridContainerInputMonat.append($('<div class="mdl-cell mdl-cell--1-col"></div>').append(minusBtnMonat)); 
		
			gridContainerInputMonat.append($('<div class="mdl-cell mdl-cell--3-col"></div>').append(monat)); 
			
			var plusBtnMonat = $('<button class="mdl-button mdl-js-button mdl-button--icon"><i class="material-icons">add_circle_outline</i></button>');
			gridContainerInputMonat.append($('<div class="mdl-cell mdl-cell--1-col"></div>').append(plusBtnMonat)); 
			
			var monatJahr = $('<div class="mdl-textfield mdl-js-textfield"> <input class="mdl-textfield__input" type="number" pattern="[0-9]+"><span class="mdl-textfield__error">Eingabe ist keine Zahl!</span> </div>');
			var monatJahrInput = monatJahr.find('input');
						
			gridContainerInputMonat.append('<div class="mdl-cell mdl-cell--2-col">' + window.i18n_jahr + '</div>');
					
			gridContainerInputMonat.append($('<div class="mdl-cell mdl-cell--3-col"></div>').append(monatJahr)); 
			
			/* die Input-Felder für Quartal */
			var quartal = $('<div class="mdl-textfield mdl-js-textfield" id="quartal"> <input class="mdl-textfield__input" type="number" pattern="[1-4]"><span class="mdl-textfield__error">Kein gültiges Quartal (nur 1..4 erlaubt)!</span> </div>');
			var quartalInput = quartal.find('input');
						
			gridContainerInputQuartal.append('<div class="mdl-cell mdl-cell--2-col">' + window.i18n_quartal + '</div>');
			
			var minusBtnQuartal = $('<button class="mdl-button mdl-js-button mdl-button--icon"><i class="material-icons">remove_circle_outline</i></button>');
			gridContainerInputQuartal.append($('<div class="mdl-cell mdl-cell--1-col"></div>').append(minusBtnQuartal)); 
			
			gridContainerInputQuartal.append($('<div class="mdl-cell mdl-cell--3-col"></div>').append(quartal)); 

			var plusBtnQuartal = $('<button class="mdl-button mdl-js-button mdl-button--icon"><i class="material-icons">add_circle_outline</i></button>');
			gridContainerInputQuartal.append($('<div class="mdl-cell mdl-cell--1-col"></div>').append(plusBtnQuartal)); 
	
			var quartalJahr = $('<div class="mdl-textfield mdl-js-textfield"> <input class="mdl-textfield__input" type="number" pattern="[0-9]+"><span class="mdl-textfield__error">Eingabe ist keine Zahl!</span> </div>');
			var quartalJahrInput = quartalJahr.find('input');
				
			gridContainerInputQuartal.append('<div class="mdl-cell mdl-cell--2-col">' + window.i18n_jahr + '</div>');
			gridContainerInputQuartal.append($('<div class="mdl-cell mdl-cell--3-col"></div>').append(quartalJahr)); 
			
			/* das Input-Feld für Jahr */
			var jahr = $('<div class="mdl-textfield mdl-js-textfield"> <input class="mdl-textfield__input" type="number" pattern="[0-9]+"><span class="mdl-textfield__error">Eingabe ist keine Zahl!</span> </div>');
			var jahrInput = jahr.find('input');
						
			gridContainerInputJahr.append('<div class="mdl-cell mdl-cell--2-col">' + window.i18n_jahr + '</div>');
			
			var minusBtnJahr = $('<button class="mdl-button mdl-js-button mdl-button--icon"><i class="material-icons">remove_circle_outline</i></button>');
			gridContainerInputJahr.append($('<div class="mdl-cell mdl-cell--1-col"></div>').append(minusBtnJahr)); 
			
			gridContainerInputJahr.append($('<div class="mdl-cell mdl-cell--3-col"></div>').append(jahr)); 
			
			var plusBtnJahr = $('<button class="mdl-button mdl-js-button mdl-button--icon"><i class="material-icons">add_circle_outline</i></button>');
			gridContainerInputJahr.append($('<div class="mdl-cell mdl-cell--1-col"></div>').append(plusBtnJahr)); 
	
			
			win.append('<br>')
			
			;  /* Ende win.append */
			
			upgradeDOM(win);
			
			/* Eventhandler der + - Buttons */
			minusBtnMonat.click(function() {
				monatInput.val(parseInt(monatInput.val()) - 1);
				monatInput.change();
			});
			
			plusBtnMonat.click(function() {
				monatInput.val(parseInt(monatInput.val()) + 1);
				monatInput.change();
			});
			
			minusBtnWeek.click(function() {
				weekInput.val(parseInt(weekInput.val()) - 1);
				weekInput.change();
			});
			
			plusBtnWeek.click(function() {
				weekInput.val(parseInt(weekInput.val()) + 1);
				weekInput.change();
			});			
			
			minusBtnQuartal.click(function() {
				quartalInput.val(parseInt(quartalInput.val()) - 1);
				quartalInput.change();
			});
			
			plusBtnQuartal.click(function() {
				quartalInput.val(parseInt(quartalInput.val()) + 1);
				quartalInput.change();
			});			
			
			minusBtnJahr.click(function() {
				jahrInput.val(parseInt(jahrInput.val()) - 1);
				jahrInput.change();
			});
			
			plusBtnJahr.click(function() {
				jahrInput.val(parseInt(jahrInput.val()) + 1);
				jahrInput.change();
			});			
			
		/* Eventhandler der Buttons */
			alleBtn.click(function () {
				if (allowEmpty) {
					query['range_min_' + dataview + '_' + col] = '';
					query['range_max_' + dataview + '_' + col] = '';
				} else {
					delete query['range_min_' + dataview + '_' + col];
					delete query['range_max_' + dataview + '_' + col];
				}
				delete query['filter_' + dataview + '_' + col];
				delete query['page_' + dataview];
				
				gridContainerInputTag.hide();
				gridContainerInputVonBis.hide();
				gridContainerInputMonat.hide();
				gridContainerInputQuartal.hide();
				gridContainerInputJahr.hide();
				gridContainerInputWeek.hide();
				
				changed = true;
				reload();
			});

			keineBtn.click(function () {
				delete query['range_min_' + dataview + '_' + col];
				delete query['range_max_' + dataview + '_' + col];
				query['filter_' + dataview + '_' + col] = '_null';

				gridContainerInputTag.hide();
				gridContainerInputVonBis.hide();
				gridContainerInputMonat.hide();
				gridContainerInputQuartal.hide();
				gridContainerInputJahr.hide();
				gridContainerInputWeek.hide();

				changed = true;
				reload();
			});
			
			tagBtn.click(function () {
				if (query['range_min_' + dataview + '_' + col]) {
					tagPicker.data('DateTimePicker').date(new Date(1000*query['range_min_' + dataview + '_' + col]));
					query['range_max_' + dataview + '_' + col] = query['range_min_' + dataview + '_' + col] + 24*60*60-1;
				} else if (query['range_max_' + dataview + '_' + col]) {
					tagPicker.data('DateTimePicker').date(new Date(1000*query['range_max_' + dataview + '_' + col] - 24*60*60 + 1));
					query['range_min_' + dataview + '_' + col] = query['range_max_' + dataview + '_' + col] - 24*60*60+1;
				} else {
					tagPicker.data('DateTimePicker').date(new Date());
				}
				delete query['filter_' + dataview + '_' + col];
				changed = true;
				reload();
				
				gridContainerInputTag.show();
				gridContainerInputVonBis.hide();
				gridContainerInputMonat.hide();
				gridContainerInputQuartal.hide();
				gridContainerInputJahr.hide();
				gridContainerInputWeek.hide();
			});

			weekBtn.click(function () {
				if (query['range_min_' + dataview + '_' + col]) {
					var d = new Date(1000*query['range_min_' + dataview + '_' + col]);
				} else if (query['range_max_' + dataview + '_' + col]) {
					var d = new Date(1000*query['range_max_' + dataview + '_' + col]);
				} else {
					var	d = new Date();
				}
				delete query['filter_' + dataview + '_' + col];
				
				d.setHours(0, 0, 0);
				d.setDate(d.getDate() + 4 - (d.getDay() || 7));
				var w = Math.ceil((((d - new Date(d.getFullYear(), 0, 1)) / 8.64e7) + 1) / 7);
				weekInput.val(w);
				weekJahrInput.val(d.getFullYear());
		
				weekInput.change();
			
				gridContainerInputTag.hide();
				gridContainerInputVonBis.hide();
				gridContainerInputMonat.hide();
				gridContainerInputQuartal.hide();
				gridContainerInputJahr.hide();
				gridContainerInputWeek.show();
			});
			
			vonbisBtn.click(function () {
				if (query['range_min_' + dataview + '_' + col]) {
					vonPicker.data('DateTimePicker').date(new Date(1000*query['range_min_' + dataview + '_' + col]));
				} else {
					vonPicker.data('DateTimePicker').date(null);
				}
				
				if (query['range_max_' + dataview + '_' + col]) {
					bisPicker.data('DateTimePicker').date(new Date(1000*(query['range_max_' + dataview + '_' + col] - 24*60*60+1)));
				} else {
					bisPicker.data('DateTimePicker').date(null);				
				}
				delete query['filter_' + dataview + '_' + col];
				gridContainerInputTag.hide();
				gridContainerInputVonBis.show();
				gridContainerInputMonat.hide();
				gridContainerInputQuartal.hide();
				gridContainerInputJahr.hide();
				gridContainerInputWeek.hide();
			});
			
			monthBtn.click(function () {
				
				if (query['range_min_' + dataview + '_' + col]) {
					var d = new Date(1000*query['range_min_' + dataview + '_' + col]);
				} else if (query['range_max_' + dataview + '_' + col]) {
					var d = new Date(1000*query['range_max_' + dataview + '_' + col]);
				} else {
					var d = new Date();
				}
				delete query['filter_' + dataview + '_' + col];
				
				/* Monat zählt ab 0 */
				monatInput.val(d.getMonth() + 1);
				monatJahrInput.val(d.getFullYear());
				
				monatInput.change();
				
				gridContainerInputTag.hide();
				gridContainerInputVonBis.hide();
				gridContainerInputMonat.show();
				gridContainerInputQuartal.hide();
				gridContainerInputJahr.hide();
				gridContainerInputWeek.hide();
			});

			quartalBtn.click(function () {
				
				if (query['range_min_' + dataview + '_' + col]) {
					var d = new Date(1000*query['range_min_' + dataview + '_' + col]);
				} else if (query['range_max_' + dataview + '_' + col]) {
					var d = new Date(1000*query['range_max_' + dataview + '_' + col]);
				} else {
					var	d = new Date();
				}
				delete query['filter_' + dataview + '_' + col];
				
				var quarter = Math.floor((d.getMonth() / 3 + 1));	
				quartalInput.val(quarter);
				quartalJahrInput.val(d.getFullYear());
		
				quartalInput.change();
			
				gridContainerInputTag.hide();
				gridContainerInputVonBis.hide();
				gridContainerInputMonat.hide();
				gridContainerInputQuartal.show();
				gridContainerInputJahr.hide();
				gridContainerInputWeek.hide();
			});
			
			function monatChange() {
				if (monatInput.val() > 12) {
					monatInput.val('1');
					monatJahrInput.val(parseInt(monatJahrInput.val()) + 1);
				}
				
				if (monatInput.val() < 1) {
					monatInput.val(12);
					monatJahrInput.val(parseInt(monatJahrInput.val()) - 1);
				}

				updateMonat();
			}

			function quartalChange() {
				if (quartalInput.val() > 4) {
					quartalInput.val('1');
					quartalJahrInput.val(parseInt(quartalJahrInput.val()) + 1);
				}
				
				if (quartalInput.val() < 1) {
					quartalInput.val(4);
					quartalJahrInput.val(parseInt(quartalJahrInput.val()) - 1);
				}
			
				updateQuartal();
			}

			function jahrChange() {
				updateJahr();
			}
			
			jahrBtn.click(function () {10
				
				if (query['range_min_' + dataview + '_' + col]) {
					var d = new Date(1000*query['range_min_' + dataview + '_' + col]);
				} else if (query['range_max_' + dataview + '_' + col]) {
					var d = new Date(1000*query['range_max_' + dataview + '_' + col]);
				} else {
					var d = new Date();
				}
				delete query['filter_' + dataview + '_' + col];
			 
				jahrInput.val(d.getFullYear());
				
				updateJahr();
				
				gridContainerInputTag.hide();
				gridContainerInputVonBis.hide();
				gridContainerInputMonat.hide();
				gridContainerInputQuartal.hide();
				gridContainerInputJahr.show();
				gridContainerInputWeek.hide();
			});
			
			/* Eventhandler der Eingabefelder */
			tag.change(function () {
				updateTag();
			});
			
			monatInput.change(monatChange);
			
			monatJahr.change(function () {
				updateMonat();
			});
			
			weekInput.change(updateWeek);
			weekJahr.change(updateWeek);
			
			quartalInput.change(quartalChange);
			
			quartalJahr.change(function () {
				updateQuartal();
			});
			
			jahrInput.change(jahrChange);
			
			
            /* Übergabe des Feldes Bei entsprechendem Zeitraum (Tag, Monat, Quartal, Jahr)*/
			if (query['filter_' + dataview + '_' + col] == '_null') {
				keineBtn.click();
			}
			else if ( //Prüfung selber Tag
				(new Date(1000*query['range_min_' + dataview + '_' + col])).getFullYear() === (new Date(1000*query['range_max_' + dataview + '_' + col])).getFullYear()
				&& (new Date(1000*query['range_min_' + dataview + '_' + col])).getMonth() === (new Date(1000*query['range_max_' + dataview + '_' + col])).getMonth()
				&& (new Date(1000*query['range_min_' + dataview + '_' + col])).getDate() === (new Date(1000*query['range_max_' + dataview + '_' + col])).getDate()
			) {
				tagBtn.click();
			}
			else if ( // Prüfung Zeitraum Monat
				(new Date(1000*query['range_min_' + dataview + '_' + col])).getFullYear() === (new Date(1000*query['range_max_' + dataview + '_' + col])).getFullYear()
				&& (new Date(1000*query['range_min_' + dataview + '_' + col])).getMonth() === (new Date(1000*query['range_max_' + dataview + '_' + col])).getMonth()
				&& (new Date(1000*query['range_max_' + dataview + '_' + col])).getDate() === new Date((new Date(1000*query['range_max_' + dataview + '_' + col])).getFullYear(), (new Date(1000*query['range_max_' + dataview + '_' + col])).getMonth() + 1, 0).getDate()
				&& (new Date(1000*query['range_min_' + dataview + '_' + col])).getDate() === 01
			) {
				monthBtn.click();
			}
			else if ( // Prüfung Zeitraum Quartal
				issameQuarter((new Date(1000*query['range_min_' + dataview + '_' + col])), (new Date(1000*query['range_max_' + dataview + '_' + col])))
			) {
				quartalBtn.click();
			}
			else if ( // Prüfung Zeitraum Jahr
				(new Date(1000*query['range_min_' + dataview + '_' + col])).getFullYear() === (new Date(1000*query['range_max_' + dataview + '_' + col])).getFullYear()
				&& (new Date(1000*query['range_min_' + dataview + '_' + col])).getMonth() === 00
				&& (new Date(1000*query['range_min_' + dataview + '_' + col])).getDate() == 01
				&& (new Date(1000*query['range_max_' + dataview + '_' + col])).getMonth() == 11
				&& (new Date(1000*query['range_max_' + dataview + '_' + col])).getDate() == 31
			) {
				jahrBtn.click();
			}
			
			else if (query['range_min_' + dataview + '_' + col] || query['range_max_' + dataview + '_' + col]) {
			    vonbisBtn.click();
			}
			else
			{
				alleBtn.click();
			}
	        
			function updateJahr() {
				query['range_min_' + dataview + '_' + col] = Math.round(new Date(jahrInput.val(), 0, 1, 0, 0, 0).getTime() / 1000);
				query['range_max_' + dataview + '_' + col] = Math.round(new Date(jahrInput.val(), 11, 31, 23, 59, 59) / 1000);
				changed = true;
				reload();
			}

			function updateWeek() {
				var w = parseInt(weekInput.val());
				var d = new Date();
				d.setYear(weekJahrInput.val());
				d.setMonth(0);
				d.setDate(1);
				d.setHours(0, 0, 0);
				while (d.getDay() != 4) {
					d.setDate(d.getDate() + 1); // find first thursday in year
				}
				d.setDate(d.getDate() - 10 + 7 * w); // switch to monday of 01 / yyyy

				var d2 = new Date();
				d2.setTime(d.getTime());
				d2.setDate(d2.getDate() + 4 - (d2.getDay() || 7));
				var w2 = Math.ceil((((d2 - new Date(d2.getFullYear(), 0, 1)) / 8.64e7) + 1) / 7);
				if (w != w2) {
					// korrigieren bei Jahreswechsel
					weekInput.val(w2);
					weekJahrInput.val(d.getFullYear());
				}
				
				query['range_min_' + dataview + '_' + col] = Math.round(d.getTime() / 1000);
				query['range_max_' + dataview + '_' + col] = Math.round(d.getTime() / 1000 + 7*24*60*60 - 1);
				changed = true;
				reload();
			}

			function updateQuartal() {
				var kq = parseInt(quartalInput.val());
				
				if (! Number.isInteger(kq)) {
					kq = aktQuartal;
					quartalInput.val(kq);
					/* entfernt roten Unterstrich für Fehlermeldung */
					$('#quartal').removeClass('is-invalid');
					alert('Kein gültiges Quartal eingegeben! Stelle aktuelles Quartal ein.');
				}
				
				query['range_min_' + dataview + '_' + col] = Math.round(new Date(quartalJahrInput.val(), 3*kq - 3, 1, 0, 0, 0).getTime() / 1000);
				query['range_max_' + dataview + '_' + col] = Math.round(new Date(quartalJahrInput.val(), 3*kq - 1, kq == 2 || kq == 3 ? 30 : 31, 23, 59, 59) / 1000);
				changed = true;
				reload();
			}

			function issameQuarter(date1, date2) {
				var month1 = date1.getMonth();
				var month2 = date2.getMonth();
				var quarter1 = Math.floor(month1 / 3);
				var quarter2 = Math.floor(month2 / 3);
				if (quarter1 === quarter2) {
					// Check if the first date is the first day of the quarter
					if (date1.getDate() === 1 && date1.getMonth() % 3 === 0) {
						// Check if the second date is the last day of the quarter
						var lastDayOfQuarter = new Date(date1.getFullYear(), quarter1 * 3 + 3, 0);
						if (date2.getDate() === lastDayOfQuarter.getDate()
							&& date2.getMonth() === lastDayOfQuarter.getMonth()
							&& date2.getFullYear() === lastDayOfQuarter.getFullYear()
						) {
							return true;
						}
					}
				}
				return false;
			}
			
			function updateMonat() {
				var mo;
				var moTage;
				
				mo = parseInt(monatInput.val());
				
				if (! Number.isInteger(mo)) {
					mo = aktMonat;
					monatInput.val(mo);
					/* entfernt roten Unterstrich für Fehlermeldung */
					$('#monat').removeClass('is-invalid');
					alert('Keinen gültigen Monat eingegeben! Stelle aktuellen Monat ein.');
				}
					
				switch (mo) {
					case 1:
					case 3:
					case 5:
					case 7:1
					case 8:
					case 10:
					case 12:
						moTage = 31;
						break;
					case 2:
						if ((monatJahrInput.val() % 4) == 0) {
							moTage = 29;
						}
						else
						{
							moTage = 28;
						}
						break;
					case 4:
					case 6:
					case 9:
					case 11:
						moTage = 30;
						break;
					default:
						moTage = 28;
				}

				query['range_min_' + dataview + '_' + col] = Math.round(new Date(monatJahrInput.val(), mo - 1, 1, 0, 0, 0).getTime() / 1000);
				query['range_max_' + dataview + '_' + col] = Math.round(new Date(monatJahrInput.val(), mo - 1, moTage, 23, 59, 59) / 1000);
				changed = true;
				reload();
			}
			
			function updateTag() {
				query['range_min_' + dataview + '_' + col] = new Date(tagInput.val());
				query['range_max_' + dataview + '_' + col] = new Date(tagInput.val());
				changed = true;
				reload();
			}
			
		}
	