/* **********************************************************************************
	Definition der im Modul verwendeten Variablen, Eventhandler und Funktionen.
	Auslesen der Eingabe Datumswerte im manuellen Modus. Feststellen von Zeitzone
	und DST sowie Berechnung und Ausgabe des:
	- Julianischen Datums und dessen gregorianische Rückrechnung
	- Modified Julianischen Datums und dessen Rückrechnung
	- UT = Universal Time Ausgabe
	- UTC = Universal Time Coordinated Ausgabe
	- Sonnenauf/Untergangszeiten
	- Dämmerungszeiten
	- Azimuth des Sonnenauf/-Untergangs
	- JD von Sonnenauf und -Untergang
	- Zeit des Sonnenhöchststandes
	- Azimuth und Höhe des Sonnenhöchststandes
	- Entfernung der Sonne
	- Durchmesser der Sonne amn Himmel
	- Aktueller Azimuth/Höhe nach laufender Zeit
	- RA / Dek nach laufender Zeit
	
	-------------------------------------------------------------------------------------------------
	Definition of the variables, event handlers and functions used in the module.
	Read out the input date values in manual mode. Detection of time zone
	and DST as well as calculation and output of:
	- Julian date and its Gregorian recalculation
	- Modified Julian date and its recalculation
	- UT = Universal Time Edition
	- UTC = Universal Time Coordinated Edition
	- Sunrise/sunset times
	- Times of twilight
	- Azimuth of sunrise/set
	- JD of sunrise and sunset
	- Time of the sun’s highest position
	- Azimuth and height of the sun’s highest position
	- Distance from the sun
	- Diameter of the Sun amn sky
	- Current azimuth/height after current time
	- RA / Deck according to current time
 ********************************************************************************** */
 // Neuen Nachrichtenkanal zum Hauptprogramm erstellen.
// Create a new message channel to the main program.
 var channel = new BroadcastChannel ("com");
 
// ********************** Variablen Deklarationen ******************************* 
// **********************   Variable declarations    ******************************* 
// Datum und Uhrzeit - Date and time
var d = null;
var actualDate = null;
var calcDate = null;
var year = 0;
var month = 0;
var day = 0;
var hour = 0;
var minute = 0;
var second = 0;
var millisecond = 0;
var JD0 = 0;
var JD = 0;
var MJD = 0;
var selectedItemDST = null;
var selectedItemTwilight = null;
var selectedItemTimezone = null;

//  Sonnenaufgang/-Untergang, Zwielicht usw.
// Sunrise/sunset, twilight etc.
var resultsSun = [];
var LCT = [];									// Lokale Zeit des Sonnenaufgangs und Status
														// Local time of sunrise and status
var LCTS = [];									// Lokale Zeit des Sonnenuntergangs und Status
														// Local time of sunset and status
var statLCT = false;							// Status des Sonnenaufgangs in Konvertierung von GST zu UT und Sichtbarkeit
														// Status of sunrise in conversion from GST to UT and visibility
var statLCTS = false;						// Status des Sonnenaunterfgangs in Konvertierung von GST zu UT und Sichtbarkeit
														// Status of sunset in conversion from GST to UT and visibility
var arrTwilightRise = [];					// Dämmerung beim Sonnenaufgang und Status
														// Twilight at sunrise and status
var arrTwilightSet = [];						// Dämmerung beim Sonnenuntergang und Status
														// Twilight at sunset and status
var statTwilightRise = false;				// Status der Dämmerung Morgens in Konvertierung von GST zu UT und Sichtbarkeit
														// Status of morning twilight in conversion from GST to UT and visibility
var statTwilightSet = false;				// Status der Dämmerung Abends in Konvertierung von GST zu UT und Sichtbarkeit
														// Status of twilight evening in conversion from GST to UT and visibility
var sunriseAzH = [];							// Alle Sonnenaufgangsdaten, wie Azimuth, Höhe über Horizont Grad/Dez. und Status
														// All sunrise data, such as azimuth, altitude above the horizon Degree/Dec. and status
var statSunriseAzH = false;				
var sunsetAzH = [];							// Alle Sonnenuntergangsdaten, wie Azimuth, Höhe über Horizont Grad/Dez. und Status
														// All sunset data, such as azimuth, altitude above the horizon Degree/Dec. and status.
var statSunsetAzH = false;
var sunDiameter = [];						// Abstand Sonne-Erde und Winkelgröße am Himmel
														// Distance Sun-Earth and angular magnitude in the sky
var SunAngularSize = "";					// Winkelgröße der Sonne am Himmel in Grad, Minute und Sekunde
														// Angular size of the Sun in the sky in degrees, minutes and seconds
var jdSunRise = 0.0;						// Julianisches Datum von Sonnenaufgang und -Untergang
var jdSunSet = 0.0;							// Julian date of sunrise and sunset
var jdSunRiseSetDiff = 0.0;				// ... danach die Differenz zwischen dem JD von Set und Rise ...
														// . . . then the difference between the JD of Set and Rise . . .
var jdSunRiseSetHalf = 0.0 ;			// ... die Differnez / 2 ergibt das JD des Sonnenstandes am höchsten Punkt, genau
														// in der Mitte der Sichtbarkeit ...
														// . . . the Differnez / 2 gives the JD of the sun's position at the highest point, exactly 
														// in the middle of the visibility . . .
var jdSunRiseSetHalfDate = 0.0 ;	// ... und das JD des Sonnenaufgangs + die Hälfte ergibt das JD der Mitte der Sichtbarkeit
														// am höchsten Punkt der Sonne am Himmel ...
														// . . . and the JD of sunrise + half gives the JD of the center of visibility 
														// at the highest point of the sun in the sky .
var arrjdSunRiseSetHalfDate = [];	// ... dann aus dem JD des höchsten Punkts am Himmel wieder ein Datum berechnen ...
														// . . . then calculate a date again from the JD of the highest point in the sky . . .
var azSunHigh = 0.0;						// Der Azimuth ds höchsten Sonnenstandes ...
														// The azimuth of the sun’s highest elevation ...
var highSunPos = 0.0;						// Höchster Sonnenstand in Grad am Himmel
													
// Das Datum vom 1. Januar des aktuellen Jahres
// The date of January 1 of the current year
var jan = null;
// Das Datum vom 1. Juli des aktuellen Jahres
// The date of July 1 of the current year
var jul = null;
// Zeitzonenwert = Timezone + DST
// Standard ist Winterzeit
// Timezone value = Timezone + DST
// Default is winter time
var TIMEZONE = 0;
var timezone = 0;
var timezoneChanged = false;
var DST = 0;
var dst = 0;
dstChanged = false;
// Differenz zwischen Juli und Januar. Wenn DST dann ist die Differnz 1,
// ansonsten 0
// Difference between July and January. If DST then the difference is 1,
// otherwise 0
var diff = 0;

/* **********************************************************************************
	Objekte für die Eingabe Datums- und Zeitfelder. Dienen der Bedienung
	und Ausgabe der Ergebnisse.
	Objects for entering date and time fields. Serving the operator
	and output of the results.
 ********************************************************************************** */

var objDate = document.getElementById("date");											// Objekt des Datum Picker
																														// Object of the date picker
var objTime = document.getElementById("time");											// Objekt des Zeit Picker
																														// Object of the time picker
var objSec = document.getElementById("second");										// Objekt des Textfelds Sekunde
																														// Object of text field second
var objMilliSec = document.getElementById("msecond");								// Objekt des Textfelds Millisekunde
																														// Object of text field milli second
var output = document.getElementById("kontrolldatum");								// Objekt des Ausgabe Textfeldes "Kontrolldatum"
																														// Object of the output text field “Control Date”
var outputLT = document.getElementById("LT");											// Objekt des Ausgabe Textfeldes "UTC"
																														// Object of the output text field “UTC”
var outputUT = document.getElementById("UT");											// Objekt des Ausgabe Textfeldes "UT"
																														// Object of the output text field “UT”
var outputJD1 = document.getElementById("JD1");										// Objekt des Ausgabe Textfeldes "JD"
																														// Object of the output text field “JD”
var outputMJD = document.getElementById("MJD");										// Objekt des Ausgabe Textfeldes "MJD"
																														// Object of the output text field “MJD”
var outputDateMJD = document.getElementById("DateMJD");						// Objekt des Ausgabe Textfeldes MJD "Datum"
																														// Object of the output text field MJD "Datum"
var outputLTJD = document.getElementById("LTJD");									// Objekt der Ausgabe des Textfeldes JD "UTC"
																														// Object of the output of the text field JD “UTC”
var outputJDLT = document.getElementById("JDLT");									// Objekt der Ausgabe des Textfeldes Datum "UTC"
																														// Object of the output of the text field Datum "UTC"
var outputMJDUTC = document.getElementById("MJDUTC");						// Objekt der Ausgabe des Textfeldes MJD "UTC"
																														// Object of the output of the text field MJD "UTC"
var outputDATEMJD = document.getElementById("DATEMJD");					// Objekt der Ausgabe des Textfeldes Datum "UTC"
																														// Object of the output of the text field Datum "UTC"
var outputDate1 = document.getElementById("DateJD1");								// Objekt des Ausgabe Textfeldes JD "Datum"
																														// Object of the output text field JD "Datum"
var objTimezone = document.getElementById("Zeitzone");							// Objekt der Select Box Zeitzone
																														// Object of the Select Box time zone
var objDST = document.getElementById("DST");											// Objekt der Select Box Sommer/Winterzeit
																														// Object of the Select Box Summer/Winter Time
var objCalc = document.getElementById("calc");											// Objekt des Button "Berechnen"
																														// Object of the button “Calculate”
var objCalcAutomatic = document.getElementById("calcAutomatic");			// Objekt des Radio Knopfes "Automatisch"
																														// Object of the radio button “Automatic”
var divAutomatic = document.getElementById("automatic");							// Objekt des Radio Knopfes "Automatisch"
																														// Object of the radio button “Automatic”
var objCalcManual = document.getElementById("calcManual");						// Objekt des Radio Knopfes "Manuell"
																														// Object of the radio button “Manuell”
var objCalcStop = document.getElementById("calcStop");								// Objekt des Buttons "Stop"
																														// Object of teh button "Stop"
var objLongitude = document.getElementById("longitude");							// Objekt des Textausgabefeldes "Länge"
																														// Object of the textfield "Länge"
var objLatitude = document.getElementById("latitude");									// Objekt des Textausgabefeldes "Länge"
																														// Object of the textfield "Länge"
var objTwilightkind = document.getElementById("twilightkind");						// Objekt der Art der verwendeten Zwielicht Berechnung
																														// Beim Sonnenauf- und Untergang
var objTSunrise = document.getElementById("tsunrise");								// Daten des Sonnenaufgangs																			
var objTSunset = document.getElementById("tsunset");								// Data sunrise
var objStatSunrise = document.getElementById("statsunrise");						// Daten des Sonnenuntergangs																																						
var objStatSunset = document.getElementById("statsunset");	 					// Data sunset
var objTTwlSunrise = document.getElementById("ttwlsunrise");						// Daten der Dämmerung des Sonnenaufgangs																			
var objTTwlSunset = document.getElementById("ttwlsunset");						// Data twilight on sunrise
var objStatTtwlSunrise = document.getElementById("statttwlsunrise");			// Daten der Dämmerung des Sonnenuntergangs																																						
var objStatTtwlSunset = document.getElementById("statttwlsunset");			// Data twilight on sunset
var objAzSunrise = document.getElementById("azsunrise");							// Daten Azimuth des Sonnenaufgangs																			
var objStatAzSunrise = document.getElementById("statazsunrise");				// Data Azimuth of sunrise
var objAzSunset = document.getElementById("azsunset");							// Daten Azimuth des SonnenUntergangs																			
var objStatAzSunset = document.getElementById("statazsunset");				// Data Azimuth of sunset
var objJdSunrise = document.getElementById("jdsunrise");							// Julian. Datum Sonnenaufgang
																														// Julian. Date Sunrise
