



/***********************************************
* Contractible Headers script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use. Last updated Oct 21st, 2003.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var dm_enablepersist="off" //Enable saving state of content structure using session cookies? (on/off)
var dm_collapseprevious="yes" //Collapse previously open content when opening present? (yes/no)

// *** CROSS-BROWSER COMPATIBILITY ***

var isDOM = (document.getElementById ? true : false); 
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isDyn = (isDOM || isIE4 || isNS4);
var bufRef = 'buffLoad';



function dm_getRef(id)
{
 if (isDOM || isDyn) return document.getElementById(id);
 if (isIE4) return document.all[id];
 if (isNS4) return document.layers[id];
}

function dm_getSty(id)
{
 return (isNS4 ? getRef(id) : getRef(id).style);
} 



if (document.getElementById){
document.write('<style type="text/css">')
document.write('.switchcontent{display:none;}')
document.write('.menu_fer{display:none;}')
document.write('.switchcontent2{visibility:visible;}')
document.write('</style>')
}
//**** PARTIE COOKIE
function EcrireCookie(nom, valeur)
{
// alert('ecriture');
var argv=EcrireCookie.arguments;
var argc=EcrireCookie.arguments.length;
var expires=(argc > 2) ? argv[2] : null;
var path=(argc > 3) ? argv[3] : null;
var domain=(argc > 4) ? argv[4] : null;
var secure=(argc > 5) ? argv[5] : false;
document.cookie=nom+"="+escape(valeur)+
((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
((path==null) ? "" : ("; path="+path))+
((domain==null) ? "" : ("; domain="+domain))+
((secure==true) ? "; secure" : "");
/*
document.write('nb args : '+argc+'<br>');
document.write('arg expires : '+expires+'<br>');
document.write('arg path : '+path+'<br>');
document.write('arg domain : '+domain+'<br>');
document.write('arg cookie : '+document.cookie+'<br>');ccook='nb args : '+argc+' / ';
ccook+='arg expires : '+expires+' / ';
ccook+='arg path : '+path+' / ';
ccook+='arg domain : '+domain' / ';
ccook+='arg cookie : '+document.cookie+' / ';
*/

// alert('EcrireCookie:contenu_cookie : '+ document.cookie);
return unescape(document.cookie);
}


function getCookieVal(offset)
{
// alert('getCookieVal');
var endstr=document.cookie.indexOf (";", offset);
if (endstr==-1) endstr=document.cookie.length;
/*
document.write('flag : '+offset+' ---> - lecture js<br>');
document.write(document.cookie.substring(offset, endstr)+' -- getCookieVal : '+endstr+'<br>');
alert('getCookieVal : '+document.cookie.substring(offset, endstr));
*/
return unescape(document.cookie.substring(offset, endstr)); 
}


function LireCookie(nom)
{

var arg=nom+"=";
var alen=arg.length;
var clen=document.cookie.length;
var i=0;
while (i<clen)
{

var j=i+alen;
if (document.cookie.substring(i, j)==arg) return getCookieVal(j);
i=document.cookie.indexOf(" ",i)+1;
if (i==0) break;


}
return null; 
}

function EffaceCookie(nom)
{

date=new Date;
date.setFullYear(date.getFullYear()-1);
EcrireCookie(nom,null,date); 
}


//**** PARTIE DEROULEMENT
function dm_getElementbyClass(classname){
dm_ccollect=new Array()
var dm_inc=0
var dm_alltags=document.all? document.all : document.getElementsByTagName("*")
for (i=0; i<dm_alltags.length; i++){
if (dm_alltags[i].className==classname)
dm_ccollect[dm_inc++]=dm_alltags[i]
}
}

/*
function contractcontent(omit){
var inc=0
var racine = omit.split('_');
//alert(racine);
while (ccollect[inc]){
if (ccollect[inc].id!=omit)
ccollect[inc].style.display="none"
inc++
}
}
*/

// Modifie pour ignorer les autres menus
function dm_contractcontent(omit){
var dm_inc=0
var dm_tmenus = omit.split("_")
var dm_rac
while (dm_ccollect[dm_inc]){
dm_rac = dm_ccollect[dm_inc].id.split("_")
if (dm_ccollect[dm_inc].id!=omit && dm_rac[0]==dm_tmenus[0])
var placebo
dm_ccollect[dm_inc].style.display="none"
dm_inc++
}
}

