/*|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|                             SCRIPT PRINCIPAL                              |
|---------------------------------------------------------------------------|
|                                                                           |
|                                                                           |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|                                         Benjamin COIFFARD - novembre 2007 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/



/* INITIALISATION DES VARIABLES NECESSAIRES
----------------------------------------------------------------------------
	Les variables suivantes sont utilisées un peu partout dans le code,
	elles sont donc initialisées en début de page
---------------------------------------------------------------------------*/


/* Ajouter des effets graphiques sur la page
----------------------------------------------------------------------------

---------------------------------------------------------------------------*/
function effets() {

	var principal = document.getElementById('principal');
	var liens = principal.getElementsByTagName('a');

// Pour tous les éléments liens
	for (var i=0; i<liens.length; i++) {
		
	// Si c'est le logo
		if (liens[i].className == 'lien_logo') {
			
		// Lorsque la souris survol la zone
			liens[i].onmouseover = function() {
				var t = this.getAttribute('id');
				var x = t.substr(4, t.length);
				document.getElementById('nom_'+x).style.backgroundColor = '#ccffcc';
				this.style.backgroundPosition = '0 -100px';
			}

		// Lorsque la souris quiite la zone
			liens[i].onmouseout = function() {
				var t = this.getAttribute('id');
				var x = t.substr(4, t.length);
				document.getElementById('nom_'+x).style.backgroundColor = '#ffffff';
				this.style.backgroundPosition = '0 0';
			}
			
		// Lors du clic, on ouvre le lien dans une nouvelle page
			liens[i].onclick = function() {
				var d = this.getAttribute('href');
				window.open(d);
				return false;
			}

		}
		
	// Si c'est le nom
		if (liens[i].className == 'lien_nom') {
						
		// Lorsque la souris survol la zone
			liens[i].onmouseover = function() {
				var t = this.getAttribute('id');
				var x = t.substr(4, t.length);
				document.getElementById('img_'+x).style.backgroundPosition = '0 -100px';
				this.style.backgroundColor = '#ccffcc';
			}

		// Lorsque la souris quiite la zone
			liens[i].onmouseout = function() {
				var t = this.getAttribute('id');
				var x = t.substr(4, t.length);
				document.getElementById('img_'+x).style.backgroundPosition = '0 0';
				this.style.backgroundColor = '#ffffff';
			}
			
		// Lors du clic, on ouvre le lien dans une nouvelle page
			liens[i].onclick = function() {
				var d = this.getAttribute('href');
				window.open(d);
				return false;
			}

		}
	
	}

}
