﻿function Application_RefreshMenus()
{    
    var strHtmlLeft="";
    var img="";
    var style="";
    var indent=0;
    var visible=false;
        
    if (document.getElementById("MenuGauche").innerHTML=="")
    {
        for(var i=0;i<_Root.Liste.length;i++)
        {
            indent=25;
    	    indent=(_Root.Liste[i].Level)*indent; 
    	    if(indent==0)
    	    {indent=10;}

            if(_Root.Liste[i].IsCourant)
            {style="MenuOn";img="flechebas.jpg";}
            else
            {style="MenuOff";img="fleche.jpg";}
            
            if(_Root.Liste[i].Visible)
            {visible="block";}
            else
            {visible="none";}
            
            strHtmlLeft+="<div id=\""+_Root.Liste[i].Id+"\" class=\""+style+"\" style=\"display:"+visible+"; padding-left:"+indent+"px\"><img id=\"img_"+_Root.Liste[i].Id+"\" src=\"skin/imgs/"+img+"\" /><a onMouseOut=\"window.status=''; return true\" onMouseOver=\"window.status='"+_Root.Liste[i].Libelle+"'; return true\" href=\"javascript:LoadContent('"+_Root.Liste[i].Chemin+"','"+_Root.Liste[i].Id+"')\" >"+_Root.Liste[i].Libelle+"</a></div>";
	    }	
	    document.getElementById("MenuGauche").innerHTML=strHtmlLeft;
    }
    else
    {
        for(var i=0;i<_Root.Liste.length;i++)
        {
            if(_Root.Liste[i].IsCourant)
            {style="MenuOn";img="flechebas.jpg";}
            else
            {style="MenuOff";img="fleche.jpg";}
            
            if(_Root.Liste[i].Visible)
            {visible="block";}
            else
            {visible="none";}
            
            document.getElementById(_Root.Liste[i].Id).className=style;
            document.getElementById(_Root.Liste[i].Id).style.display=visible;
            document.getElementById("img_"+_Root.Liste[i].Id).src="skin/imgs/"+img;
        }     
    }
}


function LoadContent(chemin,id)
{    
    window.status="Chargement...";
    top.document.getElementById("frame_contenu").src=chemin;   
    window.status="";
}
