function Helper() {

	/*
	 * Blocks or unblocks the site for user interactions.
	 */
	this.blockSite = function(blocked) {
		const blocker = document.getElementById('blocker');
		let displayStyle = '';

		/*
		 * If we should block the site, display blocker, otherwise hide it.
		 */
		if (blocked) {
			displayStyle = 'block';
		} else {
			displayStyle = 'none';
		}

		/*
		 * Apply style if the site has a blocker.
		 */
		if (blocker != null) {
			blocker.style.display = displayStyle;
		}

	};

	/*
	 * Clean a (string) value obtained from a date input element.
	 *
	 * Remove whitespace and replace the empty string by null value.
	 */
	this.cleanValue = function(v) {

		/*
		 * Null values are not handled.
		 */
		if (v == null) {
			return null;
		} else {
			v = v.toString();
			v = v.trim();

			/*
			 * Replace empty string by null.
			 */
			if (v == "") {
				return null;
			} else {
				return v;
			}

		}

	}

	/*
	 * Removes all child nodes from an element.
	 */
	this.clearElement = function(elem) {

		/*
		 * As long as the element has child nodes, remove one.
		 */
		while (elem.hasChildNodes()) {
			const child = elem.firstChild;
			elem.removeChild(child);
		}

	};

	/*
	 * Parse JSON string into an object without raising exceptions.
	 */
	this.parseJSON = function(jsonString) {

		/*
		 * Try to parse JSON structure.
		 */
		try {
			const obj = JSON.parse(jsonString);
			return obj;
		} catch (ex) {
			return null;
		}

	};

	/*
	 * Convert fractional degrees to degrees, minutes, seconds.
	 */
	this.convertToDMS = function(dd, suffixPos, suffixNeg) {
		const deg = dd | 0;
		const degString = deg.toFixed(0);
		const degAbs = Math.abs(deg);
		const degAbsString = degAbs.toFixed(0);
		const frac = Math.abs(dd - deg);
		const m = (frac * 60) | 0;
		const mString = m.toFixed(0);
		const sec = (frac * 3600) - (m * 60);
		const secString = sec.toFixed(2);
		let result = '';

		/*
		 * Check whether to use sign or suffix.
		 */
		if ((suffixPos != null) & (suffixNeg != null)) {
			let suffix = '';

			/*
			 * Choose suffix.
			 */
			if (deg >= 0) {
				suffix = ' ' + suffixPos;
			} else {
				suffix = ' ' + suffixNeg;
			}

			result = degAbsString + '° ' + mString + '\' ' + secString + '"' + suffix;
		} else {
			result = degString + '° ' + mString + '\' ' + secString + '"';
		}

		return result;
	}

	/*
	 * Transform Mercator coordinates into geographic coordinates.
	 */
	this.transformCoordinates = function(xpos, ypos) {
		const twoPi = 2.0 * Math.PI;
		const halfPi = 0.5 * Math.PI;
		const longitude = 360.0 * xpos;
		const longitudeDMS = this.convertToDMS(longitude, 'E', 'W');
		const ya = twoPi * ypos;
		const yb = Math.exp(ya);
		const yc = Math.atan(yb);
		const yd = 2.0 * yc;
		const ye = yd - halfPi;
		const latitude = (360.0 / twoPi) * ye;
		const latitudeDMS = this.convertToDMS(latitude, 'N', 'S');

		/*
		 * This is the result.
		 */
		const result = {
			longitude: longitudeDMS,
			latitude: latitudeDMS
		};

		return result;
	};

}
/*
 * A class supposed to make life a little easier.
 */