var objJdSunset = document.getElementById("jdsunset");								// Julian. Datum Sonnenuntergang
																														// Julian. Date Sunset
var objTimeHighnoon = document.getElementById("timehighnoon");				// Zeit des Höchststands der Sonne
																														// Time of the Sun’s Highest Level
var objDistanceSunEarth = document.getElementById("distancesunearth");	// Zeit des Höchststands der Sonne
																														// Time of the Sun’s Highest Level
var objDiaSunDez = document.getElementById("diasundez");						// Durchmesser der Sonne in dezimalen Grad
																														// Diameter of the Sun in decimal degrees
var objDiaSunDeg = document.getElementById("diasundeg");						// Durchmesser der Sonne in Grad als °, ', ''
																														// Diameter of the Sun in degrees	as  °, ', ''
var objAzHighSunDez = document.getElementById("azhighsundez");			// Azimuth der Höchststands der Sonne in dezimalen Grad
																														// Azimuth of the Sun’s peak in decimal degrees
var objAzHighSunDeg = document.getElementById("azhighsundeg");			// Azimuth der Höchststands der Sonne in °, ', ''
																														// Azimuth of the Sun’s peak in °, ', ''
var objShowAnimation = document.getElementById("showanimation");			// Objekt der Checkbox "Animation"
																														// Object of the checkbox “Animation”
var objShowDataOutput = document.getElementById("showdataoutput");		// Objekt der Checkbox "Datenausgabe"
																														// Object of the checkbox “Datenausgabe”
var objB = document.getElementById("b");													// Objekt des HTML Bodies
																														// Object of the HTML body
/*
	Indizes der Mondobjekte für die Textausgabe in den Feldern für automatische 
	Berechnungen.
	Manuelle Berechnungen funktionieren über die Original Objekte.
	
	[0]	=	objDistMoon
	[1]	=	objDiaMoon
	[2]	=	objAzMoon
	[3]	=	objHMoon
	[4]	=	objMoonRiseTime
	[5]	=	objStateMoonRise
	[6]	=	objMoonSetTime
	[7]	=	objStateMoonSet
	[8]	=	objMoonRiseAz
	[9]	=	objMoonRiseAzH
	[10]	=	objMoonSetAz
	[11]	=	objMoonSetAzH
	[12]	=	objMoonHighAz
	[13]	=	objMoonHighDate
	[14]	=	objMoonHighDeg
*/																													
let sendArray = [];																							// Array mit Ausgabefeld Objekten für moonParameters()
var objDistMoon = document.getElementById("distmoon");							// Objekt der geozentrischen Entfernung Erde-Mond in Km
sendArray.push(objDistMoon);																			// Object of geocentric distance Earth-Moon in Km
var objDiaMoon = document.getElementById("diamoon");								// Objekt des Durchmesser des Mondes am Himmel in Grad
sendArray.push(objDiaMoon);																			// Object of the diameter of the Moon in the sky in degrees
var objAzMoon = document.getElementById("azmoon");								// Objekt des geozentrischen Azimuths des Mondes im horzontalen Koordinatensystems
sendArray.push(objAzMoon);																			// Object of the geocentric azimuth of the Moon in the horizontal coordinate system of the Moon’s diameter in the sky in degrees
var objHMoon = document.getElementById("hmoon");									// Objekt der geozentrischen Höhe des Mondes über dem Horizont in Grad
sendArray.push(objHMoon);																			// Object of the geocentric altitude of the Moon above the horizon in degrees
var objMoonRiseTime = document.getElementById("tmoonrise");					// Objekt der Zeit des Mondaufgangs
sendArray.push(objMoonRiseTime);																// Object of the time moon rise
var objStateMoonRise = document.getElementById("statmoonrise");				// Objekt des Status des Mondaugang
sendArray.push(objStateMoonRise);																// Object of the state of the Moon rise
var objMoonSetTime = document.getElementById("tmoonset");						// Objekt der Zeit des Monduntergangs
sendArray.push(objMoonSetTime);																	// Object of the time of the Moon set
var objStateMoonSet = document.getElementById("statmoonset");				// Objekt des Status des Monduntergangs
sendArray.push(objStateMoonSet);																	// Object of the moon set
var objMoonRiseAz = document.getElementById("moonriseaz");					// Objekt des Azimuth Mondaufgang
sendArray.push(objMoonRiseAz);																	// Object of the azimuth moon rise
var objMoonRiseAzH = document.getElementById("moonriseazh");				// Objekt der Höhe des Mondaugang
sendArray.push(objMoonRiseAzH);																	// Object of the altitude of the Moon rise
var objMoonSetAz = document.getElementById("moonsetaz");						// Objekt des Azimuths des Monduntergangs
sendArray.push(objMoonSetAz);																		// Object of the azimuth of the moon set
var objMoonSetAzH = document.getElementById("moonsetazh");					// Objekt der Höhe des Monduntergangs
sendArray.push(objMoonSetAzH);																	// Object of the altitude of the moon set
var objMoonHighAz = document.getElementById("moonhighaz");					// Objekt der Höhe des Mondaugang
sendArray.push(objMoonHighAz);																	// Object of the altitude of the Moon rise
var objMoonHighDate = document.getElementById("moonhighdate");			// Objekt des Azimuths des Monduntergangs
sendArray.push(objMoonHighDate);																// Object of the azimuth of the moon set
var objMoonHighDeg = document.getElementById("moonhighdeg");				// Objekt der Höhe des Monduntergangs
sendArray.push(objMoonHighDeg);																	// Object of the altitude of the moon set

// Bei Programmstart DST und Timezone ermitteln sowie			
// die Datums Select Boxen vorbelegen.
//
// DST and timezone at program startup as well as
// specify the Date Select boxes.
//
setActualDateAndTime();
calcDSTandTimezone();

/* ***************************************************GeoPosition******************************************************* */
					
// Hole Dir die Positionsdaten des Rechners und übergebe dabei die
// Ergebnisfelder für Längengrad, Breitengrad und Genauigkeit.
// Get the position data of the computer and hand over the
// Result fields for longitude, latitude.
// In Utilities.js
startGeoPosition(objLongitude, objLatitude, 0);					

// Wartefunktion die verwendet werden kann.
// Die Funktion, in der sie verwendet wird muss vom Typ async sein:
//
// async function myFunction(){....}
//
// Waiting function that can be used.
// The function in which it is used must be of type async:
//
// async function myFunction () {....}
//
function Sleep(milliseconds) {
 return (new Promise(resolve => setTimeout(resolve, milliseconds)));
}



/* ******************************************************
	Die Funktion füllt eine Zeichenketten mit Zahl vorne
	mit n-Zeichen auf.
	Z.B. 1 -> 01
	izahl = 		Die Zahl ohne führende Nullen
	ianzStellen = 	Die gewünschte Anzahl von Stellen
	sFuelzeichen =	Das gewünschet führende Zeichen
	
	Rückgabewert =	Z.B. "01" oder "0001"
	____________________________________
	
	The function fills a string with number in front
	with n-signs.
	E.g. 1 -> 01
	izahl =   The number without leading zeros
	ianzPlaces =  The desired number of posts
	sFuelmark = The desired leading character
	
	Return value = e.g. “01” or “0001”
   *************************************************** */
function LPad( iZahl, iAnzStellen, sFuellzeichen ){
    var sZahl = iZahl + "";
    while( sZahl.length < iAnzStellen )
        sZahl = sFuellzeichen + sZahl;
    return sZahl;
	
}// End of LPAD()



// Die Funktion setzt das aktuelle Datum und Uhrzeit in den Pickern.
// The function sets the current date and time in the pickers.
function setActualDateAndTime(){
	var h = "";
	var m = "";
	var s = "";
	var ms = "";
	// Datumspicker "Datum" mit aktuellem Datum versehen.
	// Date picker “Date” with the current date.
	d = new Date();				// Aktuelles Datum holen
											// Get current date
	objDate.valueAsDate = d;	// und dem Datumspicker zuweisen
											// and assign to the date picker
	// Stunde und Minute mit "0" auffüllen und Time Picker
	// damit initialisieren.
	// Fill the hour and minute with “0” and Time Picker
	// initialize with this.
	if ((h = d.getHours()) < 10)
		h = LPad(h, 2, "0");
	if ((m = d.getMinutes()) < 10)
		m = LPad(m, 2, "0");
	objTime.value = h + ":" + m;
	// Sekunden mit "0" auffüllen und Sekunden Picker
	// damit initialisieren.
	// Fill seconds with “0” and seconds picker
	// initialize with this.
	s = d.getSeconds();
	objSec.value = s;
	// Millisekunden und Millisekunden Picker
	// damit initialisieren.
	// Millisecond and Millisecond Picker
	// initialize with this.
	ms = d.getMilliseconds();
	objMilliSec.value = ms;
	
}// End of setActualDateAndTime()



// Checkbox "Animation" für die Anzeige der Sonne-Mond Laufbahn
// in eigenem Fenster.
// Checkbox “Animation” for displaying the Sun-Moon orbit
// in its own window.
objShowAnimation.addEventListener("click", function (e){
		// Checkbox markiert ...
		// Checkbox marks ...
		if (objShowAnimation.checked == true){
			alert("Animation starten noch nicht implementiert");
		// Checkbox demarkiert ...
		// Checkbox demarks ...
		}else{
			alert("Animation stoppen noch nicht implementiert");
		}
		
});// End of objShowAnimation.addEventListener()


