String.prototype.format = function (e) { var t = this; if (arguments.length > 0) if (arguments.length == 1 && typeof e == "object") { for (var n in e) if (e[n] != undefined) { var r = new RegExp("({" + n + "})", "g"); t = t.replace(r, e[n]) } } else for (var i = 0; i < arguments.length; i++) if (arguments[i] != undefined) { var r = new RegExp("({)" + i + "(})", "g"); t = t.replace(r, arguments[i]) } return t };
String.prototype.subStrEx = function (e) { return this.length + 3 > e ? this.substr(0, e) + "..." : this };
function isUndefined(e) { return "undefined" == typeof e };
var JSON1 = {};
JSON1.request = function (url, success, error) { if (url.indexOf("&callback=?") < 0) { if (url.indexOf("?") > 0) { url += "&callback=?" } else { url += "?callback=?" } } $.ajax({ async: true, url: url, type: "get", dataType: "jsonp", jsonp: "callback", success: function (result) { if (typeof (success) == 'function') { success(typeof (result) == 'string' ? eval(result) : result) } }, error: function () { if (typeof (error) == 'function') { error() } } }) };
JSON.jsonp = function (url, funcCallback) { window.parseLocation = function (results) { var response = $.parseJSON(results); document.body.removeChild(document.getElementById('getJsonP')); delete window.parseLocation; if (funcCallback) { funcCallback(response) } }; function getJsonP(url) { url = url + '&callback=parseLocation'; var script = document.createElement('script'); script.id = 'getJsonP'; script.src = url; script.async = true; document.body.appendChild(script) } if (XMLHttpRequest) { var xhr = new XMLHttpRequest(); if ('withCredentials' in xhr) { var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState == 4) { if (xhr.status == 200) { var response = $.parseJSON(xhr.responseText); if (funcCallback) { funcCallback(response) } } else if (xhr.status == 0 || xhr.status == 400) { getJsonP(url) } else { } } }; xhr.open('GET', url, true); xhr.send() } else if (XDomainRequest) { var xdr = new XDomainRequest(); xdr.onerror = function (err) { }; xdr.onload = function () { var response = JSON.parse(xdr.responseText); if (funcCallback) { funcCallback(response) } }; xdr.open('GET', url); xdr.send() } else { getJsonP(url) } } };
JSON1.requestPost = function (url, data, success, error) { $.ajax({ async: true, url: url, data: data, type: "POST", dataType: "json", success: function (result) { if (typeof (success) == 'function') { success(typeof (result) == 'string' ? eval(result) : result) } }, error: function () { if (typeof (error) == 'function') { error() } } }) };
function randomIntFromInterval(min, max) { // min and max included
	return Math.floor(Math.random() * (max - min + 1) + min);
}
CustomerInfo = {};
CustomerInfo.TimeZone = moment().utcOffset() / 60;

