function AjaxObject()
{
	if(window.XMLHttpRequest)
	{
		xhr_object = new XMLHttpRequest();
		return xhr_object;
	}
	else if(window.ActiveXObject)
	{
		xhr_object = new ActiveXObject('Microsoft.XMLHTTP');
		return xhr_object;
	}
	else
	{ 
		alert('Votre navigateur ne supporte pas les objets XMLHTTPRequest...');
		return;
	}
}


function no_cache()
{
	date_object = new Date();
	var param = date_object.getTime();

	return param;
}

function recupFDP()
{
	var cours = document.getElementById('fdp');
				
	if(cours.selectedIndex)
	{
		val = cours.options[cours.selectedIndex].value ;
	}
	else val = 1 ;
	
	var param = no_cache();
		
	xhr_object = AjaxObject();
	xhr_object.open('GET', '/ajax/ajax_calculPts.php?save=ok&pays='+val+'&nocache=' + param, false);
	xhr_object.send(null);
				
	var reponse_default = xhr_object.responseText;
	document.getElementById('pays_id').innerHTML = reponse_default ;
}

function cremente( max, val , total , attrib )
{
	var dash = parseInt(document.getElementById("fidelitePts").value) ;

	if(!dash) dash = 50 ;
	
	dash += parseInt(val);
	
	if(dash<=max)
	{
		if((dash*attrib)<total)
		{	
			if(dash >= 100)
			{
				var param = no_cache();
		
				xhr_object = AjaxObject();
				xhr_object.open('GET', '/ajax/ajax_calculPts.php?cremente=ok&dash='+dash+'&total='+total+'&nocache=' + param, false);
				xhr_object.send(null);
				
				var reponse_default = xhr_object.responseText;
				
				document.getElementById('total').innerHTML = reponse_default ;
				
				var param2 = no_cache();
		
				xhr_object2 = AjaxObject();
				xhr_object2.open('GET', '/ajax/ajax_calculPts.php?incremente=ok&dash='+dash+'&total='+total+'&nocache=' + param, false);
				xhr_object2.send(null);
				
				var reponse_default2 = xhr_object2.responseText;
				
				document.getElementById('fideliteCts').innerHTML = reponse_default2 ;
				
				var param3 = no_cache();
				
				xhr_object3 = AjaxObject();
				xhr_object3.open('GET', '/ajax/ajax_calculPts.php?apport=ok&dash='+dash+'&total='+total+'&nocache=' + param, false);
				xhr_object3.send(null);
				
				var reponse_default3 = xhr_object3.responseText;
				
				document.getElementById('apport').innerHTML = reponse_default3 ;
				if(dash<0)
					document.getElementById("fidelitePts").value = 0 ;
				else
					document.getElementById("fidelitePts").value = dash ;
			}
			else
			{
				dash = 0 ;
				
				var param = no_cache();
		
				xhr_object = AjaxObject();
				xhr_object.open('GET', '/ajax/ajax_calculPts.php?cremente=ok&dash='+dash+'&total='+total+'&nocache=' + param, false);
				xhr_object.send(null);
				
				var reponse_default = xhr_object.responseText;
				
				document.getElementById('total').innerHTML = reponse_default ;
				
				var param2 = no_cache();
		
				xhr_object2 = AjaxObject();
				xhr_object2.open('GET', '/ajax/ajax_calculPts.php?incremente=ok&dash='+dash+'&total='+total+'&nocache=' + param, false);
				xhr_object2.send(null);
				
				var reponse_default2 = xhr_object2.responseText;
				
				document.getElementById('fideliteCts').innerHTML = reponse_default2 ;
				
				var param3 = no_cache();
				
				xhr_object3 = AjaxObject();
				xhr_object3.open('GET', '/ajax/ajax_calculPts.php?apport=ok&dash='+dash+'&total='+total+'&nocache=' + param, false);
				xhr_object3.send(null);
				
				var reponse_default3 = xhr_object3.responseText;
				
				document.getElementById('apport').innerHTML = reponse_default3 ;
				
				if(dash<0)
					document.getElementById("fidelitePts").value = 0 ;
				else
					document.getElementById("fidelitePts").value = dash ;
			}
		}
	}
	
}