            var curShownThirdLevel = '';

			var SLIDE_STEP = 12;
			var SLIDE_SLEEP = 20;

            
            function showHideThirdLevel(lvlid){
            
                if (curShownThirdLevel != '') {
                    hideThirdLevel(curShownThirdLevel);
                }
                if (curShownThirdLevel == lvlid) {
                    curShownThirdLevel = '';
                }
                else {
                    showThirdLevel(lvlid);
                    curShownThirdLevel = lvlid;
                }
            }
            
            function showThirdLevel(lvlid){
                var el = document.getElementById(lvlid);
                el.style.overflow = 'hidden'; //TODO spostare in css!!!!!!

                //lo sposto in un'area invisibile per misurarlo
                el.style.position = 'absolute';
                el.style.left = '-9999px';
                el.style.display = 'block';
                var maxHeight = el.offsetHeight;
                el.style.height = '0px';
                el.style.position = 'relative';
                el.style.left = '0px';
                
                elImg = document.getElementById(lvlid + '_img');
                elImg.src= '/img/expanded.gif'
                
                elTitle = document.getElementById(lvlid + '_title');
                elTitle.className = 'menuSecondLevelSelected';
                
                slideIt(el, 0,maxHeight, SLIDE_STEP, SLIDE_SLEEP);
                
            }
			

            function hideThirdLevel(lvlid){
                var el = document.getElementById(lvlid);
                el.style.overflow = 'hidden'; //TODO spostare in css!!!!!!

                var maxHeight = el.offsetHeight;
                
                elImg = document.getElementById(lvlid + '_img');
                elImg.src= '/img/collapsed.gif'

                elTitle = document.getElementById(lvlid + '_title');
                elTitle.className = 'menuSecondLevelNormal';

                slideDownIt(el,maxHeight, SLIDE_STEP, SLIDE_SLEEP);
                
                
                
                //settare altezza originale
                //settare display:none
            }
            
            function slideDownIt(el, maxHeight, step, sleepTime) {
                //alert('s:' + curHeight);
                el.style.height = maxHeight + 'px';
                if (maxHeight > 0) {
                    //altre iterazioni necessarie
                    maxHeight -=step;
                    if (maxHeight < 0) {
                        maxHeight = 0;
                    }
                    
                    //window.setTimeout(slideIt, sleepTime, el, curHeight, maxHeight, step); //OK FF
                    //setTimeout(function() { myFunc(a, b, c); }, ms); //DA PROVARE
                    
                    sleepTime +=3;

                    window.setTimeout(function(){slideDownIt(el, maxHeight, step, sleepTime )}, sleepTime);
                    
                } else {
                    el.style.height= '';
                    el.style.display='none'

                }
            }

            function slideIt(el, curHeight, maxHeight, step, sleepTime) {
                //alert('s:' + curHeight);
                el.style.height = curHeight + 'px';
                if (curHeight < maxHeight) {
                    //altre iterazioni necessarie
                    curHeight +=step;
                    if (curHeight > maxHeight) {
                        curHeight = maxHeight;
                    }
                    
                    //window.setTimeout(slideIt, sleepTime, el, curHeight, maxHeight, step); //OK FF
                    //setTimeout(function() { myFunc(a, b, c); }, ms); //DA PROVARE

                    sleepTime +=3;

                    window.setTimeout(function(){slideIt(el,curHeight, maxHeight, step, sleepTime )}, sleepTime);
                    
                }
            }
            
            function initCurShownThirdLevel(initialId) {
                var initial2Id = initialId.substr(0,3);
                var el = document.getElementById('3rdlvl'+initial2Id);
                //alert('3rdlvl'+initial2Id);
                //alert(el);
                if (el != undefined) {
                    curShownThirdLevel = '3rdlvl'+initial2Id;
                }
            }
            

