var ie = /MSIE/.test(navigator.userAgent);
var moz = !ie && navigator.product == "Gecko";
var csch = "/";

if (moz) 
  {
  HTMLElement.prototype.__defineGetter__("children", function()
    {
    var arr = new Array(), i=0, l=this.childNodes.length;
    for (i=0; i<l; i++)
      {
      if ( this.childNodes[i].nodeType==1 )
        {
	arr.push( this.childNodes[i]);
	}
      }
    return arr;
    }
  );
  HTMLElement.prototype.__defineGetter__("firstChild", function()
    {
    var node=this.childNodes[0];
    while (node.nodeType!=1)
      node=node.nextSibling;
    return node;
    }
  );
  HTMLElement.prototype.__defineGetter__("lastChild", function()
    {
    var node=this.childNodes[this.childNodes.length-1];
    while (node.nodeType!=1)
      node=node.previousSibling;
    return node;
    }
  );
  }

        // Déclaration des variables 'domaine' et 'date d'expiration'
        var pathname=location.pathname;
        var myDomain=pathname.substring(0,pathname.lastIndexOf('/')) +'/';
        var date_exp = new Date();
        date_exp.setTime(date_exp.getTime()+(365*24*3600*1000)); 
        
        function getCookieVal(offset) {
            var endstr=document.cookie.indexOf (";", offset);
            if (endstr==-1)
                    endstr=document.cookie.length;
            return unescape(document.cookie.substring(offset, endstr));
        }
        function GetCookie(name) {
            var arg= name + "=";
            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 SetCookie (name, value) {
            // un cookie a besoin d'un nom, d'une valeur, d'un nom de domaine, d'une date d'expiration
            //
            var argv=SetCookie.arguments;
            var argc=SetCookie.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=name+"="+escape(value)+
                ((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
                ((path==null) ? "" : ("; path="+path))+
                ((domain==null) ? "" : ("; domain="+domain))+
                ((secure==true) ? "; secure" : "");
        }


    function collapse(elmtTitre)
      {  
      var elmt = elmtTitre.parentNode;

      if (elmt.className == "boxhead")
        {
        elmt.className = "boxhead_collapse";
        elmt.children[0].className = "magnus";
        elmt.children[2].className = "content_collapse";
        SetCookie(elmt.id,"collapse");
        }
      else
        {
        elmt.className = "boxhead";
        elmt.children[0].className = "minus";
        elmt.children[2].className = "content";
        SetCookie(elmt.id,"expand");
        }
    }

function collapsus(id){
    var elmt=document.getElementById(id);
    if (GetCookie(id) == "collapse")
      {
      if (elmt.className == "boxhead")
        {
        elmt.className = "boxhead_collapse";
        elmt.children[0].className = "magnus";
        elmt.children[2].className = "content_collapse";
        }
      else
        {
        elmt.className = "boxhead";
        elmt.children[0].className = "minus";
        elmt.children[2].className = "content";
        SetCookie(elmt.id,"expand");
        }
      }
}
