<script>

	

    function dIni(date){
		return date.slice(0,10);
	}
	function dEnd(date){
		return date.slice(13,23);
	}
	var a = document.getElementById('idioma');
              if (a.value == "es") {
				<?php if (defined("BANDERA_ES")) { ?>
					document.getElementById('banderaPais').innerHTML = '<span class="flag-icon flag-icon-<?php echo BANDERA_ES; ?>"></span>&nbsp;';
				<?php } else { ?>
					document.getElementById('banderaPais').innerHTML = '<span class="flag-icon flag-icon-mx"></span>&nbsp;';
				<?php } ?>
              } else {

                document.getElementById('banderaPais').innerHTML = '<span class="flag-icon flag-icon-um"></span>&nbsp;';

              }

	var gauge;
	var today = new Date();
			var dd = today.getDate();
			var mm = today.getMonth() + 1; //January is 0!
			var yyyy = today.getFullYear();
			if (dd < 10) {
			dd = '0' + dd;
			}
			if (mm < 10) {
			mm = '0' + mm;
			}
			var hour  = today.getHours();// This method gets the hour
    	var min   = today.getMinutes();
			var today = yyyy+ '-' + mm + '-' + dd;
			$('#pickDate').val(today+" - "+today);
			$('.datepicker').css('z-index',10000);
			$('#wa_horaI').val(hour + ':' + min);
			$('#wa_horaF').val(hour + ':' + min);

	function cambiaAguja() {
		setTimeout(() => {
			var gauge = null;
			var opts = {
				percentColors: [
					[0.0, "#a9d70b"],
					[0.5, "#f9c802"],
					[1.0, "#ff0000"]
				],
				staticLabels: {
					font: "15px sans-serif",
					labels: [],
					color: "#000000",
					fractionDigits: 0
				},
				angle: 0.15,
				lineWidth: 0.44,
				radiusScale: 1,
				pointer: {
					length: 0.6,
					strokeWidth: 0.035,
					color: "#000000"
				},
				limitMax: false,
				limitMin: false,
				colorStart: "#6FADCF",
				colorStop: "#8FC0DA",
				strokeColor: "#E0E0E0",
				generateGradient: true,
				highDpiSupport: true
			};

			var target = document.getElementById("foo"); // your canvas element
			target.removeAttribute('width');
			target.removeAttribute('height');
			target.removeAttribute('style');
			gauge = new Gauge(target).setOptions(opts);
			var x = Math.round(app.maximoInt*100);
			gauge.maxValue = app.maximoInt*100;
			gauge.setMinValue(0);
			gauge.animationSpeed = 20;
			if ((x % 2) == 0) {
				gauge.options.staticLabels.labels = [0, Math.round(x / 4), Math.round(x / 2), Math.round((3 * x) / 4), x]
			} else {
				gauge.options.staticLabels.labels = [0, Math.round(x / 3), Math.round((2 * x) / 3), x]

			}
			gauge.set(app.gaugeVal*100, 100);
		}, 200)
	}


	$(document).ready(function () {
		$('.datepicker').css('z-index',10000);
		var Arreglo = $('select');
		for (var i = 0; i < Arreglo.length; i++) {
			if (Arreglo[i].id != '' && Arreglo[i].options != null) {
				$("#" + Arreglo[i].id).formSelect();
			}
		}
	});

	document.addEventListener("DOMContentLoaded", function () {
		var elems2 = document.querySelectorAll('.modal');
		var instances2 = M.Modal.init(elems2, {
			dismissible: false,
			onOpenEnd: function (modal, trigger) {
				var opts = {
					percentColors: [
						[0.0, "#a9d70b"],
						[0.5, "#f9c802"],
						[1.0, "#ff0000"]
					],
					staticLabels: {
						font: "15px sans-serif",
						labels: [0, 2, 4, 6, 8],
						color: "#000000",
						fractionDigits: 0
					},
					angle: 0.15,
					lineWidth: 0.44,
					radiusScale: 1,
					pointer: {
						length: 0.6,
						strokeWidth: 0.035,
						color: "#000000"
					},
					limitMax: false,
					limitMin: false,
					colorStart: "#6FADCF",
					colorStop: "#8FC0DA",
					strokeColor: "#E0E0E0",
					generateGradient: true,
					highDpiSupport: true
				};

				var target = document.getElementById("foo"); // your canvas element
				gauge = new Gauge(target).setOptions(opts);

				gauge.maxValue = parseFloat(app.maximoInt);

				gauge.animationSpeed = 20;
				var x = gauge.maxValue;
				if ((x % 2) == 0) {
					gauge.options.staticLabels.labels = [0, Math.round(x / 4), Math.round(x / 2), Math.round((3 * x) / 4), x]

				} else {
					gauge.options.staticLabels.labels = [0, Math.round(x / 3), Math.round((2 * x) / 3), x]

				}
				gauge.set(parseFloat(app.gaugeVal), 100);


			},
		});
	});
</script>