function chiudilivellimenu(){
	for (i=1; i<14; i++) { 
		nomelivello="sottomenu"+i;
		document.getElementById(nomelivello).style.visibility='hidden';
	}
	
	for (i=1; i<18; i++) { 
		nomelivello="livellohome"+i;
		document.getElementById(nomelivello).style.visibility='hidden';
	}		

}




function aprilivellohome(nomelivello){
	chiudilivellimenu();
	document.getElementById(nomelivello).style.visibility='visible';
}

function aprilivellomenu(nomelivello){
	chiudilivellimenu();
	document.getElementById(nomelivello).style.visibility='visible';
}
	

function toolsLinksSnapSection(section) 
{
	chiudilivellimenu();
	
	toolsLinksUnselectText();	
	if (toolsLinksIsAlreadyOpen(section)) 
	{
		toolsLinksClose(section);
	}	
	else
	{
		toolsLinksClose("corsi");
		toolsLinksClose("corsi1");
		toolsLinksClose("docenti");
		toolsLinksClose("alunni");
		toolsLinksClose("ata");
		toolsLinksClose("genitori");
		toolsLinksClose("pof");
		toolsLinksClose("scuola");
		toolsLinksClose("link");
		toolsLinksClose("trasparenza");
		toolsLinksClose("ibandi");
		toolsLinksClose("lim");
		toolsLinksOpen(section);	
	}
}

function toolsLinksOpen(section)
{
	var tbody = document.getElementById(section);
	if (tbody == null) return;
	tbody.style.display = "";
}

function toolsLinksClose(section)
{
	var tbody = document.getElementById(section);
	if (tbody == null) return;
	tbody.style.display = "none";
}

function toolsLinksIsAlreadyOpen(section)
{
	var tbody = document.getElementById(section);
	if (tbody == null) return 0;
	return (tbody.style.display == "");
}

function toolsLinksUnselectText()
{
	try { document.getSelection().empty() } catch(e) {};
	try { document.selection.empty() } catch(e) {};
	try { window.getSelection().empty() } catch(e) {};
}



