/*  Detection du fureteur
	Author : Peter-Paul Koch
	http://www.quirksmode.org/
*/

var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;

if (checkIt('konqueror'))
{
	browser = "Konqueror";
	OS = "Linux";
}
else if (checkIt('safari')) browser = "Safari"
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"
else if (!checkIt('compatible'))
{
	browser = "Netscape Navigator"
	version = detect.charAt(8);
}
else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

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 = "an unknown operating system";
}

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}


/*  Expandable Listmenu Script
	Author : Daniel Nolan
	http://www.bleedingego.co.uk/webdev.php
	
	gere l'affichage en tiroir du menu gauche
*/

var section = "";

function initMenus() {
	if (document.getElementsByTagName) {
		var aMenus = document.getElementsByTagName("DIV");
		for (var i = 0; i < aMenus.length; i++) {
			var mclass = aMenus[i].className;
			currentsection = (aMenus[i].id == section);
			if (currentsection) aMenus[i].className = "nodopen";
			if (mclass.indexOf("treenode") > -1) {
				var submenu = aMenus[i].childNodes;
				for (var j = 0; j < submenu.length; j++) {
					if (submenu[j].tagName == "A") {
						
						submenu[j].onclick = function() {
							var node = this.nextSibling;
												
							while (1) {
								if (node != null) {
									if (node.tagName == "UL") {
										var d = (node.style.display == "none")
										node.style.display = (d) ? "block" : "none";
										this.className = (d) ? "treeopen" : "treeclosed";
										if (node.parentNode.className.indexOf("prevnodeopen") != -1) {
											node.parentNode.className = (d) ? "nodopen prevnodeopen" : "prevnodeopen";
										}else{
											node.parentNode.className = (d) ? "nodopen" : "";
										}
										nextnode = node.parentNode.nextSibling;
										if (nextnode.nodeType != 1) nextnode = nextnode.nextSibling;
										if (nextnode.className.indexOf("nodopen") != -1) {
											nextnode.className = (d) ? "nodopen prevnodeopen" : "nodopen";
										}else{
											nextnode.className = (d) ? "prevnodeopen" : "";
										}
										return false;
									}
									node = node.nextSibling;
								} else {
									return false;
								}
							}
							return false;
						}
						submenu[j].className = (mclass.indexOf("open") > -1) ? "treeopen" : "treeclosed";
					}
					if (submenu[j].tagName == "UL"  && !currentsection) {
						submenu[j].style.display = (mclass.indexOf("open") > -1) ? "block" : "none";
					}
				}
			}
		}
	}
}

// affiche les URL des liens dans la zone de contenu
// utilisé dans la page Liens utiles
function showHREF() {
	if (document.getElementsByTagName) {
		onlyContentLinks = document.getElementById("contenu");
		whichLink = onlyContentLinks.getElementsByTagName("a");
		for (var i=0; i<whichLink.length; i++) {
			useLink = whichLink[i];
			showLink = useLink.getAttribute("href")

			if (useLink.getAttribute("rel") != "external") {
				if (showLink.substring(0,7) == "mailto:") {
					showLink = showLink.substring(7,lastSlash);
				} else {
					/*checkShow = showLink.lastIndexOf("/");
					showLink = showLink.substring(checkShow+1,showLink.length);

					lastSlash = document.location.href.lastIndexOf("/");
					directory = document.location.href.substring(0,lastSlash);

					showLink = directory + '/' + showLink;*/
				}
			}

			newSpan = document.createElement("span");
			showTitle = document.createTextNode(' [' + showLink + ']');
			newSpan.appendChild(showTitle);
			useLink.parentNode.insertBefore(newSpan,useLink.nextSibling);
			newSpan.className='printLink';
		}
	}
}


function multipleOnload() {
	initMenus();
	if (typeof printContentHREF != 'undefined') showHREF();
}
window.onload = multipleOnload;


