export function getThematiqueFamilySlug(thematique_slug) {
	switch (thematique_slug) {
		case "energie":
		case "urbanisme":
			return "energies-urbanisme";

		case "acoustique":
		case "coproprietes":
			return "acoustique-coproprietes";

		case "isolation":
		case "au-quotidien":
			return "isolation-quotidien";

		case "energies":
		case "urbanisme":
			return "energies-urbanisme";

		case "patrimoine":
		case "sante-securite-salubrite":
			return "patrimoine-sante-securite";

		case "location-achat":
			return "location";
	}
}

export function cleanString(string) {
	return string
		.normalize("NFD")
		.replace(/[\u0300-\u036f]/g, "")
		.toLowerCase()
		.split(" ")
		.join("-");
}

export function getAdminLanguageFromCookie(c_name) {
	var c_value = document.cookie,
		c_start = c_value.indexOf(" " + c_name + "=");
	if (c_start == -1) c_start = c_value.indexOf(c_name + "=");
	if (c_start == -1) {
		c_value = null;
	} else {
		c_start = c_value.indexOf("=", c_start) + 1;
		var c_end = c_value.indexOf(";", c_start);
		if (c_end == -1) {
			c_end = c_value.length;
		}
		c_value = unescape(c_value.substring(c_start, c_end));
	}
	return c_value;
}
