/********************************************************************/
/* pour faire un bien beau clacos en flashouille
/********************************************************************/
function sexyClacos(e) {
	var p1 = ""; var p2 = "";
	var c1 = new Array("atraiter","traite");
	var c2 = new Array("signe","perdu","sanssuite");
	e.childElements().each( function(n) {
		if(n.className == "periode") p1 = n.down("em").firstChild.nodeValue;
		if(n.className == "ensavoirplus") p2 = n.down("span").firstChild.nodeValue;
		if(n.id == "affaires_a_traitees") c1["atraiter"] = n.down("strong").firstChild.nodeValue;
		if(n.id == "affaires_traitees") c1["traite"] = n.down("strong").firstChild.nodeValue;
		if(n.nodeName == "IMG") {
			for(var i=0; i<n.getAttribute("alt").split(", ").length; i++) {
				c2[i] = n.getAttribute("alt").split(", ")[i];
			}
		}
	});
	var variables_flash = "p1="+p1+"&c1a="+c1["atraiter"]+"&c1b="+c1["traite"]+"&c2a="+c2[0]+"&c2b="+c2[1]+"&c2c="+c2[2];
				
	var FU = {      movie :			"templates/"+namesite+"/charte/images/sexyclacos.swf",
					width :			"340",
					height :		"110",
					majorversion :	"8",
					build :			"0",
					wmode :			"transparent",
					flashvars :		variables_flash
	};
	UFO.create(     FU, e.id);
}

/********************************************************************/
/* un chouille de js pour faire des zolis title sur le menu principal
/********************************************************************/
function legendesMenus(e) {
	$$("#"+e.id+" a").each( function(n, index) {
		if((n.title != undefined) && (n.title != "")) {
			var divArbo = document.createElement("div");
			divArbo.className = "surprise";
			divArbo.id = "surprise";
			n.surprise = divArbo;
			n.container = e;
			n.nb = index;
			n.onmouseover = function() {
				this.container.appendChild(this.surprise);
				this.surprise.innerHTML = this.getAttribute("title");
				this.surprise.style.left = this.nb * this.getWidth() + "px";
			}
			n.onmouseout = function() {
				this.container.removeChild(this.surprise);
			}
		}
	});
}
		
		
function hollowman() {
	// submit dans le selecteur
	$('subuser_id').onchange = function() { this.form.submit(); }
	//on cache le bouton
	$('submitHollowman').parentNode.removeChild($('submitHollowman'));
}

/********************************************************************/
function addLoadListenerCommun(func) {
   if (window.addEventListener) {
      window.addEventListener("load", func, false);
   } else if (document.addEventListener) {
      document.addEventListener("load", func, false);
   } else if (window.attachEvent) {
      window.attachEvent("onload", func);
   }
}

if (document.getElementById && document.createTextNode) {
	addLoadListenerCommun(function() {		
		if($('hollowman')) hollowman();
		if($("menuPrincipal")) legendesMenus($("menuPrincipal"));
		//if($("resumeVisuel")) sexyClacos($("resumeVisuel"));
	});
}
