function plus(obj) {
	if (obj.nextSibling.style.display=='none') {
		obj.nextSibling.style.display='inline'
	} else {
			obj.nextSibling.style.display='none'
	}
}

function minus(obj) {
	obj.style.display='none'
}

function plusAll() {
	var x = document.querySelectorAll('.plusinfo, .plus')
	x.forEach(element => {
		element.style.display='inline';
	})
}

function plusAdv() {
	minusAll();

	var x = document.querySelectorAll('.a, .plus')
	x.forEach(element => {
		element.style.display='inline';
	})
}

function plusPlus() {
	minusAll();

	var x = document.querySelectorAll('.plus')
	x.forEach(element => {
		element.style.display='inline';
	})
}

function minusAll() {
	var x = document.querySelectorAll('.plusinfo, .plus');
	x.forEach(element => {
		element.style.display='none';
	})
}

function plusParentNode(obj) {
	var x = obj.parentNode.querySelectorAll('.plusinfo, .plus')
	x.forEach(element => {
		element.style.display='inline';
	})
}

function advParentNode(obj) {
	minusParentNode(obj);

	var x = obj.parentNode.querySelectorAll('.a, .plus')
	x.forEach(element => {
		element.style.display='inline';
	})
}

function plusPlusParentNode(obj) {
	minusParentNode(obj);

	var x = obj.parentNode.querySelectorAll('.plus')
	x.forEach(element => {
		element.style.display='inline';
	})
}

function minusParentNode(obj) {
	var x = obj.parentNode.querySelectorAll('.plusinfo');
	x.forEach(element => {
		element.style.display='none';
	})
}

function setPlusRevealLevelSelect() {
	if (typeof(Storage) !== "undefined") {
		switch (localStorage.plusRevealLevel) {
			case "📖 Reveal All":
				document.getElementById("plusRevealLevelSelect").selectedIndex = 0;
				break;
			case "📄 Reveal Advanced":
				document.getElementById("plusRevealLevelSelect").selectedIndex = 1;
				break;
			case "➕ Reveal + Symbols":
				document.getElementById("plusRevealLevelSelect").selectedIndex = 2;
				break;
			case "📘 Reveal None":
				document.getElementById("plusRevealLevelSelect").selectedIndex = 3;
				break;
		}
	}
}

function changePlusRevealLevel(selectTag) {
	switch (selectTag.options[selectTag.selectedIndex].text) {
		case "📖 Reveal All":
			plusAll();
			break;
		case "📄 Reveal Advanced":
			plusAdv();
			break;
		case "➕ Reveal + Symbols":
			plusPlus();
			break;
		case "📘 Reveal None":
			minusAll();
			break;
	}

	if (typeof(Storage) !== "undefined") {
		localStorage.plusRevealLevel = selectTag.options[selectTag.selectedIndex].text;
	}
}

function setPlusRevealLevel() {
	// if localStorage is supported, set according to localStorage.plusRevealLevel
	if (typeof(Storage) !== "undefined") { // check browser support for localStorage

		// Code for localStorage/sessionStorage.
		// initialize if necessary
		if (!localStorage.plusRevealLevel) {
			localStorage.plusRevealLevel = "➕ Reveal + Symbols";
		}

		// set according to localStorage.plusRevealLevel
		switch (localStorage.plusRevealLevel) {
			case "📖 Reveal All":
				plusAll();
				break;
			case "📄 Reveal Advanced":
				plusAdv();
				break;
			case "➕ Reveal + Symbols":
				plusPlus();
				break;
			case "📘 Reveal None":
				minusAll();
				break;
		}

		setPlusRevealLevelSelect();
	}
	else {
		// if localStorage is not supported, set to Reveal + Symbols
		plusPlus();
		document.getElementById("plusRevealLevelSelect").selectedIndex = 2;
	}
}

// on page load

setPlusRevealLevel()
