// JavaScript Document
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function dMenu()
{
for(i=1;i<=6;i++)
{
L="bouton"+i+"b";
MM_showHideLayers(L,'','hide')
L2="bouton"+i+"S";
MM_showHideLayers(L2,'','show')
}
}



// detection du navigateur utilise //

// declaration des variables - nom de l'application cliente mis en minuscules

var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,thestring;

// fonction permettant de reperer le positionnement du nom du navigateur dans la chaine 

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}


// debut de la detection


if (checkIt('konqueror'))
{
	browser = "Konqueror";
	OS = "Linux";
}
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"

// pour tous les navigateurs qui se presentent comme compatible Mozilla (Netscape)

else if (!checkIt('compatible'))
{
	browser = "Netscape Navigator"
	version = detect.charAt(8);
}
else browser = "Navigateur inconnu";

// detecte la version sauf pour Mozilla deja detectee

if (!version) version = detect.charAt(place + thestring.length);

// detecte l'OS sauf pour Konqueror deja detecte

if (!OS)
{
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "Operating system inconnu";
}


var n_Menus=8;n_Menus-=1;
var h_Menus=25

//tableau des positions de bases des menus
H1 = new Array(150,175,200,225,250,275,300,325)

//tableau a 2 dimensions des positions de deplacements des menus
H2 = new Array(4);



if ((browser=="Netscape Navigator")&&(version==4)){}
else{
for(i=0;i<n_Menus;i++){H2[i] = new Array(4);}
}





function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function P7AniMagic(el, x, y, a, b, c, s) { //v2.5 PVII
 var g,elo=el,f="",m=false,d="";x=parseInt(x);y=parseInt(y);
 var t = 'g.p7Magic = setTimeout("P7AniMagic(\''+elo+'\','; 
 if ((g=MM_findObj(el))!=null) {d=(document.layers)?g:g.style;}else{return;}
 if (parseInt(s)>0) {eval(t+x+','+y+','+a+','+b+','+c+',0)",' + s+')');return;}
 var xx=(parseInt(d.left))?parseInt(d.left):0;
 var yy=(parseInt(d.top))?parseInt(d.top):0;
 if(parseInt(c)==1) {x+=xx;y+=yy;m=true;c=0;}
 else if (c==2) {m=false;clearTimeout(g.p7Magic);}
 else {var i=parseInt(a);
  if (eval(g.moved)){clearTimeout(g.p7Magic);}
  if (xx<x){xx+=i;m=true;if(xx>x){xx=x;}}
  if (xx>x){xx-=i;m=true;if(xx<x){xx=x;}}
  if (yy<y){yy+=i;m=true;if(yy>y){yy=y;}}
  if (yy>y){yy-=i;m=true;if(yy<y){yy=y;}}}
 if (m) {if((navigator.appName=="Netscape") && parseInt(navigator.appVersion)>4){
    xx+="px";yy+="px";}
  d.left=xx;d.top=yy;g.moved=true;eval(t+x+','+y+','+a+','+b+','+c+',0)",'+b+')');
  }else {g.moved=false;}
}

function tmt_findObj(n){
	var x,t; if((n.indexOf("?"))>0&&parent.frames.length){t=n.split("?");
	x=eval("parent.frames['"+t[1]+"'].document.getElementById('"+t[0]+"')");
	}else{x=document.getElementById(n)}return x;
}

function MM_showHideLayers() { //v3.0A Modified by Al Sparber and Massimo Foti for NN6 Compatibility
  var i,p,v,obj,args=MM_showHideLayers.arguments;if(document.getElementById){
   for (i=0; i<(args.length-2); i+=3){ obj=tmt_findObj(args[i]);v=args[i+2];
   v=(v=='show')?'visible':(v='hide')?'hidden':v;
   if(obj)obj.style.visibility=v;}} else{
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }}
}


function MM_changeProp(objName,x,theProp,theValue) { //v3.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)) eval("obj."+theProp+"='"+theValue+"'");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function deselect()
{
/*
for(i=0;i<=n_Menus;i++)
{
titre_A="titre"+i
titre_B="titre"+i+"b"
P7AniMagic(titre_A,20,H1[i],30,1,0,0);
MM_showHideLayers(titre_A,'','show',titre_B,'','hide')
}
*/

}

var ouverture=0

function adapt(n)
{
n1 = n+1
H = H2[n1]

for(i=n_Menus;i>=n1;i--)
{
titre_A="titre"+i
//

with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
Hb = H+((h_Menus+4)*(i-n))
}
else{
Hb = H2[n][i]

Hb+=ouverture

}


}
//alert(n+"-"+i+"-"+Hb)
Sel[n]=1


P7AniMagic(titre_A,20,Hb,70,1,0,0);
}

//ouverture+=document.getElementById('titre'+n+'b').offsetHeight
divH = document.getElementById('titre'+n+'b').offsetHeight
				divT = document.getElementById('titre'+n+'b').offsetTop				
				ouverture = divH+divT-50
alert(ouverture)
}


Sel=new Array(n_Menus)


