function FindByCP(field,lang){
	var codepostal = document.getElementById(field).value;
	//verify that postal code is valid
	if(ValidateCodePostal(codepostal))
	{
		//remove the spaces and -
		codepostal = codepostal.replace("-","");
		codepostal = codepostal.replace(" ","");
		if(lang == "fr")
		{
			location.href = "/fr/succursales/recherche/" + codepostal + "/";
		}else{
			location.href = "/fr/stores/search/" + codepostal + "/";
		}
		
	}
}
// verification si le format de code postal entré est valide.
function ValidateCodePostal(val){
	var regEx = /[a-zA-Z][0-9][a-zA-Z](-| |)[0-9][a-zA-Z][0-9]/;
	if(regEx.test(val))
	{    
		return true;
	}else{
		alert("Le code postal entré est invalide.\r\n Entrez votre code postal sous le format A1A-1A1");
		return false;
	}
}	
