


function swap_image(imagePath, currentSection) {
	//alert('imagePath: ' + imagePath + ', currentSection: ' + currentSection);

	if (currentSection == 'null')
	 	return;
	image_path = '' + imagePath;
	document[currentSection].src = image_path + currentSection + '_on.gif';
}

// Formattage auto du code postal
function formatterCodePostal(codePostal) {
	if(/[^0-9A-Z]/.test(codePostal.value)){
		codePostal.value=codePostal.value.toUpperCase().replace(/([^0-9A-Z])/g,"");
	}
}

function checkAll(formField, controlCheckbox) {

	if (formField.length > 0) {
		for (var i=0; i < formField.length; i++) {
			formField[i].checked = controlCheckbox.checked? true:false;
		}
	}

	else {
		formField.checked = controlCheckbox.checked? true:false;
	}
}

function trimLength(textarea, maxChars) {
	if(textarea.value.length <= maxChars) return;
	textarea.value = textarea.value.substr(0, maxChars)
}

function canAddCharacter(textarea, maxChars) {
	if(typeof(textarea.onkeypress.arguments[0]) != 'undefined')
		var keyCode = textarea.onkeypress.arguments[0].keyCode;
	else
	{
		if(document.selection.createRange().text.length != 0) return true;
		var keyCode = event.keyCode;
	}

	var allowedChars = new Array(8, 37, 38, 39, 40, 46);	//Backspace, delete and arrow keys
	for(var x=0; x < allowedChars.length; x++) if(allowedChars[x] == keyCode) return true;

	if(textarea.value.length < maxChars) return true;

	return false;
}

function mapLoad() {
}