// Ereignis, wenn im Hauptprogramm auf den Button "Stop", Taste "S"
// geklickt wird. Bricht die sutomatische Berechnung ab.
//
// Event, when in the main program on the button “Stop”, key “S”
// is clicked. Abort the sutomatic calculation.
objCalcStop.addEventListener("click", function(){
	// Stoppt den Worker für das Datum Overlay.
	// Stops the worker for the date overlay.
	//
	if (wAutomaticTime) stopWorker();
	// Wenn der Worker für die Berechnung "Ab aktuellem Datum" endlos läuft,
	// dann stoppe Ihn.
	// If the worker runs endlessly for the calculation “from current date”,
	// then stop him.
	if (workerActualEndless) stopWorkerActualDateEndless();
	// Wenn der Worker für die Berechnung "Ab gewähltem Datum" endlos läuft,
	// dann stoppe Ihn.
	// If the worker runs endlessly for the calculation “Ab gewähltem Datum”,
	// then stop him.
	if (workerChoiceEndless) stopWorkerChoiceDateEndless();
	TIMELAPS = 0.0;											// Zeitsprungvariable auf 0 setzen
																		// Set time jump variable to 0
	objCalcManual.disabled = false;					// Radio Button "Manuell" bedienbar machen
																		// Make radio button “Manuell” operable
	objCalcAutomatic.disabled = false;				// Radio Button "Automatisch" bedienbar machen
																		// Make radio button “Automatisch” operable
	objCalcStop.disabled = true;						// Deaktiviert den Stop Button
																		// Deactivates the stop button
	objCalcChoiceDateAutomatic.checked = false;// Im Overlay den Radio Knopf "Bis zum Datum" deaktivieren
																		// Deactivate the radio button “Until date” in the overlay
	objShowDataOutput.checked = false;			// Checkbox "Datenausgabe" Demarkieren
																		// Checkbox “Datenausgabe” Demark
	objShowDataOutput.disabled = false;			// Checkbox "Datenausgabe" bedienbar machen
																		// Make “datenausgabe” checkbox operable
	objCalcManual.checked = "checked";			// Schaltet Radio Button Manuell "Ein".
																		// Switch Radio Button Manually “On.”
	objCalcAutomatic.checked = "";					// Button "Automatisch" wird ausgeschaltet.
																		// Button “Automatisch” is switched off.
	divAutomatic.style.visibility = "hidden";			// Overlay wird geschlossen.
																		// Overlay is closing.
	objCalc.disabled = false;								// Button "Berechnen" des Hauptformulars ist "Ein".
																		// Button “Berechnen” of the main form is “On.”
	// Radio Knopf "Bis zum Datum" deaktivieren	
	// Deactivate radio button “Until date”	
	objCalcUntilDateAutomatic.checked = "";
	// Date Picker "Bis zum Datum" zurücksetzen
	// Reset Date Picker “Bis zum Datum”
	objUntilDateAutomatic.value = "";
	// Time Picker "Bis zum Datum" zurücksetzen
	// Reset Time Picker “Bis zum Datum”
	objCalcUntilTimeAutomatic.value = "00:00";
	// Sekunden Picker "Bis zum Datum" zurücksetzen
	// Reset seconds picker “Bis zum Datum”
	objCalcUntilSecondAutomatic.value = "0";
	// Sekunden Picker "Bis zum Datum" zurücksetzen
	// Reset seconds picker “Until date”
	objCalcUntilMSecondAutomatic.value = "0";
	// Datenfelder für den Zeitsprung Löschen und unbedienbar machen
	// Data fields for the time jump Delete and make them unusable
	// Stunden - Hours
	objCalcActualDateHour.disabled = true;
	objCalcActualDateHour.value = "0";
	// Minuten - Minutes
	objCalcActualDateMinute.disabled = true;
	objCalcActualDateMinute.value = "0";
	// Sekunden - Seconds
	objCalcActualDateSecond.disabled = true;
	objCalcActualDateSecond.value = "0";
	// Millisekunden - milliseconds
	objCalcActualDateMillisecond.disabled = true;
	objCalcActualDateMillisecond.value = "0";
	setActualDateAndTime();								// Aktuelles Datum und Uhrzeit als Startdatum setzen.
																		// Set current date and time as start date.
	eraseOutputFields();									// Die Ausgabefelder löschen.
																		// Delete the output fields.
	enableDateTimePicker();								// Die obigen Datums Picker einschalten.
																		// Switch on the above date pickers.
	// Ausgabefelder am Ende der Seite auf Not Availible setzen
	// Set output fields at the bottom of the page to Not Availible
	document.getElementById("msvelosity").value = "N/A";
	document.getElementById("mstimelaps").value = "N/A";
	document.getElementById("msprogresstime").value = "N/A";
	
});// End of objCalcStop.addEventListener()



// Event Listener beim Klick auf den Button "Berechnen"
// startet die Verarbeitung.
// Event listener by clicking on the “Calculate” button
// starts processing.
objCalc.addEventListener("click", getDateValues);



/* **********************************************************************************
	Eventhandler für die Eingabe Datums- und Zeitfelder. Bei Klick darauf werden
	die Ausgabefelder gelöscht.
 ********************************************************************************** */

// Bei Klick auf das Datums Input Element wird alles
// gelöscht.
// Clicking on the Date Input Element everything is displayed
// deleted.
objDate.addEventListener("click", function () {
	eraseOutputFields();
});


// Bei Klick auf das Time Input Element wird alles
// gelöscht.
// By clicking on the Time Input element everything is displayed
// deleted.
objTime.addEventListener("click", function () {
	eraseOutputFields();
});


// Bei Klick auf das Second Input Element wird alles
// gelöscht.
// Clicking on the Second Input Element
// deleted.
objSec.addEventListener("click", function () {
	eraseOutputFields();
});


// Bei Klick auf das Milli-Second Input Element wird alles
// gelöscht.
// Clicking on the Milli-Second input element
// deleted.
objMilliSec.addEventListener("click", function () {
	eraseOutputFields();
});


// Bei Klick auf das Auswahl Element "Dämmerung" wird alles
// gelöscht.
// Clicking on the selection Element “Twilight” everything will be displayed
// deleted.
objTwilightkind.addEventListener("click", function () {
	eraseOutputFields();
});


// Bei Klick auf das Texteingabe Element "Länge" wird alles
// gelöscht.
// Clicking on the text entry element “Length”
// deleted.
objLongitude.addEventListener("click", function () {
	eraseOutputFields();
});


// Bei Klick auf das Texteingabe Element "Breite" wird alles
// gelöscht.
// Clicking on the text entry element “width”
// deleted.
objLatitude.addEventListener("click", function () {
	eraseOutputFields();
});


// Löscht die Ausgabefelder.
// Deletes the output fields.
function eraseOutputFields(){
	// Alle Ausgabefelder der Datums und Zeitangaben Löschen
	// Delete all output fields of date and time
	output.value = "";
	outputLT.value = "";
	outputUT.value = "";
	outputJD1.value = "";
	outputDate1.value = "";
	outputMJD.value = "";
	outputDateMJD.value = "";
	outputLTJD.value = "";
	outputJDLT.value = "";
	outputMJDUTC.value = "";
	outputDATEMJD.value = "";
	// Alle Ausgabefelder der Sonnendaten Löschen
	// Delete all output fields of the solar data
	document.getElementById("actualdecsun").value = "";
	document.getElementById("actualrasun").value = "";
	document.getElementById("actualhighsun").value = "";
	document.getElementById("actualazsun").value = "";
	document.getElementById("azhighsundeg").value = "";
	document.getElementById("azhighsundez").value = "";
	document.getElementById("diasundeg").value = "";
	document.getElementById("diasundez").value = "";
	document.getElementById("distancesunearth").value = "";
	document.getElementById("timehighnoon").value = "";
	document.getElementById("jdsunset").value = "";
	document.getElementById("jdsunrise").value = "";
	document.getElementById("statazsunset").value = "";
	document.getElementById("azsunset").value = "";
	document.getElementById("statazsunrise").value = "";
	document.getElementById("azsunrise").value = "";
	document.getElementById("statttwlsunset").value = "";
	document.getElementById("ttwlsunset").value = "";
	document.getElementById("statttwlsunrise").value = "";
	document.getElementById("ttwlsunrise").value = "";
	document.getElementById("statsunset").value = "";
	document.getElementById("tsunset").value = "";
	document.getElementById("statsunrise").value = "";
	document.getElementById("tsunrise").value = "";
	document.getElementById("tsunrise").value = "";
	// Alle Ausgabefelder der Monddaten Löschen
	// Delete all output fields of the moon data
	document.getElementById("hmoon").value = "";
	document.getElementById("azmoon").value = "";
	document.getElementById("diamoon").value = "";
	document.getElementById("distmoon").value = "";
	document.getElementById("moonhighdeg").value = "";
	document.getElementById("moonhighdate").value = "";
	document.getElementById("moonhighaz").value = "";
	document.getElementById("moonsetazh").value = "";
	document.getElementById("moonriseaz").value = "";
	document.getElementById("moonsetaz").value = "";
	document.getElementById("moonriseazh").value = "";
	document.getElementById("statmoonset").value = "";
	document.getElementById("tmoonset").value = "";
	document.getElementById("statmoonrise").value = "";
	document.getElementById("tmoonrise").value = "";
	// Statistische Angaben am Ende der Seite
	// Statistics at the bottom of the page
	document.getElementById("mstimelaps").value = "";
	document.getElementById("msvelosity").value = "";
	document.getElementById("msprogresstime").value = "";
	
}// End of eraseOutputFields()



// Bei einem Klick auf den Radio Button "Automatisch" oder "Stop" Button
// werden die Datums- und Time Picker ausgeschaltet.
//
// By clicking on the radio button “Automatic” or “Stop” button
// the date and time pickers are switched off.
function disableDateTimePicker(){
	objDate.disabled = true;
	objTime.disabled = true;
	objSec.disabled = true;
	objMilliSec.disabled = true;
	objTwilightkind.disabled = true;
	objTimezone.disabled = true;
	objDST.disabled = true;
	objLongitude.disabled = true;
	objLatitude.disabled = true;
	
}// End of disableDateTimePicker()



// Bei einem Klick auf den Radio Button "Manuell" oder "Stop" Button oder "Abbrechen" Button im Overlay
// werden die Datums- und Time Picker eingeschaltet.
//
// By clicking on the radio button “Automatic” or “Stop” button
// the date and time pickers are switched on.
function enableDateTimePicker(){
	// "Mit aktuellem Datum" im Overlay bedienbar machen.
	// Make “With current date” operable in the overlay.
	objDate.disabled = false;
	objTime.disabled = false;
	objSec.disabled = false;
	objMilliSec.disabled = false;
	// ... und direkt wieder markieren ...
	// ... and mark directly again ...
	objCalcActualDate.checked = "checked";
	// "Ab gewählten Datum" Date, Time, Sekunden, Millisekunden Picker auf 0 setzen
	// “Ab gewählten Datum” Set date, time, seconds, millisecond picker to 0
	objChoiceDateAutomatic.value = "";
	objCalcChoiceTimeAutomatic.value = "00:00";
	objCalcChoiceSecondAutomatic.value = "0";
	objCalcChoiceMSecondAutomatic.value = "0";
	// ... und unbedienbar machen ...
	// ... and render useless ...
	objChoiceDateAutomatic.disabled = true;
	objCalcChoiceTimeAutomatic.disabled = true;
	objCalcChoiceSecondAutomatic.disabled = true;
	objCalcChoiceMSecondAutomatic.disabled = true;
	// Im Hauptprogramm "Dämmerung", "Zeitzone", "Sommer/Winterzeit", "Längengrad" und "Breitengrad"
	// bedienbar machen.
	// In the main programme “Dämmerung”, “Zeitzone”, “Summer/Winterzeit”, “Längengrad” and “Breitengrad”
	// make it operable.
	objTwilightkind.disabled = false;
	objTimezone.disabled =  false;
	objDST.disabled =  false;
	objLongitude.disabled =  false;
	objLatitude.disabled = false;
	
}// End of enableDateTimePicker()



/* **********************************************************************************
	Eventhandler für die manuelle oder automatische Verarbeitung bei einem Klick auf
	die Radio Buttons Manuell oder Automatisch.
	
	Event handler for manual or automatic processing with a click on
	the radio buttons Manual or Automatic.
 ********************************************************************************** */

// Eventhandler bei Änderung Select Box "Zeitzone".
// Event handler by changing the select box “Zeitzone”
//
objTimezone.addEventListener("change", async function () {
	// Zeitzone and DST - set timezone and DST
	TIMEZONE = 0;
});


