
	// ajoute la fonction trim aux variables de type String
	String.prototype.trim = function() {
		return this.replace(/(^\s*)|(\s*$)/g, '');
	}

	function trim(htmlInputElement) {
		//bidouille pour savoir si value est undefined
		if(htmlInputElement.value != htmlInputElement.x_x_x_x_x_x_x_x_x)
			htmlInputElement.value = htmlInputElement.value.trim();
		else
			throw "Le parametre de la fonction trim() doit avoir la propriété value";
	}

	function toUpperCase(htmlInputElement) {
		//bidouille pour savoir si value est undefined
		if(htmlInputElement.value != htmlInputElement.x_x_x_x_x_x_x_x_x)
			htmlInputElement.value = htmlInputElement.value.toUpperCase();
		else
			throw "Le parametre de la fonction toUpperCase() doit avoir la propriété value";
	}

	function toLowerCase(htmlInputElement) {
		//bidouille pour savoir si value est undefined
		if(htmlInputElement.value != htmlInputElement.x_x_x_x_x_x_x_x_x)
			htmlInputElement.value = htmlInputElement.value.toLowerCase();
		else
			throw "Le parametre de la fonction toLowerCase() doit avoir la propriété value";
	}

	function toUpperTrim(htmlInputElement) {
		//bidouille pour savoir si value est undefined
		if(htmlInputElement.value != htmlInputElement.x_x_x_x_x_x_x_x_x)
			htmlInputElement.value = htmlInputElement.value.toUpperCase().trim();
		else
			throw "Le parametre de la fonction toUpperTrim() doit avoir la propriété value";
	}

	function toLowerTrim(htmlInputElement) {
		//bidouille pour savoir si value est undefined
		if(htmlInputElement.value != htmlInputElement.x_x_x_x_x_x_x_x_x)
			htmlInputElement.value = htmlInputElement.value.toLowerCase().trim();
		else
			throw "Le parametre de la fonction toLowerTrim() doit avoir la propriété value";
	}

	function removeSpecChar(htmlInputElement) {
		//bidouille pour savoir si value est undefined
		if(htmlInputElement.value != htmlInputElement.x_x_x_x_x_x_x_x_x)
			htmlInputElement.value = htmlInputElement.value.replace(/[.\/ ]/g, '');
		else
			throw "Le parametre de la fonction trim() doit avoir la propriété value";
	}

	function show(htmlDivElement, value) {
		if(htmlDivElement.style) {
			if (value)
				htmlDivElement.style.display = "block";
			if (!value)
				htmlDivElement.style.display = "none";
		} else {
			throw "Le premier parametre de la fonction show() doit avoir la propriété style";
		}
	}


/*
	// ajoute la fonction trim aux variables de type HTMLInputElement
	// enlever les espaces superflux de la valeur
	HTMLInputElement.prototype.trim = function() {
		this.value = this.value.trim();
	}
	
	// ajoute la fonction toUpperCase aux variables de type HTMLInputElement
	// met la valeur en majuscule
	HTMLInputElement.prototype.toUpperCase = function() {
		this.value = this.value.toUpperCase();
	}

	// ajoute la fonction toLowerCase aux variables de type HTMLInputElement
	// met la valeur en minuscule
	HTMLInputElement.prototype.toLowerCase = function() {
		this.value = this.value.toLowerCase();
	}

	// ajoute la fonction toUpperTrim aux variables de type HTMLInputElement
	// met la valeur en majuscule et enleve les espaces superflux
	HTMLInputElement.prototype.toUpperTrim = function() {
		this.value = this.value.toUpperCase().trim();
	}

	// ajoute la fonction toLowerTrim aux variables de type HTMLInputElement
	// met la valeur en minuscule et enleve les espaces superflux
	HTMLInputElement.prototype.toLowerTrim = function() {
		this.value = this.value.toLowerCase().trim();
	}

	// ajoute la fonction removeSpecChar aux variables de type HTMLInputElement
	// enleve les caracteres speciaux des numeros de telephone (./ )
	HTMLInputElement.prototype.removeSpecChar = function() {
		this.value = this.value.replace(/[.\/ ]/g, '');
	}



	// ajoute la fonction show aux variables de type HTMLDivElement
	// permet de montrer ou caher l'element concerné
	// value doit etre un boolean
	HTMLDivElement.prototype.show = function(value) {
		if (value)
			this.style.display = "block";
		if (!value)
			this.style.display = "none";
	}
*/
	
	
	// returns the array number of the selected radio button or -1 if no button is selected
	function getSelectedRadio(buttonGroup) {
		// if the button group is an array (one button is not an array)
		if (buttonGroup[0]) { 
			for (var i=0; i<buttonGroup.length; i++) {
				if (buttonGroup[i].checked) {
					return i;
				}
			}
		} else {
			// if the one button is checked, return zero
 			if (buttonGroup.checked) { return 0; }
		}
		// if we get to this point, no radio button is selected
		return -1;
	}


	// returns the value of the selected radio button or "" if no button is selected
	function getSelectedRadioValue(buttonGroup) {
		var i = getSelectedRadio(buttonGroup);
		if (i == -1) {
			return "";
		} else {
			// Make sure the button group is an array (not just one button)
			if (buttonGroup[i]) { 
				return buttonGroup[i].value;
			} else { // The button group is just the one button, and it is checked
				return buttonGroup.value;
			}
		}
	}
	
	// enable or disable a button group
	function enableButtonGroup(buttonGroup, enable) {
		// if the button group is an array (one button is not an array)
		if (buttonGroup[0]) { 
			for (var i=0; i < buttonGroup.length; i++)
				buttonGroup[i].disabled = !enable;
		} else {
			buttonGroup.disabled = !enable;
		}
	}
	