var ports = 0; 

$(document).ready(function() {
	
	majTotal();
	
	$('#qte').change(function() {
		majTotal();					  
	});
	$('#port_france').click(function() {
		majTotal();					  
	});
	$('#port_europe').click(function() {
		majTotal();					  
	});
	$('#port_monde').click(function() {
		majTotal();					  
	});
	
	//affichae ou non de l'adresse de factu
	$('#adf_non').click(function() {
		$('#factu_adr').fadeIn();							 
	});
	$('#adf_oui').click(function() {
		$('#factu_adr').fadeOut();							 
	});
	
	//affichae ou non du nom pour la dedicace
	$('#dedicace_oui').click(function() {
		$('#nom_ded').fadeIn();							 
	});
	$('#dedicace_non').click(function() {
		$('#nom_ded').fadeOut();							 
	});
	
});


function majTotal(){
	if (document.getElementById('port_france').checked) {
		ports = $('#port_france').val();
	} else if (document.getElementById('port_europe').checked) {
		ports = $('#port_europe').val();
	} else if (document.getElementById('port_monde').checked) {
		ports = $('#port_monde').val();
	}
	var total = parseInt(($('#qte').val() * parseInt($('#prixLivre').html()))) + parseInt(ports);
	$('#total').val(total);
}