// Eventhandler bei Klick auf die Select Box "Zeitzone".
// Event handler by clicking the select box “Zeitzone”
//
objTimezone.addEventListener("click", function () {
	// Wenn der Worker für die Berechnung "Ab aktuellem Datum" endlos läuft,
	// dann stoppe Ihn.
	// If the worker runs endlessly for the calculation “from current date”,
	// then stop him.
	if (workerActualEndless)
		stopWorkerActualDateEndless();
	objCalcStop.disabled = true;						// Den Button "Stop" unbrauhbar machen
																		// Make the “Stop” button unburnable
	objCalcAutomatic.checked = false;				// Button "Automatisch" wird ausgeschaltet.
																		// Button “Automatic” is switched off.
	objCalc.disabled = false;								// Button "Berechnen" des Hauptformulars ist "Ein".
																		// Button “Calculate” of the main form is “On.”
	setActualDateAndTime();								// Aktuelles Datum und Uhrzeit als Startdatum setzen.
																		// Set current date and time as start date.
	eraseOutputFields();									// Die Ausgabefelder löschen.
																		// Delete the output fields.
	enableDateTimePicker();								// Die obigen Datumspicker einschalten.
																		// Switch on the above date pickers.
	// Ausgabefelder am Ende der Seite auf Not Availible setzen
	// Set output fields at the bottom of the page to Not Availible
	document.getElementById("msvelosity").value = "N/A";
	document.getElementById("mstimelaps").value = "N/A";
	document.getElementById("msprogresstime").value = "N/A";
	
});// End of objTimezone.addEventListener()



// Eventhandler bei Änderung der Select Box "Sommer/Winterzeit".
// Event handler when changing the Select Box “Summer/Winter Time.”
objDST.addEventListener("change", function () {
	// Zeitzone and DST - set timezone and DST
	TIMEZONE = 0;
});



// Eventhandler bei Klick auf die Select Box "Sommer/Winterzeit".
// Event handler when clicking the Select Box “Summer/Winter Time.”
objDST.addEventListener("click", function () {
	// Wenn der Worker für die Berechnung "Ab aktuellem Datum" endlos läuft,
	// dann stoppe Ihn.
	// If the worker runs endlessly for the calculation “from current date”,
	// then stop him.
	if (workerActualEndless) stopWorkerActualDateEndless();
	objCalcStop.disabled = true;						// Den Button "Stop" unbrauchbar machen
																		// Make the “Stop” button unburnable
	objCalcAutomatic.checked = false;				// Button "Automatisch" wird ausgeschaltet.
																		// Button “Automatic” is switched off.
	objCalc.disabled = false;								// Button "Berechnen" des Hauptformulars ist "Ein".
																		// Button “Calculate” of the main form is “On.”
	setActualDateAndTime();								// Aktuelles Datum und Uhrzeit als Startdatum setzen.
																		// Set current date and time as start date.
	eraseOutputFields();									// Die Ausgabefelder löschen.
																		// Delete the output fields.
	enableDateTimePicker();								// Die obigen Datumspicker einschalten.
																		// Switch on the above date pickers.
	// Ausgabefelder am Ende der Seite auf Not Availible setzen
	// Set output fields at the bottom of the page to Not Availible
	document.getElementById("msvelosity").value = "N/A";
	document.getElementById("mstimelaps").value = "N/A";
	document.getElementById("msprogresstime").value = "N/A";
});



// Eventhandler bei Klick auf den Radio Button "Manuell".
// Event handler by clicking on the radio button “Manuell”
objCalcManual.addEventListener("click", function () {
	// Stoppt den Worker für das Datum Overlay.
	// Stops the worker for the date overlay.
	if (wAutomaticTime) stopWorker();
	// Stoppt den Worker "worker-automatictime.js" des Overlays
	// Stoppt den Worker «worker-automatictime.js» des Overlays
	if (workerChoiceEndless) {
		stopWorkerChoiceDateEndless();
	}
	// Objekt automatische Berechnung "Ab gewähltem Datum" Overlay.	
	// Object automatic calculation “Ab gewähltem Datum” Overlay.	
	objCalcChoiceDateAutomatic.checked = false;
	objChoiceDateAutomatic.value = "";
	objChoiceDateAutomatic.disabled = true;
	objCalcChoiceTimeAutomatic.value = "00:00";
	objCalcChoiceTimeAutomatic.disabled = true;
	objCalcChoiceSecondAutomatic.value = "0";
	objCalcChoiceSecondAutomatic.disabled = true;
	objCalcChoiceMSecondAutomatic.value = "0";
	objCalcChoiceMSecondAutomatic.disabled = true;
	// Objekt automatische Berechnung "Bis gewähltem Datum" Overlay.	
	// Object automatic calculation “Bis gewähltem Datum” Overlay.	
	objCalcUntilDateAutomatic.checked = false;
	objUntilDateAutomatic.value = "";
	objUntilDateAutomatic.disabled = true;
	objCalcUntilTimeAutomatic.value = "00:00";
	objCalcUntilTimeAutomatic.disabled = true;
	objCalcUntilSecondAutomatic.value = "0";
	objCalcUntilSecondAutomatic.disabled = true;
	objCalcUntilMSecondAutomatic.value = "0";
	objCalcUntilMSecondAutomatic.disabled = true;
	// Wenn der Worker für die Berechnung "Ab aktuellem Datum" endlos läuft,
	// dann stoppe Ihn.
	// If the worker runs endlessly for the calculation “from current date”,
	// then stop him.
	if (workerActualEndless) stopWorkerActualDateEndless();
	// Datenfelder für den Zeitsprung Löschen und unbedienbar machen
	// Data fields for the time jump Delete and make them unusable
	// Stunden - Hours
	objCalcActualDateHour.disabled = true;
	objCalcActualDateHour.value = "0";
	// Minuten - Minutes
	objCalcActualDateMinute.disabled = true;
	objCalcActualDateMinute.value = "0";
	// Sekunden - Seconds
	objCalcActualDateSecond.disabled = true;
	objCalcActualDateSecond.value = "0";
	// Millisekunden - milliseconds
	objCalcActualDateMillisecond.disabled = true;
	objCalcActualDateMillisecond.value = "0";
	objCalcStop.disabled = true;						// Den Button "Stop" unbrauchbar machen
																		// Make the “Stop” button unburnable
	objShowAnimation.disabled = true;				// Checkbox "Animation" unbedienbar machen
																		// Make “Animation” checkbox unoperable
	objShowDataOutput.disabled = false;			// Checkbox "Datenausgabe" unbedienbar machen
																		// Make “Datenausgabe” checkbox unoperable
	objCalcManual.checked = "checked";			// Schaltet Radion Button Manuell "Ein".
																		// Switch Radion Button Manually “On.”
	objCalcAutomatic.checked = "";					// Button "Automatisch" wird ausgeschaltet.
																		// Button “Automatic” is switched off.
	divAutomatic.style.visibility = "hidden";			// Overlay wird geschlossen.
																		// Overlay is closed.
	objCalc.disabled = false;								// Button "Berechnen" des Hauptformulars ist "Ein".
																		// Button “Calculate” of the main form is “On.”
	setActualDateAndTime();								// Aktuelles Datum und Uhrzeit als Startdatum setzen.
																		// Set current date and time as start date.
	eraseOutputFields();									// Die Ausgabefelder löschen.
																		// Delete the output fields.
	enableDateTimePicker();								// Die obigen Datumspicker einschalten.
																		// Switch on the above date pickers.
	// Ausgabefelder am Ende der Seite auf Not Availible setzen
	// Set output fields at the bottom of the page to Not Availible
	document.getElementById("msvelosity").value = "N/A";
	document.getElementById("mstimelaps").value = "N/A";
	document.getElementById("msprogresstime").value = "N/A";
	
});// End of objDST.addEventListener()




// Eventhandler für die Auswahl des Radio Buttons "Automatisch".
// Event handler for the selection of the radio button “Automatic.”
objCalcAutomatic.addEventListener("click", function () {
	// Wenn der Worker für die Berechnung "Ab aktuellem Datum" endlos läuft,
	// dann stoppe Ihn
	// If the worker for the calculation “From current date” runs endlessly,
	// then stop him
	if (workerActualEndless) stopWorkerActualDateEndless();
	// Den Wert für dier jeweilige Zeitzone aus der Auswahlbox "Zeitzone" ermitteln
	// Determine the value for the respective time zone from the “Time zone” selection box
	var selectedItemTimezone = objTimezone.options[objTimezone.selectedIndex];
	// Mit der Funktion wird die Plausibilität von Zeitzone und Längengrad überprüft. Beide
	// müssen korrespondieren. Z.B. muss die TZ = 1 mit einem Längengrad von 0° - 15° Ost
	// übereinstimmen. TZ = -1 mit 0° bis -15° .... usw. Wir haben von 0° = Grennwich Meridian
	// bis +180° und -180° in der Länge und Zeitzone von 0 = Grennwich bis +12 und -12.
	if (testTimezoneAndLongitude(Number(selectedItemTimezone.value) , objLongitude.value)== false ){
		// Gebe Meldung über fehlerhalte Zeitzone + Längengrad ...
		// Error message for a mistake in time zone and longitude ...
		alert("Fehler bei Zeitzone und Längengrad des Standortes!\nKeine Berechnung");
	// Die Daten von Zeitzone und Längengrad korrespondieren miteinander und
	// damit kann gerechnet werden.
	// The data of time zone and longitude correspond with each other and
	// this can be expected.
	}else{
		objCalcStop.disabled = false;							// Button "Stop" ermöglichen
																				// Enable “Stop” button
		objShowAnimation.disabled = false;				// Checkbox "Animation" bedienbar machen
																				// Make “Animation” checkbox operable
		objShowDataOutput.disabled = false;				// Checkbox "Datenausgabe" bedienbar machen
																				// Make “datenausgabe” checkbox operable
		objCalcUntilDateAutomatic.disabled = false;	// Checkbox "Automatische Berechnung bis Datum" ausschalten
																				// Switch off “Automatic calculation to date” checkbox
		objCalcManual.checked = "";							// Radio Knopf "Manuell" Ausschalten.
																				// Radio button “Manual” Switch off.
		objCalcAutomatic.checked = "checked";			// Radio Knopf "Automatisch" markieren.
																				// Select the radio button “Automatic.”
		divAutomatic.style.visibility = "visible";				// Das Overlay für die Einstellungen Anzeigen.
																				// The overlay for the Display settings.
		objCalc.disabled = true;									// "Berechnen" Button im Hauptformular Ausschalten.
																				// “Calculate” button in the main form Switch off.
		setActualDateAndTimeAutomatic(TIMEZONE);// Aktuelles Datum und Uhrzeit und Timezone + DST im Overlay setzen.
																				// Set current date and time and timezone + DST in the overlay.
		disableDateTimePicker();									// Die obigen Datumspicker ausschalten.
																				// Switch off the above date pickers.
	}
	
});// End of objCalcAutomatic.addEventListener()




 /* ************************************************************************************
 *	Die Funktion setzt für eine Select Box (<select> ... </select> HTML Element) automatisch 
 *	den Wert, der in Option steht.
 *
 *	Übergabeparameter:
 *	---------------------------
 *
 *			arrSelect 		= Objekt auf die Select Box
 *			sItem     		= Wert(value), der in <option> steht und ausgewählt wird
 *
 *	Returnwert:
 *	----------------
 *			Keiner
 * 	-----------------------------------------------------------------------------------------------
 *	The function sets for a select box (<select> ... </select> HTML element) automatically 
 *	the value that is in option.
 *
 *	Transfer parameter:
 *	---------------------------
 *
 *			arrSelect = object on the select box
 *			sItem = value(value) which is in <option> and is selected
 *
 *	Return value:
 *	----------------
 *			None
 *********************************************************************************** */
