// JavaScript Document

var leprix;

	

function affichage()
{
	var leprix = document.Data.prix.value;
	var prixvendomax = Math.round(leprix*0.019);
	var prixcompet = Math.round(leprix*0.07);
	document.getElementById("final").innerHTML = addSpace(prixvendomax) + " $";
	document.getElementById("final2").innerHTML = addSpace(prixcompet)  + " $";
	document.getElementById("difference").innerHTML =  "Une &eacute;conomie de <strong>" + addSpace((prixcompet-prixvendomax)) + " $</strong>";
	var econo = document.getElementById('econo');
	econo.style.display = 'block';
	econo.style.marginTop = '35px';
	
	var tau = document.getElementById('tau');
	tau.style.display = 'inline';
	
	var tau2 = document.getElementById('tau2');
	tau2.style.display = 'inline';
	
}

function addSpace(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ' ' + '$2');
	}
	return x1 + x2;
}
