var Cookie = { Set: function () { var name = arguments[0], value = escape(arguments[1]), days = (arguments.length > 2) ? arguments[2] : 365, path = (arguments.length > 3) ? arguments[3] : "/"; with (new Date()) { setDate(getDate() + days); days = toUTCString(); } document.cookie = "{0}={1};expires={2};path={3}".format(name, value, days, path); }, Set1Day: function () { var name = arguments[0], value = escape(arguments[1]), days = (arguments.length > 2) ? arguments[2] : 365, path = (arguments.length > 3) ? arguments[3] : "/"; with (new Date()) { setDate(getDate() + days); days = toUTCString(); } document.cookie = "{0}={1};expires={2};path={3}".format(name, value, days, path); }, Set30Min: function () { var name = arguments[0], value = escape(arguments[1]), days = (arguments.length > 2) ? arguments[2] : 0.5, path = (arguments.length > 3) ? arguments[3] : "/", //expires = new Date(new Date().getTime() + 30 * 60 * 1000); expires = new Date(new Date().getTime() + 10 * 60 * 1000); document.cookie = `${name}=${value};expires=${expires.toUTCString()};path=${path}`; }, Get: function () { var returnValue = document.cookie.match(new RegExp("[\b\^;]?" + arguments[0] + "=([^;]*)(?=;|\b|$)", "i")); return returnValue ? unescape(returnValue[1]) : returnValue; }, Delete: function () { var name = arguments[0]; document.cookie = name + "=1 ; expires=Fri, 31 Dec 1900 23:59:59 GMT;"; } }