/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \
|		
|		Copyright (c) 2006 Juridica
|		Design + Intégration + Dev : Smart Agence
|		http://www.smartagence.com/
|		
\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */


/* ______________________[ 01 | Interactivité du menu principal (menu horizontal) ]________________________ */

/* A special thanks goes to Eric Shepherd for his ALA article about “Hybrid CSS Dropdowns”: http://www.alistapart.com/articles/hybrid/ 
and to Patrick Griffiths and Dan Webb for their htmldog.com article “Sons of Suckerfish”: http://www.htmldog.com/articles/suckerfish/ */

function SmartFolder(referme) {
	if (document.getElementById&&document.getElementById("NavigationPrincipale")&&document.getElementById("NavigationPrincipale").className!="Services"&&document.getElementById("NavigationPrincipale").className!="Partenaires") {
		var root=document.getElementById("NavigationPrincipale").childNodes;
		for (a=0;a<root.length;a++) {
			if (root[a].nodeName=="LI") {
				var sroot=root[a].childNodes;
				for (b=0;b<sroot.length;b++) {
					if (sroot[b].nodeName=="A") {
						ShowHide(sroot[b],referme);
					}
				}
			}
		}
	}
}

function ShowHide(who,referme){
	who.onclick=function() {
		var Daddy=who.parentNode;
		var Brothers=who.parentNode.childNodes;
		var Uncles=who.parentNode.parentNode.childNodes;
		if(referme==1){
			for (h=0;h<Uncles.length;h++) {
				if (Uncles[h].nodeName=="LI") {
					//Uncles[h].className=Uncles[h].className=="selected"?"selected":"";
					Uncles[h].className="";
				}
			}
		}
		for (g=0;g<Brothers.length;g++) {
			if (Brothers[g].nodeName=="UL") {
				Daddy.className=(Daddy.className=="on"||Daddy.className==" on")?"":"on";
				return false;
			}
		}
	}
}


/* ______________________[ 02 | Gestion de la taille du texte d’un article ]________________________ */

function SmartSize() {
	if (document.getElementById&&document.getElementById("TaillePlus")&&document.getElementById("TailleMoins")&&document.getElementById("ColB")) {
		var cibleplus=document.getElementById("TaillePlus");
		var ciblemoins=document.getElementById("TailleMoins");
		var cibletxt=document.getElementById("ColB");
		cibleplus.onclick=function() {
			var sizestr=cibletxt.style.fontSize.substring(0,cibletxt.style.fontSize.length-2);
			var sizeinter=cibletxt.style.lineHeight.substring(0,cibletxt.style.lineHeight.length-2);
			sizestr=sizestr!=""?parseInt(sizestr):11;
			//sizeinter=sizeinter!=""?parseInt(sizeinter):15;
			cibletxt.style.fontSize=sizestr+1+"px";
			//cibletxt.style.lineHeight=sizeinter+1+"px";
		}
		ciblemoins.onclick=function() {
			var sizestr=cibletxt.style.fontSize.substring(0,cibletxt.style.fontSize.length-2);
			var sizeinter=cibletxt.style.lineHeight.substring(0,cibletxt.style.lineHeight.length-2);
			sizestr=sizestr!=""?parseInt(sizestr):11;
			//sizeinter=sizeinter!=""?parseInt(sizeinter):15;
			cibletxt.style.fontSize=sizestr-1+"px";
			//cibletxt.style.lineHeight=sizeinter-1+"px";
		}
	}
}


/* ______________________[ 04 | Lancement d’une impression pour les navigateurs compatibles ]________________________ */

function DirectPrint() {
	if (window.print) self.print();
}


/* ______________________[ 05 | Ouverture de fenêtre compatible XHTML 1.0 Strict ]________________________ */

function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors=document.getElementsByTagName("a");
	for (var i=0;i<anchors.length;i++) {
		var anchor=anchors[i];
		if (anchor.getAttribute("href")&&anchor.getAttribute("rel")=="external") anchor.target="_blank";
	}
}


/* ______________________[ 06 | Gestion de l’ouverture/fermeture d’une liste « <dl/> » ]________________________ */

function SmartDL() {
	var args=SmartDL.arguments;
	for (n=0;n<args.length;n+=2) {
		var ClickFx=args[n+1];
		if (document.getElementById&&document.getElementById(args[n])) {
			var root=document.getElementById(args[n]).getElementsByTagName("DT");
			for (a=0;a<root.length;a++) {
				if (root[a].nodeName=="DT"&&root[a].className!="on") {
					if (root[a].nextSibling.nodeName=="DD") {var Sister=root[a].nextSibling;}
					else if (root[a].nextSibling.nextSibling.nodeName=="DD") {var Sister=root[a].nextSibling.nextSibling;}
					Sister.className="off";
				}
				if (root[a].nodeName=="DT"&&root[a].className=="on") {
					if (root[a].nextSibling.nodeName=="DD") {var Sister=root[a].nextSibling;}
					else if (root[a].nextSibling.nextSibling.nodeName=="DD") {var Sister=root[a].nextSibling.nextSibling;}
					Sister.className="on";
				} 
			}
			for (a=0;a<root.length;a++) {
				if (root[a].nodeName=="DT") {SmartOpenClose(root[a],root[a],ClickFx);}
			}
		}
	}
}

function SmartOpenClose(who,Brothers,ClickFx) {
	if (who.nextSibling.nodeName=="DD") {var Sister=who.nextSibling;}
	else if (who.nextSibling.nextSibling.nodeName=="DD") {var Sister=who.nextSibling.nextSibling;}
	if (ClickFx==1) {
		who.onclick=function() {
			who.className=who.className=="on"?"off":"on";
			Sister.className=Sister.className=="on"?"off":"on";
		}
	} else {
		who.onclick=function() {
			for (a=0;a<who.parentNode.childNodes.length;a++) {
				if (who.parentNode.childNodes[a].nodeName=="DT") {who.parentNode.childNodes[a].className="";}
				else if (who.parentNode.childNodes[a].nodeName=="DD") {who.parentNode.childNodes[a].className="off";}
			}
			AllDT=who.parentNode.getElementsByTagName("DT");
			AllDD=who.parentNode.getElementsByTagName("DD");
			for (b=0;b<AllDT.length;b++) {
				AllDT[b].className="off";
			}
			for (c=0;c<AllDD.length;c++) {
				AllDD[c].className="off";
			}
			who.className="on";
			Sister.className=(Sister.className=="on"||Sister.className==" on")?"":"on";
		}
	}
}

function OpenPopup(url,nom,option) {
	window.open(url,nom,option);
}
/* ______________________[ 07 | Lancement des scripts : méthode dite « Unobtrusive JavaScript » ]________________________ */

window.onload=function() {
	SmartFolder(1);
	SmartSize();
	SmartDL("FAQ",0,"InfosPratiques",0);
	externalLinks();
}


/*			MOOOOOOOOO... Tools					*/
var box = {};
window.addEvent('domready', function(){
	box = new MultiBox('multibox', {descClassName: 'multiboxdesc', useOverlay: true}
);
  
});