Protocol = {
	MarkerIcon: [
		L.icon({
			iconUrl: '../resources/images/marker.svg',
			iconSize: [32, 32], // size of the icon
			iconAnchor: [17, 55], // point of the icon which will correspond to marker's location
			popupAnchor: [0, -60] // point from which the popup should open relative to the iconAnchor
		}),
		L.icon({
			iconUrl: '../resources/images/marker2.svg',
			iconSize: [32, 32], // size of the icon
			iconAnchor: [17, 55], // point of the icon which will correspond to marker's location
			popupAnchor: [0, -60] // point from which the popup should open relative to the iconAnchor
		}),
		L.icon({
			iconUrl: '../resources/images/marker3.svg',
			iconSize: [32, 32], // size of the icon
			iconAnchor: [20, 39], // point of the icon which will correspond to marker's location
			popupAnchor: [0, -40] // point from which the popup should open relative to the iconAnchor
		}),
		L.icon({
			iconUrl: '../resources/images/info-pin.svg',
			iconSize: [32, 32], // size of the icon
			iconAnchor: [16, 31], // point of the icon which will correspond to marker's location
			popupAnchor: [0, -32] // point from which the popup should open relative to the iconAnchor
		}),
		L.icon({
			iconUrl: '../resources/images/pin-alarm.svg',
			iconSize: [32, 32], // size of the icon
			iconAnchor: [16, 31], // point of the icon which will correspond to marker's location
			popupAnchor: [0, -32] // point from which the popup should open relative to the iconAnchor
		}),
		L.icon({
			iconUrl: '../resources/images/pin-accon.svg',
			iconSize: [32, 32], // size of the icon
			iconAnchor: [16, 31], // point of the icon which will correspond to marker's location
			popupAnchor: [0, -32] // point from which the popup should open relative to the iconAnchor
		}),
		L.icon({
			iconUrl: '../resources/images/pin-stopped.svg',
			iconSize: [32, 32], // size of the icon
			iconAnchor: [16, 31], // point of the icon which will correspond to marker's location
			popupAnchor: [0, -32] // point from which the popup should open relative to the iconAnchor
		}),
		L.icon({
			iconUrl: '../resources/images/pin-out-geofence.svg',
			iconSize: [32, 32], // size of the icon
			iconAnchor: [16, 31], // point of the icon which will correspond to marker's location
			popupAnchor: [0, -32] // point from which the popup should open relative to the iconAnchor
		}),
		L.icon({
			iconUrl: '../resources/images/pin-in-geofence.svg',
			iconSize: [32, 32], // size of the icon
			iconAnchor: [16, 31], // point of the icon which will correspond to marker's location
			popupAnchor: [0, -32] // point from which the popup should open relative to the iconAnchor
		}),
		L.icon({
			iconUrl: '../resources/images/search-address-pin.svg',
			iconSize: [32, 32], // size of the icon
			iconAnchor: [16, 31], // point of the icon which will correspond to marker's location
			popupAnchor: [0, -32] // point from which the popup should open relative to the iconAnchor
		}),
		L.icon({
			iconUrl: '../resources/images/moving2.svg',
			iconSize: [32, 32], // size of the icon
			iconAnchor: [16, 31], // point of the icon which will correspond to marker's location
			popupAnchor: [0, -32] // point from which the popup should open relative to the iconAnchor
		}),
		L.icon({
			iconUrl: '../resources/images/moving.svg',
			iconSize: [32, 32], // size of the icon
			iconAnchor: [16, 31], // point of the icon which will correspond to marker's location
			popupAnchor: [0, -32] // point from which the popup should open relative to the iconAnchor
		}),
		L.icon({
			iconUrl: '../resources/images/offline.svg',
			iconSize: [32, 32], // size of the icon
			iconAnchor: [16, 31], // point of the icon which will correspond to marker's location
			popupAnchor: [0, -32] // point from which the popup should open relative to the iconAnchor
		}),
		L.icon({
			iconUrl: '../resources/images/ignition-off.svg',
			iconSize: [32, 32], // size of the icon
			iconAnchor: [16, 31], // point of the icon which will correspond to marker's location
			popupAnchor: [0, -32] // point from which the popup should open relative to the iconAnchor
		}),
		L.icon({
			iconUrl: '../resources/images/ignition-on.svg',
			iconSize: [32, 32], // size of the icon
			iconAnchor: [16, 31], // point of the icon which will correspond to marker's location
			popupAnchor: [0, -32] // point from which the popup should open relative to the iconAnchor
		}),

	],
	UpgradeToLive: [
		{
			url: 'https://activation.warden.quiktrak.eu/app/upgrade-to-live.php',
			code: 36
		},
		{
			url: 'https://activation.gps-secure.co/upgrade-to-live.php',
			code: 30
		},
		{
			url: 'https://activation.western.gps-secure.co/app/upgrade-to-live.php',
			code: 55
		},
		{
			url: 'https://activation.cobra.gps-secure.co/app/upgrade-to-live.php',
			code: 57
		},
		{
			url: 'https://activation.autoprotect.quiktrak.eu/app/upgrade-to-live.php',
			code: 45
		},
		{
			url: 'https://activation.boatwatch.quiktrak.eu/app/upgrade-to-live.php',
			code: 15
		},
		{
			url: 'https://activation.al3rt.gps-secure.co/app/upgrade-to-live.php',
			code: 33
		},
	],
	TrackingInterval: [
		{
			'1': {
				AUS: {
					cost: 5.50 + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG03,  //month
					button: 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LT53RSYE5B4A2',
					payPlanCode: 'LT53RSYE5B4A2',
				},
				OTHER: {
					cost: 0.00 + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG03,  //month
					button: '',
					payPlanCode: '',
				},
			},
			'2': {
				AUS: {
					cost: 66.00 + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG12,    // year
					button: 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4P2ZLZU7KYZ8G',
					payPlanCode: '4P2ZLZU7KYZ8G',
				},
				OTHER: {
					cost: 0.00 + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG12,    // year
					button: '',
					payPlanCode: '',
				},
			},
			intervalDisplayed: '12' + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG10,
			interval: 720,
		},
		{
			'1': {
				AUS: {
					cost: 8.00 + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG03,
					button: 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MT2SUYZ35R7GL',
					payPlanCode: '2WHU48K4XUFSS'
				},
				OTHER: {
					cost: 2.00 + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG03,
					button: 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2WHU48K4XUFSS',
					payPlanCode: '2WHU48K4XUFSS'
				},
			},
			'2': {
				AUS: {
					cost: 96.00 + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG12,
					button: 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LQYYAZFFYW9D6',
					payPlanCode: 'L9S33552S62Q6'
				},
				OTHER: {
					cost: 20.00 + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG12,
					button: 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=L9S33552S62Q6',
					payPlanCode: 'L9S33552S62Q6'
				},

			},
			intervalDisplayed: '6' + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG10,
			interval: 360,
		},
		{
			'1': {
				AUS: {
					cost: 12.00 + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG03,
					button: 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZPUNBTBMQU594',
					payPlanCode: 'FHWEQYJU4J7PG'
				},
				OTHER: {
					cost: 5.00 + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG03,
					button: 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FHWEQYJU4J7PG',
					payPlanCode: 'FHWEQYJU4J7PG'
				},
			},
			'2': {
				AUS: {
					cost: 144.00 + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG12,
					button: 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W7ZNFJ976H7CL',
					payPlanCode: 'KHH32FAY82TTC'
				},
				OTHER: {
					cost: 50.00 + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG12,
					button: 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KHH32FAY82TTC',
					payPlanCode: 'KHH32FAY82TTC'
				},
			},
			intervalDisplayed: '1' + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG09,
			interval: 60,
		},
		{
			'1': {
				AUS: {
					cost: 16.50 + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG03,
					button: 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VMDPGMUUAFTFC',
					payPlanCode: 'S52J34JS89MTU'
				},
				OTHER: {
					cost: 10.00 + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG03,
					button: 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=S52J34JS89MTU',
					payPlanCode: 'S52J34JS89MTU'
				},
			},
			'2': {
				AUS: {
					cost: 198.00 + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG12,
					button: 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BDR3HC6Z4AX9U',
					payPlanCode: '8ZRAGALKV27D2'
				},
				OTHER: {
					cost: 100.00 + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG12,
					button: 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8ZRAGALKV27D2',
					payPlanCode: '8ZRAGALKV27D2'
				},
			},
			intervalDisplayed: '30' + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG07,
			interval: 30,
		},
		{
			'1': {
				AUS: {
					cost: 19.00 + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG03,
					button: 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LB6GD39K98M6U',
					payPlanCode: 'W4LJDLLA4DNHU'
				},
				OTHER: {
					cost: 20.00 + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG03,
					button: 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W4LJDLLA4DNHU',
					payPlanCode: 'W4LJDLLA4DNHU'
				},
			},
			'2': {
				AUS: {
					cost: 228.00 + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG12,
					button: 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3HDP3UANR3KBQ',
					payPlanCode: 'W7N6LKCNNLT6S'
				},
				OTHER: {
					cost: 200.00 + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG12,
					button: 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W7N6LKCNNLT6S',
					payPlanCode: 'W7N6LKCNNLT6S'
				},

			},
			intervalDisplayed: '1' + ' ' + LANGUAGE.ASSET_TRACKING_INTERVAL_MSG11,
			interval: 1,
		},
	],
	PositionTypes: {
		"NONE": 0,
		"GPS": 1,
		"LBS": 2,
		"GPSLBS": 3,
		"IRIDIUM": 4,
		"COMPASS": 8,
		"GLONASS": 16,
		"WiFi": 32
	},
	DeviceStatus: {
		"Disable": 0,
		"Normal": 1,
		"Overdue": -1
	},
	PositionAlerts: {
		"None": 0,
		"Custom": 1,
		"SOS": 2,
		"ElectricCutoff": 4,
		"InGeoFance": 8,
		"OutGeoFance": 16,
		"HighSpeed": 32,
		"LowSpeed": 64,
		"Theft": 128,
		"Vibrate": 256,
		"LowPower": 512,
		"Moving": 1024,
		"Fire": 2048,
		"MedicalHelp": 4096,
		"Defence": 8192,
		"Destroy": 16384,
		"ACCON": 32768,
		"ACCOFF": 65536,
		"INPUT1": 131072,
		"INPUT2": 262144,
		"INPUT1_LOW": 524288,
		"INPUT2_LOW": 1048576,

		"INPUT3": 134217728,
		"INPUT3_LOW": 268435456,
		"INPUT4": 536870912,
		"INPUT4_LOW": 1073741824,

		"HardBrake": 2097152,
		"LowTemp": 4194304,
		"HighTemp": 8388608,
		"FatigueDriving": 16777216,
		"Accelerate": 33554432,
		"Offline": 67108864,
		"INPUT3": 134217728,
		"INPUT3_OFF": 268435456,
		"INPUT4": 536870912,
		"INPUT4_OFF": 1073741824,
	},
	PositionStatus: {
		"NONE": 0,
		"ACC": 1,
		"Static": 2,
		"Power": 4,
		"Charging": 8,
		"BeProtected": 16,
		"ACC2": 32,
		"Relay": 64,
		"ForceSave": 2097152,
		"input1": 8192,
		"input2": 16384,
	},
	EventClasses: {
		"PROTOCOL_DEFINED": 0,
		"ALERT": 1,
		"ACC": 2,
		"STATIC": 4,
		"COMMAND": 8,
		"POI": 16,
		"ACC2": 32,
		"GEOLOCK": 64,
		"ACC3": 128,
		"SERVICEINTERVAL": 256,
		"NEW_SERVICEINTERVAL": 512,
		"POI_STATION": 1024
	},
	EventCommandTypes: {
		"NONE": 0,
		"REQUEST": 1,
		"RESPONSE": 2
	},
	ProductFeatures: {
        /*"Static":256,
        "Holder":32768,
        "FuelSensor":2048,
        "Acc":128,
        "Direct":4,
        "Acc2":131072,
        "LatLng":1,
        "GpsSignal":64,
        "OBD":8192,
        "Battery":1024,
        "DrivingTime":65536,
        "RFIDCard":16384,
        "GsmSignal":32,
        "Mileage":16,
        "None":0,
        "TempSensor":4096,
        "Alt":2,
        "Speed":8,
        "Voltage":512*/
		None: 0,
		LatLng: 1,
		Alt: 2,
		Direct: 4,
		Speed: 8,
		Mileage: 16,
		GsmSignal: 32,
		GpsSignal: 64,
		Acc: 128,
		Static: 256,
		Voltage: 512,
		Battery: 1024,
		FuelSensor: 2048,
		TempSensor: 4096,
		OBD: 8192,
		RFIDCard: 16384,
		Holder: 32768,
		DrivingTime: 65536,
		Acc2: 131072,
		Heartrate: 262144,
		Charging: 524288,
		BrakePedal: 1048576,
		Camera: 2097152,
		HarshBracking: 4194304,
		HarshAcceleration: 8388608,
		Input1: 16777216,
		Input3: 33554432,
		Input4: 67108864,
		Output1: 134217728,
		Output2: 268435456,
	},
	ProductInputFeatures: {
		Input1: 16777216,
		Input2: 131072,

		Input3: 33554432,
		Input4: 67108864,
		Output1: 134217728,
		Output2: 268435456,
	},
	InputActiveState: {
		Input1: 512,
		Input2: 128,
		Input3: 1024,
		Input4: 2048,
		Output1: 4096,
		Output2: 8192,

		/*Input3: 33554432,
		Input4: 67108864,
		Output1: 134217728,
		Output2: 268435456,*/
	},
	StatusNewEnum: {
		"Geolock": 1,
		"Immobilise": 2,
		"LockDoor": 4,
	},
	CustomerTypes: {
		Agent: 2,
		Enterprise: 4,
		Personal: 5,
		Dealer: 6,
		Master: 7,
		ProtectEnterprise: 8,
	},
	UserRoleTypes: {
		Admin: 1,
		Controller: 2,
		Installer: 4,
		Dirver: 5,
		User: 6,
		Standard: 7,
		View: 9,
		ViewOnly: 10,
		FullAccess: 11
	},
	DaysOfWeek: [
		{
			val: 0,
			name: LANGUAGE.COM_MSG38,
			nameSmall: LANGUAGE.COM_MSG45,
		},
		{
			val: 1,
			name: LANGUAGE.COM_MSG39,
			nameSmall: LANGUAGE.COM_MSG46,
		},
		{
			val: 2,
			name: LANGUAGE.COM_MSG40,
			nameSmall: LANGUAGE.COM_MSG47,
		},
		{
			val: 3,
			name: LANGUAGE.COM_MSG41,
			nameSmall: LANGUAGE.COM_MSG48,
		},
		{
			val: 4,
			name: LANGUAGE.COM_MSG42,
			nameSmall: LANGUAGE.COM_MSG49,
		},
		{
			val: 5,
			name: LANGUAGE.COM_MSG43,
			nameSmall: LANGUAGE.COM_MSG50,
		},
		{
			val: 6,
			name: LANGUAGE.COM_MSG44,
			nameSmall: LANGUAGE.COM_MSG51,
		},
	],

	Permissions2Enum: {
		MonthlyAccountReport: 64,
	},

	Helper: {
		getSpeedValue: function (speedUnit, speed) {
			let ret = 0;
			switch (speedUnit) {
				case "KT":
					ret = parseFloat(speed * 0.53995680345572);
					break;
				case "KPH":
					ret = parseFloat(speed);
					break;
				case "MPS":
					ret = parseFloat(speed * 0.277777778);
					break;
				case "MPH":
					ret = parseFloat(speed * 0.621371192);
					break;
				default:
					break;
			}
			return Math.round(ret);
		},
		getSpeedValueInKM: function (speedUnit, speed) {
			let ret = 0;
			switch (speedUnit) {
				case "KT":
					ret = parseFloat(speed / 0.53995680345572);
					break;
				case "KPH":
					ret = parseFloat(speed);
					break;
				case "MPS":
					ret = parseFloat(speed / 0.277777778);
					break;
				case "MPH":
					ret = parseFloat(speed / 0.621371192);
					break;
				default:
					break;
			}
			return Math.round(ret);
		},
		getSpeedUnit: function (speedUnit) {
			var ret = "";
			switch (speedUnit) {
				case "KT":
					ret = "kt";
					break;
				case "KPH":
					ret = "km/h";
					break;
				case "MPS":
					ret = "m/s";
					break;
				case "MPH":
					ret = "mile/h";
					break;
				default:
					break;
			}
			return ret;
		},
		getMileageValue: function (speedUnit, mileage) {
			var ret = 0;
			switch (speedUnit) {
				case "KT":
					ret = parseInt(mileage * 0.53995680345572);
					break;
				case "KPH":
					ret = parseInt(mileage);
					break;
				case "MPS":
					ret = parseInt(mileage * 1000);
					break;
				case "MPH":
					ret = parseInt(mileage * 0.62137119223733);
					break;
				default:
					break;
			}
			return ret;
		},
		getMileageUnit: function (speedUnit) {
			var ret = "";
			switch (speedUnit) {
				case "KT":
					ret = "mile";
					break;
				case "KPH":
					ret = "km";
					break;
				case "MPS":
					ret = "m";
					break;
				case "MPH":
					ret = "mile";
					break;
				default:
					break;
			}
			return ret;
		},
		getMileage: function (asset, mileage) {
			var ret = 0;
			//console.log('m',Protocol.Helper.getMileageValue(asset.Unit, mileage),',', parseInt(asset.InitMileage) ,',',parseInt(asset._FIELD_FLOAT7), '=',Protocol.Helper.getMileageValue(asset.Unit, mileage) + parseInt(asset.InitMileage) + parseInt(asset._FIELD_FLOAT7))
			ret = (Protocol.Helper.getMileageValue(asset.Unit, mileage) + parseInt(asset.InitMileage) + parseInt(asset._FIELD_FLOAT7)) + '&nbsp;' + Protocol.Helper.getMileageUnit(asset.Unit);
			return ret;
		},
		getEngineHours: function (asset, launchHours) {
			var ret = 0;
			ret = TimeSpan(parseInt(launchHours) * 1000 + parseInt(asset.InitAcconHours) * 60 * 60 * 1000 + parseInt(asset._FIELD_FLOAT8) * 1000).format("^hh:mm:ss");
			return ret;
		},
		getDirectionCardinal: function (direction) {
			var ret = "";
			direction = parseFloat(direction);
			switch (true) {
				case (direction >= 338 || direction <= 22):
					ret = LANGUAGE.COM_MSG19;
					break;
				case (direction >= 23 && direction <= 75):
					ret = LANGUAGE.COM_MSG20;
					break;
				case (direction >= 76 && direction <= 112):
					ret = LANGUAGE.COM_MSG21;
					break;
				case (direction >= 113 && direction <= 157):
					ret = LANGUAGE.COM_MSG22;
					break;
				case (direction >= 158 && direction <= 202):
					ret = LANGUAGE.COM_MSG23;
					break;
				case (direction >= 203 && direction <= 247):
					ret = LANGUAGE.COM_MSG24;
					break;
				case (direction >= 248 && direction <= 292):
					ret = LANGUAGE.COM_MSG25;
					break;
				case (direction >= 293 && direction <= 337):
					ret = LANGUAGE.COM_MSG26;
					break;
				default: ret = LANGUAGE.COM_MSG27;
			}
			return ret;
		},
		getPositionType: function (type) {
			var ret = "";
			switch (type) {
				case 0: case 1:
					ret = "GPS";
					break;
				case 2:
					ret = "LBS";
					break;
				case 3:
					ret = "GPSLBS";
					break;
				case 4:
					ret = "IRIDIUM";
					break;
				case 8:
					ret = "COMPASS";
					break;
				case 16:
					ret = "GLONASS";
					break;
				case 32:
					ret = "WiFi";
					break;
			}
			return ret;

		},
		getReportTypeName: function (type) {
			var ret = "";
			switch (type) {
				case '1': // Low Battery
					ret = LANGUAGE.REPORT_PANEL_MSG00;
					break;
				case '3': // Not Reporting
					ret = LANGUAGE.REPORT_PANEL_MSG02;
					break;
				case '4': //Power Disconnect
					ret = LANGUAGE.REPORT_PANEL_MSG01;
					break;
				case '5': //Devices Sold
					ret = LANGUAGE.REPORT_PANEL_MSG03;
					break;
				case '6': //In Lot
					ret = LANGUAGE.REPORT_PANEL_MSG06;
					break;
				case '7': //Off Lot
					ret = LANGUAGE.REPORT_PANEL_MSG05;
					break;
				case '8': //Drive Off
					ret = LANGUAGE.REPORT_PANEL_MSG07;
					break;
				case '9': //Alarm
					ret = LANGUAGE.REPORT_PANEL_MSG08;
					break;
				case '10': //LOT OVERVIEW
					ret = LANGUAGE.REPORT_PANEL_MSG65;
					break;
				case '11': //GEOFENCE OVERVIEW
					ret = LANGUAGE.REPORT_PANEL_MSG80;
					break;
				case '12': //TRIP REPORT
					ret = LANGUAGE.REPORT_PANEL_MSG79;
					break;
				case '13': //Servicing OVERVIEW REPORT
					ret = LANGUAGE.REPORT_PANEL_MSG78;
					break;
				case '14': //OVERVIEW REPORT
					ret = LANGUAGE.REPORT_PANEL_MSG77;
					break;
				case '15': //LOT OVERVIEW 2
					ret = LANGUAGE.REPORT_PANEL_MSG65;
					break;
				case '16': //Fringe Benefit Tax
					ret = LANGUAGE.REPORT_PANEL_MSG152;
					break;
				case '17': //Fuel Tax Credit
					ret = LANGUAGE.REPORT_PANEL_MSG153;
					break;
				case '18': //Fleet Report
					ret = LANGUAGE.REPORT_PANEL_MSG154;
					break;
				case '19': //PlayBack Report
					ret = LANGUAGE.REPORT_PANEL_MSG182;
					break;
				case '20': //Devices Installed
					ret = LANGUAGE.REPORT_PANEL_MSG183;
					break;
				case '21': //Missing VIN
					ret = LANGUAGE.REPORT_PANEL_MSG185;
					break;
				case '22': //Missing Stock Number
					ret = LANGUAGE.REPORT_PANEL_MSG186;
					break;
				case '23': //Devices Installed data from current account for dashboard
					ret = LANGUAGE.REPORT_PANEL_MSG188;
					break;
				case '24': //Devices In Inventory
					ret = LANGUAGE.REPORT_PANEL_MSG189;
					break;
				case '25': //Devices Installed data from server log for reports
					ret = LANGUAGE.REPORT_PANEL_MSG188;
					break;
				case '26': //Devices Deactivated data from server log for reports
					ret = LANGUAGE.REPORT_PANEL_MSG193;
					break;
				case '27': //Devices Deactivated data from current account for dashboard
					ret = LANGUAGE.REPORT_PANEL_MSG193;
					break;
				case '28': //Driver Behaviour
					ret = LANGUAGE.REPORT_PANEL_MSG197;
					break;
				case '29': //Driver Behaviour
					ret = LANGUAGE.REPORT_PANEL_MSG209;
					break;
				case '30': //Asset Listing
					ret = LANGUAGE.REPORT_PANEL_MSG219;
					break;
			}
			return ret;

		},
		getEventTypeName: function (eventClass, eventType) {
			let ret = '';
			eventClass += '';
			eventType += '';
			switch (eventClass) {
				case '2':
					eventType == '1' ? ret = LANGUAGE.ASSET_ALARM_MSG11 : ret = LANGUAGE.ASSET_ALARM_MSG10;
					break;
				case '4':
					eventType == '1' ? ret = LANGUAGE.REPORT_PANEL_MSG136 : ret = LANGUAGE.REPORT_PANEL_MSG135;
					break;
			}
			return ret;
		},
		getOverviewReportOptions: function () {
			let ret = [
				{
					Value: "STATIC",
					Name: LANGUAGE.REPORT_PANEL_MSG119,
				},
				{
					Value: "MOVE",
					Name: LANGUAGE.REPORT_PANEL_MSG120,
				},
				{
					Value: "ACC",
					Name: LANGUAGE.REPORT_PANEL_MSG121,
				},
				{
					Value: "ACC2",
					Name: LANGUAGE.REPORT_PANEL_MSG124
				},
				{
					Value: "MILEAGE",
					Name: LANGUAGE.REPORT_PANEL_MSG122,
				},
				{
					Value: "FUEL_CONSUMED",
					Name: LANGUAGE.REPORT_PANEL_MSG123,
				},
				{
					Value: "TOTAL_MILEAGE",
					Name: LANGUAGE.REPORT_PANEL_MSG125,
				},
			];

			return ret;
		},
		getTripReportOptions: function () {
			let ret = [
				{
					Value: 1,
					Name: LANGUAGE.REPORT_PANEL_MSG146,
				},
                /*{
                    Value: 2,
                    Name: LANGUAGE.REPORT_PANEL_MSG120,
                },
                {
                    Value: 4,
                    Name: LANGUAGE.REPORT_PANEL_MSG121,
                },*/

			];

			return ret;
		},
		getTripReportOptionsSelected: function (val) {
			let ret = {};
			if (val) {
				if ((parseInt(val, 10) & 1) > 0) {
					ret.Coordinates = true;
				}
			}
			return ret;
		},
		getTripPurposeOptions: function () {
			let ret = [
				{
					Value: "private",
					Name: LANGUAGE.COM_MSG77,
					Selected: true
				},
				{
					Value: "business",
					Name: LANGUAGE.COM_MSG76,
				},
				{
					Value: "custom",
					Name: LANGUAGE.COM_MSG78,
					//Disabled: true
				},

			];

			return ret;
		},
		getFBTOptions: function () {
			let ret = [
				{
					Value: 2,
					Name: LANGUAGE.REPORT_PANEL_MSG159,
				},
				{
					Value: 1,
					Name: LANGUAGE.REPORT_PANEL_MSG146,
				},
				{
					Value: 4,
					Name: LANGUAGE.REPORT_PANEL_MSG160,
				},
                /*{
                    Value: 8,
                    Name: LANGUAGE.REPORT_PANEL_MSG161,
                },
                {
                    Value: 16,
                    Name: LANGUAGE.REPORT_PANEL_MSG162,
                },
                {
                    Value: 32,
                    Name: LANGUAGE.REPORT_PANEL_MSG163,
                },
                {
                    Value: 64,
                    Name: LANGUAGE.REPORT_PANEL_MSG164,
                },*/
				{
					Value: 128,
					Name: LANGUAGE.REPORT_PANEL_MSG165,
				},
                /*{
                    Value: 256,
                    Name: LANGUAGE.REPORT_PANEL_MSG166,
                },
                {
                    Value: 512,
                    Name: LANGUAGE.REPORT_PANEL_MSG167,
                },*/
                /*{
                    Value: 1024,
                    Name: LANGUAGE.REPORT_PANEL_MSG171,
                },*/
				{
					Value: 2048,
					Name: LANGUAGE.REPORT_PANEL_MSG172,
				},

			];

			return ret;
		},
		getFBTOptionsSelected: function (val) {
			let ret = {};
			if (val) {

				if ((parseInt(val, 10) & 1) > 0) {
					ret.Coordinates = true;
				}
				if ((parseInt(val, 10) & 2) > 0) {
					ret.AvgSpeed = true;
				}
				if ((parseInt(val, 10) & 4) > 0) {
					ret.MaxSpeed = true;
				}
				if ((parseInt(val, 10) & 8) > 0) {
					ret.TotalDuration = true;
				}
				if ((parseInt(val, 10) & 16) > 0) {
					ret.TotalMileage = true;
				}
				if ((parseInt(val, 10) & 32) > 0) {
					ret.TotalMileageB = true;
				}
				if ((parseInt(val, 10) & 64) > 0) {
					ret.TotalMileageP = true;
				}
				if ((parseInt(val, 10) & 128) > 0) {
					ret.TotalFuel = true;
				}
				if ((parseInt(val, 10) & 256) > 0) {
					ret.TotalFuelB = true;
				}
				if ((parseInt(val, 10) & 512) > 0) {
					ret.TotalFuelP = true;
				}
				if ((parseInt(val, 10) & 1024) > 0) {
					ret.TotalMileageBP = true;
				}
				if ((parseInt(val, 10) & 2048) > 0) {
					ret.TotalFuelBP = true;
				}
			}
			return ret;
		},
		getFTCOptions: function () {
			let ret = [
				{
					Value: 2,
					Name: LANGUAGE.REPORT_PANEL_MSG159,
				},
				{
					Value: 1,
					Name: LANGUAGE.REPORT_PANEL_MSG146,
				},
				{
					Value: 4,
					Name: LANGUAGE.REPORT_PANEL_MSG160,
				},
                /*{
                    Value: 8,
                    Name: LANGUAGE.REPORT_PANEL_MSG161,
                },
                {
                    Value: 16,
                    Name: LANGUAGE.REPORT_PANEL_MSG162,
                },
                {
                    Value: 32,
                    Name: LANGUAGE.REPORT_PANEL_MSG163,
                },
                {
                    Value: 64,
                    Name: LANGUAGE.REPORT_PANEL_MSG164,
                }, {
                    Value: 128,
                    Name: LANGUAGE.REPORT_PANEL_MSG165,
                },{
                    Value: 256,
                    Name: LANGUAGE.REPORT_PANEL_MSG166,
                },
                {
                    Value: 512,
                    Name: LANGUAGE.REPORT_PANEL_MSG167,
                },
                {
                    Value: 1024,
                    Name: LANGUAGE.REPORT_PANEL_MSG171,
                },
                {
                    Value: 2048,
                    Name: LANGUAGE.REPORT_PANEL_MSG172,
                },*/

			];

			return ret;
		},
		getDriverIdOptions: function () {
			return [
				{
					Value: 1,
					Name: LANGUAGE.REPORT_PANEL_MSG159,
				},
				{
					Value: 2,
					Name: LANGUAGE.REPORT_PANEL_MSG160,
				},
                /*{
                    Value: 4,
                    Name: LANGUAGE.REPORT_PANEL_MSG217,
                },
                {
                    Value: 8,
                    Name: LANGUAGE.REPORT_PANEL_MSG216,
                },*/

			]
		},
		getDriverIdOptionsSelected: function (val) {
			let ret = {};
			if (val) {
				if ((parseInt(val, 10) & 1) > 0) {
					ret.AvgSpeed = true;
				}
				if ((parseInt(val, 10) & 2) > 0) {
					ret.MaxSpeed = true;
				}
			}
			return ret;
		},

		getTableOverviewRowNames: function (obj) {
			let ret = [];
			if (!app.methods.isObjEmpty(obj)) {
				let keys = Object.keys(obj);
				for (const key of keys) {
					switch (key) {
						case 'AS_IMEI':
							ret.push({
								DisplayName: 'IMEI',
								Key: key,
							});
							break;

						case 'AS_NAME':
							ret.push({
								DisplayName: LANGUAGE.REPORT_PANEL_MSG37,  //Asset Name
								Key: key,
							});
							break;

						case 'ACC2':
							ret.push({
								DisplayName: LANGUAGE.REPORT_PANEL_MSG132,    //ACC2
								Key: key,
							});
							break;

						case 'ACC_TIMES':
							ret.push({
								DisplayName: LANGUAGE.REPORT_PANEL_MSG128, //No. of Engine Start
								Key: key,
							});
							break;

						case 'ACC_TIMESPAN':
							ret.push({
								DisplayName: LANGUAGE.REPORT_PANEL_MSG129,    //Engine Hours
								Key: key,
							});
							break;

						case 'ACC_TOTAL_TIMESPAN':
							ret.push({
								DisplayName: LANGUAGE.REPORT_PANEL_MSG130,  //Total Engine Hours
								Key: key,
							});
							break;

						case 'FUEL_CONSUMED':
							ret.push({
								DisplayName: LANGUAGE.REPORT_PANEL_MSG123,  //Fuel Consumed
								Key: key,
							});
							break;

						case 'MILEAGE':
							ret.push({
								DisplayName: LANGUAGE.REPORT_PANEL_MSG122, //Mileage
								Key: key,
							});
							break;

						case 'MOVE_TIMESPAN':
							ret.push({
								DisplayName: LANGUAGE.REPORT_PANEL_MSG127,  //Move Hours
								Key: key,
							});
							break;

						case 'STATIC_TIMES':
							ret.push({
								DisplayName: LANGUAGE.REPORT_PANEL_MSG131,    //No. of Stops
								Key: key,
							});
							break;

						case 'STATIC_TIMESPAN':
							ret.push({
								DisplayName: LANGUAGE.REPORT_PANEL_MSG126,    //Stationary Time
								Key: key,
							});
							break;

						case 'TOTAL_MILEAGE':
							ret.push({
								DisplayName: LANGUAGE.REPORT_PANEL_MSG125,    //Total Mileage Time
								Key: key,
							});
							break;

						case 'ALERTS':
							ret.push({
								DisplayName: LANGUAGE.REPORT_PANEL_MSG55,  //Alerts
								Key: key,
							});
							break;

						case 'POI_IN':
							ret.push({
								DisplayName: LANGUAGE.REPORT_ALERT_LIST_MSG05, //Enter Geofences
								Key: key,
							});
							break;

						case 'POI_OUT':
							ret.push({
								DisplayName: LANGUAGE.REPORT_ALERT_LIST_MSG06, //Leave Geofences
								Key: key,
							});
							break;


					}

					//ret.push(obj[key]);
				}
			}
			return ret;
		},
		//in developing
		getreportListByCustomerType: function (CustomerType) {
			let ret = [];
			if (CustomerType == 2 || CustomerType == 6) {
				ret = [
					{
						value: 1,
						name: LANGUAGE.REPORT_PANEL_MSG00,
						icon: 'icon-report-low-battery',
						bgColor: 'bg-color-1',
						description: LANGUAGE.REPORT_PANEL_MSG09,
						selected: false
					},
					{
						value: 4,
						name: LANGUAGE.REPORT_PANEL_MSG01,
						icon: 'icon-report-disconnect',
						bgColor: 'bg-color-2',
						description: LANGUAGE.REPORT_PANEL_MSG10,
						selected: false
					},
					{
						value: 3,
						name: LANGUAGE.REPORT_PANEL_MSG02,
						icon: 'icon-report-not-reporting',
						bgColor: 'bg-color-3',
						description: LANGUAGE.REPORT_PANEL_MSG11,
						selected: false
					},
					{
						value: 5,
						name: LANGUAGE.REPORT_PANEL_MSG03,
						icon: 'icon-report-sold',
						bgColor: 'bg-color-4',
						description: LANGUAGE.REPORT_PANEL_MSG12,
						selected: false
					},
					{
						value: 6,
						name: LANGUAGE.REPORT_PANEL_MSG06,
						icon: 'icon-report-in-lot',
						bgColor: 'bg-color-5',
						description: LANGUAGE.REPORT_PANEL_MSG13,
						selected: false
					},
					{
						value: 7,
						name: LANGUAGE.REPORT_PANEL_MSG05,
						icon: 'icon-report-off-lot',
						bgColor: 'bg-color-6',
						description: LANGUAGE.REPORT_PANEL_MSG14,
						selected: false
					},
					{
						value: 10,
						name: LANGUAGE.REPORT_PANEL_MSG65,
						icon: 'icon-report-lot-overview',
						bgColor: 'bg-color-7',
						description: LANGUAGE.REPORT_PANEL_MSG71,
						selected: false
					},
					{
						value: 8,
						name: LANGUAGE.REPORT_PANEL_MSG07,
						icon: 'icon-report-drive-off',
						bgColor: 'bg-color-8',
						description: LANGUAGE.REPORT_PANEL_MSG16,
						selected: false
					},
					{
						value: 9,
						name: LANGUAGE.REPORT_PANEL_MSG08,
						icon: 'icon-report-alarm-report',
						bgColor: 'bg-color-9',
						description: LANGUAGE.REPORT_PANEL_MSG17,
						selected: false
					}
				];
			} else {
				ret = [
					{
						value: 1,
						name: LANGUAGE.REPORT_PANEL_MSG00,
						icon: 'icon-report-low-battery',
						bgColor: 'bg-color-1',
						description: LANGUAGE.REPORT_PANEL_MSG09,
						selected: false
					},
					{
						value: 4,
						name: LANGUAGE.REPORT_PANEL_MSG01,
						icon: 'icon-report-disconnect',
						bgColor: 'bg-color-2',
						description: LANGUAGE.REPORT_PANEL_MSG10,
						selected: false
					},
					{
						value: 3,
						name: LANGUAGE.REPORT_PANEL_MSG02,
						icon: 'icon-report-not-reporting',
						bgColor: 'bg-color-3',
						description: LANGUAGE.REPORT_PANEL_MSG11,
						selected: false
					},
					{
						value: 11,
						name: LANGUAGE.REPORT_PANEL_MSG80,
						icon: 'icon-admin-geofences',
						bgColor: 'bg-color-5',
						description: LANGUAGE.REPORT_PANEL_MSG81,
						selected: false
					},
					{
						value: 12,
						name: LANGUAGE.REPORT_PANEL_MSG79,
						icon: 'icon-report-trip',
						bgColor: 'bg-color-8',
						description: LANGUAGE.REPORT_PANEL_MSG95,
						selected: false
					},
					{
						value: 13,
						name: LANGUAGE.REPORT_PANEL_MSG78,
						icon: 'icon-report-servicing-log',
						bgColor: 'bg-color-6',
						description: LANGUAGE.REPORT_PANEL_MSG117,
						selected: false
					},
					{
						value: 9,
						name: LANGUAGE.REPORT_PANEL_MSG08,
						icon: 'bg-color-9',
						bgColor: 'icon-report-alarm-report',
						description: LANGUAGE.REPORT_PANEL_MSG17,
						selected: false
					}
				]
			}
			return ret;
		},
		getAletTypeName: function (type) {
			var ret = "";
			type = '' + type;
			switch (type) {
				
				case '1': ret = 'CUSTOM'; break; // SOS Duress
				case '2': ret = LANGUAGE.ASSET_ALARM_MSG19; break; // SOS Duress
				case '4': ret = LANGUAGE.ASSET_ALARM_MSG18; break; // Power Disconnect
				case '8': ret = LANGUAGE.ASSET_ALARM_MSG12; break; // Enter Geofence
				case '16': ret = LANGUAGE.ASSET_ALARM_MSG13; break; // Leave Geofence
				case '32': ret = LANGUAGE.REPORT_ALERT_LIST_MSG07; break; // Speed Alert
				case '64': ret = 'Low Speed'; break; // Low Speed
				case '128': ret = LANGUAGE.ASSET_ALARM_MSG27; break; // Intrusion Alert
				case '256': ret = LANGUAGE.ASSET_ALARM_MSG07; break; // Tilt / Shock
				case '512': ret = LANGUAGE.ASSET_ALARM_MSG17; break; // Low Battery
				case '1024': ret = LANGUAGE.ASSET_ALARM_MSG05; break; // Geolock Alert
				case '2048': ret = 'Fire'; break; // Fire
				case '4096': ret = 'Medical Help'; break; // MedicalHelp
				case '8192': ret = 'Defence'; break; // MedicalHelp
				case '16384': ret = LANGUAGE.REPORT_ALERT_LIST_MSG16; break; // Impact / Crash
				case '32768': ret = LANGUAGE.ASSET_ALARM_MSG11; break; // Ignition On
				case '65536': ret = LANGUAGE.ASSET_ALARM_MSG10; break; // Ignition Off
				case '131072': ret = LANGUAGE.ASSET_ALARM_MSG22; break; // Positive Input
				case '262144': ret = 'Input2'; break; // Input2
				case '524288': ret = 'INPUT1_LOW'; break; // INPUT1_LOW
				case '1048576': ret = LANGUAGE.ASSET_ALARM_MSG20; break; // Negative Input
				case '2097152': ret = LANGUAGE.ASSET_ALARM_MSG29; break; // Harsh Bracking
				case '4194304': ret = 'LowTemp'; break; // LowTemp
				case '8388608': ret = 'HighTemp'; break; // HighTemp
				case '16777216': ret = LANGUAGE.ASSET_ALARM_MSG44; break; // Fatigue Driving
				case '33554432': ret = LANGUAGE.ASSET_ALARM_MSG28; break; // Harsh Accelerate
				case '67108864': ret = 'Offline'; break; // Offline
				case '134217728': ret = 'INPUT3'; break; // INPUT3
				case '268435456': ret = 'INPUT3_OFF'; break; // INPUT3_OFF
				case '536870912': ret = 'INPUT4'; break; // INPUT4
				case '1073741824': ret = 'INPUT4_OFF'; break; // INPUT4_OFF
			               
			}
			return ret;
		},

		getRoleList: function () {
			return [
				{ Name: 'None', Code: '0' },
				{ Name: 'Admin', Code: '1' },
				{ Name: 'Client', Code: '2' },
				{ Name: 'Monitor', Code: '3' },
				{ Name: 'Installer', Code: '4' },
				{ Name: 'Driver', Code: '5' },
				{ Name: 'User', Code: '6' },
				{ Name: 'Visitor', Code: '7' },
				{ Name: 'Support', Code: '8' },
				{ Name: 'Visitor2', Code: '9' },
				{ Name: 'Loc8ViewOnly', Code: '10' },
				{ Name: 'Loc8FullAccess', Code: '11' },
			]

		},
		getInstallationOptionsInput1: function () {
			return [
				{
					value: "NONE",
					name: LANGUAGE.COM_MSG111,
					icon: '',
				}, {
					value: "ACC2",
					name: LANGUAGE.ASSET_EDIT_MSG32,
					icon: 'icon-input-car-alarm',
				}, {
					value: "ALARM",
					name: LANGUAGE.ASSET_EDIT_MSG43,
					icon: 'icon-input-car-alarm3',
				}, {
					value: "BILGE",
					name: LANGUAGE.ASSET_EDIT_MSG35,
					icon: 'icon-input-bilge-alarm',
				}, {
					value: "DOOR",
					name: LANGUAGE.ASSET_EDIT_MSG33,
					icon: 'icon-input-door-alarm',
				}, {
					value: "PTO",
					name: LANGUAGE.ASSET_EDIT_MSG34,
					icon: 'icon-input-pto-alarm',
				}, {
					value: "SHORE",
					name: LANGUAGE.ASSET_EDIT_MSG36,
					icon: 'icon-input-shore-power',
				}, {
					value: "PLOW",
					name: LANGUAGE.ASSET_EDIT_MSG44,
					icon: 'icon-input-snow-plow',
				}, {
					value: "TILT",
					name: LANGUAGE.ASSET_EDIT_MSG37,
					icon: 'icon-input-tilt-alarm',
				}, {
					value: "Input 1",
					name: LANGUAGE.ASSET_EDIT_MSG30,
					icon: 'icon-input-car-alarm',
				}, {
					value: "Input 2",
					name: LANGUAGE.ASSET_EDIT_MSG31,
					icon: 'icon-input-car-alarm',
				}, {
					value: "Input 3",
					name: LANGUAGE.ASSET_EDIT_MSG30,
					icon: 'icon-input-car-alarm',
				}, {
					value: "Input 4",
					name: LANGUAGE.ASSET_EDIT_MSG31,
					icon: 'icon-input-car-alarm',
				}
			]
		},
		getInstallationOptionsInput2: function () {
			return [
				{
					value: "NONE",
					name: LANGUAGE.COM_MSG111,
					icon: '',
				}, {
					value: "ACC2",
					name: LANGUAGE.ASSET_EDIT_MSG32,
					icon: 'icon-input-car-alarm',
				}, {
					value: "ALARM",
					name: LANGUAGE.ASSET_EDIT_MSG43,
					icon: 'icon-input-car-alarm3',
				}, {
					value: "BILGE",
					name: LANGUAGE.ASSET_EDIT_MSG35,
					icon: 'icon-input-bilge-alarm',
				}, {
					value: "DOOR",
					name: LANGUAGE.ASSET_EDIT_MSG33,
					icon: 'icon-input-door-alarm',
				}, {
					value: "PTO",
					name: LANGUAGE.ASSET_EDIT_MSG34,
					icon: 'icon-input-pto-alarm',
				}, {
					value: "SHORE",
					name: LANGUAGE.ASSET_EDIT_MSG36,
					icon: 'icon-input-shore-power',
				}, {
					value: "PLOW",
					name: LANGUAGE.ASSET_EDIT_MSG44,
					icon: 'icon-input-snow-plow',
				}, {
					value: "TILT",
					name: LANGUAGE.ASSET_EDIT_MSG37,
					icon: 'icon-input-tilt-alarm',
				}, {
					value: "Input 1",
					name: LANGUAGE.ASSET_EDIT_MSG30,
					icon: 'icon-input-car-alarm',
				}, {
					value: "Input 2",
					name: LANGUAGE.ASSET_EDIT_MSG31,
					icon: 'icon-input-car-alarm',
				}, {
					value: "Input 3",
					name: LANGUAGE.ASSET_EDIT_MSG30,
					icon: 'icon-input-car-alarm',
				}, {
					value: "Input 4",
					name: LANGUAGE.ASSET_EDIT_MSG31,
					icon: 'icon-input-car-alarm',
				}
			]
		},
		getInstallationOptionsInput3: function () {
			return [
				{
					value: "NONE",
					name: LANGUAGE.COM_MSG111,
					icon: '',
				}, {
					value: "ACC2",
					name: LANGUAGE.ASSET_EDIT_MSG32,
					icon: 'icon-input-car-alarm',
				}, {
					value: "ALARM",
					name: LANGUAGE.ASSET_EDIT_MSG43,
					icon: 'icon-input-car-alarm3',
				}, {
					value: "BILGE",
					name: LANGUAGE.ASSET_EDIT_MSG35,
					icon: 'icon-input-bilge-alarm',
				}, {
					value: "DOOR",
					name: LANGUAGE.ASSET_EDIT_MSG33,
					icon: 'icon-input-door-alarm',
				}, {
					value: "PTO",
					name: LANGUAGE.ASSET_EDIT_MSG34,
					icon: 'icon-input-pto-alarm',
				}, {
					value: "SHORE",
					name: LANGUAGE.ASSET_EDIT_MSG36,
					icon: 'icon-input-shore-power',
				}, {
					value: "PLOW",
					name: LANGUAGE.ASSET_EDIT_MSG44,
					icon: 'icon-input-snow-plow',
				}, {
					value: "TILT",
					name: LANGUAGE.ASSET_EDIT_MSG37,
					icon: 'icon-input-tilt-alarm',
				}, {
					value: "Input 1",
					name: LANGUAGE.ASSET_EDIT_MSG30,
					icon: 'icon-input-car-alarm',
				}, {
					value: "Input 2",
					name: LANGUAGE.ASSET_EDIT_MSG31,
					icon: 'icon-input-car-alarm',
				}, {
					value: "Input 3",
					name: LANGUAGE.ASSET_EDIT_MSG30,
					icon: 'icon-input-car-alarm',
				}, {
					value: "Input 4",
					name: LANGUAGE.ASSET_EDIT_MSG31,
					icon: 'icon-input-car-alarm',
				}
			]
		},
		getInstallationOptionsInput4: function () {
			return [
				{
					value: "NONE",
					name: LANGUAGE.COM_MSG111,
					icon: '',
				}, {
					value: "ACC2",
					name: LANGUAGE.ASSET_EDIT_MSG32,
					icon: 'icon-input-car-alarm',
				}, {
					value: "ALARM",
					name: LANGUAGE.ASSET_EDIT_MSG43,
					icon: 'icon-input-car-alarm3',
				}, {
					value: "BILGE",
					name: LANGUAGE.ASSET_EDIT_MSG35,
					icon: 'icon-input-bilge-alarm',
				}, {
					value: "DOOR",
					name: LANGUAGE.ASSET_EDIT_MSG33,
					icon: 'icon-input-door-alarm',
				}, {
					value: "PTO",
					name: LANGUAGE.ASSET_EDIT_MSG34,
					icon: 'icon-input-pto-alarm',
				}, {
					value: "SHORE",
					name: LANGUAGE.ASSET_EDIT_MSG36,
					icon: 'icon-input-shore-power',
				}, {
					value: "PLOW",
					name: LANGUAGE.ASSET_EDIT_MSG44,
					icon: 'icon-input-snow-plow',
				}, {
					value: "TILT",
					name: LANGUAGE.ASSET_EDIT_MSG37,
					icon: 'icon-input-tilt-alarm',
				}, {
					value: "Input 1",
					name: LANGUAGE.ASSET_EDIT_MSG30,
					icon: 'icon-input-car-alarm',
				}, {
					value: "Input 2",
					name: LANGUAGE.ASSET_EDIT_MSG31,
					icon: 'icon-input-car-alarm',
				}, {
					value: "Input 3",
					name: LANGUAGE.ASSET_EDIT_MSG30,
					icon: 'icon-input-car-alarm',
				}, {
					value: "Input 4",
					name: LANGUAGE.ASSET_EDIT_MSG31,
					icon: 'icon-input-car-alarm',
				}
			]
		},
		getInstallationOptionsInput5: function () {
			return [
				{
					value: "NONE",
					name: LANGUAGE.COM_MSG111,
					icon: '',
				}, {
					value: "ACC2",
					name: LANGUAGE.ASSET_EDIT_MSG32,
					icon: 'icon-input-car-alarm',
				}, {
					value: "ALARM",
					name: LANGUAGE.ASSET_EDIT_MSG43,
					icon: 'icon-input-car-alarm3',
				}, {
					value: "BILGE",
					name: LANGUAGE.ASSET_EDIT_MSG35,
					icon: 'icon-input-bilge-alarm',
				}, {
					value: "DOOR",
					name: LANGUAGE.ASSET_EDIT_MSG33,
					icon: 'icon-input-door-alarm',
				}, {
					value: "PTO",
					name: LANGUAGE.ASSET_EDIT_MSG34,
					icon: 'icon-input-pto-alarm',
				}, {
					value: "SHORE",
					name: LANGUAGE.ASSET_EDIT_MSG36,
					icon: 'icon-input-shore-power',
				}, {
					value: "PLOW",
					name: LANGUAGE.ASSET_EDIT_MSG44,
					icon: 'icon-input-snow-plow',
				}, {
					value: "TILT",
					name: LANGUAGE.ASSET_EDIT_MSG37,
					icon: 'icon-input-tilt-alarm',
				},
			]
		},
		getInstallationOptionsInput6: function () {
			return [
				{
					value: "NONE",
					name: LANGUAGE.COM_MSG111,
					icon: '',
				}, {
					value: "ACC2",
					name: LANGUAGE.ASSET_EDIT_MSG32,
					icon: 'icon-input-car-alarm',
				}, {
					value: "ALARM",
					name: LANGUAGE.ASSET_EDIT_MSG43,
					icon: 'icon-input-car-alarm3',
				}, {
					value: "BILGE",
					name: LANGUAGE.ASSET_EDIT_MSG35,
					icon: 'icon-input-bilge-alarm',
				}, {
					value: "DOOR",
					name: LANGUAGE.ASSET_EDIT_MSG33,
					icon: 'icon-input-door-alarm',
				}, {
					value: "PTO",
					name: LANGUAGE.ASSET_EDIT_MSG34,
					icon: 'icon-input-pto-alarm',
				}, {
					value: "SHORE",
					name: LANGUAGE.ASSET_EDIT_MSG36,
					icon: 'icon-input-shore-power',
				}, {
					value: "PLOW",
					name: LANGUAGE.ASSET_EDIT_MSG44,
					icon: 'icon-input-snow-plow',
				}, {
					value: "TILT",
					name: LANGUAGE.ASSET_EDIT_MSG37,
					icon: 'icon-input-tilt-alarm',
				}
			]
		},
		getInstallationOptionsOutput1: function () {
			return [
				{
					value: "NONE",
					name: LANGUAGE.COM_MSG111,
					icon: '',
				},
			]
		},
		getInstallationOptionsOutput2: function () {
			return [
				{
					value: "NONE",
					name: LANGUAGE.COM_MSG111,
					icon: '',
				},
			]
		},
		getSolutionTypeIcon: function (type) {
			var ret = "icon-solution";
			if (type) {
				type = type.toLowerCase();
				if (type.indexOf('protect') !== -1) {
					ret = 'icon-solution-protect';
				} else if (type.indexOf('loc8') !== -1) {
					ret = 'icon-solution-loc8';
				} else if (type.indexOf('track') !== -1) {
					ret = 'icon-solution-track';
				} else if (type.indexOf('watch') !== -1) {
					ret = 'icon-solution-watch';
				}
				switch (type) {
					case 'protect':
					case 'qprotect':
					case 'witiprotect':
					case 'witiqprotect':
						ret = 'icon-solution-protect';
						break;
					case 'loc8':
						ret = 'icon-solution-loc8';
						break;
					case 'track':
					case 'wititrack':
					case 'boat_watch':
						ret = 'icon-solution-track';
						break;
					case 'watch':
						ret = 'icon-solution-watch';
						break;
				}
			}
			return ret;
		},
		getIntervalServiceTypeIcon: function (type) {
			var ret = "icon-interval-reminder-custom";
			if (type) {
				type = '' + type;
				switch (type) {
					case '1':
						ret = 'icon-interval-reminder-engine';
						break;
					case '2':
						ret = 'icon-interval-reminder-tyre';
						break;
					case '3':
						ret = 'icon-interval-reminder-registration';
						break;
					case '4':
						ret = 'icon-interval-reminder-insurance';
						break;
				}
			}
			return ret;
		},
		getTimePeriodNames: function (timePeriod) {
			var ret = {};
			if (timePeriod) {
				timePeriod = '' + timePeriod;

				switch (timePeriod) {
					case '11':
						ret = {
							Name: LANGUAGE.COM_MSG62,
							Name1: LANGUAGE.COM_MSG63,
							Name2: LANGUAGE.COM_MSG64,

							DescrName: moment().startOf('week').format('dddd, MMMM Do') + ' - ' + moment().format('dddd, MMMM Do'),
							DescrName1: moment().subtract(1, 'weeks').startOf('week').format('dddd, MMMM Do') + ' - ' + moment().subtract(1, 'weeks').endOf('week').format('dddd, MMMM Do'),
							DescrName2: moment().subtract(1, 'months').startOf('month').format('MMMM Do') + ' - ' + moment().subtract(1, 'months').endOf('month').format('MMMM Do'),
						};
						break;
					case '21':
						ret = {
							Name: LANGUAGE.COM_MSG65,
							Name1: LANGUAGE.COM_MSG66,
							Name2: LANGUAGE.COM_MSG67,

							DescrName: moment().startOf('month').format('MMMM Do') + ' - ' + moment().format('MMMM Do'),
							DescrName1: moment().subtract(1, 'months').startOf('month').format('MMMM Do') + ' - ' + moment().subtract(1, 'months').endOf('month').format('MMMM Do'),
							DescrName2: moment().subtract(4, 'months').startOf('month').format('MMMM Do') + ' - ' + moment().subtract(2, 'months').endOf('month').format('MMMM Do'),
						};
						break;
					case '31':
						ret = {
							Name: moment().subtract(2, 'months').format('MMM') + ' - ' + moment().format('MMM'), //3 + ' ' + LANGUAGE.COM_MSG61,
							Name1: moment().subtract(5, 'months').format('MMM') + ' - ' + moment().subtract(3, 'months').format('MMM'),
							Name2: moment().subtract(8, 'months').format('MMM') + ' - ' + moment().subtract(6, 'months').format('MMM'),

							DescrName: moment().subtract(2, 'months').startOf('month').format('MMMM Do') + ' - ' + moment().endOf('month').format('MMMM Do'),
							DescrName1: moment().subtract(5, 'months').startOf('month').format('MMMM Do') + ' - ' + moment().subtract(3, 'months').endOf('month').format('MMMM Do'),
							DescrName2: moment().subtract(8, 'months').startOf('month').format('MMMM Do') + ' - ' + moment().subtract(6, 'months').endOf('month').format('MMMM Do'),
						};
						break;
					case '41':
						ret = {
							Name: moment().subtract(5, 'months').format('MMM') + ' - ' + moment().format('MMM'), //6 + ' ' + LANGUAGE.COM_MSG61,
							Name1: moment().subtract(11, 'months').format('MMM') + ' - ' + moment().subtract(6, 'months').format('MMM'),
							Name2: moment().subtract(17, 'months').format('MMM Y') + ' - ' + moment().subtract(12, 'months').format('MMM Y'),

							DescrName: moment().subtract(5, 'months').startOf('month').format('MMMM Do') + ' - ' + moment().endOf('month').format('MMMM Do'),
							DescrName1: moment().subtract(11, 'months').startOf('month').format('MMMM Do') + ' - ' + moment().subtract(6, 'months').endOf('month').format('MMMM Do'),
							DescrName2: moment().subtract(17, 'months').startOf('month').format('MMMM Do Y') + ' - ' + moment().subtract(12, 'months').endOf('month').format('MMMM Do Y'),
						};
						break;
					case '51':
						ret = {
							Name: moment().subtract(11, 'months').format('MMM Y') + ' - ' + moment().format('MMM Y'), //12 + ' ' + LANGUAGE.COM_MSG61,
							Name1: moment().subtract(23, 'months').format('MMM Y') + ' - ' + moment().subtract(12, 'months').format('MMM Y'),
							Name2: moment().subtract(35, 'months').format('MMM Y') + ' - ' + moment().subtract(24, 'months').format('MMM Y'),

							DescrName: moment().subtract(11, 'months').startOf('month').format('MMMM Do Y') + ' - ' + moment().endOf('month').format('MMMM Do Y'),
							DescrName1: moment().subtract(23, 'months').startOf('month').format('MMMM Do Y') + ' - ' + moment().subtract(12, 'months').endOf('month').format('MMMM Do Y'),
							DescrName2: moment().subtract(35, 'months').startOf('month').format('MMMM Do Y') + ' - ' + moment().subtract(24, 'months').endOf('month').format('MMMM Do Y'),
						};
						break;
					case '61':
						ret = {
							Name: moment().startOf('year').format('MMM Y') + ' - ' + moment().format('MMM Y'), //12 + ' ' + LANGUAGE.COM_MSG61,
							Name1: moment().startOf('year').subtract(1, 'years').format('MMM Y') + ' - ' + moment().endOf('year').subtract(1, 'years').format('MMM Y'),
							Name2: moment().startOf('year').subtract(2, 'years').format('MMM Y') + ' - ' + moment().endOf('year').subtract(2, 'years').format('MMM Y'),

							DescrName: moment().startOf('year').format('MMMM Do Y') + ' - ' + moment().format('MMMM Do Y'),
							DescrName1: moment().startOf('year').subtract(1, 'years').format('MMMM Do Y') + ' - ' + moment().endOf('year').subtract(1, 'years').format('MMMM Do Y'),
							DescrName2: moment().startOf('year').subtract(2, 'years').format('MMMM Do Y') + ' - ' + moment().endOf('year').subtract(2, 'years').format('MMMM Do Y'),
						};
						break;
				}
			} else {
				ret = {
					Name: '',
					Name1: LANGUAGE.COM_MSG62,
					Name2: LANGUAGE.COM_MSG65,

					DescrName: '',
					DescrName1: moment().startOf('week').format('dddd, MMMM Do') + ' - ' + moment().format('dddd, MMMM Do'),
					DescrName2: moment().startOf('month').format('MMMM Do') + ' - ' + moment().format('MMMM Do'),
				};
			}
			return ret;
		},
		getWeekArray: function () {
			return [
				{
					val: 0,
					name: LANGUAGE.COM_MSG38,
					displayAs: LANGUAGE.COM_MSG45,
					selected: false,
				},
				{
					val: 1,
					name: LANGUAGE.COM_MSG39,
					displayAs: LANGUAGE.COM_MSG46,
					selected: false,
				},
				{
					val: 2,
					name: LANGUAGE.COM_MSG40,
					displayAs: LANGUAGE.COM_MSG47,
					selected: false,
				},
				{
					val: 3,
					name: LANGUAGE.COM_MSG41,
					displayAs: LANGUAGE.COM_MSG48,
					selected: false,
				},
				{
					val: 4,
					name: LANGUAGE.COM_MSG42,
					displayAs: LANGUAGE.COM_MSG49,
					selected: false,
				},
				{
					val: 5,
					name: LANGUAGE.COM_MSG43,
					displayAs: LANGUAGE.COM_MSG50,
					selected: false,
				},
				{
					val: 6,
					name: LANGUAGE.COM_MSG44,
					displayAs: LANGUAGE.COM_MSG51,
					selected: false,
				},
			];
		},
		getWeekDayByNumber: function (num) {
			ret = ''
			num = '' + num;
			switch (num) {
				case '0':
					ret = {
						val: 0,
						name: LANGUAGE.COM_MSG38,
						displayAs: LANGUAGE.COM_MSG45,
					};
					break;
				case '1':
					ret = {
						val: 1,
						name: LANGUAGE.COM_MSG39,
						displayAs: LANGUAGE.COM_MSG46,
					};
					break;
				case '2':
					ret = {
						val: 2,
						name: LANGUAGE.COM_MSG40,
						displayAs: LANGUAGE.COM_MSG47,
					}
					break;
				case '3':
					ret = {
						val: 3,
						name: LANGUAGE.COM_MSG41,
						displayAs: LANGUAGE.COM_MSG48,
					};
					break;
				case '4':
					ret = {
						val: 4,
						name: LANGUAGE.COM_MSG42,
						displayAs: LANGUAGE.COM_MSG49,
					};
					break;
				case '5':
					ret = {
						val: 5,
						name: LANGUAGE.COM_MSG43,
						displayAs: LANGUAGE.COM_MSG50,
					};
					break;
				case '6':
					ret = {
						val: 6,
						name: LANGUAGE.COM_MSG44,
						displayAs: LANGUAGE.COM_MSG51,
					};
					break;
			}
			return ret;
		},
		getUserRolesArray: function () {
			
			return [
				{
					Value: 0,
					Name: 'None',//LANGUAGE.USER_SETTINGS_MSG16,
				},
				{
					Value: 2,
					Name: 'Controller',//LANGUAGE.USER_SETTINGS_MSG17,
				},
				{
					Value: 7,
					Name: 'Standard',//LANGUAGE.USER_SETTINGS_MSG17,
				},
				{
					Value: 10,
					Name: 'View Only',//LANGUAGE.USER_SETTINGS_MSG16,
				},
				{
					Value: 5,
					Name: 'Driver',//LANGUAGE.USER_SETTINGS_MSG16,
				},
			];
			
			/*return [
				{
					Value: 0,
					Name: 'None',//LANGUAGE.USER_SETTINGS_MSG16,
				},
				{
					Value: 1,
					Name: 'Admin',//LANGUAGE.USER_SETTINGS_MSG16,
				},
				{
					Value: 2,
					Name: 'Controller',//LANGUAGE.USER_SETTINGS_MSG17,
				},
				{
					Value: 3,
					Name: 'Monitor',//LANGUAGE.USER_SETTINGS_MSG16,
				},
				{
					Value: 4,
					Name: 'Installer',//LANGUAGE.USER_SETTINGS_MSG17,
				},
				{
					Value: 5,
					Name: 'Driver',//LANGUAGE.USER_SETTINGS_MSG16,
				},
				{
					Value: 6,
					Name: 'Standard',//LANGUAGE.USER_SETTINGS_MSG17,
				},
				{
					Value: 7,
					Name: 'View Only',//LANGUAGE.USER_SETTINGS_MSG16,
				},
				{
					Value: 8,
					Name: 'Support',//LANGUAGE.USER_SETTINGS_MSG17,
				},
				{
					Value: 9,
					Name: 'Visitor(2)',//LANGUAGE.USER_SETTINGS_MSG16,
				},
				{
					Value: 10,
					Name: 'Loc8ViewOnly',//LANGUAGE.USER_SETTINGS_MSG17,
				},
				{
					Value: 11,
					Name: 'Loc8FullAccess',//LANGUAGE.USER_SETTINGS_MSG17,
				},
			];*/
		},
		getUserTypesArray: function () {
			return [
				{
					Value: 10,
					Name: LANGUAGE.USER_SETTINGS_MSG16,
				},
				{
					Value: 11,
					Name: LANGUAGE.USER_SETTINGS_MSG17,
				},
			];
		},
		getUserTypeByNumber: function (num) {
			ret = '';
			num = '' + num;
			switch (num) {
				case '0':
					ret = {
						Value: 0,
						Name: 'None',
					};
					break;
				case '1':
					ret = {
						Value: 1,
						Name: LANGUAGE.USER_SETTINGS_MSG18,
					};
					break;
				case '2':
					ret = {
						Value: 2,
						Name: LANGUAGE.USER_SETTINGS_MSG19,
					};
					break;
				case '3':
					ret = {
						Value: 3,
						Name: 'Monitor',
					};
					break;
				case '4':
					ret = {
						Value: 4,
						Name: LANGUAGE.USER_SETTINGS_MSG20,
					};
					break;
				case '5':
					ret = {
						Value: 5,
						Name: LANGUAGE.USER_SETTINGS_MSG21,
					};
					break;
				case '6':
					ret = {
						Value: 6,
						Name: LANGUAGE.USER_SETTINGS_MSG22,
					};
					break;
				case '7':
					ret = {
						Value: 7,
						Name: LANGUAGE.USER_SETTINGS_MSG23,
					};
					break;
				case '8':
					ret = {
						Value: 8,
						Name: 'Support',
					};
					break;
				case '9':
					ret = {
						Value: 9,
						Name: LANGUAGE.USER_SETTINGS_MSG24,
					};
					break;
				case '10':
					ret = {
						Value: 10,
						Name: LANGUAGE.USER_SETTINGS_MSG16,
					};
					break;
				case '11':
					ret = {
						Value: 11,
						Name: LANGUAGE.USER_SETTINGS_MSG17,
					};
					break;
			}
			return ret;
		},

		getDifferenceBTtwoDates: function (date1, date2) {
			var ret = "";
			if (date1 && date2) {
				//var one_day=1000*60*60*24;

				// Convert both dates to milliseconds
				var date1_ms = moment(date1).valueOf();
				var date2_ms = moment(date2).valueOf();

				ret = date2_ms - date1_ms;
			}
			return ret;
		},
		getGeoImmobState: function (val) {
			var ret = {
				Geolock: false,
				Immobilise: false,
				LockDoor: false,
			};
			if (val) {
				if ((parseInt(val, 10) & 1) > 0) {
					ret.Geolock = true;
				}
				if ((parseInt(val, 10) & 2) > 0) {
					ret.Immobilise = true;
				}
				if ((parseInt(val, 10) & 4) > 0) {
					ret.LockDoor = true;
				}
			}
			return ret;
		},
		getGoefenceAlarmTypes: function (val) {
			var ret = [
				{
					Val: 16,
					State: false,
					Name: LANGUAGE.GEOFENCES_MSG02,
				},
				{
					Val: 8,
					State: false,
					Name: LANGUAGE.GEOFENCES_MSG01,
				},
			];
			if (val) {
				for (var i = ret.length - 1; i >= 0; i--) {
					if (parseInt(val, 10) & ret[i].Val) {
						ret[i].State = true;
					}
				}
			}
			return ret;
		},
		getGeofenceTypes: function (val) {
			var ret = [
				{
					Val: 1,
					State: false,
					Name: LANGUAGE.GEOFENCES_MSG15,
				},
				{
					Val: 2,
					State: false,
					Name: LANGUAGE.GEOFENCES_MSG16,
				},
			];
			return ret;
		},
		getOfflineAlarmOptions: function (selectedSrt) {
			var ret = [
				{
					Value: 24,
					State: false,
					Name: 24 + ' ' + LANGUAGE.ASSET_ALARM_MSG33,
				},
				{
					Value: 48,
					State: false,
					Name: 48 + ' ' + LANGUAGE.ASSET_ALARM_MSG33,
				},
				{
					Value: 72,
					State: false,
					Name: 72 + ' ' + LANGUAGE.ASSET_ALARM_MSG33,
				},
			];
			if (selectedSrt) {
				var arr = selectedSrt.split(',');
				for (var i = arr.length - 1; i >= 0; i--) {
					ret[ret.findIndex(el => el.Value == arr[i])].State = true;
				}
			}
			return ret;
		},
		getTimezoneList: function (selected) {
			let ret = [
				{ Value: '-12_Dateline Standard Time', Name: '(UTC-12:00) International Date Line West' },
				{ Value: '-10_Hawaiian Standard Time', Name: '(UTC-10:00) Hawaii' },
				{ Value: '-9_Alaskan Standard Time', Name: '(UTC-09:00) Alaska' },
				{ Value: '-8_Pacific Standard Time (Mexico)', Name: '(UTC-08:00) Baja California' },
				{ Value: '-8_Pacific Standard Time', Name: '(UTC-08:00) Pacific Time (US & Canada)' },
				{ Value: '-7_US Mountain Standard Time', Name: '(UTC-07:00) Arizona' },
				{ Value: '-7_Mountain Standard Time (Mexico)', Name: '(UTC-07:00) Chihuahua, La Paz, Mazatlan' },
				{ Value: '-7_Mountain Standard Time', Name: '(UTC-07:00) Mountain Time (US & Canada)' },
				{ Value: '-6_Central America Standard Time', Name: '(UTC-06:00) Central America' },
				{ Value: '-6_Central Standard Time', Name: '(UTC-06:00) Central Time (US & Canada)' },
				{ Value: '-6_Central Standard Time (Mexico)', Name: '(UTC-06:00) Guadalajara, Mexico City, Monterrey' },
				{ Value: '-6_Canada Central Standard Time', Name: '(UTC-06:00) Saskatchewan' },
				{ Value: '-5_SA Pacific Standard Time', Name: '(UTC-05:00) Bogota, Lima, Quito, Rio Branco' },
				{ Value: '-5_Eastern Standard Time', Name: '(UTC-05:00) Eastern Time (US & Canada)' },
				{ Value: '-5_US Eastern Standard Time', Name: '(UTC-05:00) Indiana (East)' },
				{ Value: '-4.5_Venezuela Standard Time', Name: '(UTC-04:30) Caracas' },
				{ Value: '-4_Paraguay Standard Time', Name: '(UTC-04:00) Asuncion' },
				{ Value: '-4_Atlantic Standard Time', Name: '(UTC-04:00) Atlantic Time (Canada)' },
				{ Value: '-4_Central Brazilian Standard Time', Name: '(UTC-04:00) Cuiaba' },
				{ Value: '-4_SA Western Standard Time', Name: '(UTC-04:00) Georgetown, La Paz, Manaus, San Juan' },
				{ Value: '-4_Pacific SA Standard Time', Name: '(UTC-04:00) Santiago' },
				{ Value: '-3.5_Newfoundland Standard Time', Name: '(UTC-03:30) Newfoundland' },
				{ Value: '-3_E. South America Standard Time', Name: '(UTC-03:00) Brasilia' },
				{ Value: '-3_Argentina Standard Time', Name: '(UTC-03:00) Buenos Aires' },
				{ Value: '-3_SA Eastern Standard Time', Name: '(UTC-03:00) Cayenne, Fortaleza' },
				{ Value: '-3_Greenland Standard Time', Name: '(UTC-03:00) Greenland' },
				{ Value: '-3_Montevideo Standard Time', Name: '(UTC-03:00) Montevideo' },
				{ Value: '-3_Bahia Standard Time', Name: '(UTC-03:00) Salvador' },
				{ Value: '-2_Mid-Atlantic Standard Time', Name: '(UTC-02:00) Mid-Atlantic - Old' },
				{ Value: '-1_Azores Standard Time', Name: '(UTC-01:00) Azores' },
				{ Value: '-1_Cape Verde Standard Time', Name: '(UTC-01:00) Cape Verde Is.' },
				{ Value: '0_Morocco Standard Time', Name: '(UTC) Casablanca' },
				{ Value: '0_UTC', Name: '(UTC) Coordinated Universal Time' },
				{ Value: '0_GMT Standard Time', Name: '(UTC) Dublin, Edinburgh, Lisbon, London' },
				{ Value: '0_Greenwich Standard Time', Name: '(UTC) Monrovia, Reykjavik' },
				{ Value: '1_W. Europe Standard Time', Name: '(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna' },
				{ Value: '1_Central Europe Standard Time', Name: '(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague' },
				{ Value: '1_Romance Standard Time', Name: '(UTC+01:00) Brussels, Copenhagen, Madrid, Paris' },
				{ Value: '1_Central European Standard Time', Name: '(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb' },
				{ Value: '1_W. Central Africa Standard Time', Name: '(UTC+01:00) West Central Africa' },
				{ Value: '1_Namibia Standard Time', Name: '(UTC+01:00) Windhoek' },
				{ Value: '2_Jordan Standard Time', Name: '(UTC+02:00) Amman' },
				{ Value: '2_GTB Standard Time', Name: '(UTC+02:00) Athens, Bucharest' },
				{ Value: '2_Middle East Standard Time', Name: '(UTC+02:00) Beirut' },
				{ Value: '2_Egypt Standard Time', Name: '(UTC+02:00) Cairo' },
				{ Value: '2_Syria Standard Time', Name: '(UTC+02:00) Damascus' },
				{ Value: '2_E. Europe Standard Time', Name: '(UTC+02:00) E. Europe' },
				{ Value: '2_South Africa Standard Time', Name: '(UTC+02:00) Harare, Pretoria' },
				{ Value: '2_FLE Standard Time', Name: '(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius' },
				{ Value: '2_Turkey Standard Time', Name: '(UTC+02:00) Istanbul' },
				{ Value: '2_Israel Standard Time', Name: '(UTC+02:00) Jerusalem' },
				{ Value: '2_Libya Standard Time', Name: '(UTC+02:00) Tripoli' },
				{ Value: '3_Arabic Standard Time', Name: '(UTC+03:00) Baghdad' },
				{ Value: '3_Kaliningrad Standard Time', Name: '(UTC+03:00) Kaliningrad, Minsk' },
				{ Value: '3_Arab Standard Time', Name: '(UTC+03:00) Kuwait, Riyadh' },
				{ Value: '3_E. Africa Standard Time', Name: '(UTC+03:00) Nairobi' },
				{ Value: '3.5_Iran Standard Time', Name: '(UTC+03:30) Tehran' },
				{ Value: '4_Arabian Standard Time', Name: '(UTC+04:00) Abu Dhabi, Muscat' },
				{ Value: '4_Azerbaijan Standard Time', Name: '(UTC+04:00) Baku' },
				{ Value: '4_Russian Standard Time', Name: '(UTC+04:00) Moscow, St. Petersburg, Volgograd' },
				{ Value: '4_Mauritius Standard Time', Name: '(UTC+04:00) Port Louis' },
				{ Value: '4_Georgian Standard Time', Name: '(UTC+04:00) Tbilisi' },
				{ Value: '4_Caucasus Standard Time', Name: '(UTC+04:00) Yerevan' },
				{ Value: '4.5_Afghanistan Standard Time', Name: '(UTC+04:30) Kabul' },
				{ Value: '5_West Asia Standard Time', Name: '(UTC+05:00) Ashgabat, Tashkent' },
				{ Value: '5_Pakistan Standard Time', Name: '(UTC+05:00) Islamabad, Karachi' },
				{ Value: '5.5_India Standard Time', Name: '(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi' },
				{ Value: '5.5_Sri Lanka Standard Time', Name: '(UTC+05:30) Sri Jayawardenepura' },
				{ Value: '5.75_Nepal Standard Time', Name: '(UTC+05:45) Kathmandu' },
				{ Value: '6_Central Asia Standard Time', Name: '(UTC+06:00) Astana' },
				{ Value: '6_Bangladesh Standard Time', Name: '(UTC+06:00) Dhaka' },
				{ Value: '6_Ekaterinburg Standard Time', Name: '(UTC+06:00) Ekaterinburg' },
				{ Value: '6.5_Myanmar Standard Time', Name: '(UTC+06:30) Yangon (Rangoon)' },
				{ Value: '7_SE Asia Standard Time', Name: '(UTC+07:00) Bangkok, Hanoi, Jakarta' },
				{ Value: '7_N. Central Asia Standard Time', Name: '(UTC+07:00) Novosibirsk' },
				{ Value: '8_China Standard Time', Name: '(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi' },
				{ Value: '8_North Asia Standard Time', Name: '(UTC+08:00) Krasnoyarsk' },
				{ Value: '8_Singapore Standard Time', Name: '(UTC+08:00) Kuala Lumpur, Singapore' },
				{ Value: '8_W. Australia Standard Time', Name: '(UTC+08:00) Perth' },
				{ Value: '8_Taipei Standard Time', Name: '(UTC+08:00) Taipei' },
				{ Value: '8_Ulaanbaatar Standard Time', Name: '(UTC+08:00) Ulaanbaatar' },
				{ Value: '9_North Asia East Standard Time', Name: '(UTC+09:00) Irkutsk' },
				{ Value: '9_Tokyo Standard Time', Name: '(UTC+09:00) Osaka, Sapporo, Tokyo' },
				{ Value: '9_Korea Standard Time', Name: '(UTC+09:00) Seoul' },
				{ Value: '9.5_Cen. Australia Standard Time', Name: '(UTC+09:30) Adelaide' },
				{ Value: '9.5_AUS Central Standard Time', Name: '(UTC+09:30) Darwin' },
				{ Value: '10_E. Australia Standard Time', Name: '(UTC+10:00) Brisbane' },
				{ Value: '10_AUS Eastern Standard Time', Name: '(UTC+10:00) Canberra, Melbourne, Sydney' },
				{ Value: '10_West Pacific Standard Time', Name: '(UTC+10:00) Guam, Port Moresby' },
				{ Value: '10_Tasmania Standard Time', Name: '(UTC+10:00) Hobart' },
				{ Value: '10_Yakutsk Standard Time', Name: '(UTC+10:00) Yakutsk' },
				{ Value: '11_Central Pacific Standard Time', Name: '(UTC+11:00) Solomon Is., New Caledonia' },
				{ Value: '11_Vladivostok Standard Time', Name: '(UTC+11:00) Vladivostok' },
				{ Value: '12_New Zealand Standard Time', Name: '(UTC+12:00) Auckland, Wellington' },
				{ Value: '12_Fiji Standard Time', Name: '(UTC+12:00) Fiji' },
				{ Value: '12_Magadan Standard Time', Name: '(UTC+12:00) Magadan' },
				{ Value: '12_Kamchatka Standard Time', Name: '(UTC+12:00) Petropavlovsk-Kamchatsky - Old' },
				{ Value: '13_Tonga Standard Time', Name: '(UTC+13:00) Nuku\'alofa' },
				{ Value: '13_Samoa Standard Time', Name: '(UTC+13:00) Samoa' },

                /*{ Value: 'Dateline Standard Time_-12', Id: 'Dateline Standard Time', Name: '(UTC-12:00) International Date Line West' },
                { Value: 'Hawaiian Standard Time_-10', Id: 'Hawaiian Standard Time', Name: '(UTC-10:00) Hawaii' },
                { Value: 'Alaskan Standard Time_-9', Id: 'Alaskan Standard Time', Name: '(UTC-09:00) Alaska' },
                { Value: 'Pacific Standard Time (Mexico)_-8', Id: 'Pacific Standard Time (Mexico)', Name: '(UTC-08:00) Baja California' },
                { Value: 'Pacific Standard Time_-8', Id: 'Pacific Standard Time', Name: '(UTC-08:00) Pacific Time (US & Canada)' },
                { Value: 'US Mountain Standard Time_-7', Id: 'US Mountain Standard Time', Name: '(UTC-07:00) Arizona' },
                { Value: 'Mountain Standard Time (Mexico)_-7', Id: 'Mountain Standard Time (Mexico)', Name: '(UTC-07:00) Chihuahua, La Paz, Mazatlan' },
                { Value: 'Mountain Standard Time_-7', Id: 'Mountain Standard Time', Name: '(UTC-07:00) Mountain Time (US & Canada)' },
                { Value: 'Central America Standard Time_-6', Id: 'Central America Standard Time', Name: '(UTC-06:00) Central America' },
                { Value: 'Central Standard Time_-6', Id: 'Central Standard Time', Name: '(UTC-06:00) Central Time (US & Canada)' },
                { Value: 'Central Standard Time (Mexico)_-6', Id: 'Central Standard Time (Mexico)', Name: '(UTC-06:00) Guadalajara, Mexico City, Monterrey' },
                { Value: 'Canada Central Standard Time_-6', Id: 'Canada Central Standard Time', Name: '(UTC-06:00) Saskatchewan' },
                { Value: 'SA Pacific Standard Time_-5', Id: '-SA Pacific Standard Time', Name: '(UTC-05:00) Bogota, Lima, Quito, Rio Branco' },
                { Value: 'Eastern Standard Time_-5', Id: 'Eastern Standard Time', Name: '(UTC-05:00) Eastern Time (US & Canada)' },
                { Value: 'US Eastern Standard Time_-5', Id: 'US Eastern Standard Time', Name: '(UTC-05:00) Indiana (East)' },
                { Value: 'Venezuela Standard Time_-4.5', Id: 'Venezuela Standard Time', Name: '(UTC-04:30) Caracas' },
                { Value: 'Paraguay Standard Time_-4', Id: 'Paraguay Standard Time', Name: '(UTC-04:00) Asuncion' },
                { Value: 'Atlantic Standard Time_-4', Id: 'Atlantic Standard Time', Name: '(UTC-04:00) Atlantic Time (Canada)' },
                { Value: 'Central Brazilian Standard Time_-4', Id: 'Central Brazilian Standard Time', Name: '(UTC-04:00) Cuiaba' },
                { Value: 'SA Western Standard Time_-4', Id: 'SA Western Standard Time', Name: '(UTC-04:00) Georgetown, La Paz, Manaus, San Juan' },
                { Value: 'Pacific SA Standard Time_-4', Id: 'Pacific SA Standard Time', Name: '(UTC-04:00) Santiago' },
                { Value: 'Newfoundland Standard Time_-3.5', Id: 'Newfoundland Standard Time', Name: '(UTC-03:30) Newfoundland' },
                { Value: 'E. South America Standard Time_-3', Id: 'E. South America Standard Time', Name: '(UTC-03:00) Brasilia' },
                { Value: 'Argentina Standard Time_-3', Id: 'Argentina Standard Time', Name: '(UTC-03:00) Buenos Aires' },
                { Value: 'SA Eastern Standard Time_-3', Id: 'SA Eastern Standard Time', Name: '(UTC-03:00) Cayenne, Fortaleza' },
                { Value: 'Greenland Standard Time_-3', Id: 'Greenland Standard Time', Name: '(UTC-03:00) Greenland' },
                { Value: 'Montevideo Standard Time_-3', Id: 'Montevideo Standard Time', Name: '(UTC-03:00) Montevideo' },
                { Value: 'Bahia Standard Time_-3', Id: 'Bahia Standard Time', Name: '(UTC-03:00) Salvador' },
                { Value: 'Mid-Atlantic Standard Time_-2', Id: 'Mid-Atlantic Standard Time', Name: '(UTC-02:00) Mid-Atlantic - Old' },
                { Value: 'Azores Standard Time_-1', Id: 'Azores Standard Time', Name: '(UTC-01:00) Azores' },
                { Value: 'Cape Verde Standard Time_-1', Id: 'Cape Verde Standard Time', Name: '(UTC-01:00) Cape Verde Is.' },
                { Value: 'Morocco Standard Time_0', Id: 'Morocco Standard Time', Name: '(UTC) Casablanca' },
                { Value: 'UTC_0', Id: '0_UTC', Name: '(UTC) Coordinated Universal Time' },
                { Value: 'GMT Standard Time_0', Id: 'GMT Standard Time', Name: '(UTC) Dublin, Edinburgh, Lisbon, London' },
                { Value: 'Greenwich Standard Time_0', Id: 'Greenwich Standard Time', Name: '(UTC) Monrovia, Reykjavik' },
                { Value: 'W. Europe Standard Time_1', Id: 'W. Europe Standard Time', Name: '(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna' },
                { Value: 'Central Europe Standard Time_1', Id: 'Central Europe Standard Time', Name: '(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague' },
                { Value: 'Romance Standard Time_1', Id: 'Romance Standard Time', Name: '(UTC+01:00) Brussels, Copenhagen, Madrid, Paris' },
                { Value: 'Central European Standard Time_1', Id: 'Central European Standard Time', Name: '(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb' },
                { Value: 'W. Central Africa Standard Time_1', Id: 'W. Central Africa Standard Time', Name: '(UTC+01:00) West Central Africa' },
                { Value: 'Namibia Standard Time_1', Id: 'Namibia Standard Time', Name: '(UTC+01:00) Windhoek' },
                { Value: 'Jordan Standard Time_2', Id: 'Jordan Standard Time', Name: '(UTC+02:00) Amman' },
                { Value: 'GTB Standard Time_2', Id: 'GTB Standard Time', Name: '(UTC+02:00) Athens, Bucharest' },
                { Value: 'Middle East Standard Time_2', Id: 'Middle East Standard Time', Name: '(UTC+02:00) Beirut' },
                { Value: 'Egypt Standard Time_2', Id: 'Egypt Standard Time', Name: '(UTC+02:00) Cairo' },
                { Value: 'Syria Standard Time_2', Id: 'Syria Standard Time', Name: '(UTC+02:00) Damascus' },
                { Value: 'E. Europe Standard Time_2', Id: 'E. Europe Standard Time', Name: '(UTC+02:00) E. Europe' },
                { Value: 'South Africa Standard Time_2', Id: 'South Africa Standard Time', Name: '(UTC+02:00) Harare, Pretoria' },
                { Value: 'FLE Standard Time_2', Id: 'FLE Standard Time', Name: '(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius' },
                { Value: 'Turkey Standard Time_2', Id: 'Turkey Standard Time', Name: '(UTC+02:00) Istanbul' },
                { Value: 'Israel Standard Time_2', Id: 'Israel Standard Time', Name: '(UTC+02:00) Jerusalem' },
                { Value: 'Libya Standard Time_2', Id: 'Libya Standard Time', Name: '(UTC+02:00) Tripoli' },
                { Value: 'Arabic Standard Time_3', Id: 'Arabic Standard Time', Name: '(UTC+03:00) Baghdad' },
                { Value: 'Kaliningrad Standard Time_3', Id: 'Kaliningrad Standard Time', Name: '(UTC+03:00) Kaliningrad, Minsk' },
                { Value: 'Arab Standard Time_3', Id: 'Arab Standard Time', Name: '(UTC+03:00) Kuwait, Riyadh' },
                { Value: 'E. Africa Standard Time_3', Id: 'E. Africa Standard Time', Name: '(UTC+03:00) Nairobi' },
                { Value: 'Iran Standard Time_3.5', Id: 'Iran Standard Time', Name: '(UTC+03:30) Tehran' },
                { Value: 'Arabian Standard Time_4', Id: 'Arabian Standard Time', Name: '(UTC+04:00) Abu Dhabi, Muscat' },
                { Value: 'Azerbaijan Standard Time_4', Id: 'Azerbaijan Standard Time', Name: '(UTC+04:00) Baku' },
                { Value: 'Russian Standard Time_4', Id: 'Russian Standard Time', Name: '(UTC+04:00) Moscow, St. Petersburg, Volgograd' },
                { Value: 'Mauritius Standard Time_4', Id: 'Mauritius Standard Time', Name: '(UTC+04:00) Port Louis' },
                { Value: 'Georgian Standard Time_4', Id: 'Georgian Standard Time', Name: '(UTC+04:00) Tbilisi' },
                { Value: 'Caucasus Standard Time_4', Id: 'Caucasus Standard Time', Name: '(UTC+04:00) Yerevan' },
                { Value: 'Afghanistan Standard Time_4.5', Id: 'Afghanistan Standard Time', Name: '(UTC+04:30) Kabul' },
                { Value: 'West Asia Standard Time_5', Id: 'West Asia Standard Time', Name: '(UTC+05:00) Ashgabat, Tashkent' },
                { Value: 'Pakistan Standard Time_5', Id: 'Pakistan Standard Time', Name: '(UTC+05:00) Islamabad, Karachi' },
                { Value: 'India Standard Time_5.5', Id: 'India Standard Time', Name: '(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi' },
                { Value: 'Sri Lanka Standard Time_5.5', Id: 'Sri Lanka Standard Time', Name: '(UTC+05:30) Sri Jayawardenepura' },
                { Value: 'Nepal Standard Time_5.75', Id: 'Nepal Standard Time', Name: '(UTC+05:45) Kathmandu' },
                { Value: 'Central Asia Standard Time_6', Id: 'Central Asia Standard Time', Name: '(UTC+06:00) Astana' },
                { Value: 'Bangladesh Standard Time_6', Id: 'Bangladesh Standard Time', Name: '(UTC+06:00) Dhaka' },
                { Value: 'Ekaterinburg Standard Time_6', Id: 'Ekaterinburg Standard Time', Name: '(UTC+06:00) Ekaterinburg' },
                { Value: 'Myanmar Standard Time_6.5', Id: 'Myanmar Standard Time', Name: '(UTC+06:30) Yangon (Rangoon)' },
                { Value: 'SE Asia Standard Time_7', Id: 'SE Asia Standard Time', Name: '(UTC+07:00) Bangkok, Hanoi, Jakarta' },
                { Value: 'N. Central Asia Standard Time_7', Id: 'N. Central Asia Standard Time', Name: '(UTC+07:00) Novosibirsk' },
                { Value: 'China Standard Time_8', Id: 'China Standard Time', Name: '(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi' },
                { Value: 'North Asia Standard Time_8', Id: 'North Asia Standard Time', Name: '(UTC+08:00) Krasnoyarsk' },
                { Value: 'Singapore Standard Time_8', Id: 'Singapore Standard Time', Name: '(UTC+08:00) Kuala Lumpur, Singapore' },
                { Value: 'W. Australia Standard Time_8', Id: 'W. Australia Standard Time', Name: '(UTC+08:00) Perth' },
                { Value: 'Taipei Standard Time_8', Id: 'Taipei Standard Time', Name: '(UTC+08:00) Taipei' },
                { Value: 'Ulaanbaatar Standard Time_8', Id: 'Ulaanbaatar Standard Time', Name: '(UTC+08:00) Ulaanbaatar' },
                { Value: 'North Asia East Standard Time_9', Id: 'North Asia East Standard Time', Name: '(UTC+09:00) Irkutsk' },
                { Value: 'Tokyo Standard Time_9', Id: 'Tokyo Standard Time', Name: '(UTC+09:00) Osaka, Sapporo, Tokyo' },
                { Value: 'Korea Standard Time_9', Id: 'Korea Standard Time', Name: '(UTC+09:00) Seoul' },
                { Value: 'Cen. Australia Standard Time_9.5', Id: '_Cen. Australia Standard Time', Name: '(UTC+09:30) Adelaide' },
                { Value: 'AUS Central Standard Time_9.5', Id: 'AUS Central Standard Time', Name: '(UTC+09:30) Darwin' },
                { Value: 'E. Australia Standard Time_10', Id: 'E. Australia Standard Time', Name: '(UTC+10:00) Brisbane' },
                { Value: 'AUS Eastern Standard Time_10', Id: 'AUS Eastern Standard Time', Name: '(UTC+10:00) Canberra, Melbourne, Sydney' },
                { Value: 'West Pacific Standard Time_10', Id: 'West Pacific Standard Time', Name: '(UTC+10:00) Guam, Port Moresby' },
                { Value: 'Tasmania Standard Time_10', Id: 'Tasmania Standard Time', Name: '(UTC+10:00) Hobart' },
                { Value: 'Yakutsk Standard Time_10', Id: 'Yakutsk Standard Time', Name: '(UTC+10:00) Yakutsk' },
                { Value: 'Central Pacific Standard Time_11', Id: 'Central Pacific Standard Time', Name: '(UTC+11:00) Solomon Is., New Caledonia' },
                { Value: 'Vladivostok Standard Time_11', Id: 'Vladivostok Standard Time', Name: '(UTC+11:00) Vladivostok' },
                { Value: 'New Zealand Standard Time_12', Id: 'New Zealand Standard Time', Name: '(UTC+12:00) Auckland, Wellington' },
                { Value: 'Fiji Standard Time_12', Id: 'Fiji Standard Time', Name: '(UTC+12:00) Fiji' },
                { Value: 'Magadan Standard Time_12', Id: 'Magadan Standard Time', Name: '(UTC+12:00) Magadan' },
                { Value: 'Kamchatka Standard Time_12', Id: 'Kamchatka Standard Time', Name: '(UTC+12:00) Petropavlovsk-Kamchatsky - Old' },
                { Value: 'Tonga Standard Time_13', Id: 'Tonga Standard Time', Name: '(UTC+13:00) Nuku\'alofa' },
                { Value: 'Samoa Standard Time_13', Id: 'Samoa Standard Time', Name: '(UTC+13:00) Samoa' },*/
			];
			if (selected) {
				let index = ret.findIndex(el => el.Value.indexOf(selected) > -1);
				if (index !== -1) {
					ret[index].State = true;
				} else {
					index = ret.findIndex(el => parseFloat(el.Value) == selected);
					if (index !== -1) {
						ret[index].State = true;
					}
				}
			}

			return ret;
		},
		getAssetPayPlanName: function (code) {
			var ret = code;
			if (code) {
				switch (code) {
					case 'Tracking':
						ret = 'Live';
						break;
					case 'Monitoring':
						ret = 'Live';
						break;
					case 'Protect Plan':
						ret = 'Protect';
						break;
				}
			}
			return ret;
		},
		getGeofenceAlertType: function (val) {
			var ret = '';
			if (val) {
				if ((parseInt(val) & 8) > 0) {
					ret += LANGUAGE.GEOFENCES_MSG01 + ', ';
				}
				if ((parseInt(val) & 16) > 0) {
					ret += LANGUAGE.GEOFENCES_MSG02 + ', ';
				}
			}
			if (ret) {
				ret = ret.slice(0, -2);
			} else {
				ret = LANGUAGE.COM_MSG111;
			}
			return ret;
		},
		getAddressByGeocoder: function (latlng, replyFunc) {
            /*var url = "http://map.quiktrak.co/reverse.php?format=json&lat={0}&lon={1}&zoom=18&addressdetails=1".format(latlng.lat, latlng.lng);
            JSON1.request(url, function(result){ replyFunc(result.display_name);});*/
			var coords = LANGUAGE.COM_MSG09 + ': ' + latlng.lat + ', ' + LANGUAGE.COM_MSG10 + ': ' + latlng.lng;
			$.ajax({
				type: "GET",
				url: "https://nominatim.sinopacific.com.ua/reverse.php?format=json&lat={0}&lon={1}&zoom=18&addressdetails=1".format(latlng.lat, latlng.lng),
				dataType: "json",
				async: true,
				cache: false,
				success: function (result) {
					if (result.display_name) {
						replyFunc(result.display_name);
					} else {
						replyFunc(coords);
					}
				},
				error: function (XMLHttpRequest, textStatus, errorThrown) {
					$.ajax({
						type: "GET",
						url: "https://nominatim.openstreetmap.org/reverse?format=json&lat={0}&lon={1}&zoom=18&addressdetails=1".format(latlng.lat, latlng.lng),
						dataType: "json",
						async: true,
						cache: false,
						success: function (result) {
							if (result.display_name) {
								replyFunc(result.display_name);
							} else {
								replyFunc(coords);
							}
						},
						error: function (XMLHttpRequest, textStatus, errorThrown) {
							replyFunc(coords);
						}
					});
				}
			});
		},
		getLatLngByGeocoder: function (address, replyFunc) {
			var url = "https://nominatim.openstreetmap.org/search?q={0}&format=json&polygon=1&addressdetails=1".format(address);
			/*JSON1.request(url, function(result){
				var res = new L.LatLng(result[0].lat, result[0].lon);
				replyFunc(res);
			});*/
			var res = null;
			$.ajax({
				type: "GET",
				url: url,
				dataType: "json",
				async: true,
				cache: false,
				success: function (result) {
					if (result.length > 0) {
						if (result[0].lat && result[0].lon) {
							res = new L.LatLng(result[0].lat, result[0].lon);
							replyFunc(res);
						} else {
							replyFunc(res);
						}
					} else {
						replyFunc(res);
					}
				},
				error: function (XMLHttpRequest, textStatus, errorThrown) {
					url = "https://nominatim.sinopacific.com.ua/?q={0}&format=json&polygon=1&addressdetails=1".format(address);
					$.ajax({
						type: "GET",
						url: url,
						dataType: "json",
						async: true,
						cache: false,
						success: function (result) {
							if (result.length > 0) {
								if (result[0].lat && result[0].lon) {
									res = new L.LatLng(result[0].lat, result[0].lon);
									replyFunc(res);
								} else {
									replyFunc(res);
								}
							} else {
								replyFunc(res);
							}
						},
						error: function (XMLHttpRequest, textStatus, errorThrown) {
							replyFunc(res);
						}
					});
				}
			});
		},
		createMap: function (option) {
			var osm = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { name: 'osm', attribution: '' });
			var googleStreets = L.tileLayer('https://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}' + '&hl=' + lang, {
				maxZoom: 22,
				subdomains: ['mt0', 'mt1', 'mt2', 'mt3']
			});
			var googleSatelitte = L.tileLayer('https://{s}.google.com/vt/lyrs=s,h&x={x}&y={y}&z={z}' + '&hl=' + lang, {
				maxZoom: 22,
				subdomains: ['mt0', 'mt1', 'mt2', 'mt3']
			});

			var layerSeaMark = L.tileLayer("https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png", { numZoomLevels: 18, isBaseLayer: false, displayOutsideMaxExtent: true });

			var layerGrid2 = L.latlngGraticule({
				showLabel: true,
				dashArray: [8, 8],
				color: '#999',
				fontColor: '#999',
				opacity: .8,
				zoomInterval: [
					{ start: 2, end: 3, interval: 30 },
					{ start: 4, end: 4, interval: 10 },
					{ start: 5, end: 6, interval: 5 },
					{ start: 7, end: 8, interval: 1 },
					{ start: 9, end: 10, interval: 0.25 },
					{ start: 11, end: 12, interval: 0.1 },
					{ start: 13, end: 13, interval: 0.025 },
					{ start: 14, end: 15, interval: 0.01 },
					{ start: 16, end: 22, interval: 0.005 },
				]
			});

			let mapSettingsObg = app.methods.getFromStorage('mapSettings');

			let layersToShow = [];
			if (mapSettingsObg.map) {
				if (mapSettingsObg.map === 'google') layersToShow.push(googleStreets);
				if (mapSettingsObg.map === 'satellite') layersToShow.push(googleSatelitte);
				if (mapSettingsObg.map === 'openstreet') layersToShow.push(osm);
			}
			if (!layersToShow.length) layersToShow.push(googleStreets);
			if (app.data.AppDetails.isMarine) {
				if (typeof mapSettingsObg.seamark === 'undefined' || mapSettingsObg.seamark) layersToShow.push(layerSeaMark);
				if (typeof mapSettingsObg.grid === 'undefined' || mapSettingsObg.grid) layersToShow.push(layerGrid2);
			} else {
				if (mapSettingsObg.seamark) layersToShow.push(layerSeaMark);
				if (mapSettingsObg.grid) layersToShow.push(layerGrid2);
			}


			var map = L.map(option.target, { preferCanvas: true, zoomControl: false, center: option.latLng, zoom: option.zoom, layers: layersToShow });


			let layers = {
				"<span class='mapSwitcherWrapper customOverlay googleSwitcherWrapper' data-type='google'><img class='layer-icon' src='../resources/images/googleRoad.png' alt='' /> <p>Map</p></span>": googleStreets,
				"<span class='mapSwitcherWrapper customOverlay satelliteSwitcherWrapper' data-type='satellite'><img class='layer-icon' src='../resources/images/googleSatellite.png' alt='' />  <p>Satellite</p></span>": googleSatelitte,
				"<span class='mapSwitcherWrapper customOverlay openstreetSwitcherWrapper' data-type='openstreet'><img class='layer-icon' src='../resources/images/openStreet.png' alt='' /> <p>OpenStreet</p></span>": osm,
			};

			var mapOverlays = {
				'<i class="icon-checkbox customOverlay" data-type="seamark"></i>SeaMarks': layerSeaMark,
				'<i class="icon-checkbox customOverlay" data-type="grid"></i>Grid': layerGrid2,
			};

			L.control.layers(layers, mapOverlays).addTo(map);

			return map;
		},
		toDegreesMinutesAndSeconds: function (coordinate) {
			var absolute = Math.abs(coordinate);
			var degrees = Math.floor(absolute);
			var minutesNotTruncated = (absolute - degrees) * 60;
			var minutes = Math.floor(minutesNotTruncated);
			var seconds = Math.floor((minutesNotTruncated - minutes) * 60);

			return degrees + " " + minutes + " " + seconds;
		},
		convertDMS: function (lat, lng) {
			var latitude = Protocol.Helper.toDegreesMinutesAndSeconds(lat);
			var latitudeCardinal = Math.sign(lat) >= 0 ? "N" : "S";

			var longitude = Protocol.Helper.toDegreesMinutesAndSeconds(lng);
			var longitudeCardinal = Math.sign(lng) >= 0 ? "E" : "W";

			return latitude + " " + latitudeCardinal + "\n" + longitude + " " + longitudeCardinal;
		},
		getAssetStateInfo: function (asset, additionalOptions = false) {
            /*
                state-0  -- gray
                state-1  -- green
                state-2  -- yellow
                state-3  -- red
            */
			//var staticIdle = asset.getStaticTimeSpan();
			var ret = {};
			if (asset) {

				var dateTimeSecond = 24 * 600 * 60 * 1000;
				//console.log(asset.posInfo.positionTime);
				if (asset.posInfo.positionTime !== null) {
					try {
						dateTimeSecond = Math.abs(moment(moment(asset.posInfo.positionTime.toDate()).add(CustomerInfo.TimeZone, 'hours').toDate()).diff(moment(moment(moment().toDate()).add((moment().utcOffset() / 60), 'hours').toDate()), 'milliseconds'));
					} catch (error) {
						console.log(error);
					}

				}

				if (asset.posInfo.positionTime !== null) {
					try {
						if (asset.posInfo.lat === 0 || asset.posInfo.lng === 0 || (asset.posInfo.positionTime !== null && Math.abs(moment(moment(asset.posInfo.positionTime.toDate()).add(CustomerInfo.TimeZone).toDate(), 'hours').diff(moment(moment(moment().toDate()).add((moment().utcOffset() / 60)).toDate()), 'milliseconds'), 'hours') > 40 * 60 * 1000)) {
							asset.posInfo.isRealTime = "False";
							asset.posInfo.isLocated = "False";
							asset.posInfo.speed = 0;
							asset.posInfo.status = 0;
						}
					} catch (error) {
						console.log(error);
					}
				}

				ret.geolock = false;
				if (asset.posInfo.status & Protocol.PositionStatus.BeProtected > 0) {
					ret.geolock = true;
				}
				ret.immobilisation = false;
				if (asset.posInfo.status & Protocol.PositionStatus.Relay > 0) {
					ret.immobilisation = true;
				}

				ret.stats = true;
				if (asset.posInfo.positionTime === null) {
					ret.stats = false;

				} else {
					ret.istDriverRatingSupported = false;
					if (asset.haveFeature("HarshBracking") && asset.haveFeature("HarshAcceleration")) {
						ret.istDriverRatingSupported = true;
					}

					if (asset.haveFeature("Speed")) {
						if (asset.haveFeature("Acc") && (Protocol.PositionStatus.ACC & asset.posInfo.status) === 0) {
							asset.posInfo.speed = 0;
						}
						ret.speed = {};
						if (asset.posInfo.speed < 0) {
							asset.posInfo.speed = 0;
						}
						ret.speed.value = Protocol.Helper.getSpeedValue(asset.Unit, asset.posInfo.speed) + ' ' + Protocol.Helper.getSpeedUnit(asset.Unit);
					}
					if (asset.haveFeature("TempSensor")) {
						ret.temperature = {};
						if (typeof asset.posInfo.alt == "undefined") {
							ret.temperature.value = LANGUAGE.COM_MSG11;
						} else {
							ret.temperature.value = asset.posInfo.alt + '&nbsp;°C';
						}
					}
					if (asset.posInfo.temp1) {
						ret.temp1 = {};
						ret.temp1.value = asset.posInfo.temp1 + '&nbsp;°C';
					}
					if (asset.posInfo.temp2) {
						ret.temp2 = {};
						ret.temp2.value = asset.posInfo.temp2 + '&nbsp;°C';
					}
					if (asset.posInfo.temp3) {
						ret.temp3 = {};
						ret.temp3.value = asset.posInfo.temp3 + '&nbsp;°C';
					}
					if (asset.posInfo.temp4) {
						ret.temp4 = {};
						ret.temp4.value = asset.posInfo.temp4 + '&nbsp;°C';
					}
					if (asset.posInfo.temp5) {
						ret.temp5 = {};
						ret.temp5.value = asset.posInfo.temp5 + '&nbsp;°C';
					}
					if (asset.posInfo.temp6) {
						ret.temp6 = {};
						ret.temp6.value = asset.posInfo.temp6 + '&nbsp;°C';
					}
					if (asset.posInfo.temp7) {
						ret.temp7 = {};
						ret.temp7.value = asset.posInfo.temp7 + '&nbsp;°C';
					}
					if (asset.posInfo.temp8) {
						ret.temp8 = {};
						ret.temp8.value = asset.posInfo.temp8 + '&nbsp;°C';
					}

					if (asset.haveFeature("FuelSensor")) { 
						ret.fuel = {};
						if (typeof asset.posInfo.fuel == "undefined" || asset.posInfo.fuel == 0 && asset._FIELD_FLOAT2 == 0 && asset._FIELD_FLOAT1 == 0) {
							ret.fuel.value = LANGUAGE.COM_MSG11; 
						} else {
							ret.fuel.value = parseInt(((parseFloat(asset.posInfo.fuel) - asset._FIELD_FLOAT2) / (asset._FIELD_FLOAT1 - asset._FIELD_FLOAT2)) * 100) + '&nbsp;% (' + parseFloat(asset.posInfo.fuel).toFixed(2) + 'V)';// console.log('FuelSensor', asset.posInfo.fuel, asset._FIELD_FLOAT1, asset._FIELD_FLOAT2)
						}
					}
					if (asset.haveFeature("Voltage")) {
						ret.voltage = {};
						ret.voltage.value = LANGUAGE.COM_MSG11;

						if (asset.posInfo.Voltage) {
							ret.voltage.value = Math.round(asset.posInfo.Voltage * 10) / 10 + '&nbsp;V';//LANGUAGE.COM_MSG11;
						} else {
							//ret.voltage.value = Math.round(asset.posInfo.alt*10)/10;
							//additionalOptions && additionalOptions.onlyNumber ? '' : ret.voltage.value += '&nbsp;V';
						ret.voltage.value = (asset.posInfo.alt > 50 || !asset.posInfo.alt ? LANGUAGE.COM_MSG031 : "" + Math.round(asset.posInfo?.alt * 10) / 10 + '&nbsp;V');

						}
					}
					if (asset.haveFeature("Mileage")) {
						ret.mileage = {};
						if (additionalOptions && additionalOptions.inKilometers) {
							ret.mileage.value = (Protocol.Helper.getMileageValue('KPH', asset.posInfo.mileage) + parseInt(asset.InitMileage) + parseInt(asset._FIELD_FLOAT7));
							additionalOptions && additionalOptions.onlyNumber ? '' : ret.mileage.value += '&nbsp;' + Protocol.Helper.getMileageUnit(asset.Unit);
						} else {
							ret.mileage.value = (Protocol.Helper.getMileageValue(asset.Unit, asset.posInfo.mileage) + parseInt(asset.InitMileage) + parseInt(asset._FIELD_FLOAT7)) + '&nbsp;' + Protocol.Helper.getMileageUnit(asset.Unit);
						}


						ret.engineHours = {};
						if (asset.posInfo.Engine) {
							asset.posInfo.launchHours = asset.posInfo.Engine;
						}
						ret.engineHours.value = TimeSpan(parseInt(asset.posInfo.launchHours) * 1000 + parseInt(asset.InitAcconHours) * 60 * 60 * 1000 + parseInt(asset._FIELD_FLOAT8) * 1000).format("^hh:mm:ss");
						//console.log(asset);

					}
					if (asset.haveFeature("Acc")) {
						ret.acc = {};
						//if((Protocol.PositionStatus.ACC & asset.posInfo.status) > 0 && asset.posInfo.isLocated=="True"){
						//if((Protocol.PositionStatus.ACC & this.posInfo.status) > 0)
						if ((Protocol.PositionStatus.ACC & asset.posInfo.status) > 0) {
							ret.acc.value = 'ON';
						} else {
							ret.acc.value = 'OFF';
						}
					}
					if (asset.haveFeature("Acc2")) {
						ret.acc2 = {};
						if ((Protocol.PositionStatus.ACC2 & asset.posInfo.status) > 0) {
							ret.acc2.value = 'ON';
						} else {
							ret.acc2.value = 'OFF';
						}
					}
					if (asset.haveFeature("Battery")) {
						ret.battery = {};
						console.log('asss',asset.posInfo)
						if (asset.posInfo.Battery) {
							if(asset.posInfo.Battery){
								ret.battery.value = parseInt(asset.posInfo.Battery) + '&nbsp;%';
							}else{
								ret.battery.value = parseInt(asset.posInfo.Battery) + '&nbsp;%';
							}
						} else {
							ret.battery.value = LANGUAGE.COM_MSG11; // no data
						}
					}
					if (asset.haveFeature("Alt")) {
						ret.altitude = {};
						ret.altitude.value = asset.posInfo.alt + '&nbsp;ft';
					}
                    /*if(asset.haveFeature("RFIDCard")){
                        ret.driver = {};
                        if(asset.posInfo.rfid !== null && asset.posInfo.rfid !== ""){
                            var hasFound = false;
                            for(var i= 0; i< ContactList.length; i++){
                                if(asset.posInfo.rfid == ContactList[i].Number){
                                    hasFound = true;
                                    ret.driver.value = ContactList[i].FirstName + " " + ContactList[i].SurName;
                                    break;
                                }
                            }
                            if(!hasFound){
                                ret.driver.value = asset.posInfo.rfid;
                            }
                        }else{
                            ret.driver.value = LANGUAGE.COM_MSG11;
                        }
                    }else if(asset.haveFeature("Driver")){
                        ret.driver = {};
                        var name = '';
                        if(asset.contactCode !== null && asset.contactCode !== ""){
                            for(var j = 0; j< ContactList.length; j++){
                                if(asset.contactCode == ContactList[j].Code){
                                    name += ContactList[j].FirstName + " " + ContactList[j].SurName;
                                    break;
                                }
                            }
                        }
                        ret.driver.value = name;
                    }   */
					ret.boatStates = {
						bilgePump: {
							state: 'state-0',
							value: LANGUAGE.COM_MSG93
						},
						shorePower: {
							state: 'state-0',
							value: LANGUAGE.COM_MSG93
						}
					}

					if ((asset.originalStatus & Protocol.PositionStatus.input1) > 0) {
						ret.boatStates.bilgePump.state = 'state-1'
						ret.boatStates.bilgePump.value = LANGUAGE.COM_MSG94
					}
					if ((asset.originalStatus & Protocol.PositionStatus.input2) > 0) {
						ret.boatStates.shorePower.state = 'state-1'
						ret.boatStates.shorePower.value = LANGUAGE.COM_MSG94
					}

					ret.installation = {
						input1name: {
							state: 'state-1',
							value: LANGUAGE.COM_MSG93
						},
						input2name: {
							state: 'state-1',
							value: LANGUAGE.COM_MSG93
						},
						input3name: {
							state: 'state-1',
							value: LANGUAGE.COM_MSG93
						},
						input4name: {
							state: 'state-1',
							value: LANGUAGE.COM_MSG93
						},
						output1name: {
							state: 'state-5',
							value: LANGUAGE.COM_MSG93
						},
						output2name: {
							state: 'state-5',
							value: LANGUAGE.COM_MSG93
						},
					}

					if ((asset.posInfo.status & Protocol.InputActiveState.Input1) > 0) {
						ret.installation.input1name.state = 'state-3'
						ret.installation.input1name.value = LANGUAGE.COM_MSG94
					}
					if ((asset.posInfo.status & Protocol.InputActiveState.Input2) > 0) {
						ret.installation.input2name.state = 'state-3'
						ret.installation.input2name.value = LANGUAGE.COM_MSG94
					}
					if ((asset.posInfo.status & Protocol.InputActiveState.Input3) > 0) {
						ret.installation.input3name.state = 'state-3'
						ret.installation.input3name.value = LANGUAGE.COM_MSG94
					}
					if ((asset.posInfo.status & Protocol.InputActiveState.Input4) > 0) {
						ret.installation.input4name.state = 'state-3'
						ret.installation.input4name.value = LANGUAGE.COM_MSG94
					}
					if ((asset.posInfo.status & Protocol.InputActiveState.Output1) > 0) {
						ret.installation.output1name.state = 'state-4'
						ret.installation.output1name.value = LANGUAGE.COM_MSG94
					}
					if ((asset.posInfo.status & Protocol.InputActiveState.Output2) > 0) {
						ret.installation.output2name.state = 'state-4'
						ret.installation.output2name.value = LANGUAGE.COM_MSG94
					}
					//console.log('e3', asset.posInfo.status, Protocol.InputActiveState)

					ret.GPS = {};
					ret.GPS.state = 'state-1';
					ret.GPS.value = randomIntFromInterval(71, 95) + '%';
					ret.GSM = {};
					ret.GSM.state = 'state-1';
					ret.GSM.value = randomIntFromInterval(71, 95) + '%';
					if (asset.posInfo.lat === 0 || asset.posInfo.lng === 0 || dateTimeSecond > 40 * 60 * 1000) {
						ret.GPS.state = 'state-0';
						ret.GPS.value = '0%';
					}
					if (dateTimeSecond > 5 * 60 * 60 * 1000) {
						ret.GSM.state = 'state-0';
						ret.GSM.value = '0%';
					}
					ret.status = {};
					if (parseInt(asset.posInfo.speed) > 0) {
						ret.status.value = LANGUAGE.HOME_MSG014;
						ret.status.state = 'state-1';
						ret.status.event = LANGUAGE.HOME_MSG017;
						ret.status.eventTime = asset.posInfo.positionTime.format(window.COM_TIMEFORMAT);
						ret.GSM.state = 'state-1';
						ret.GSM.value = randomIntFromInterval(71, 95) + '%';
					}
					else if (parseInt(asset.posInfo.speed) === 0) {
						if (asset.haveFeature("Acc") && (Protocol.PositionStatus.ACC & asset.posInfo.status) > 0) {
							ret.status.value = LANGUAGE.HOME_MSG016;
							ret.status.state = 'state-2';
							ret.status.eventTime = asset.posInfo.positionTime.format(window.COM_TIMEFORMAT);
							ret.status.event = LANGUAGE.HOME_MSG018;
							ret.GSM.state = 'state-1';
							ret.GSM.value = randomIntFromInterval(71, 95) + '%';
						} else {
							if (asset.posInfo.staticTime) {
								//ret.status.value = LANGUAGE.ASSET_STATUS_MSG04+' <span class="stopped_time">('+asset.posInfo.staticTime.format(window.COM_TIMEFORMAT)+')</span>';

								ret.stopped = {};
								ret.stopped.time = asset.posInfo.staticTime.format(window.COM_TIMEFORMAT);
								var dateDifference = Protocol.Helper.getDifferenceBTtwoDates(asset.posInfo.staticTime, moment());
								ret.stopped.duration = moment.duration(dateDifference, "milliseconds").format('d[d] h[h] m[m]');

							}
							ret.status.value = LANGUAGE.HOME_MSG015;
							ret.status.state = 'state-0';
							ret.status.eventTime = asset.posInfo.positionTime.format(window.COM_TIMEFORMAT);
							ret.status.event = LANGUAGE.HOME_MSG018;
							ret.GSM.state = 'state-1';
							ret.GSM.value = randomIntFromInterval(71, 95) + '%';
						}

					}

					if (dateTimeSecond > 72 * 60 * 60 * 1000) {
						ret.GSM.state = 'state-3';
						ret.GSM.value = randomIntFromInterval(5, 10) + '%';
					}
					else if (dateTimeSecond > 24 * 60 * 60 * 1000) {
						ret.GSM.state = 'state-2';
						ret.GSM.value = randomIntFromInterval(25, 70) + '%';
					}
					else if (dateTimeSecond > 12 * 60 * 60 * 1000) {
						ret.GSM.state = 'state-0';
						ret.GSM.value = '0%';
					} else {
						ret.GSM.state = 'state-1';
						ret.GSM.value = randomIntFromInterval(71, 95) + '%';
					}

					if (dateTimeSecond > 48 * 60 * 60 * 1000) {
						ret.GPS.state = 'state-0';
						ret.GPS.value = '0%';
					}
					else if (asset.haveFeature("Acc") && (Protocol.PositionStatus.ACC & asset.posInfo.status) === 0 && asset.posInfo.speed === 0) {
						ret.GPS.state = 'state-1';
						ret.GPS.value = randomIntFromInterval(71, 95) + '%';
					}
					else if (asset.posInfo.speed > 0) {
						ret.GPS.state = 'state-1';
						ret.GPS.value = randomIntFromInterval(71, 95) + '%';
					} else if (asset.posInfo.speed === 0) {
						ret.GPS.state = 'state-1';
						ret.GPS.value = randomIntFromInterval(71, 95) + '%';
					}

					ret.geolock = {
						value: false,
						state: 'state-0',
					};
					ret.immob = {
						value: false,
						state: 'state-0',
					};
					ret.lockdoor = {
						value: false,
						state: 'state-0',
					};
					if (asset.StatusNew) {
						var geolockImmobSate = Protocol.Helper.getGeoImmobState(asset.StatusNew);
						if (geolockImmobSate.Geolock) {
							ret.geolock.value = geolockImmobSate.Geolock;
							ret.geolock.state = 'state-1';
						}
						if (geolockImmobSate.Immobilise) {
							ret.immob.value = geolockImmobSate.Immobilise;
							ret.immob.state = 'state-3';
						}
						if (geolockImmobSate.LockDoor) {
							ret.lockdoor.value = geolockImmobSate.LockDoor;
							ret.lockdoor.state = 'state-3';
						}
					}

				}
			}


			return ret;
		}
	}
};

