/*|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|                             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() {

// Surlignage des labels lors du survol des boutons radios ou cases à cocher associées
	
	var tab = new Array('demandeur', 'connaissance', 'lvt', 'sct', 'pio', 'compas', 'chef', 'autre');
	for (var i=0; i<tab.length; i++) {
		var el = document.getElementsByName(tab[i]);
		for (var j=0; j<el.length; j++) {
			el[j].onmouseover = function() {
				var x = this.getAttribute('id')+'L';
				document.getElementById(x).style.backgroundColor = '#ccffcc';
				document.getElementById(x).style.borderColor = '#000000';
			}
			el[j].onmouseout = function() {
				var x = this.getAttribute('id')+'L';
				document.getElementById(x).style.backgroundColor = '#ffffff';
				document.getElementById(x).style.borderColor = '#999999';
			}
		}
	}
		
// Surlignage du champ lors du survol
	var tab = new Array('nom', 'prenom', 'email', 'ville', 'd1L', 'd2L', 'c1L', 'c2L',
						'lvtL', 'sctL', 'pioL', 'compasL', 'chefL', 'autreL');
	for (var i=0; i<tab.length; i++) {
		
		var el = document.getElementById(tab[i]);
		el.onmouseover = function() {
			this.style.backgroundColor = '#ccffcc';
			this.style.borderColor = '#000000';
		}
		el.onmouseout = function() {
			this.style.backgroundColor = '#ffffff';
			this.style.borderColor = '#999999';
		}
	
	}

// Surlignage du champ textarea
	var el = document.getElementById("commentaire");
	el.onmouseover = function() {
		this.style.backgroundColor = '#ccffcc';
		this.style.borderColor = '#000000';
	}
	el.onmouseout = function() {
		this.style.backgroundColor = '#ffffff';
		this.style.borderColor = '#999999';
	}


// Surlignage du champ texte lors du survol
	var tab = new Array('nomL', 'prenomL', 'emailL', 'villeL');	
	for (var i=0; i<tab.length; i++) {
		var el = document.getElementById(tab[i]);
		el.onmouseover = function() {
			var t = this.getAttribute('id');
			var x = t.substr(0, (t.length)-1);
			document.getElementById(x).style.backgroundColor = '#ccffcc';
			document.getElementById(x).style.borderColor = '#000000';
		}
		el.onmouseout = function() {
			var t = this.getAttribute('id');
			var x = t.substr(0, (t.length)-1);
			document.getElementById(x).style.backgroundColor = '#ffffff';
			document.getElementById(x).style.borderColor = '#999999';
		}
	
	}

// Effet de survol du bouton envoyer
	var envoyer = document.getElementById('envoyer');
	
	envoyer.onmouseover = function() {
		this.style.backgroundPosition = '0 -20px';
	}
	
	envoyer.onmouseout = function() {
		this.style.backgroundPosition = '0 0';
	}


}