function SelectItemInSelect(arrSelect, sItem) {
	for (var k=0; k < arrSelect.options.length; k++) {
		if (arrSelect.options[k].value==sItem) {
			arrSelect.options[k].selected = true;
		}
	}
	
}// End of SelectItemInSelect()



/* **********************************************************************************
	DST und Timezone ermitteln und die Select Boxen mit den Werten einstellen.
	DST and timezone and set the Select boxes with the values.
 ********************************************************************************** */

// Bei Programmstart, also Aufruf des Programmes,
// wird die Funktion gerufen und ermittelt
// Sommer/Winterzeit wie die Timezone. Stellt die Select Boxen
// daruf ein.
//
// At program start, i.e. call of the program,
// the function is called and determined
// Summer/winter time like the timezone. Sets the Select Boxes
// on it.
function calcDSTandTimezone(){
	// Das Datum vom 1. Januar des aktuellen Jahres ermitteln ...
	// ... then determine the date of January 1 of the current year ...
	jan = new Date(d.getFullYear(), 0, 1);
	// ... und das Datum vom 1. Juli des aktuellen Jahres ermitteln ...
	// ... and determine the date of 1 July of the current year ...
	jul = new Date(d.getFullYear(), 6, 1);
	// ... den Zeitzonenwert = Timezone + DST ...
	//  ...Standard ist Winterzeit, also GMT + die jeweilige Zeitzone in h ...
	// ... the time zone value = Timezone + DST ...
	// ... default is winter time, so GMT + the respective time zone in h ...
	TIMEZONE = 0;
	// ... nimmt die Differenz zwischen Juli und Januar auf. Wenn DST dann ist die Differnz 1,
	// ansonsten 0 ...
	// ... takes up the difference between July and January. If DST then the difference is 1,
	// otherwise 0 ...
	diff = 0;
	// ... und die Differnz zwischen Juli und Januar des Jahres ermitteln ...
	// ... and determine the difference between July and January of the year ...
	diff = jul.getTimezoneOffset()/60 - jan.getTimezoneOffset()/60;
	// ... und die Differenz ist auch der Wert, der von der UTC abgezogen werden muss
	// um auf UT zu kommen. Der Wert kann negativ sein und es muss mit dem absoluten
	// Wert gerechnet werden ...
	// ... and the difference is also the value to be subtracted from the UTC
	// to get to UT. The value can be negative and it must be with the absolute
	// Value to be calculated ...
	TIMEZONE = diff;
	// ... und wenn DST (Sommerzeit) ist, dann zur Timezone dazuaddieren ...
	// ... and if DST is summer time, then add to the timezone ...
	if  ( isDST(d) ){
		// Selectbox automatisch setzen und Sommerzeit automatisch eintragen ...
		// Set Selectbox automatically and enter summer time automatically ...
		SelectItemInSelect(objDST, 2);
		// ... dann die Variable TIMEZONE und die Selectbox Zeitzone setzen.
		// Nach Osten ist der Wert negativ und nach Westen positiv ...
		// ... then set the variable TIMEZONE and the Selectbox Time Zone.
		// To the east the value is negative and to the west it is positive ...
		if ( TIMEZONE < 0 ){
			TIMEZONE -= 1;
			// ... und Zeitzone nach Osten automatisch eintragen ...
			// ... and automatically enter time zone to the east ...
			SelectItemInSelect(objTimezone, Math.abs(TIMEZONE + 1));
		}else{
			TIMEZONE += 1;
			// ... und Zeitzone nach Westen automatisch eintragen ...
			// ... and automatically enter time zone to the west ...
			SelectItemInSelect(objTimezone, --Math.abs(TIMEZONE - 1));
		}
	// Winterzeit - Winter time
	}else{
		// ... DST automatisch eintragen ...
		// ... Automatically enter DST.
		SelectItemInSelect(objDST, 1);
		// ... Zeitzone automatisch eintragen ...
		// ... Automatically enter time zone.
		SelectItemInSelect(objTimezone, Math.abs(TIMEZONE));
	}
	
}// End of calcDSTandTimezone()



 /* ************************************************************************************
 *	Die Funktion besteht aus getDateValues() und getTimeValues. Sie ermitteln
 * und berechnen die einzelnen Werte für UTC=LT und UT=GMT das Jd und MJD.
 * Es werden die jeweilig Zeitzone von -12 h bis +12 h und Sommer/Winterzeit
 * berücksichtigt.
 * Die Funktion getDateValues() wird beim Klick auf den Button "Berechnen" 
 * aufgerufen.
 *
 *	Übergabeparameter:
 *	---------------------------
 *
 *			Keine
 *
 *	Returnwert:
 *	----------------
 *			Keiner
 * 	-----------------------------------------------------------------------------------------------
 * The function consists of getDateValues () and getTimeValues. They investigate
 * and calculate the individual values for UTC=LT and UT=GMT the Jd and MJD.
 * The respective time zone from -12 h to +12 h and summer/winter time
 * taken into account.
 * The getDateValues () function is clicked on the “Calculate” button. 
 * accessed.
 *
 * Transfer parameters:
 *	---------------------------
 *
 *    None
 *
 * Return value:
 *	----------------
 *    None
 *********************************************************************************** */