function dm_expandcontent(cid,objclassName,ctr){
dm_mcid =cid;
if(cid=="same") {
 dm_mcid=LireCookie('ancien');
// alert('same:LireCookie = '+dm_mcid);
 }
dm_getElementbyClass(objclassName);
if (typeof dm_ccollect!="undefined"){
//alert("dm_ccollect:dm_mcid = "+dm_mcid);
  if (dm_collapseprevious=="yes" && ctr=="on") dm_contractcontent(cid)
  document.getElementById(dm_mcid).style.display=(document.getElementById(dm_mcid).style.display!="block")? "block" : "none"
  // document.getElementById(dm_mcid).style.display="block"
// EffaceCookie("ancien");
contenu_cookie=EcrireCookie("ancien",dm_mcid,null,"/",null,null);
//alert('dm_ccollect:ecriture cookie = '+LireCookie('ancien')+' dm_mcid_ecrit = '+dm_mcid);
//alert('verif_cookie : '+LireCookie('ancien'));
  }
// contenu_cookie=EcrireCookie("ancien",dm_mcid,null,"/",null,null);
// alert('ecriture cookie : '+LireCookie('ancien'));
//document.cookie=window.location.pathname+"="+dm_mcid
}

function dm_revivecontent(){
dm_contractcontent("omitnothing")
dm_selectedItem=dm_getselectedItem()
dm_selectedComponents=dm_selectedItem.split("|")
for (i=0; i<dm_selectedComponents.length-1; i++)
document.getElementById(dm_selectedComponents[i]).style.display="block"
}

function dm_get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
// alert('dm_get_cookie:returnvalue = '+search+returnvalue);
return returnvalue;
}

function dm_getselectedItem(){
if (dm_get_cookie(window.location.pathname) != ""){
dm_selectedItem=dm_get_cookie(window.location.pathname)
return dm_selectedItem
}
else
return ""
}

function dm_saveswitchstate(){
var dm_inc=0, dm_selectedItem=""
while (dm_ccollect[dm_inc]){
if (dm_ccollect[dm_inc].style.display=="block")
dm_selectedItem+=dm_ccollect[dm_inc].id+"|"
dm_inc++
}

document.cookie=window.location.pathname+"="+dm_selectedItem
}

function dm_do_onload(menuclass){
if (menuclass=='') menuclass="switchcontent"
dm_getElementbyClass(menuclass)
if (dm_enablepersist=="on" && typeof dm_ccollect!="undefined")
dm_revivecontent()
}


if (window.addEventListener)
window.addEventListener("load", dm_do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", dm_do_onload)
else if (document.getElementById)
window.onload=dm_do_onload

if (dm_enablepersist=="on" && document.getElementById)
window.onunload=dm_saveswitchstate


// ***** PROVISOIRE
function dm_expandfiche(cid,fiche) {

  // Document en cache buffer.

if (isDOM && !document.all)
  {
   var  oldLoc = buffLoad.src;
  }
else
  { var  oldLoc = buffLoad.location.href;}
 if (isDOM || isIE4)
 {
  // This is a kludge, since NS6 doesn't support Iframe onloads yet. Give it 5 secs to load.
  if (isDOM && !document.all) setTimeout( 'buffLoad.document.readyState="complete"', 1000);

  if (oldLoc != fiche)
   {
     buffLoad.location.href = fiche;
     dm_scrCheckBuffer(cid,fiche)
    }
}
else
{
divRef = getRef('mainDiv3');
  // Once done, display it and scroll to top.
  divRef.onload =  scrollBy(-100000);
  // Netscape's load(URL, width) method...
  divRef.load(name, cWidth);
}
} // fin fonction


function dm_scrCheckBuffer(cid,oldLoc) 
{
// alert(oldLoc+' - '+cid);
 // si chargement en cours, recheck  50ms.
 if ((buffLoad.location.href == oldLoc) || (buffLoad.document.readyState != 'complete'))
  setTimeout( 'dm_scrCheckBuffer(\'' + oldLoc + '\')', 50);
 else
 {
  // Transfert contenu.
document.getElementById("mainDiv3").innerHTML = buffLoad.document.body.innerHTML;
  // Remove file from buffer, to allow refreshing - not strictly necessary.
  buffLoad.location.href = 'about:blank';
 
 // And set visibilities now everything's finally ready.
document.getElementById("mainDiv3").style.visibility = 'visible';
 }
}


