function buyCode(id, code) {
	var regexp = new RegExp("^[A-Z0-9]{8}$");
	var correct = regexp.test(code.toUpperCase());
	if ( correct ) {
		var ajax = new QW_AJAX;
		ajax.get('http://'+window.location.host+'/index.php5?module=achat_ajax&id='+id+'&code='+code, null, false);
	}
	return correct;
}

function onCode(id, code) {
	if ( !buyCode(id, code) ) {
		alert('Le code que vous avez saisi est incorrect.');
		return false;
	}
	toggleAllopass(id, false);
	return true;
}

function toggleAllopass(id, showFront) {
	document.getElementById('allopassFront'+id).style.display = showFront ? 'block' : 'none';
	document.getElementById('allopassBack'+id).style.display = showFront ? 'none' : 'block';
}
