text: /*
  *  Functions for setting and reading cookies.
  */
  
  exports.set_cookie = function(data) {
  	var cookie_str = "";
  	if (data !== Object(data)) {
  		throw new Error("Invalid cookie data.");
  	}
  	for (var key in data) {
  		cookie_str += key + "=" + data[key] + ";";
  	}
  	document.cookie = cookie_str;
  }
  
  exports.get_cookies = function() {
  	var cookies = {};
  	for (let c of document.cookie.split('; ')) {
  		cookies[c.split('=')[0]] = c.split('=')[1];
  	}
  	return cookies;
  }
  
  exports.get_cookie = function(name) {
  	return exports.get_cookies()[name];
  }
  
  exports.cookie_exists = function(name) {
  	return name in exports.get_cookies();
  }
  
  exports.rm_cookie = function(data) {
  	var ndata = data;
  	ndata.expires = 'Thu, 01 Jan 1970 00:00:00 UTC';
  	exports.set_cookie(ndata);
  }
  