const COOKIE_AUDIT_TYPE_FILTER 		= "sed6atf";
const COOKIE_THEME_COLOR_MODE  		= "sed6cm";
const COOKIE_THEME_THEME_NAME  		= "sed6tn";
const COOKIE_CURRENT_CATEGORY_ID	= "sed6cid";
const COOKIE_CURRENT_AUTOQUERY_ID	= "sed6aid";
const COOKIE_CURRENT_DISPLAY_GROUP  = "sed6dgp";
const COOKIE_SELECTED_DOMAIN_NAME	= "sed6dn";
const COOKIE_SELECTED_DOMAIN_ID		= "sed6did";
const COOKIE_DOMAIN_SORT_COLUMN		= "sed6dsc";
const COOKIE_CURRENT_DOMAIN_TAB		= "sed6dmt";
const COOKIE_DOMAIN_TABLE_HEIGHT	= "sed6dth";
const COOKIE_CATEGORY_CONTROL_TAB	= "sed6cct";
const COOKIE_CATEGORY_LIST_SORT		= "sed6cls";
const COOKIE_AUTOQUERY_LIST_SORT	= "sed6als";
const COOKIE_CURRENT_REPORT_NAME	= "sed6crn";
const COOKIE_REPORT_SORT_COLUMN		= "sed6rsc";
const COOKIE_CONTENT_TRANSPARENCY	= "sed6ctr";
const COOKIE_CONTENT_BLURFILTER		= "sed6cbf";
const COOKIE_MONITOR_SORT_ORDER		= "sed6mso";
const COOKIE_CURRENT_REPORT_ID		= "sed6rid";
const COOKIE_MONITOR_DISPLAY_GROUP	= "sed6mdg";
const COOKIE_ADD_DOMAIN_OPTIONS		= "sed6add";
const COOKIE_ITEMS_PER_PAGE			= "sed6ipp";
const COOKIE_SSL_TABLE_HEIGHT		= "sed6sth";
const COOKIE_EXPIRY_HIGLIGHT_DAYS	= "sed6hlt";

/////////////////////////////////////////////////////////////////////////////////////////

function saveCookie(name, value, exp=30)
{
	if(value == null || value == '' || (value && value.length && value.toLowerCase() == 'default'))
		$.removeCookie(name);
	else
		$.cookie(name, value, {expires:exp});
}

/////////////////////////////////////////////////////////////////////////////////////////

function getCookie(name, defval)
{
	var value = $.cookie(name);
	if(value == "" || value == null)
		return defval;
	return value
}

/////////////////////////////////////////////////////////////////////////////////////////

function getCookieInt(name, defval)
{
	var value = $.cookie(name);
	if(value == "" || value == null || isNaN(value))
		return defval;
	return Math.round(parseFloat(value));
}

/////////////////////////////////////////////////////////////////////////////////////////

function getCookiePercent(name, defval)
{
	var value = getCookieInt(name, defval);
	if(value < 0 || value > 100)
		value = defval;
	return value;
}

/////////////////////////////////////////////////////////////////////

function clearAllCookies() {
	var cookies = $.cookie();
	for(var cookie in cookies) {
	   $.removeCookie(cookie);
	}
}
