function toggler() {
	var t = "UL";
	if (getStringVar('menuid')=="") {
	    if (getStringVar('KeyPub')!="") {
	    	t += getStringVar('KeyPub');
	    	t = t.replace("|","");
	    	}
	    else
		return;
	}
	else
	t += getStringVar('menuid');
	toggler_ID(t);
}

function toggler_ID(t) {
if (t.indexOf('_NEW_') >= 0) return;
if ($){
	var current = $("#"+t);
	
	current.addClass("current");
	var MenuContainer = current.parents(".navcontainer");
	MenuContainer.addClass("current");
	var menuTitle = MenuContainer.find(".navtitle");
	menuTitle.addClass("navtitle_current");
	menuTitle.attr("current", "true");
	menuTitle.next("div").find("ul:first").show(); //mostra le pagine di 1° livello
	
	current.find("ul:first").removeClass("def");
	var Lev = current.parents(".navcontainer li").length+1;
	if (current[0].nodeName=="LI" && typeof(MenuApplyCustomStyle)=="function") MenuApplyCustomStyle(current, Lev);
	
	//toglie la classe .def a ritroso
	temp = current[0];
	while (temp.nodeName!="DIV" )
	{
		temp=temp.parentNode;
		if (temp.nodeName=="UL"){
			$(temp).removeClass("def");
		}
		if (temp.nodeName=="LI") {
			Lev--;
			if (typeof(MenuApplyCustomStyle)=="function") MenuApplyCustomStyle(temp, Lev);
		}
	}
	return;
}
var a = new Array();

var temp=document.getElementById(t);

if (temp==null) return;

temp.className="current";

//toglie la classe .def che nasconde le sottopagine
temp.getElementsByTagName("UL")[0].className="";

a=temp.getElementsByTagName("UL")[0].getElementsByTagName("LI");


while (temp.nodeName!="DIV" )
{
	temp=temp.parentNode;

	if (temp.nodeName=="UL"){
		temp.className="";
	}
}

//Imposta la classe current sul menu
var t = document.getElementById("title_" + temp.id);
if (t) t.className="navtitle_current";

}

//endtoggler
function MenuNav(){
	if ($(this).attr("current")=="true") return;
	$(".navtitle[current=true]").removeAttr("current");
	if ($(this).attr("current", "true"));
	
	var _this = this;
	
	if(jQuery.browser.msie && jQuery.browser.version<8){
		$(".navtitle").next("div").find("ul:first").hide();
		$(this).next("div").find("ul:first").show();
	}
	else {
		$(".navtitle").next("div").find("ul:first").slideUp();
		$(this).next("div").find("ul:first").slideDown();
	}
}	
$(function(){
	$(".navtitle").click(MenuNav);
});

