function AchatItem(newItem, newPrice, newID,newQuantity) {
	//Vérification de la valeur de quantite
	if ( newQuantity <= 0 ) {
		rc = alert('La quantité spécifiée est incorrecte !');
	}
	
	if (confirm('Voulez-vous ajouter '+newQuantity+' fois le produit '+newItem+' dans votre panier ?')) {
		//Recupere la chaine du cookie 
		//alert('element:'+newItem+', prix:'+newPrice+', cle:'+newID+', quantite:'+newQuantity);
		index = document.cookie.indexOf('CaveAze');
		//indice du début de la chaine
		countbegin = (document.cookie.indexOf('=', index) + 1);
		//indice de la fin de la chaine
		countend = document.cookie.indexOf(';', index);
		//si le cookie est vide, on crée une chaine vide
		if (countend == -1) {
			countend = document.cookie.length+1;
		}
		moreItem=true ;
		toto='CaveAze=';
		//on recupere la chaine en entier
		fulllist = document.cookie.substring(countbegin, countend);
		//alert(fulllist);
		totprice = 0;
		itemlist = 0;
		
		for (var i = 0; i <= fulllist.length; i++) {
			if (fulllist.substring(i,i+1) == '[') {
				itemstart = i+1;
			} else if (fulllist.substring(i,i+1) == ']') {
				itemend = i;
				thequantity = fulllist.substring(itemstart, itemend);
				itemtotal = 0;
				itemtotal = (eval(theprice*thequantity));
				totprice=itemtotal+totprice;
				temptotal = itemtotal * 100;
				itemlist=itemlist+1;
				qtemp=0;
				qtemp2=0;
				qtemp=parseInt(thequantity) ;
				qtemp2=parseInt(thequantity2) ;
				qtemp3=qtemp2+qtemp;
				indextoto = toto.indexOf('CaveAze');
				countbegintoto = (toto.indexOf('=', indextoto) + 1);
				countendtoto = toto.indexOf(';', indextoto);
				if (countendtoto == -1) {
					countendtoto = toto.length;
				}
				toto='CaveAze='+toto.substring(countbegintoto, countendtoto)+'['+theitem+','+theprice+'#'+theiditem+'|'+qtemp3+']';
			} else if (fulllist.substring(i,i+1) == ',') {
				theitem = fulllist.substring(itemstart, i);
				itemstart = i+1;
			} else if (fulllist.substring(i,i+1) == '#') {
				theprice = fulllist.substring(itemstart, i);
				itemstart = i+1;
			} else if (fulllist.substring(i,i+1) == '|') {
				theiditem = fulllist.substring(itemstart, i);
				if (newID == theiditem ) {
					thequantity2 = newQuantity ;
					moreItem=false;
				} else { thequantity2 = 0 ;}
					itemstart = i+1;
				}
			}
			indextoto = toto.indexOf('CaveAze');
			countbegintoto = (toto.indexOf('=', indextoto) + 1);
			countendtoto = toto.indexOf(';', indextoto);
			if (countendtoto == -1) {
				countendtoto = toto.length;
			}
			if (moreItem){
				//alert('1 moreItem :'+'CaveAze='+toto.substring(countbegintoto, countendtoto)+'['+newItem+','+newPrice+'#'+newID+'|'+newQuantity+']');
				document.cookie='CaveAze='+toto.substring(countbegintoto, countendtoto)+'['+newItem+','+newPrice+'#'+newID+'|'+newQuantity+']';
			} else {
				//alert('2 moreItem :'+'CaveAze='+toto.substring(countbegintoto, countendtoto));
				document.cookie='CaveAze='+toto.substring(countbegintoto, countendtoto);
			}
		}
	}