function getDateValues(){
	var arrDate = [];
	resultsSun = [];
	// Wir benötigen nur das normale Datum für die meisten Berechnungen
	// von Sonnenaufgang/Untergang, Azimuth, Größe am Himmel und Entfernung ...
	// We only need the normal date for most calculations
	// from sunrise/set, azimuth, magnitude in the sky and distance ...
	arrDate =  objDate.value.split("-");
	year = arrDate[0];
	month =  arrDate[1];
	day = arrDate[2];
	// Den Wert für dier jeweilige Zeitzone aus der Auswahlbox "Zeitzone" ermitteln
	// Determine the value for the respective time zone from the “Time zone” selection box
	selectedItemTimezone = objTimezone.options[objTimezone.selectedIndex];
	// ... dann die Sommer/Winterzeit aus der Select Box "DST" ermitteln. Dort ist der Wert für
	// Sommerzeit = 2 und Winterzeit = 1 ...
	// ... then determine the summer/winter time from the Select Box “DST.” There is the value for
	// Summertime = 2 and Wintertime = 1 ...
	selectedItemDST = objDST.options[objDST.selectedIndex];
	// ******************************** Sonnenaufgang - Sunrise *****************************				
	// ... und berechne aus SunRiseSet.js den Sonnenaufgang am lokalen Ort...
	// [0] = Die dezimale Aufgangszeit  als hh:mm:ss.ms
	// [1] = Konvertierung von GST nach UT OK oder nicht
	// [2] = Immer sichtbar oder Nie sichtbar ...
	//
	// ... and then calculate the sunrise at the local location...
	// [0] = The decimal rise time as hh:mm:ss.ms
	// [1] = Conversion from GST to UT OK or not
	// [2] = Always visible or never visible ...
	LCT = sunriseLocalTime(day, month, year, Number(selectedItemDST.value) -1 , Number(selectedItemTimezone.value) , objLongitude.value, objLatitude.value);
	LCT[0]  = LCT[0] + 0.0083333	;
	resultsSun.push(LCT[0]); 
	// ********************************* Sonnenuntergang - Sun set ****************************
	// ... und berechne dann aus SunRiseSet.js  den Sonnenuntergang am lokalen Ort ...
	// ... and then calculate the sunset at the local location ...
	// [0]	=	Lokale Zeit des Sonnenaufgangs als hh:mm:ss.ms
	// [1] = Konvertierung von GST nach UT OK oder nicht
	// [2] = Immer sichtbar oder Nie sichtbar ...
	//
	// [0] = Local time of sunset as hh:mm:ss.ms
	// [1] = Conversion from GST to UT OK or not
	// [2] = Always visible or never visible ...
	LCTS = sunsetLocalTime(day, month, year, Number(selectedItemDST.value) -1, Number(selectedItemTimezone.value), objLongitude.value, objLatitude.value);	
	LCTS[0]  = LCTS[0] + 0.0083333	;
	// Index [1]	=	Lokale Zeit des Sonnenuntergangs als hh:mm:ss.ms	
	// Index [1] 	=	Local time of sunset as hh:mm:ss.ms
	resultsSun.push(LCTS[0]); 
	// ... wenn beim Sonnenaufgang der Status von Konvertierung Greenwich Sternzeit zu UT OK ist und die Sichtbarkeit OK ist ...
	// ... if at sunrise the status of conversion Greenwich stardate to UT is OK and the visibility is OK ...
	statLCT = LCT[2];
	// Index [2]	=	Status des Sonnenaufgangs
	// Index [2] 	= Sunrise status
	resultsSun.push(statLCT); 
	// ... wenn beim Sonnenuntergang der Status von Konvertierung Greenwich Sternzeit zu UT OK ist und die Sichtbarkeit OK ist ...
	// ... if at sunset the status of conversion Greenwich stardate to UT is OK and the visibility is OK ...
	statLCTS = LCTS[2];
	// Index [3]	=	Status des Sonnenuntergangs
	// Index [3] 	= Sunset status
	resultsSun.push(statLCTS); 
	// *********************** Berechne die Dämmerungsdaten aus SunRiseSet.js *************************
	// ************************** Calculate data of twilight in SunRiseSet.js *********************************	
	selectedItemTwilight = objTwilightkind.options[objTwilightkind.selectedIndex];	
	// Dämmerung Morgens bis zum Sonnenaufgang in einem Array mit Index 0 - 3 ...
	//	0	=	Die Zeit der Dämmerung beim Sonnenaufgang dezimal
	//	1	=	Die Konvertierung von Greenwich Sternzeit zu UT bei der Morgendämmerung
	//	2	=	Die Sichtbarkeit der Dämmerung - Immer sichtbar - nie sichtbar
	//	3	=	Status der Dämmerung OK, Sonne immer sichtbar, Sonne nie sichtbar
	//
	// Twilight  Morning until sunrise in an array with index 0 – 3 ...
	// 0 = Time of twilight at sunrise decimal
	// 1 = The conversion of Greenwich stardate to UT at dawn
	// 2 = The visibility of the twilight - Always visible – never visible
	// 3 = State of twilight OK, Sun always visible, Sun never visible
	arrTwilightRise = twilightLCT(day, month, year, Number(selectedItemDST.value) -1 , Number(selectedItemTimezone.value) , objLongitude.value,
												objLatitude.value, objTwilightkind.value,"am");
	// Index [4]	=	Dämmerung Aufgang in Zeit hh:mm:ss.ms
	// Index [4] 	= Twilight rising in time hh:mm:ss.ms
	resultsSun.push(arrTwilightRise[0]); 
	// Dämmerung Abends nach dem Sonnenuntergang in einem Array mit Index 0 - 3 ...
	//	0	=	Die Zeit der Dämmerung beim Sonnenaufgang dezimal
	//	1	=	Die Konvertierung von Greenwich Sternzeit zu UT bei der Morgendämmerung
	//	2	=	Die Sichtbarkeit der Dämmerung - Immer sichtbar - nie sichtbar
	//	3	=	Status der Dämmerung OK, Sonne immer sichtbar, Sonne nie sichtbar
	//
	// Twilight  Morning until sunset in an array with index 0 – 3 ...
	// 0 = Time of twilight at sunrise decimal
	// 1 = The conversion of Greenwich stardate to UT at dawn
	// 2 = The visibility of the twilight - Always visible – never visible
	// 3 = State of twilight OK, Sun always visible, Sun never visible
	arrTwilightSet = twilightLCT(day, month, year, Number(selectedItemDST.value) -1 , Number(selectedItemTimezone.value) , objLongitude.value,
											  objLatitude.value, objTwilightkind.value,"pm");
	// Index [5]	=	Dämmerung Untergang in Zeit hh:mm:ss.ms
	// Index [5] = Twilight Decline in time hh:mm:ss.ms
	resultsSun.push(arrTwilightSet[0]); 
	// ... wenn bei der Dämmerung der Status von Konvertierung Greenwich Sternzeit zu UT OK ist und die Sichtbarkeit OK ist ...
	// ... if at dusk the status of conversion Greenwich stardate to UT is OK and the visibility is OK ...
	//if (arrTwilightRise[1]  == "OK" && arrTwilightRise[2] == "OK") statTwilightRise = arrTwilightRise[3]; else statTwilightRise  = arrTwilightRise[3];
	statTwilightRise  = arrTwilightRise[3];
	// Index [6]=	Status Dämmerung Aufgang
	// Index [6] = Status Twilight Rise
	resultsSun.push(statTwilightRise);	
	// ... wenn bei der Dämmerung der Status von Konvertierung Greenwich Sternzeit zu UT OK ist und die Sichtbarkeit OK ist ...
	// ... if at dusk the status of conversion Greenwich stardate to UT is OK and the visibility is OK ...
	//if (arrTwilightSet[1]  == "OK" && arrTwilightSet[2] == "OK")statTwilightSet = arrTwilightSet[3]; else statTwilightSet =  arrTwilightSet[3];
	statTwilightSet =  arrTwilightSet[3];
	// Index [7]	=	Status Dämmerung Untergang
	// Index [7] 	= Status Twilight Decline
	resultsSun.push(statTwilightSet);	
	// ************ Aufgang und Untergang Azimut und Höhe und Status **************	
	// ******************** Rise and fall Azimuth and Height and Status *****************				
	// ... hier berechne Azimuth (negative = East, positive = west) und Höhe der Sonne über dem Horizont Sonnenaufgang...
	// [0]	=	Der Azimuth in dezimalen Grad
	// [1]	=	Die Höhe der Sonne über dem Horizont in °, ', '' als Horizontal Koordinate
	// [2]	=	die Höhe der Sonne über dem Horizont in dez. Grad als Horizontal Koordinate 
	// [3]	=	Ist die Zeitkonvertierung von GST zu UT OK oder Warnung
	// [4]	=	Status des Sonnenaufgangs, ob OK, Immer sichtbar oder Nie sichtbar
	//
	// ... here calculate azimuth (negative = East, positive = west) and altitude of the Sun above the horizon sunrise ...
	// [0] = Azimuth in decimal degrees
	// [1] = The height of the Sun above the horizon in °, ', “ as a horizontal coordinate
	// [2] = the height of the Sun above the horizon in dec. Degree as Horizontal Coordinate 
	// [3] = Is the time conversion from GST to UT OK or warning
	// [4] = Sunrise status, whether OK, Always Visible or Never Visible
	sunriseAzH = sunriseAZ(day, month, year, 
										Number(selectedItemDST.value) -1, Number(selectedItemTimezone.value) , objLongitude.value, objLatitude.value);
	// Index [8]=	Azimuth des Sonnenaufgangs in dezimalen Grad
	// Index [8] = azimuth of sunrise in decimal degrees
	resultsSun.push((sunriseAzH[0] - 180.0) ); 
	// Wenn die Konvertierung von DST zu UT OK ist und der Status des Azimuths des Aufgangs OK ist dann setze den Status auf OK.
	// Wenn nicht dann ist die Sonne immer sichtbar oder nie sichtbar und setze den Status dann auf diesen Wert.
	// If the conversion from DST to UT is OK and the azimuth of the output is OK then set the state to OK.
	// If not then the Sun is always visible or never visible and then set the status to this value.
	//if (sunriseAzH[3]  == "OK" && sunriseAzH[4] == "OK")statSunriseAzH = sunriseAzH[3]; else statSunriseAzH =  sunriseAzH[4];
	statSunriseAzH =  sunriseAzH[4];
	// ... hier berechne Azimuth (negative = East, positive = west) und Höhe der Sonne über dem Horizont Sonnenuntergang...
	// ... here calculate azimuth (negative = East, positive = west) and altitude of the Sun above the horizon sunset ...
	sunsetAzH  = sunsetAZ(day, month, year, 
										Number(selectedItemDST.value) -1, Number(selectedItemTimezone.value) , objLongitude.value, objLatitude.value);
	// Index [9] =	Azimuth des Sonnenuntergangs in Grad
	// Index [9] = Azimuth of sunset in degrees
	resultsSun.push((sunsetAzH[0] - 180.0) ); 
	// Wenn die Konvertierung von DST zu UT OK ist und der Status des Azimuths des Untergangs OK ist dann setze den Status auf OK.
	// Wenn nicht dann ist die Sonne immer sichtbar oder nie sichtbar und setze den Status dann auf diesen Wert.
	// If the conversion from DST to UT is OK and the azimuth of the output is OK then set the state to OK.
	// If not then the Sun is always visible or never visible and then set the status to this value.
	//if (sunsetAzH[3]  == "OK" && sunsetAzH[4] == "OK")statSunsetAzH = sunsetAzH[3]; else statSunsetAzH =  sunsetAzH[4];
	statSunsetAzH =  sunsetAzH[4];
	// Index [10]	=	Status der Konvertierung GST zu UT des Sonnenaufgangs
	// Index [10]  = conversion status GST to UT of the sunrise
	resultsSun.push(sunriseAzH[3]);
	// Index [11]	=	Sichtbarkeit des Sonnenaufrgangs
	// Index [11]  = visibility of sunrise
	resultsSun.push(sunriseAzH[4]);
	// Index [12]	=	Status der Konvertierung GST zu UT des Sonnenuntergangs
	// Index [12]  = conversion status GST to UT of the sunset
	resultsSun.push(sunsetAzH[3]); 
	// Index [13]	=	Sichtbarkeit des Sonnenuntergangs
	// Index [13]  = Sunset visibility
	resultsSun.push(sunsetAzH[4]); 
	// *********************** Berechnung des Sonnenhöchststands *************************	
	//  ************************* Calculate the sun’s maximum  ****************************
	// ... nun das Julianisches Datum des Sonnenaufgangs ermitteln ...
	// . . . now determine the Julian date of sunrise . . .
	jdSunRise = calcJD(day, month , year, LCT[0] , 0, 0, 0,  0, 0);
	// Index [14]	=	JD des Sonnenaufgangs
	// Index [14] = JD of sunrise
	resultsSun.push(jdSunRise); 
	// ... nun das Julianisches Datum des Sonnenuntergangs in Greenwich ermitteln ...
	// . . . now determine the Julian date of the sunset in Greenwich . . .
	jdSunSet = calcJD(day, month , year, LCTS[0] , 0, 0, 0,  0, 0);
	// Index [15]	=	JD des Sonnenuntergangs
	// Index [15] = 	JD of sunset
	resultsSun.push(jdSunSet); 
	// ... danach die Differenz zwischen dem JD von Set und Rise ...
	// . . . then the difference between the JD of Set and Rise . . .
	jdSunRiseSetDiff = (jdSunSet - jdSunRise);
	// ... die Differnez / 2 ergibt das JD des Sonnenstandes am höchsten Punkt, genau
	// in der Mitte der Sichtbarkeit ...
	// . . . the Differnez / 2 gives the JD of the sun's position at the highest point, exactly 
	// in the middle of the visibility . . .
	jdSunRiseSetHalf = jdSunRiseSetDiff / 2 ;
	// ... und das JD des Sonnenaufgangs + die Hälfte ergibt das JD der Mitte der Sichtbarkeit
	// am höchsten Punkt der Sonne am Himmel ...
	// . . . and the JD of sunrise + half gives the JD of the center of visibility 
	// at the highest point of the sun in the sky . . .
	jdSunRiseSetHalfDate = jdSunRise + jdSunRiseSetHalf ;
	// ... dann aus dem JD des höchsten Punkts am Himmel wieder ein Datum berechnen ...
	// arrjdSunRiseSetHalfDate[0]	= Datum + Uhrzeit als Gleitkommazahl = 17.3456789
	// arrjdSunRiseSetHalfDate[1]	= Monat
	// arrjdSunRiseSetHalfDate[2]	= Jahr
	// . . . then calculate a date again from the JD of the highest point in the sky . . .
	// arrjdSunRiseSetHalfDate[0] = date + time as floating point number = 17.3 456 789
	// arrjdSunRiseSetHalfDate[1] = month
	// arrjdSunRiseSetHalfDate[2] = year
	arrjdSunRiseSetHalfDate = julianDate2Date(jdSunRiseSetHalfDate);
	// Index [16]	=	Dezimale Zeit des Tages des Sonnenhöchststandes
	// Index [16] = Decimal time of the day of the sun’s highest position
	resultsSun.push( LPAD(Math.floor(arrjdSunRiseSetHalfDate[0]), 2, "0") + "." + LPAD(arrjdSunRiseSetHalfDate[1], 2, "0") + "." + LPAD(arrjdSunRiseSetHalfDate[2], 4, "0") +
							  "  -  " +  percentageOfDecimal2Time((arrjdSunRiseSetHalfDate[0] - Math.floor(arrjdSunRiseSetHalfDate[0])), "string") ); 
	// Berechnung der Entfernung der Sonne und Winkelgröße als dezimale Grad am Himmel aus "Sunpositions.js".
	// Calculation of the distance of the Sun and angular magnitude in decimal degrees in the sky from "Sunpositions.js". 
	sunDiameter = calcSunDistanceAndDiameter(day, month,  year, arrjdSunRiseSetHalfDate[0], arrjdSunRiseSetHalfDate[1], arrjdSunRiseSetHalfDate[2],
																		Number(selectedItemDST.value) -1, Number(selectedItemTimezone.value) );
	// Index [17]	=	Abstand Erde - Sonne in Km
	// Index [17] = 	Distance Earth – Sun in Km
	resultsSun.push(sunDiameter[0]); 
	// Index [18]	= Durchmesser der Sonne am Himmel Dezimal
	// Index [18] = Diameter of the Sun in the Sky Decimal
	resultsSun.push(sunDiameter[1]); 
	// Winkeldurchmesser der Sonne in Grad, Minute, SekundeArray 1
	// Angular size as grad, minute and second in array 1
	SunAngularSize = decDegrees2AngleOfHours(sunDiameter [1]);
	// Index [19] =	Größe der Sonne am Himmel in Grad, Minuten, Sekunden
	// Index [19] =	Sun size in the sky in degrees, minutes, seconds
	resultsSun.push(SunAngularSize); 
	// ... Azimut des höchsten Sonnenstandes am Himmel ...
	//  ... Azimuth of the highest sun position in the sky ...
	azSunHigh = ((sunriseAzH[0] - 180.0) + (((sunsetAzH[0] - 180.0) -  (sunriseAzH[0] - 180.0)) / 2 ));
	// Index [20]	=	Der Azimuth des Sonnenhöchstand ungenau in dez. Grad
	// Index [20] 	= The azimuth of the sun’s elevation in dec. Degree
	resultsSun.push(azSunHigh); 
	// Dezimale Zeit des Sonnenhöchststandes in Array konvertieren
	// Convert decimal time of solar peak to array
	// Index [0]	=	Stunde - Hour
	// Index [1]	=	Minute - Minute
	// Index [2]	=	Sekunde - Second
	// Index [3]	=	Millisekunde - Millisecond
	var zh = percentageOfDecimal2Time((arrjdSunRiseSetHalfDate[0] - Math.floor(arrjdSunRiseSetHalfDate[0])), "array");
	// ... Azimut und Höhe der Sonne berechnen aus SunRiseSet.js...
	// ...  Calculate the azimuth and altitude of the sun from SunRiseSet.js ...
	// [0]	=	Azimuth in dezimalen Grad
	// [1]	=	Höchststand in dezimalen Grad
	// [2]	=	Rektaszension in dezimalen Grad
	// [3]	=	Deklination in dezimalen Grad
	highSunPos = precSunHorAZHeight(zh[0], zh[1], zh[2],
															Number(selectedItemDST.value) - 1, Number(selectedItemTimezone.value), day, month, year, objLongitude.value, objLatitude.value);
	// Index [21]	=	Sonnenhöchstand im Azimuth in Grad
	// Index [21]	=	Sun’s elevation in azimuth in degrees
	resultsSun.push(highSunPos[1]); 
	// ... wenn der neu berechnete Azimuth der Sonnenhöhe unterschiedlich zur vorher berechneten Höhe ist, dann updaten ...
	//  ... if the newly calculated azimuth of the sun’s altitude is different from the previously calculated altitude, then update ...
	// Index [20] 	=	 Der Azimuth des Sonnenhöchststand genau in dez. Grad
	// Index [20]  =  The azimuth of the sun’s elevation exactly in dec. Degree
	if (highSunPos[0] !=  azSunHigh){ azSunHigh = highSunPos[0]; resultsSun[20] = azSunHigh; }
	// *********************** Ausgabe der berechneten Werte *************************	
	//  ************************* Output of calculated values *****************************
	/*
			resultsSun[]
			Index [0]	=	Lokale Zeit des Sonnenaufgangs als hh:mm:ss.ms
			Index [1]	=	Lokale Zeit des Sonnenuntergangs als hh:mm:ss.ms
			Index [2]	=	Status des Sonnenaufgangs
			Index [3]	=	Status des Sonnenuntergangs
			Index [4]	=	Dämmerung Aufgang in Zeit hh:mm:ss.ms
			Index [5]	=	Dämmerung Untergang in Zeit hh:mm:ss.ms
			Index [6]	=	Status Dämmerung Aufgang
			Index [7]	=	Status Dämmerung Untergang
			Index [8]	=	Azimuth des Sonnenaufgangs in Grad
			Index [9]	=	Azimuth des Sonnenuntergangs in Grad
			Index [10]	=	Status der Konvertierung GST zu UT des Azimuth Sonnenaufgangs
			Index [11]	=	Sichtbarkeit des Azimuth des Sonnenaufgangs
			Index [12]	=	Status der Konvertierung GST zu UT des Azimuths Sonnenuntergangs
			Index [13]	=	Sichtbarkeit des Azimuths Sonnenuntergangs
			Index [14]	=	JD des Sonnenaufgangs
			Index [15]	=	JD des Sonnenuntergangs
			Index [16]	=	Dezimale Zeit des Tages des Sonnenhöchststandes
			Index [17]	=	Abstand Erde - Sonne in Km
			Index [18]	=	Durchmesser der Sonne am Himmel Dezimal
			Index [19] =	Größe der Sonne am Himmel in Grad, Minuten, Sekunden
			Index [20]	=	Der Azimuth des Sonnenhöchstand ungenau in dez. Grad
			Index [21]	=	Der  Sonnenhöchstand genau in dezimalen Grad
	*/
	// Daten des Sonnenaufgangs
	// Data sunrise
	if (resultsSun[2] == "OK"){
		objTSunrise.value = dectime2Time(resultsSun[0], "string");
		objJdSunrise.value = resultsSun[14];
		objStatSunrise.value = "OK";
	}else {
		objTSunrise.value = "N/A";
		objJdSunrise.value = "N/A";
		objStatSunrise.value = statLCT;
	}
	// Daten des Sonnenuntergangs
	// Data sunset
	if (resultsSun[3] == "OK"){
		objTSunset.value = dectime2Time(resultsSun[1], "string");
		objJdSunset.value = resultsSun[15];
		objStatSunset.value = "OK";
	}else{
		objTSunset.value = "N/A";
		objJdSunset.value ="N/A";
		objStatSunset.value = statLCTS;
	}
	// Daten der Dämmerung des Sonnenaufgangs
	// Data twilight on sunrise
	if (resultsSun[6] == "OK"){
		objTTwlSunrise.value = dectime2Time(Number(resultsSun[4]), "string");
		objStatTtwlSunrise.value = "OK";
	}else {
		objTTwlSunrise.value = "N/A";
		objStatTtwlSunrise.value = statTwilightRise;
	}
	// Daten der Dämmerung des Sonnenuntergangs
	// Data twilight on sunset
	if (resultsSun[7] == "OK"){
		objTTwlSunset.value = dectime2Time(Number(resultsSun[5]), "string");
		objStatTtwlSunset.value = "OK";
	}else {
		objTTwlSunset.value =  "N/A";
		objStatTtwlSunset.value = statTwilightSet;
	}
	// Daten des Azimuths des Sonnenaufgangs
	// Data of the azimuth of the sunrise
	if (resultsSun[10] == "OK" && resultsSun[11] == "OK"){
		objAzSunrise.value = Number(resultsSun[8]);
		objStatAzSunrise.value = "OK";
	}else {
		objAzSunrise.value =  "N/A";
		objStatAzSunrise.value = statSunriseAzH;
	}
	// Daten des Azimuths des Sonnenuntergangs
	// Data of the azimuth of the sunset
	if (resultsSun[12] == "OK" && resultsSun[13] == "OK"){
		objAzSunset.value = Number(resultsSun[9]);
		objStatAzSunset.value = "OK";
	}else {
		objAzSunset.value =  "N/A";
		objStatAzSunset.value = statSunsetAzH;
	}
	// Denn Sonnenhöchstand als Datum und Uhrzeit dd.mm.yyyy - hh:mm:ss.ms ausgeben
	// Because display solar elevation as date and time dd.mm.yyyy – hh:mm:ss.ms
	if (resultsSun[16] != "" && ( resultsSun[12] == "OK" && resultsSun[13] == "OK" ) && ( resultsSun[10] == "OK" && resultsSun[11] == "OK" ))
		objTimeHighnoon.value = resultsSun[16];
	else
		objTimeHighnoon.value = "N/A";
	// Denn Abstand Erde - Sonne in Km ausgeben
	// Because distance earth – sun output in Km
	if (resultsSun[17] != "")
		objDistanceSunEarth.value = resultsSun[17];
	else
		objDistanceSunEarth.value = "N/A";
	// Durchmesser der Sonne in dezimalen Grad
	// Diameter of the Sun in decimal degrees
	if (resultsSun[18] != "")
		objDiaSunDez.value = resultsSun[18];
	else
		objDiaSunDez.value = "N/A";	
	// Durchmesser der Sonne in °, ', ''
	// Diameter of the Sun in °, ', “ 
	if (resultsSun[19] != "")
		objDiaSunDeg.value = resultsSun[19];
	else
		objDiaSunDeg.value = "N/A";
	// Azimuth des Sonnenhöchststands in dezimalen Grad
	// Azimuth of the sun’s highest point in decimal degrees
	if (resultsSun[20] != "")
		objAzHighSunDez.value = resultsSun[20];
	else
		objAzHighSunDez.value = "N/A";	
	// Der Höchststand der Sonne in dezimalen Grad über dem Horizont
	// The maximum position of the Sun in decimal degrees above the hearing horizon
	if (resultsSun[21] != "")
		objAzHighSunDeg.value = resultsSun[21];
	else
		objAzHighSunDeg.value = "N/A";
	// ... und dann Zeitwerte ermitteln
	// ... and than Determine time values
	getTimeValues();
	
}// End of getDateValues()



