function quantite(quantite,prixu,elem,cpt){
	if(quantite>0){
		var element = $(elem);
		var url = 'ajax_action.php?action=quantite';
		var data = $H({"quantite":quantite,"prixu":prixu,"cpt":cpt}).toQueryString();
		var myAjax = new Ajax.Updater(
		  element,
		  url,
		  {
			method: 'post',
			postBody: data
		  });
	}else{
		alert('La quantité choisie est inférieure à 0');	
	}
}

function setSousTotal(quantite,prixu,elem,cpt){
	if(quantite>0){
		var element = $(elem);
		var url = 'ajax_action.php?action=total';
		//var data = '';
		var data = $H({"quantite":quantite,"prixu":prixu,"cpt":cpt}).toQueryString();
		var myAjax = new Ajax.Updater(
		  element,
		  url,
		  {
			method: 'post',
			postBody: data
		  });
	}
}

function adresseIdentique(){
	//Civilite
	if($F('identique') == 1){
		if($F('mr') == 'M.'){
			$('mrl').checked = 'checked';
		}else if($F('mme') == 'Mme'){
			$('mmel').checked = 'checked';
		}else{
			$('mllel').checked = 'checked';
		}
		//alert($F('mr'));
		$('noml').value = $F('nom');
		$('adressel').value = $F('adresse');
		$('code_postall').value = $F('code_postal');
		$('villel').value = $F('ville');
		$('tell').value = $F('tel');
		$('emaill').value = $F('email2');
	}
}

function check_formulaire(){
	//Champs adresse de facturation doivent etre remplis....
	if($F('mr')==null && $F('mme')==null && $F('mlle')==null){
		alert('Vous devez spécifier une civilité');
	}else if($F('nom') == ''){
		alert('Vous devez spécifier le champ nom');
		$('nom').focus();
	}else if($F('adresse') == ''){
		alert('Vous devez spécifier le champ adresse');
		$('adresse').focus();
	}else if($F('code_postal') == ''){
		alert('Vous devez spécifier le champ code postal');
		$('code_postal').focus();
	}else if($F('ville') == ''){
		alert('Vous devez spécifier le champ ville');
		$('ville').focus();
	}else if($F('tel') == ''){
		alert('Vous devez spécifier le champ téléphone');
		$('tel').focus();
	}else if($F('email') == ''){
		alert('Vous devez spécifier le champ email');
		$('email').focus();
	}else if($F('mrl')==null && $F('mmel')==null && $F('mllel')==null){//Champs adresse de livraison doivent etre remplis....
		alert('Vous devez spécifier une civilité');
	}else if($F('noml') == ''){
		alert('Vous devez spécifier le champ nom');
		$('noml').focus();
	}else if($F('adressel') == ''){
		alert('Vous devez spécifier le champ adresse');
		$('adressel').focus();
	}else if($F('code_postall') == ''){
		alert('Vous devez spécifier le champ code postal');
		$('code_postall').focus();
	}else if($F('villel') == ''){
		alert('Vous devez spécifier le champ ville');
		$('villel').focus();
	}else if($F('tell') == ''){
		alert('Vous devez spécifier le champ téléphone');
		$('tell').focus();
	}else if($F('emaill') == ''){
		alert('Vous devez spécifier le champ email');
		$('emaill').focus();
	}else{
		$('adresses').submit();
	}
}