//init
window.onload= function(){
	//	alert('init : ' + cat);
	var divs = $$("a.titre_2");
	if(divs.length){
		$H(divs).each(function(item){
			var str = String(item.value);
			//						alert('"' + str + '" = "' + cat + '" ? ');
			//alert(str.indexOf(cat));
			if(str.indexOf(cat) > 0){
				//				 alert('OUI');
				var enfants = item.value.childNodes;
				var mess = '';
				for(prop in enfants){
					if(typeof enfants[prop] == "object"){
						var obj = enfants[prop];
						var j = obj['src'].lastIndexOf('.');// ! il pt y avoir plusieurs '.' (http://127.0.0.1/...)
						var chemin = obj['src'].substring(0, j);// chemin + nom de fichier sans extension
						new_img = chemin + '_roll.gif';
						//alert(new_img);
						obj['src'] = new_img;	 
					}	
				}
				//alert('enfants ' + mess);
			}else{
				 //alert('NON');
				Event.observe(item.value, "mouseover", hover, false);
				Event.observe(item.value, "mouseout", hover_out, false);
			}
		});
	}
	//menu gauche
	var liens = $$("a.dossier");
	//var enfants = liens.childNodes
	var n = 0;
	$H(liens).each(function(item, value){
		n++;
		if(n < 14){
			//			alert(item.value + ' => ' + item.value.childNodes.length);
			var enfants = item.value.childNodes;
		Event.observe(item.value, "mouseover", hover2, false);
		Event.observe(item.value, "mouseout", hover2_out, false);
		}
	});
	
}

/********************* functions *************************/
/******* menu haut *************/
var img_src = '';
function hover(e){
	//alert('hover : ' + Event.element(e).src);
	img_src = Event.element(e).src;
	var i = img_src.lastIndexOf('.');// ! il pt y avoir plusieurs '.' (http://127.0.0.1/...)
	var chemin = img_src.substring(0, i);// chemin + nom de fichier sans extension
	new_img = chemin + '_roll.gif';
	//alert(new_img);
	Event.element(e).src = new_img;
}	
function hover_out(e){
	//alert('out');
	Event.element(e).src = img_src;
}

/*********************** menu gauche **********************/
function hover2(e){
	var enfants = Event.element(e).childNodes;
	for(prop in enfants){
			//			alert('nodeType : ' + enfants[prop]["nodeType"] + " => " + enfants[prop]["tagName"]);
			
			if(enfants[prop]["tagName"] == 'IMG'){
				enfants[prop]["src"] = 'img/LMC/cat/sup_rouge.jpg';
			}/**/
		
	}
}
function hover2_out(e){
	var enfants = Event.element(e).childNodes;
	for(prop in enfants){
			//alert('nodeType : ' + enfants[prop]["nodeType"] + " => " + enfants[prop]["tagName"]);		
			if(enfants[prop]["tagName"] == 'IMG'){
				enfants[prop]["src"] = 'img/LMC/cat/sup_noir.jpg';
			}/**/
		
	}
}
