 
	
function afficher(nom)
{
	document.getElementById("illustration").style.backgroundImage = 'url('+nom+')';
	document.getElementById("illustration").style.backgroundRepeat = 'no-repeat';
}
function valider_form()
{
  if (document.contact.nom.value != "")
  {
  }
  else 
  {    
	document.contact.nom.focus();
	alert("La case Nom doit etre rempli");
	return false;
	
  }
  if (document.contact.prenom.value != "")
  {
  }
  else 
  {    
	document.contact.prenom.focus();
	alert("La case Prénom doit etre rempli");
	return false;
  }
  if (document.contact.tel.value != "")
  {
  }
  else 
  {    
	document.contact.tel.focus();
	alert("La case Téléphone doit etre rempli");
	return false;
  }
  if (document.contact.email.value != "")
  {
  }
  else 
  {    
	document.contact.email.focus();
	alert("La case Email doit etre rempli");
	return false;
  }
}
function addCommas( strValue ) {
/************************************************
DESCRIPTION: Inserts commas into numeric string.

PARAMETERS:
strValue - source string containing commas.

RETURNS: String modified with comma grouping if
source was all numeric, otherwise source is
returned.

REMARKS: Used with integers or numbers with
2 or less decimal places.
*************************************************/
var objRegExp = new RegExp('(-?[0-9]+)([0-9]{3})');

//check for match to search criteria
while(objRegExp.test(strValue)) {
//replace original string with first group match,
//a comma, then second group match
strValue = strValue.replace(objRegExp, '$1 $2');
}
return strValue;
}

function numberformat(num,dec)
{
mul=Math.pow(10,dec);
num=num*mul;
num=Math.round(num);
num = num/mul;
var numstr=String(num);
if(numstr.indexOf(".") == -1)
{
//numstr = numstr + ".";
for(nfi=0;nfi<dec;nfi++) numstr = numstr + "0";
}
decpl = numstr.length - numstr.indexOf(".");
decpl = decpl - 1;
if (decpl < dec)
{
for(nfi=decpl;nfi<dec;nfi++) numstr = numstr + "0";
}
return (addCommas(numstr.toString()));

}
//Fonction qui calcule la totalité
function calculate()
{
	var p_demain = 0;
	var inter = 0;
	var visite = 0;
	var sauvegrd = parseInt(document.form_calc.sauvegarde.value);
	var forfait = parseInt(document.form_calc.forfait.value);
	var telesurveil = 0;
	var compt = 0;
	var subtotal = 0;
	if (document.form_calc.forfait.value != 0){

		if (document.form_calc.prise_de_main.checked){
			p_demain =  20;
		}
		if (document.form_calc.interventions.checked){
			inter = forfait * 0.2;
		}
		if (document.form_calc.visites.checked){
			visite =  20;
		}
		if (sauvegrd != 0){
			sauvegrd =  sauvegrd * 10;
		}
		if (document.form_calc.telesurveillance.checked){
			telesurveil =  15;
		}
		if (document.form_calc.competences.checked){
			compt =  forfait * 0.1;
		}
		subtotal = forfait + p_demain + inter + visite + sauvegrd + telesurveil + compt;
		subtotal = numberformat(subtotal,0);
		document.getElementById('subtotal').innerHTML=subtotal + " &euro; HT  ";
	}
	else
		document.getElementById('subtotal').innerHTML="0 &euro; HT  ";
	}

