function check_code(form) {
  var valid = true;
  var reg  = /[A-C|E|G-H|J-N|P|R-T|V|X-Y|a-c|e|g-h|j-n|p|r-t|v|x-y][0-9][A-C|E|G-H|J-N|P|R-T|V-Z|a-c|e|g-h|j-n|p|r-t|v-z][ |-|][0-9][A-C|E|G-H|J-N|P|R-T|V-Z|a-c|e|g-h|j-n|p|r-t|v-z][0-9]/;
  //var isin = reg.test(form.code_postal.value);
	
  if ( !check_fields(form) ) {
    valid = false;
  
  } else if (!reg.test(form.code_postal.value)) {
    alert('Format de code postal non valide! Utilisez le format "A9A 9A9"'); 
	  form.code_postal.focus();
	  valid = false;
	}
  
  return valid;
}

function check_fields(form) {
  var valid = true;
  
	if (!form.code_postal.value) {
		alert('Inscrivez votre code postal!');
		form.code_postal.focus();
		valid = false;
	}
  
	return valid;
}