// JavaScript Document
/// declaration de variables
var OldRubrique = 0;

var OldID 		= 0;
var OldETAT 	= 0;
var OldID2 		= 0;
var OldETAT2 	= 0;
var OldMenu		= 0;




/// TESTE DU NAVIGATEUR POUR LES FONCTION DE ROLLOVER
function Teste_Navigateur()
{

		Nom_Browser = navigator.appName;
		Version_Browser = navigator.appVersion;
		if ( Nom_Browser == "Netscape" )
		{
			return 1;
		}
		if ( Nom_Browser == "Microsoft Internet Explorer" )
		{
			return 2;
		}
		return 2;
}
/// FONCTION DE MISE A TAILLE DE L'IFRAME
function RedimIframe( Objet )
{
	//var Taille = 600;
	Taille = Objet.getElementById('CADRE').clientHeight + 25;
	var iNav = Teste_Navigateur();
	if( iNav == 1)
	{
	
		var obj = document.getElementById('FRAME_CENTRALE');
		if( obj != null ) obj.setAttribute('height', Taille );
	}
	if( iNav == 2)//ie
	{
		var obj = document.getElementById('FRAME_CENTRALE');
		if( obj != null ) obj.height = Taille ;
			
	}
	
}
///  fonction changement de class au rollover
function RollOver( ID, Class)
{
	var iNav = Teste_Navigateur();
		
		if( iNav == 1)
		{	
			if(ID != OldRubrique)
			{
					var obj = document.getElementById(ID);
					if( obj != null ) obj.setAttribute('class', Class );
			}
		}
		if( iNav == 2 )
		{
			if(ID != OldRubrique)
			{
				var obj = document.getElementById(ID);
				if( obj != null ) obj.className = Class;
			}
		}
}
//// fonction changement de class et chargement de page a la selection
function Charge_URL(ID, URL)
{
	var iNav = Teste_Navigateur();
		
	if( iNav == 1)
		{	
			if(ID != OldRubrique)
			{
					if(ID != 'Vide')
					{
						var obj = document.getElementById(ID);
						if( obj != null ) obj.setAttribute('class', 'MENU_NIVEAU1SELECTED' );
					}
					
					var obj = document.getElementById('FRAME_CENTRALE');
					if( obj != null ) obj.setAttribute('src', URL );
					
					/// réinitialisation du style
					var obj = document.getElementById(OldRubrique);
					if( obj != null ) obj.setAttribute('class', 'MENU_NIVEAU1' );
			}
		}
	else if( iNav == 2 )
		{
			if(ID != OldRubrique)
			{
					var obj = document.getElementById(ID);
					if( obj != null ) obj.className = 'MENU_NIVEAU1SELECTED';
					
					var obj = document.getElementById('FRAME_CENTRALE');
					if( obj != null ) obj.src = URL;
					
					/// réinitialisation du style
					var obj = document.getElementById(OldRubrique);
					if( obj != null ) obj.className = 'MENU_NIVEAU1';
			}
		}
		
		OldRubrique = ID;
}

function Charge_URLBIS(URL)
{
	var iNav = Teste_Navigateur();
		
	if( iNav == 1)
		{	
			
					var obj = document.getElementById('FRAME_CENTRALE');
					if( obj != null ) obj.setAttribute('src', URL );
					
					/// réinitialisation du style
					var obj = document.getElementById(OldRubrique);
					if( obj != null ) obj.setAttribute('class', 'MENU_NIVEAU1' );
		}
	else if( iNav == 2 )
		{
					var obj = document.getElementById('FRAME_CENTRALE');
					if( obj != null ) obj.src = URL;
					
					/// réinitialisation du style
					var obj = document.getElementById(OldRubrique);
					if( obj != null ) obj.className = 'MENU_NIVEAU1';
		}
		OldRubrique = null;
}


//// fonction changement de class et chargement de page a la selection
function Charge_Page(URL)
{
	// Modification du chemin de l'url
	URL = "../TEMPLATES/" + URL;
	// on recherche l'ID
	var i = URL.indexOf( "=" );
	var ID = null;
	if( i > -1 )
	{
		ID = URL.substr( (i + 1	) );
	}
	ID = "MENU"+ID;

	parent.Charge_URL( ID, URL );
}

function AfficheProgramme( ID , ID2 , ACTION)
{
	var iNav = Teste_Navigateur();
		
	if( iNav == 1)
		{	
			if(ACTION == 'OUVRIR' )
			{
			
					var obj = document.getElementById(ID);
					if( obj != null ) obj.setAttribute('style', 'display:none;');
					
					var obj = document.getElementById(ID2);
					if( obj != null ) obj.setAttribute('style', 'display:block;' );
					
					/// réinitialistaion de l'ancienne selection			
					var obj = document.getElementById(OldID);
					if( obj != null ) obj.setAttribute('style', 'display:block;');
					
					var obj = document.getElementById(OldID2);
					if( obj != null ) obj.setAttribute('style', 'display:none;');
					
					if( parent.RedimIframe != null )
						parent.RedimIframe( document );
					
					OldID   = ID;
					OldID2   = ID2;
		
			}
			if(ACTION == 'FERMER' )
			{
			
					/// réinitialistaion de l'ancienne selection			
					var obj = document.getElementById(OldID);
					if( obj != null ) obj.setAttribute('style', 'display:block;');
					
					var obj = document.getElementById(OldID2);
					if( obj != null ) obj.setAttribute('style', 'display:none;');
					
					if( parent.RedimIframe != null )
						parent.RedimIframe( document );
					
					OldID   = '';
					OldID2   = '';
			
			}
					
					
					
				
		}
	else if( iNav == 2 )
		{
			if(ACTION == 'OUVRIR' )
			{
					var obj = document.getElementById(ID);
					if( obj != null ) obj.style.display = 'none';

					
					var obj = document.getElementById(ID2);
					if( obj != null ) obj.style.display = 'block';	
					
					if( parent.RedimIframe != null )					
						parent.RedimIframe( document );
					
					/// réinitialistaion de l'ancienne selection	
					var obj = document.getElementById(OldID);
					if( obj != null ) obj.style.display = 'block';
						
					var obj = document.getElementById(OldID2);
					if( obj != null ) obj.style.display = 'none';	
					
					if( parent.RedimIframe != null )
						parent.RedimIframe( document );
					
					
					OldID  = ID;
					OldID2  = ID2;
			}
			if(ACTION == 'FERMER' )
			{
					var obj = document.getElementById(OldID);
					if( obj != null ) obj.style.display = 'block';
					
					var obj = document.getElementById(OldID2);
					if( obj != null ) obj.style.display = 'none';	
					
					if( parent.RedimIframe != null )
						parent.RedimIframe( document );
					
					OldID   = '';
					OldID2   = '';
			}
		}
		
		
}
function AfficheMenu(ID)
{
	var iNav = Teste_Navigateur();
		
	if( iNav == 1)
		{
			if(ID != OldMenu)
			{
					var obj = document.getElementById(ID);
					if( obj != null ) obj.setAttribute('style', 'display:block;');
					
					var obj = document.getElementById(OldMenu);
					if( obj != null ) obj.setAttribute('style', 'display:none;' );
			}
			OldMenu   = ID;
					
		}
			
			
	else if( iNav == 2 )
		{
			if(ID != OldMenu)
			{
			
					var obj = document.getElementById(ID);
					if( obj != null ) obj.style.display = 'block';

					
					var obj = document.getElementById(OldMenu);
					if( obj != null ) obj.style.display = 'none';
					
			}
			OldMenu   = ID;
			
		}
		
		
}
