function fValidCP(inpt, l){
	
	val = inpt.value;


	//la reg qui check le cp
	r=/^\s*[a-ceghj-npr-tvxy]\d[a-z](\s)?\d[a-z]\d\s*$/i;
	
	iscp=r.test(val);
	
	if(!iscp){
		if(l=='f'){
			alert('Veuillez entrer le code postal au format X9X 9X9');
		} else {
			alert('Please enter the postal code in the format X9X 9X9');
		}
		inpt.focus();
		return false;
	}
	
	val = val.toUpperCase();
	
	//s'assure quil y a un espace entre les 2 chunks
	r=/([A-Z0-9]{3})([0-9])/;
	inpt.value = val.replace(r,'$1 $2');
	
	return true;
	
}

function fCheckForm(l, idres){

	o=safeFindObj('vari');
	o.value=idres;
	

	incp=safeFindObj('pbrc3');
	
	if( !fValidCP(incp, l)){
		return false;
	} else {
		f=safeFindObj('formrech');
		f.submit();
	}

}
