	/*
		pureDOM navigator
		inspirated by Christian Heilmann http://www.onlinetools.org/
		Updated by Jacques PYRAT http://www.pyrat.net/
		17 jun 2004
	*/
	// Presets, should they not be defined
	var blankpic='/squelette/images/0.gif';
	var onpic='/squelette/images/plus.gif';
	var offpic='/squelette/images/minus.gif';
	var picalt='Cliquer pour ';
	var strDeplier='déplier: ';
	var strReplier='replier: ';
	var parentID='menu';
	// Checking for DOM compatibility	
	if (document.getElementById && document.createTextNode && document.createElement){canDOM=true}

	function expinit(){
		if (canDOM){
			if(parentID && document.getElementById(parentID)){
				alluls=document.getElementById(parentID).getElementsByTagName('UL');
				alllis=document.getElementById(parentID).getElementsByTagName('LI');
			}else{
				alluls=document.getElementsByTagName('UL');
				alllis=document.getElementsByTagName('LI');
			}
			for(i=0;i<alllis.length;i++){
				islink=alllis[i].getElementsByTagName('A')[0];
				if(islink){
					addimg = document.createElement('img');
					addimg.src=blankpic;
					addimg.className='node';
					addimg.alt='';
					cola = document.createElement('a');
					cola.setAttribute('href','#');
					cola.className='node';
					cola.onclick=function() {ex(this);return false;};
					cola.onkeypress=function() {ex(this);return false;};
					cola.appendChild(addimg);
					alllis[i].insertBefore(cola,alllis[i].firstChild);
				}
			}

			for(i=0;i<alluls.length;i++){
				subul=alluls[i];
				if(subul.parentNode.tagName=='LI'){
					// Do not collapse when there is a strong element in the list.
					highlight=subul.parentNode.getElementsByTagName('strong').length==0?true:false;
					disp=highlight?'none':'block';
					var picaltonoff=highlight?picalt+strDeplier:picalt+strReplier;
					pic=highlight?onpic:offpic;
					// End  highlight change
					childs=subul.getElementsByTagName('LI').length
					mom=subul.parentNode.getElementsByTagName('A')[0]
					if(mom){
						momimg=mom.childNodes[0];
						momimg.setAttribute('title',picaltonoff+subul.parentNode.getElementsByTagName('A')[1].innerHTML);
						momimg.src=pic;
						subul.style.display=disp;
					}
				}
			}

			// Suppresion des images qui ne sont pas des plus ou moins
			for(i=0;i<alllis.length;i++){
				mom=alllis[i].getElementsByTagName('A')[0];
				if(mom){
					momimg=mom.childNodes[0];
					if (momimg.src.indexOf(blankpic)!=-1) {
						// remove link and image
						mom.parentNode.removeChild(mom);
					}					
				}
			}
		}
	}

	// Collapse and Expand node.
    function ex(n){
		if(canDOM){
			u=n.parentNode.getElementsByTagName("ul")[0];
			if(u){
				u.style.display=u.style.display=='none'||u.style.display==''?'block':'none';
				img=n.getElementsByTagName('img')[0];
				img.src=img.src.indexOf(offpic)!=-1?onpic:offpic;
				var strAlt=img.getAttribute('title');
				if (img.src.indexOf(offpic)!=-1) {
					var re = new RegExp (strDeplier, 'gi');
					var strAltNew = strAlt.replace(re,strReplier);
				}else{
					var re = new RegExp (strReplier, 'gi');
					var strAltNew = strAlt.replace(re,strDeplier);
				}
				img.setAttribute('title',strAltNew);
			}
		}			
	}
	window.onload=expinit;