function montre(n)
{

for(i=0;i<=n_Menus;i++)
{
titre_A="titre"+i
titre_B="titre"+i+"b"



if(i==n){ 
Hb2=document.getElementById('titre'+n).offsetTop
//alert(Hb2+" "+H1[n])
if(Hb2!=H1[n])P7AniMagic(titre_B,20,Hb2,70,1,0,0);
MM_showHideLayers(titre_A,'','hide',titre_B,'','show') }
//P7AniMagic(titre_A,20,Hb,70,1,0,0);

//else { MM_showHideLayers(titre_A,'','show',titre_B,'','hide') }
}
}



function compte()
{
//POUR CHACUN DES BOUTONS

	for(i=0;i<=n_Menus;i++)
	{
	titre_B="titre"+i+"b"

	// si le bouton n'est pas le dernier

		if(i<n_Menus)
		{
		suiv=i+1
			// NETSCAPE 4
			if(browser=="Netscape Navigator"&&version==4)
			{
			
			H2[suiv]=document.layers[titre_B].layers['fin'].pageY-30
			}
			
			// IE5 - N6
			else
			{
			// coordonnees de deplacement des boutons suivants
				var marge=(n_Menus-i)*h_Menus
				for(j=n_Menus;j>i;j--)
				{

				divH = document.getElementById(titre_B).offsetHeight
				divT = document.getElementById(titre_B).offsetTop				
				marge-=h_Menus
				taille = divH+divT+marge
				H2[i][j]=taille
				//document.forms[0].elements[i].value+=" "+taille
				//alert(i+"-"+j+"-"+H2[i][j])
				}
			

			
			}
		}
	}
}


//ct=document.layers['titre0b'].layers

/*for (i=0;i<ct.length;i++)
{
alert(ct[i].pageY)
}*/

//alert(ct['fin'].pageY)
//H2[1]=ct['fin'].pageY+10




var isOpera = (navigator.userAgent.indexOf('Opera') != -1);
var isIE = (!isOpera && navigator.userAgent.indexOf('MSIE') != -1)

function M_out(e)
{
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	
	if (e.pageX || e.pageY)
	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY)
	{
		posx = e.clientX;
		posy = e.clientY;
		if (isIE)
		{
			posx += document.body.scrollLeft;
			posy += document.body.scrollTop;
		}
	}
	

	
	window.status=posx+" "+posy+" out"



	// posx and posy contain the mouse position relative to the document
	// Do something with this information

	if((posx<5)||(posy<10))
	{
	dMenu()
	}


}


function M_over(e)
{
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY)
	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY)
	{
		posx = e.clientX;
		posy = e.clientY;
		if (isIE)
		{
			posx += document.body.scrollLeft;
			posy += document.body.scrollTop;
		}
	}
	

	
	window.status=posx+" "+posy+" over"



	// posx and posy contain the mouse position relative to the document
	// Do something with this information

	if((posx>760)||(posy<5))
	{

	dMenu()
	}


if((posx<140)&&(posy>150))
	{

	dMenu()
	}


}



// JavaScript Document
// JavaScript Document


courant=0
nbr_ecrans=7


function profil(n,h)
{
if(!h)h=54

MM_swapImage('c'+courant,'','../imgs/t.gif',0)
MM_swapImage('t'+courant,'','../imgs/t.gif',0)
courant=n

n*=-592;
P7AniMagic('info',n,h,30,1,0,0);
/*
if(courant>0)MM_swapImage('fl1','','imgs/fl1.gif',0)
else MM_swapImage('fl1','','../imgs/t.gif',0)


if(courant<(nbr_ecrans-1))MM_swapImage('fl2','','imgs/fl2.gif',0)
else MM_swapImage('fl2','','../imgs/t.gif',0)
*/

MM_swapImage('c'+courant,'','imgs/FF0000.gif',0)
MM_swapImage('t'+courant,'','imgs/marqueur.gif',0)
}



function profil2(s)
{



if(s=='b')
{

if(courant>0)
{
MM_swapImage('c'+courant,'','../imgs/t.gif',0)
MM_swapImage('t'+courant,'','../imgs/t.gif',0)
courant-=1
profil(courant)
/*
if(courant<1)MM_swapImage('fl1','','../imgs/t.gif',0)
if(courant==(nbr_ecrans-2))MM_swapImage('fl2','','imgs/fl2.gif',0);
*/

MM_swapImage('c'+courant,'','imgs/FF0000.gif',0)
MM_swapImage('t'+courant,'','imgs/marqueur.gif',0)
}
}

else if(s=='f')
{

if(courant<(nbr_ecrans-1)){
MM_swapImage('c'+courant,'','../imgs/t.gif',0)
MM_swapImage('t'+courant,'','../imgs/t.gif',0)
courant+=1
profil(courant)
/*
if(courant==(nbr_ecrans-1))MM_swapImage('fl2','','../imgs/t.gif',0)
if(courant==1)MM_swapImage('fl1','','imgs/fl1.gif',0)
*/
MM_swapImage('c'+courant,'','imgs/FF0000.gif',0)
MM_swapImage('t'+courant,'','imgs/FF0000.gif',0)
}
}

}


function noSelect(lien)
{

if(lien.blur)lien.blur()
}

var rien=0

function calendr()
{


if(browser=='Netscape Navigator'&&version<=4.7) {

mess=confirm('Votre navigateur ne semble pas assez performant pour visualiser la page Calendrier.\nVoulez-vous voir la version imprimable?')

if(mess)
{window.location.href='../pdf/imp_calendrier.pdf'
alert('retour site')
}}

}

//alert(parseFloat(navigator.appVersion))