function isMobile() {
	mobile = ["Android", "webOS", "iPhone", "iPod", "BlackBerry", "Windows Phone", "Opera Mini", "IEMobile"];
	for (var i = 0; i <= mobile.length - 1; i++) {
		var mobilex = navigator.userAgent.indexOf(mobile[i]);
		if (mobilex != -1) {
			return true;
			break;
		}
	}
	return false;
}

function isPad() {
	pad = ["iPad"];
	for (var i = 0; i <= pad.length - 1; i++) {
		var mobilex = navigator.userAgent.indexOf(pad[i]);
		if (mobilex != -1) {
	    	return true;
	        break;
	    }
	}
	return false;
}
function jwtDecode(token) {
    const base64Url = token.split('.')[1];
    const base64 = base64Url.replace('-', '+').replace('_', '/');
    return JSON.parse(window.atob(base64)) || false;
}

function setCookie(name, value, domain){
	document.cookie=name + "=" + value + ";" + domain + ";";
}

function getCookie(cname) {
    var name = cname + "=";
    var decodedCookie = decodeURIComponent(document.cookie);
    var ca = decodedCookie.split(';');
    for(var i = 0; i <ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') {
            c = c.substring(1);
        }
        if (c.indexOf(name) == 0) {
            return c.substring(name.length, c.length);
        }
    }
    return "";
}