function alterError(value) {

		if (value<=0.99) {

			newPounds = '0';

		} else {

			newPounds = parseInt(value);

		}

		newPence = parseInt((value+.0008 - newPounds)* 100);

		if (eval(newPence) <= 9) newPence='0'+newPence;

		newString = newPounds + '.' + newPence;

		return (newString);

	}

//-----------------------------------------------------------------------------------------------------------

	function buyItem(newItem, newPrice, newQuantity) {

		if (newQuantity <= 0) {

			rc = alert('Entrez un quantité correcte !');

		} else {

			if (confirm('Voulez-vous ajouter : '+newQuantity+' fois "'+newItem+'" au panier ?')) {

				index = document.cookie.indexOf("GSBasket");

				countbegin = (document.cookie.indexOf("=", index) + 1);

        			countend = document.cookie.indexOf(";", index);

	        		if (countend == -1) {

        	    			countend = document.cookie.length;

	        		}

		                document.cookie="GSBasket="+document.cookie.substring(countbegin, countend)+"["+newItem+"|"+newPrice+"|"+newQuantity+"]";	
							
							location.reload() ;	
							window.scrollTo(0,0);
					
						}  
}

	}

//-----------------------------------------------------------------------------------------------------------

	function resetShoppingBasket() {

		index = document.cookie.indexOf("GSBasket");

		document.cookie="GSBasket=.";

		if (document.cookie) {

                } else {

                  alert('You have disabled using cookies.\nThis shop needs cookies to store your orders.\nPlease activate cookies in your browser settings and reload the shop pages.');	}  
}

//-----------------------------------------------------------------------------------------------------------

	function showItems() {

                var tablerowcolor = '#edf2f5';

                index = document.cookie.indexOf("GSBasket");

		countbegin = (document.cookie.indexOf("=", index) + 1);

        	countend = document.cookie.indexOf(";", index);

        	if (countend == -1) {

            		countend = document.cookie.length;

        	}

		fulllist = document.cookie.substring(countbegin, countend);

		totprice = 0;

		document.writeln('<FORM NAME="updateform">');

		document.writeln('<div align="left">');

		document.writeln('<table class="tablegeneralpanier" WIDTH=95% BORDER=0 CELLPADDING="5">');

document.writeln('<TR BGCOLOR="#d4d8de" ALIGN="left" ><TD  colspan="5"><strong>Vous avez les articles suivants dans votre panier</strong></TD></TR>');

// Nun die horizontale Linie:

document.writeln('<TR BGCOLOR="E9F1D5"><TD colspan="5"></TD></TR>');

		itemlist = 0;

		for (var i = 0; i <= fulllist.length; i++) {

			if (fulllist.substring(i,i+1) == '[') {

				itemstart = i+1;

				thisitem = 1;

			} else if (fulllist.substring(i,i+1) == ']') {

				itemend = i;

				thequantity = fulllist.substring(itemstart, itemend);

				itemtotal = 0;

				itemtotal = (eval(theprice*thequantity));

				temptotal = itemtotal * 100;

				totprice = totprice + itemtotal;

				itemlist=itemlist+1;

				document.write('<tr valign="center" BGCOLOR="'+tablerowcolor+'"><td colspan="5">'+theitem+' <BR> Quantit&eacute; : '+thequantity+'</td></tr>');

				document.write('<tr BGCOLOR="'+tablerowcolor+'"><td  colspan="5">Prix de l\'article : '+theprice+'</TD></tr>');

				

                                if (tablerowcolor == '#4f87c2') {

                                  tablerowcolor = "#E9F1D5";

                                } else {

                                  tablerowcolor = "#dfe4e7";	}  
} else if (fulllist.substring(i,i+1) == '|') {

				if (thisitem==1) theitem = fulllist.substring(itemstart, i);

				if (thisitem==2) theprice = fulllist.substring(itemstart, i);

				thisitem++;

				itemstart=i+1;	}  
}

                document.writeln('<TR BGCOLOR="FCFCFC"><TD colspan="5"><HR></TD></TR>');

		document.writeln('<tr BGCOLOR="#cfd3d6" ALIGN="left" ><td colspan=3>Total : </td><td align=left>'+alterError(totprice)+' Euros</td><td>&nbsp;</td></tr>');

		document.writeln('</TABLE><cr>');

		document.writeln('</div>');

		document.writeln('</FORM>');

	}

//-----------------------------------------------------------------------------------------------------------

	function amendItem(itemno, newquant) {

		newItemList = null;

		itemlist = 0;

		for (var i = 0; i <= fulllist.length; i++) {

			if (fulllist.substring(i,i+1) == '[') {

				thisitem = 1;

				itemstart = i+1;

				fullstart = i+1;

			} else if (fulllist.substring(i,i+1) == ']') {

				itemend = i;

				itemlist=itemlist+1;

				if (itemlist != itemno) {

					newItemList = newItemList+'['+fulllist.substring(fullstart, itemend)+']';

				} else {

					newItemList = newItemList + '['+theitem+'|'+theprice+'|'+newquant+']';	}  
} else if (fulllist.substring(i,i+1) == '|') {

				if (thisitem==1) theitem = fulllist.substring(itemstart, i);

				if (thisitem==2) theprice = fulllist.substring(itemstart, i);

				thisitem++;

				itemstart=i+1;	}  
}

		index = document.cookie.indexOf("GSBasket");

		document.cookie="GSBasket="+newItemList;

		self.location = "panier.html";

	}

//-----------------------------------------------------------------------------------------------------------

	function removeItem(itemno) {

		newItemList = null;

		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;

				theitem = fulllist.substring(itemstart, itemend);

				itemlist=itemlist+1;

				if (itemlist != itemno) {

					newItemList = newItemList+'['+fulllist.substring(itemstart, itemend)+']';	}  
}

		}

		index = document.cookie.indexOf("GSBasket");

		document.cookie="GSBasket="+newItemList;

		self.location = "panier.html";

	}

//-----------------------------------------------------------------------------------------------------------

	// clearBasket() - removes all items from the basket

	function clearBasket() {

		if (confirm('Voulez vous vider votre panier ?')) {

			index = document.cookie.indexOf("GSBasket");

			document.cookie="GSBasket=.";

			self.location = "panier.html";	}  
}