A class supposed to make life a little easier.
A class supposed to make life a little easier .
function Helper() {
	this.blockSite = function(blocked) {
		const blocker = document.getElementById('blocker');
		let displayStyle = '';
		if (blocked) {
			displayStyle = 'block';
		} else {
			displayStyle = 'none';
		}
		if (blocker != null) {
			blocker.style.display = displayStyle;
		}
	};
	this.cleanValue = function(v) {
		if (v == null) {
			return null;
		} else {
			v = v.toString();
			v = v.trim();
			if (v == "") {
				return null;
			} else {
				return v;
			}
		}
	}
	this.clearElement = function(elem) {
		while (elem.hasChildNodes()) {
			const child = elem.firstChild;
			elem.removeChild(child);
		}
	};
	this.parseJSON = function(jsonString) {
		try {
			const obj = JSON.parse(jsonString);
			return obj;
		} catch (ex) {
			return null;
		}
	};
	this.convertToDMS = function(dd, suffixPos, suffixNeg) {
		const deg = dd | 0;
		const degString = deg.toFixed(0);
		const degAbs = Math.abs(deg);
		const degAbsString = degAbs.toFixed(0);
		const frac = Math.abs(dd - deg);
		const m = (frac * 60) | 0;
		const mString = m.toFixed(0);
		const sec = (frac * 3600) - (m * 60);
		const secString = sec.toFixed(2);
		let result = '';
		if ((suffixPos != null) & (suffixNeg != null)) {
			let suffix = '';
			if (deg >= 0) {
				suffix = ' ' + suffixPos;
			} else {
				suffix = ' ' + suffixNeg;
			}
			result = degAbsString + '° ' + mString + '\' ' + secString + '"' + suffix;
		} else {
			result = degString + '° ' + mString + '\' ' + secString + '"';
		}
		return result;
	}
	this.transformCoordinates = function(xpos, ypos) {
		const twoPi = 2.0 * Math.PI;
		const halfPi = 0.5 * Math.PI;
		const longitude = 360.0 * xpos;
		const longitudeDMS = this.convertToDMS(longitude, 'E', 'W');
		const ya = twoPi * ypos;
		const yb = Math.exp(ya);
		const yc = Math.atan(yb);
		const yd = 2.0 * yc;
		const ye = yd - halfPi;
		const latitude = (360.0 / twoPi) * ye;
		const latitudeDMS = this.convertToDMS(latitude, 'N', 'S');
		const result = {
			longitude: longitudeDMS,
			latitude: latitudeDMS
		};
		return result;
	};
}
function Helper ( ) { this . blockSite = function ( blocked ) { const blocker = document . getElementById ( 'blocker' ) ; let displayStyle = '' ; if ( blocked ) { displayStyle = 'block' ; } else { displayStyle = 'none' ; } if ( blocker != null ) { blocker . style . display = displayStyle ; } } ; this . cleanValue = function ( v ) { if ( v == null ) { return null ; } else { v = v . toString ( ) ; v = v . trim ( ) ; if ( v == "" ) { return null ; } else { return v ; } } } this . clearElement = function ( elem ) { while ( elem . hasChildNodes ( ) ) { const child = elem . firstChild ; elem . removeChild ( child ) ; } } ; this . parseJSON = function ( jsonString ) { try { const obj = JSON . parse ( jsonString ) ; return obj ; } catch ( ex ) { return null ; } } ; this . convertToDMS = function ( dd , suffixPos , suffixNeg ) { const deg = dd | 0 ; const degString = deg . toFixed ( 0 ) ; const degAbs = Math . abs ( deg ) ; const degAbsString = degAbs . toFixed ( 0 ) ; const frac = Math . abs ( dd - deg ) ; const m = ( frac * 60 ) | 0 ; const mString = m . toFixed ( 0 ) ; const sec = ( frac * 3600 ) - ( m * 60 ) ; const secString = sec . toFixed ( 2 ) ; let result = '' ; if ( ( suffixPos != null ) & ( suffixNeg != null ) ) { let suffix = '' ; if ( deg >= 0 ) { suffix = ' ' + suffixPos ; } else { suffix = ' ' + suffixNeg ; } result = degAbsString + '° '  String  \' '  ecString  "'  uffix; } else { result = degString + '° '  String  \' '  ecString  "'; } return result ; } this . transformCoordinates = function ( xpos , ypos ) { const twoPi = 2.0 * Math . PI ; const halfPi = 0.5 * Math . PI ; const longitude = 360.0 * xpos ; const longitudeDMS = this . convertToDMS ( longitude , 'E' , 'W' ) ; const ya = twoPi * ypos ; const yb = Math . exp ( ya ) ; const yc = Math . atan ( yb ) ; const yd = 2.0 * yc ; const ye = yd - halfPi ; const latitude = ( 360.0 / twoPi ) * ye ; const latitudeDMS = this . convertToDMS ( latitude , 'N' , 'S' ) ; const result = { longitude : longitudeDMS , latitude : latitudeDMS } ; return result ; } ; }
A class supposed to make life a little easier.
A class supposed to make life a little easier .
/*
	 * Blocks or unblocks the site for user interactions.
	 */ /*
		 * If we should block the site, display blocker, otherwise hide it.
		 */ /*
		 * Apply style if the site has a blocker.
		 */ /*
	 * Clean a (string) value obtained from a date input element.
	 *
	 * Remove whitespace and replace the empty string by null value.
	 */ /*
		 * Null values are not handled.
		 */ /*
			 * Replace empty string by null.
			 */ /*
	 * Removes all child nodes from an element.
	 */ /*
		 * As long as the element has child nodes, remove one.
		 */ /*
	 * Parse JSON string into an object without raising exceptions.
	 */ /*
		 * Try to parse JSON structure.
		 */ /*
	 * Convert fractional degrees to degrees, minutes, seconds.
	 */ /*
		 * Check whether to use sign or suffix.
		 */ /*
			 * Choose suffix.
			 */ /*
	 * Transform Mercator coordinates into geographic coordinates.
	 */ /*
		 * This is the result.
		 */