// REQUIERT Prototype.js version 1.6+

/*window.onload = function () {
	$('formulaire').select('input[type="text"]', 'input[type="password"]', 'textarea').each(initInput);
	$('formulaire').select('input[type="checkbox"]').each(initCheckBox);
}*/

document.observe("dom:loaded", initForm);

function initForm () {
	$('formulaire').select('input[type="text"]', 'input[type="password"]', 'textarea').each(initInput);
	$('formulaire').select('input[type="checkbox"]').each(initCheckBox);
	document.stopObserving("dom:loaded", initForm);
}

function initInput (id) {
	var element = $(id);
	var classOn = 'input01on';
	var classOff = 'input01off';
	
	if (element) {
		// Ajouter style css
		if (element.hasClassName (classOff) == false) {
			element.addClassName (classOff);
		}
		// ajouter comportement
		element.observe('blur', function(event){
  			Event.element(event).removeClassName (classOn);
			Event.element(event).addClassName (classOff);
 		});
		element.observe('focus', function(event){
  			Event.element(event).removeClassName (classOff);
			Event.element(event).addClassName (classOn);
 		});
	}
}

function initCheckBox (id) {
	var element = $(id);
	var className = 'no-style';
	
	if (element) {
		// Ajouter style css
		if (element.hasClassName (className) == false) {
			element.addClassName (className);
		}
	}
}// REQUIERT Prototype.js version 1.6+

/*window.onload = function () {
	$('formulaire').select('input[type="text"]', 'input[type="password"]', 'textarea').each(initInput);
	$('formulaire').select('input[type="checkbox"]').each(initCheckBox);
}*/

document.observe("dom:loaded", initForm);

function initForm () {
	$('formulaire').select('input[type="text"]', 'input[type="password"]', 'textarea').each(initInput);
	$('formulaire').select('input[type="checkbox"]').each(initCheckBox);
	document.stopObserving("dom:loaded", initForm);
}

function initInput (id) {
	var element = $(id);
	var classOn = 'input01on';
	var classOff = 'input01off';
	
	if (element) {
		// Ajouter style css
		if (element.hasClassName (classOff) == false) {
			element.addClassName (classOff);
		}
		// ajouter comportement
		element.observe('blur', function(event){
  			Event.element(event).removeClassName (classOn);
			Event.element(event).addClassName (classOff);
 		});
		element.observe('focus', function(event){
  			Event.element(event).removeClassName (classOff);
			Event.element(event).addClassName (classOn);
 		});
	}
}

function initCheckBox (id) {
	var element = $(id);
	var className = 'no-style';
	
	if (element) {
		// Ajouter style css
		if (element.hasClassName (className) == false) {
			element.addClassName (className);
		}
	}
}