// Die Eingegebenen Zeitfelder auslesen und verarbeiten.
// Read out and process the entered time fields.
function getTimeValues(){
	// Zuerst die Zeitzone aus der Select Box "Zeitzone" ermittel ...
	// First determine the time zone from the Select Box “Time Zone” ...
	var selectedItemTimezone = objTimezone.options[objTimezone.selectedIndex];
	timezone = Number(selectedItemTimezone.value);
	// ... und negieren, da damit durch Addition direkt aus Zeitzone und DST 
	// die UT berechnet werden kann ...
	// ... and negate, because by adding directly from time zone and DST 
	// the UT can be calculated ...
	timezone *=  -1;
	// ... dann die Sommer/Winterzeit aus der Select Box "DST" ermittel. Dort ist der Wert für
	// Sommerzeit = 2 und Winterzeit = 1 ...
	// ... then determine the summer/winter time from the Select Box “DST.” There is the value for
	// Summertime = 2 and Wintertime = 1 ...
	var selectedItemDST = objDST.options[objDST.selectedIndex];
	dst= Number(selectedItemDST.value);
	// ... darum muß der Wert 1 abgezogen werden, damit man direkt den Stundenwert
	// für UT berechnen kann ...
	// ... therefore the value 1 has to be subtracted, so that you can directly calculate the hourly value
	// can calculate for UT ...
	dst -= 1;
	// ... dann noch den Wert negieren um damit nach Ost und West durch Addition 
	// richtig rechnen zu können ...
	// ... then negate the value in order to east and west by addition 
	// to be able to calculate correctly ...
	dst *= -1;
	// ... und dann den Zeitzonenwert als Zeitzone + DST zu erhalten ...
	// ... and then get the time zone value as time zone + DST ...
	TIMEZONE = timezone + dst;
	//console.log("getTimeValues() DST =" + dst + " - TZ=" + TIMEZONE);
	// Hole vom Zeitpicker Stunde und Minute ...
	// Get hour and minute from the time picker ...
	var ot = objTime.value.split(":");
	hour = ot[0];
	minute = ot[1]
	// ... und Sekunde und Millisekunde aus den folgenden Textfeldern ...
	// ... and second and millisecond from the following text fields ...
	second = objSec.value;
	millisecond = objMilliSec.value;
	// ... und initialisiere noch einige Variablen ...
	// ... and initialize some variables ...
	var LT = 0;
	var UThour = 0;
	var Date1 = null;
	// ... in LT ist dann die Uhrzeit als Dezimalzahl bis zur Millisekunde ...
	// ... in LT the time is then as a decimal number up to the millisecond ...
	LT = Number(hour) + (minute/60.) + (second/3600.) + (millisecond/1000./3600.);
	//console.log("LT=" + LT);
	// ... aus den eingegebenen Datums- und Uhrzeitangaben das Julianische Datum der Lokalzeit LT
	// berechnen und Ausgeben ...
	// ... from the entered date and time data the Julian date of the local time LT
	// Calculate and output ...
	//JDLT = calcJD(day, month, year, hour, minute, second, millisecond,  Number(selectedItemDST.value) - 1, Number(selectedItemTimezone.value));
	JDLT = calcJD(day, month, year, LT, 0, 0, 0,  0, 0);
	outputLTJD.value = Number(JDLT);
	//console.log("getTimeValues() JDLT=" + JDLT);
	// ... dann aus dem Julianischen Datum das lokale Datum und Uhrzeit zurück Konvertieren und
	// ... Ausgeben ...
	// ... then convert from the Julian date to the local date and time
	// ... output ...
	var ctrlJD = julianDate2Date(JDLT);
	outputJDLT.value = LPAD((ctrlJD[0] - decPart(ctrlJD[0])), 2, "0") + "." + LPAD(ctrlJD[1], 2, "0") + "." + LPAD(ctrlJD[2], 4, "0") + " - " + percentageOfDecimal2Time(decPart(ctrlJD[0]), "string");
	if ( parseInt(ctrlJD[2]) >= 1900 ){
		outputMJDUTC.title = "Das Modifizierte Julianische Datum der Uhrzeit";
		outputDATEMJD.title = "Das errechnete Datum aus dem Modifizierten Julianischen Datum der UTC";
		// ... aus dem berechneten Julianischen Datum der lokalen Zeit das Modifizierte
		// Julianische Datum ab 1900 berechnen und Ausgeben ...
		// ... from the calculated Julian date of local time the modified
		// Calculate and output Julian date from 1900 ...
		var MJDLT = calculateMJD(JDLT);
		outputMJDUTC.value = MJDLT;
		// ... und aus dem Modifizierten Julianischen Datum der Lokalzeit wieder
		// das Datum und Uhrzeit ermitteln und Ausgeben ...
		// ... and from the modified Julian date of local time again
		// Determine the date and time and output ...
		var ctrlMJD = calculateDateFromMJD(MJDLT);
		outputDATEMJD.value = LPAD(ctrlMJD[0], 2, "0") + "." + LPAD(ctrlMJD[1], 2, "0") + "." + LPAD(ctrlMJD[2], 4, "0") + " - " + 
												LPAD(ctrlMJD[3], 2, "0") + ":" + LPAD(ctrlMJD[4], 2, "0") + ":" + LPAD(ctrlMJD[5], 2, "0") + "." + LPAD(ctrlMJD[6], 3, "0");
		// ... Vor 1900 keine Ausgabe ...
		// ... Before 1900 no issue ...
	}else{
		outputMJDUTC.value = "N/A";
		outputMJDUTC.title += " - MJD wird nur ab dem Jahr1900 berechnet!";
		outputDATEMJD.value = "N/A";
		outputDATEMJD.title += " - MJD wird nur ab dem Jahr1900 berechnet!";
	}
	// Um 0 Uhr Mitternacht muss für UT mit 24 gerechnet werden ...
	// ... hour ist die Variable mit dem Wert aus der Select Box "Uhrzeit" ...
	// At 0 o’clock midnight, 24 hours must be counted for UT ...
	// ... hour is the variable with the value from the Select Box “Uhrzeit” ...
	if (hour == 0){
		UThour = 24;
		// ... dazu kommt der Wert für die Zeitzone, die auch die Sommer/Winterzeit
		// aus den Select Boxen "Zeitzone" und "Sommer/Winterzeit" enthält ...
		// ... then there is the value for the time zone, which also includes the summer/winter time
		// from the Select Boxes “Time Zone” and “Summer/Winter Time” contains ...
		UThour = UThour + TIMEZONE;
	}else{
		// ... bei allen Anderen Stundenwerten berechne die UT aus der lokalen Zeit (UTC) und
		// Zeitzone wie Sommer/Winterzeit ...
		// ... for all other hourly values calculate the UT from local time (UTC) and
		// Time zone like summer/winter time ...
		UThour = LT + TIMEZONE;
	}
	// UT nach UTC und DST und Zeitzone ...
	//UTeqGMT = LT + TIMEZONE;
	// ... ist UThour größer als 24 Stunden ...
	// ... is UThour greater than 24 hours ...
	if ( UThour > 24.0 ){
		// ... subtrahiere die 24 Stunden von dem Wert ...
		// ... subtract the 24 hours from the value ...
		UThour -= 24.0;
	// ... ist UThour negativ, dann subtrahiere von 24 Stunden den positiven
	// Wert, um auf die korrekte Uhrzeit zu kommen ...
	// ... if UThour is negative, then subtract the positive from 24 hours
	// Value to get the correct time ...
	}else if (UThour < 0.0){
		UThour = 24.0 - Math.abs(UThour);
	}
	// ... Ausgabe der lokalen Zeit = LT = UTC ...
	// ... Output of local time = LT = UTC ...
	outputLT.value = LPAD(Math.trunc(hour), 2, "0") + ":" + LPAD(minute, 2, "0") + ":" + LPAD(second, 2, "0") + "." + LPAD(millisecond, 3, "0");
	// ... Ausgabe der UT = GMT ...
	// ... Output of UT = GMT ...
	outputUT.value = LPAD(Math.trunc(UThour), 2, "0") + ":" + LPAD(minute, 2, "0") + ":" + LPAD(second, 2, "0") + "." + LPAD(millisecond, 3, "0");
	// ... Date Objekt mit den eingegebenen Datumswerten ...
	// ... Date Object with entered date values ...
	calcDate = new Date(year, month - 1, day, hour, minute, second, millisecond);
	// ... Ausgabe des gesamten Datums mit Zeit zur Kontrolle unter "Kontrolldatum" ...
	// ... Output of the entire date with time to check under "Kontrolldatum" ......
	output.value = calcDate.toLocaleString() + "." + millisecond;
	// ... Ausgabe der Julianischen Datumsergebnisse UT ... ACHTUNG: DST + TIMEZONE muss hier 0 sein, da
	// in UThour schon dst und tz mit eingerechnet sind ...
	// ... Output of Julian date results UT ... ATTENTION: DST + TIMEZONE must be 0 here, because
	// in UThour already dst and tz are included ...
	var JD1 = calcJD(day,month,year, Math.trunc(UThour), minute, second, millisecond, 0, 0);
	outputJD1.value = JD1;
	// ... Rückrechnung von JD nach Datum und Uhrzeit, aber mit der Zeit UT und Ausgeben ...
	// ... Backcalculation of JD by date and time, but with time UT and output...
	Date1 = julianDate2Date(JD1);
	outputDate1.value = LPAD((Date1[0] - decPart(Date1[0])), 2, "0") + "." + LPAD(Date1[1], 2, "0") + "." + LPAD(Date1[2], 4, "0") + " - " + percentageOfDecimal2Time(decPart(Date1[0]), "string");
	// ... Rückrechnung von MJD nach Datum und Uhrzeit und Ausgeben, aber nur ab 1900 ...
	// ... Recalculation of MJD by date and time and output, but only from 1900 ...
	if ( parseInt(Date1[2]) >= 1900 ){
		outputMJD.title = "Das Modified Julianisches Datum (MJD) aus dem UT aus Grundlagen der Orbitmechanik - von Volker Maiwald, Dominik Quantius, Benny Rievers";
		outputDateMJD.title = "Das Kontrolldatum aus dem MJD aus dem UT ab 1900";
		// ... Ausgabe des Modified Julianischen Datums ...
		// ... Output of the Modified Julian Date ...
		MJD = calculateMJD(JD1);
		outputMJD.value = MJD;
		// ... und Ausgabe des zurückgerechneten Modified Julian Date in Datum und Uhrzeit ...
		// ... and output of the Calculated Modified Julian Date in date and time ...
		Date1 = calculateDateFromMJD(MJD);
		outputDateMJD.value = LPAD(Date1[0], 2, "0") + "." + LPAD(Date1[1], 2, "0") + "." + LPAD(Date1[2], 4, "0") + " - " + 
											 LPAD(Date1[3], 2, "0") + ":" + LPAD(Date1[4], 2, "0") + ":" + LPAD(Date1[5], 2, "0") + "." + LPAD(Date1[6], 3, "0");
	// ... Vor 1900 keine Ausgabe ...
	// ... Before 1900 no issue ...
	}else{
		outputMJD.value = "N/A";
		outputMJD.title += " - MJD wird nur ab dem Jahr1900 berechnet!";
		outputDateMJD.value = "N/A";
		outputDateMJD.title += " - MJD wird nur ab dem Jahr1900 berechnet!";
	}
	// ... Azimut und Höhe der Sonne im Horizontal/Äquatorialsystem berechnen aus SunRiseSet.js...
	// [0]	=	Azimuth in dezimalen Grad
	// [1]	=	Höchststand in dezimalen Grad
	// [2]	=	Rektaszension in dezimalen Grad
	// [3]	=	Deklination in dezimalen Grad
	//
	// ...  Calculate the azimuth and altitude of the sun from SunRiseSet.js ...
	// [0] = Azimuth in decimal degrees
	// [1] = Maximum level in decimal degrees
	// [2] = rectascension in decimal degrees
	// [3] = Declination in decimal degrees
	arrHorizon = precSunHorAZHeight(hour, minute, second, Number(selectedItemDST.value) - 1, Number(selectedItemTimezone.value), day, month, year, objLongitude.value, objLatitude.value);
	// Der Azimuth des aktuellen Sonnenstandes im Horizontalsystem
	// The azimuth of the current position of the sun in the horizontal system
	if (Number(arrHorizon[1]) < 0.0){
		document.getElementById("actualazsun").title = "Der aktuelle Azimuth des Sonnenstandes in dezimalen Grad 0°N - 360°N - Die Sonne ist unter dem Horizont!";
		document.getElementById("actualazsun").style.color = "red";
		document.getElementById("actualazsun").value = Number(arrHorizon[0]);
	}else{
		document.getElementById("actualazsun").title = "Der aktuelle Azimuth des Sonnenstandes in dezimalen Grad 0°N - 360°N - Die Sonne ist ueber dem Horizont!";
		document.getElementById("actualazsun").style.color = "green";
		document.getElementById("actualazsun").value = Number(arrHorizon[0]);
	}
	// Die Höhe des aktuellen Sonnenstandes im Horizontalsystem
	// The level of the current position of the sun in the horizontal system
	if (Number(arrHorizon[1]) < 0.0){
		document.getElementById("actualhighsun").title = "Der aktuelle Hoehe des Sonnenstandes in dezimalen Grad - Die Sonne ist unter dem Horizont!";
		document.getElementById("actualhighsun").style.color = "red";
		document.getElementById("actualhighsun").value = Number(arrHorizon[1]);
	}else{
		document.getElementById("actualhighsun").title = "Der aktuelle Hoehe des Sonnenstandes in dezimalen Grad - Die Sonne ist ueber dem Horizont!";
		document.getElementById("actualhighsun").style.color = "green";
		document.getElementById("actualhighsun").value = Number(arrHorizon[1]);
	}
	// Hier der Aufruf zur Berechnung der Mondpositionen ...
	// Here is the call to calculate the moon positions ...
	//var RADEC = moonParameters(calcJD(day, month, year, hour, minute, second, millisecond, sendString));
	// Die Rektaszension des aktuellen Sonnenstandes im Äquatorialsystem
	// The recaszension of the current position of the sun in the equatorial system
	document.getElementById("actualrasun").value = Number(arrHorizon[2]);
	// Die Deklination des aktuellen Sonnenstandes im Äquatorialsystem
	// The declination of the current position of the sun in the equatorial system
	document.getElementById("actualdecsun").value = Number(arrHorizon[3]);
	// Berechnung der Mondparameter ...
	moonParameters(JDLT, arrHorizon[2], arrHorizon[3], Number(selectedItemDST.value) - 1, Number(selectedItemTimezone.value), objLongitude.value, objLatitude.value, /*sendArray,*/ "manual");
	
}// End of getTimeValues()