/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \
|		
|		Copyright (c) 2007
|		Design + HTML/CSS/DOM JavaScript : Smart Agence
|		http://www.smartagence.com/
|		
\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */


// Merci à Chris Heilmann de http://www.onlinetools.org/
// pour findimg() et roll(o). Thanx goes to Chris Heilmann
// from http://www.onlinetools.org/
function findimg() {
	var imgs,i;
	imgs=document.getElementsByTagName('img');
	for(i=0;i<imgs.length;i++) {
		if (/roll/.test(imgs[i].className)) {
			imgs[i].onmouseover=function(){roll(this);};
			imgs[i].onmouseout=function(){roll(this);};
		}
	}
}

function roll(o) {
	var src,ftype,newsrc;
	src=o.src;
	ftype=src.substring(src.lastIndexOf('.'), src.length);
	if(/_over/.test(src)) {
		newsrc=src.replace('_over','');
	} else {
		newsrc=src.replace(ftype, '_over'+ftype);
	}
	o.src=newsrc;
}

function flash(tag) {
	document.write(tag);
}

/* ______________________[ 05 | Gestion de l’ouverture/fermeture d’un <h2> » ]________________________ */

function SmartPlan(cible) {
	if (document.getElementById&&document.getElementById(cible)) {
		var root=document.getElementById(cible).getElementsByTagName("H2");
		for (a=0;a<root.length;a++) {
			if (root[a].nodeName=="H2") {
				SmartOpenClose(root[a]);
			}
		}
	}
}

function SmartOpenClose(who) {
	var args=SmartOpenClose.arguments;
	if (who.nextSibling&&who.nextSibling.className=="treeview") {
		var Sister=who.nextSibling;
		Sister.style.display="none";
		who.className="off";
	} 
	if (!document.all&&who.nextSibling.nextSibling&&who.nextSibling.nextSibling.className=="treeview") {
		var Sister=who.nextSibling.nextSibling;
		Sister.style.display="none";
		who.className="off";
	}
	
	who.onclick=function() {
		if (Sister) {
			Sister.style.display = (Sister.style.display == "none" ? "block" : "none");
			this.className = (who.className == "off" ? "on" : "off");
			
			var src,ftype,newsrc;
			src = this.firstChild.firstChild.src;
			
			ftype = src.substring(src.lastIndexOf('.'), src.length);
	
			switch(who.className) {
				case "off" :	// caché => +
					newsrc = src.replace('_moins','');
				break;
				case "on":	// affiché => -
					if(/over/.test(src)) {
						newsrc = src.replace('_over','');
						newsrc = newsrc.replace(ftype,'_moins_over'+ftype);
					}
					else {	
						newsrc = src.replace(ftype, '_moins'+ftype);
					}
			//		alert(newsrc);
				break;
			}
			
			this.firstChild.firstChild.src = newsrc;
		}
	}
}


/* ________[ Lancement des scripts ]__________ */

window.onload=function() {
	SmartPlan("sitemap");
	findimg();
};