function CalcPips()
{
	if (document.getElementById("eurusd").value > 0 &&
		document.getElementById("gbpusd").value > 0 &&
		document.getElementById("usdjpy").value > 0 &&
		document.getElementById("usdchf").value > 0 &&
		document.getElementById("usdcad").value > 0)
	{
		var taillelot = document.getElementById("position").value;
		
		var eurusd = parseFloat(document.getElementById("eurusd").value);
		var gbpusd = parseFloat(document.getElementById("gbpusd").value);
		var usdjpy = parseFloat(document.getElementById("usdjpy").value);
		var usdchf = parseFloat(document.getElementById("usdchf").value);
		var usdcad = parseFloat(document.getElementById("usdcad").value);

		var pip_usd_eurusd = (taillelot * 0.0001);
		var pip_usd_gbpusd = pip_usd_eurusd;
		var pip_usd_usdjpy = (taillelot * 0.01 * (1/usdjpy));
		var pip_usd_usdchf = (taillelot * 0.0001 * (1/usdchf));
		var pip_usd_usdcad = (taillelot * 0.0001 * (1/usdcad));
		
		var pip_eur_eurusd = pip_usd_eurusd / eurusd;
		var pip_eur_gbpusd = pip_eur_eurusd;
		var pip_eur_usdjpy = pip_usd_usdjpy / eurusd;
		var pip_eur_usdchf = pip_usd_usdchf / eurusd;
		var pip_eur_usdcad = pip_usd_usdcad / eurusd;
		
		var precision = 10000;
		
		document.getElementById("colusd_eurusd").value = pip_usd_eurusd;
		document.getElementById("colusd_gbpusd").value = pip_usd_gbpusd;
		document.getElementById("colusd_usdjpy").value = Math.round(pip_usd_usdjpy*precision)/precision;
		document.getElementById("colusd_usdchf").value = Math.round(pip_usd_usdchf*precision)/precision;
		document.getElementById("colusd_usdcad").value = Math.round(pip_usd_usdcad*precision)/precision;

		document.getElementById("coleur_eurusd").value = Math.round(pip_eur_eurusd*precision)/precision;
		document.getElementById("coleur_gbpusd").value = Math.round(pip_eur_gbpusd*precision)/precision;
		document.getElementById("coleur_usdjpy").value = Math.round(pip_eur_usdjpy*precision)/precision;
		document.getElementById("coleur_usdchf").value = Math.round(pip_eur_usdchf*precision)/precision;
		document.getElementById("coleur_usdcad").value = Math.round(pip_eur_usdcad*precision)/precision;
	} else {
		alert("Erreur : veuillez remplir correctement les champs requis");
	}
}
