/**
 * @author Maxime
 */


function calcul_gain_possible(match_id, nb_matches){
	var cote = 0;
	var gain_possible = "gain_possible" + match_id;
	var mise = $("PronoCote" + match_id + "Mise").value;
	if($("PronoCote" + match_id + "Resultat1").checked){
		cote = $("cotedom" + match_id).value;
	}else if($("PronoCote" + match_id + "Resultat2").checked){
		cote = $("coteext" + match_id).value;
	}else if($("PronoCote" + match_id + "Resultat0").checked){
		cote = $("cotenul" + match_id).value;
	}
	if(cote != 0){
		$(gain_possible).innerHTML = Math.round((cote - 1) * mise * 100) / 100;
		calcul_gain_possible_total(nb_matches);
	}
}

function calcul_gain_possible_total(nb_matches){
	var gain = 0;
	for(var i = 1; i <= nb_matches; i++){
		var nom = "gain_possible" + i;
		gain += parseFloat($(nom).innerHTML);
	}
	$("gain_possible_total").innerHTML = Math.round(gain * 100) / 100;
}