Protocol.Common = JClass({
	STATIC: {

	},
	constructor: function (arg) {
		this.initDeviceInfo(arg);
		this.posInfo = {};
	},
	initDeviceInfo: function (arg) {
        /*this.id = arg.ID;
        this.imei = arg.IMEI;
        this.protocolClass = arg.ProtocolClass;
        this.name = arg.Name;
        this.productCode = arg.ProductCode;
        this.customerCode = arg.CustomerCode;
        this.groupCode = arg.GroupCode;
        this.contactCode = arg.ContactCode;
        this.speedUnit = arg.SpeedUnit;
        this.beMonitored = arg.BeMonitored;
        this.initMileage = arg.InitMileage;
        this.InitAcconHours = arg.InitAcconHours;
        this.state = arg.State;
        this.billCode=arg.BillCode;

        this._FIELD_FLOAT1 = arg._FIELD_FLOAT1;
        this._FIELD_FLOAT2 = arg._FIELD_FLOAT2;
        this._FIELD_FLOAT3 = arg._FIELD_FLOAT3;
        this.initDeviceInfoEx(arg);*/

		this.Id = arg.Id;
		this.IMEI = arg.IMEI;
		this.Name = arg.Name;
		this.TagName = arg.TagName;
		this.Icon = arg.Icon;
		this.Unit = arg.Unit;
		this.InitMileage = arg.InitMileage;
		this.InitAcconHours = arg.InitAcconHours;
		this.State = arg.State;
		this.ActivateDate = arg.ActivateDate;
		this.PayPlanName = arg.PayPlanName;
		this.PRDTName = arg.PRDTName;
		this.PRDTFeatures = arg.PRDTFeatures;
		this.PRDTAlerts = arg.PRDTAlerts;
		this.Describe1 = arg.Describe1;
		this.Describe2 = arg.Describe2;
		this.Describe3 = arg.Describe3;
		this.Describe4 = arg.Describe4;
		this.Describe5 = arg.Describe5;
		this.Describe7 = arg.Describe7;
		this._FIELD_FLOAT1 = arg._FIELD_FLOAT1;
		this._FIELD_FLOAT2 = arg._FIELD_FLOAT2;
		this._FIELD_FLOAT7 = arg._FIELD_FLOAT7;
		this.AlarmOptions = arg.AlarmOptions;
		this.StatusNew = arg.StatusNew;
		this._FIELD_FLOAT8 = arg._FIELD_FLOAT8;
		this.IMSI = arg.IMSI;
		this._FIELD_INT2 = arg._FIELD_INT2;
		this.GroupCode = arg.GroupCode;
		this.SolutionType = arg.SolutionType;
		this.Registration = arg.Registration;
		this.StockNumber = arg.StockNumber;
		this.MaxSpeed = arg.MaxSpeed;
		this.MaxSpeedAlertMode = arg.MaxSpeedAlertMode;
		this.StorageTime = arg.StorageTime;
		this.DaysInInventory = arg.DaysInInventory;
		this.ActivationTime = arg.ActivationTime;
		this.BusinessExpense = arg.BusinessExpense;
		this.FuelEconomy = arg.FuelEconomy;
		this.EngineCapacity = arg.EngineCapacity;
		this.OffroadTaxCredit = arg.OffroadTaxCredit;
		this.AssetType = arg.AssetType;
		this.DriverCode = arg.DriverCode;
		this.RoadSpeed = arg.RoadSpeed;
		this.LBSWIFI = arg.LBSWIFI;
		this.STATICDRIFT = arg.STATICDRIFT;
		this.Input1Name = arg.Input1Name;
		this.Input2Name = arg.Input2Name;
		this.Input3Name = arg.Input3Name;
		this.Input4Name = arg.Input4Name;
		this.Output1Name = arg.Output1Name;
		this.Output2Name = arg.Output2Name;
		this.isShared = arg.isShared;
		this.SuspendDate = arg.SuspendDate;

	},
	initDeviceInfoEx: function () { },
	initPosInfo: function (ary) {
		var posInfo = {};

		posInfo.assetID = ary[0];
		posInfo.imei = ary[1];
		posInfo.protocolClass = ary[2];
		posInfo.positionType = ary[3];
		posInfo.dataType = ary[4];
		if (ary[5] !== null) {

			posInfo.positionTime = moment(ary[5].split('.')[0]).add(CustomerInfo.TimeZone, 'hours');
		}
		else {
			posInfo.positionTime = null;
		}
		if (ary[6] !== null) {
			posInfo.sysTime = moment(ary[6].split('.')[0]).add(CustomerInfo.TimeZone, 'hours');
		}
		else {
			posInfo.sysTime = null;
		}
		if (ary[7] !== null) {
			posInfo.staticTime = moment(ary[7]).add(CustomerInfo.TimeZone, 'hours');
		}
		else {
			posInfo.staticTime = null;
		}
		posInfo.isRealTime = ary[8];
		posInfo.isLocated = ary[9];
		posInfo.satelliteSignal = ary[10];
		posInfo.gsmSignal = ary[11];
		posInfo.lat = ary[12];
		posInfo.lng = ary[13];
		posInfo.alt = ary[14];
		posInfo.direct = ary[15];
		posInfo.speed = ary[16];
		posInfo.mileage = ary[17];
		posInfo.launchHours = ary[18];
		posInfo.alerts = ary[19];
		posInfo.status = ary[20];
		posInfo.originalAlerts = ary[21];
		posInfo.originalStatus = ary[22];
		this.initPosInfoEx(ary, posInfo);
		this.posInfo = posInfo;

		return posInfo;
	},
	initPosInfoEx: function () { },
	initHisPosInfo: function (ary) {
		var posInfo = {};
		posInfo.assetID = ary[0];
		posInfo.positionType = ary[1];
		posInfo.dataType = ary[2];
		if (ary[3] !== null) {
			posInfo.positionTime = moment(ary[3].split('.')[0]).add(CustomerInfo.TimeZone, 'hours');
		}
		else {
			posInfo.positionTime = null;
		}
		if (ary[4] !== null) {
			posInfo.sysTime = moment(ary[4]).add(CustomerInfo.TimeZone, 'hours');
		}
		else {
			posInfo.sysTime = null;
		}
		if (ary[5] !== null) {
			posInfo.staticTime = moment(ary[5]).add(CustomerInfo.TimeZone, 'hours');
		}
		else {
			posInfo.staticTime = null;
		}
		posInfo.isRealTime = ary[6];
		posInfo.isLocated = ary[7];
		posInfo.satelliteSignal = ary[8];
		posInfo.gsmSignal = ary[9];
		posInfo.lat = ary[10];
		posInfo.lng = ary[11];
		posInfo.alt = ary[12];
		posInfo.direct = ary[13];
		posInfo.speed = ary[14];
		posInfo.mileage = ary[15];
		posInfo.launchHours = ary[16];
		posInfo.alerts = ary[17];
		posInfo.status = ary[18];
		posInfo.originalAlerts = ary[19];
		posInfo.originalStatus = ary[20];
		this.initHisPosInfoEx(ary, posInfo);
		return posInfo;
	},
	initHisPosInfoEx: function () { },
	initEventInfo: function (ary) {
		var event = {};
		event.assetID = ary[0];
		event.eventClass = ary[1];
		event.eventType = ary[2];
		event.state = ary[3];
		event.otherCode = ary[4];
		event.otherCode2 = ary[5];
		event.contactCode = ary[6];
		event.beginTime = moment(ary[7]).add(CustomerInfo.TimeZone, 'hours');
		event.endTime = moment(ary[8]).add(CustomerInfo.TimeZone, 'hours');
		event.positionType = ary[9];
		event.lat = ary[10];
		event.lng = ary[11];
		event.alt = ary[12];
		event.alerts = ary[13];
		event.status = ary[14];
		this.initEventInfoEx(ary, event);
		return event;
	},
	initEventInfoEx: function () { },
	haveFeature: function (feature) {
		return (Protocol.ProductFeatures[feature] & this.PRDTFeatures) > 0;
	},
	getStaticTimeSpan: function () {
		var ret = "";
		if (this.posInfo.speed === 0 && this.posInfo.positionTime !== null && this.posInfo.staticTime !== null) {
			ret = TimeSpan(this.posInfo.positionTime.diff(this.posInfo.staticTime, 'milliseconds')).format("^hh:mm:ss");
		}
		return ret;
	}
});
Protocol.ClassManager = {
	array: {},
	add: function (name, clas) {
		Protocol.ClassManager.array[name] = clas;
	},
	get: function (name, arg) {
		var clasType = Protocol.ClassManager.array[name];
		var ret = null;
		if (isUndefined(clasType)) {
			ret = new Protocol.Common(arg);
		}
		else {
			ret = new clasType(arg);
		}
		return ret;
	}
};



/*
// EXAMPLE
var deviceInfo = {
    // GPS DEVICE INFO, you can change initDeviceInfo method base on api response
};

var posData = ["3C3E3B3A3F","0354188046604596","EELINK_OBD","0","2","2016-03-12T10:15:17","2016-03-12T10:17:23.767","2013-11-04T06:25:03","true","true","0","0","43.905781111111168","125.27960111111116","0.0","332","0.0","0.0","10","0","1","0","0","0.0","0.0",null,"0.0"];
var protocolClass = posData[2];

var posInfo = Protocol.ClassManager.get(protocolClass, deviceInfo);

posInfo.initPosInfo(posData); //  for init or update position data

if(posInfo.haveFeature("Speed")){
    // display speed in asset list

}
*/