//ROLL OVER D'IMAGES sans autre contrainte de nomenclature que pour le nom de l'image active

//1) Prechargement des images au chargement de la page pour des images uniques
//sur la page web coder les images dans un calque auquel l'on attribut une 'id' precise
//les images peuvent avoir n'importe quel nom de fichier
//les images au survol doivent avoir le nom de l'original + _suvol + extension  : a 'image.gif' correspond 'image_survol.gif' par ex.
//pour les precharger : <body onLoad="precharger('menu')"> ou "menu" ici est en fait le nom du calque qui contient les images
//Gaetan Langhade, mars 2006, Nurun France - Gaz de France ; mai 2006, Nurun France - Thales
var nomim = new Array();
function precharger(a){
	//a : calque contenant les images
	/*if (document.getElementById && document.getElementById(a)){
		for (i=0;i<document.getElementById(a).childNodes.length;i++){
			if (document.getElementById(a).childNodes[i].tagName && document.getElementById(a).childNodes[i].tagName.toLowerCase() == 'li'){
				for (j=0;j<document.getElementById(a).childNodes[i].childNodes.length;j++){
					if (document.getElementById(a).childNodes[i].childNodes[j].tagName && document.getElementById(a).childNodes[i].childNodes[j].tagName.toLowerCase() == 'a'){
						for (k=0;k<document.getElementById(a).childNodes[i].childNodes[j].childNodes.length;j++){
							if (document.getElementById(a).childNodes[i].childNodes[j].childNodes[k].tagName && document.getElementById(a).childNodes[i].childNodes[j].childNodes[k].tagName.toLowerCase() == 'img'){
								var be = document.getElementById(a).childNodes[i].childNodes[j].childNodes[k].src;
								nomim[nomim.length] = new Image();
								nomim[nomim.length - 1].src = be.substring(0,be.length - 4) + '_survol' + be.substring(be.length - 4,be.length);
							}
						}
					}
				}
			}
		}
	}*/
}

//2) Le roll over 
//pour declencher le roll over au survol, rajouter les evenements suivants aux liens qui encapsulent les images :
//onMouseOver="iconomorphe(this,0);" onFocus="iconomorphe(this,0);" onMouseOut="iconomorphe(this,1);" onBlur="iconomorphe(this,1);"
//attention : le fait de declencher le roll over a la fois au survol et au focus (navigation clavier) 
//ne correspond pas a des images telles qu'une puce dans un lien si ce focus n'a pas d'effet sur le style des liens
//onMouseOver="iconomorphe(this,0);" onMouseOut="iconomorphe(this,1);"
function iconomorphe(a,b){
	//a : this
	//b : 0 pour image au roll over, 1 pour restituer image d'origine
	if (a.childNodes){
		for (i=0;i<a.childNodes.length;i++){
			if (a.childNodes[i].src){
				var be = a.childNodes[i].src;
				if (b == 0 && be.toLowerCase().indexOf('_survol') < 0){
					a.childNodes[i].src = be.substring(0,be.length - 4) + '_survol' + be.substring(be.length - 4,be.length);
					break;
				} else if (b == 1 && be.toLowerCase().indexOf('_survol') >= 0){
					a.childNodes[i].src = be.substring(0,be.length - 11) + be.substring(be.length - 4,be.length);
					break;
				}
			}
		}
	}
}
function displayNavOn(myId){
	iconomorphe(document.getElementById(myId),2);
} 

function openWindow(url, width, height){
	// pour ?viter d'ouvrir plusieurs fen?tres simultan?es 
	pop = open(url,"Thales","toolbar=no,scrollbars=yes,directories=no,menubar=no,status=no,resizable=no,width="+width+",height="+height);
   	/*if (pop && !pop.closed) pop.close();
   	// ouvre la fen?tre 
   	pop = open(url,"Thales","toolbar=no,scrollbars=no,directories=no,menubar=no,status=no,resizable=no,width="+width+",height="+height);
   	if (!pop.opener) pop.opener = self;   */	
}

function sendMail(docId, contentId){
	//alert(docId);
	//alert(contentId);
	chaine_mail = "mailto:?subject=[www.thalesgroup.com] The following article has been recommended to you "; 
	chaine_mail += "&body=" + location.href+"&docid="+docId+"&contentid="+contentId; 
	//alert(chaine_mail);
	location.href = chaine_mail;
}


