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,newcolor) {

		
		if (newQuantity <= 0) {
			rc = alert('Porfavor dame una cantidad');
		} else {
			if (confirm('¿  '+newQuantity+' x '+newItem+' comprar?')) {
				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+"|"+newcolor+"|"+newQuantity+"]";
			}
		}
	}


	function resetShoppingBasket() {
		index = document.cookie.indexOf("GSBasket");
		document.cookie="GSBasket=.";

		if (document.cookie) {
                } else {
                  alert('Tu Browers no acepta cookies. Pero esta tienda necesita todavía cookies. Por favor acepta los cookies para esta compra. Muchas Gracias por la molestia. :-)');
                }

	}
	function showItems() {
                var tablerowcolor = '#F0F0F0';
                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 WIDTH=100% BORDER=0 CELLPADDING="2">');
document.writeln('<TR BGCOLOR="#C0C0C0"><TD><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Artículo</FONT></b></TD><TD align="right"><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Cantidad</FONT></b></TD><TD align="right"><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Precio único</FONT></b></TD><td align="right"><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Precio Total</FONT></b></TD><TD>&nbsp;</TD></TR>');

document.writeln('<TR BGCOLOR="F8F8F8"><TD colspan="5"><HR></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;
				var color= fulllist.substring(itemstart, itemend);
				document.write('<tr valign="top"BGCOLOR="'+tablerowcolor+'"><td><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>'+theitem+'</FONT></td>');

				document.write('<td valign="top" align="right"><INPUT TYPE=TEXT NAME="quant'+itemlist+'" VALUE="'+thequantity+'" SIZE=3></td><td valign="top" align="right"><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>'+theprice+'</FONT></td><td valign="top" align="right"><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>'+alterError(itemtotal)+'</FONT></td><td  align="center" valign="top"><a href="javascript:removeItem('+itemlist+')"><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>borrar</FONT></a>&nbsp;<a href="javascript:amendItem('+itemlist+',document.updateform.quant'+itemlist+'.value)"><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>update</FONT></a></td></tr>');

                                if (tablerowcolor == '#F0F0F0') {
                                  tablerowcolor = "#F8F8F8";
                                } else {
                                  tablerowcolor = "#F0F0F0";
                                }



			} 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="#C0C0C0"><td colspan=3><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Total</FONT></b></td><td align=right><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Euro '+alterError(totprice)+'</FONT></b></td><td>&nbsp;</td></tr>');
		document.writeln('<tr BGCOLOR="#C0C0C0"><td colspan=3><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Coste de Transporte</FONT></b></td><td align=right><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Euro '+'15.00'+'</FONT></b></td><td>&nbsp;</td></tr>');
		document.writeln('<tr BGCOLOR="#C0C0C0"><td colspan=3><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Precio total</FONT></b></td><td align=right><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Euro '+alterError(totprice+15)+'</FONT></b></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 = "pedido.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 = "pedido.html";
	}

	// clearBasket() - removes all items from the basket
	function clearBasket() {
		if (confirm('¿Quieres borrar todo?')) {
			index = document.cookie.indexOf("GSBasket");
			document.cookie="GSBasket=.";
			self.location = "pedido.html";
		}
	}



	function changeimage(towhat,url){

        if (document.images){

            document.images.targetimage.src=towhat.src

        gotolink=url

        }

}

    function warp(){

        window.location=gotolink

}

    var myimages=new Array()

    var gotolink="#"

    function preloadimages(){

        for (i=0;i<preloadimages.arguments.length;i++){

            myimages[i]=new Image()

            myimages[i].src=preloadimages.arguments[i]

        }

}

    preloadimages("sandalia/sandale02.jpg","sandalia/schuhe.jpg","sandalia/stiefel.jpg","sandalia/moccasin.jpg","sandalia/kinder.jpg")



	function showItems2() {
		var allcart="";
                var tablerowcolor = '#F0F0F0';
		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('<TABLE BORDER=0 CELLPADDING="2" WIDTH="100%">');
		document.writeln('<TR BGCOLOR="#C0C0C0"><TD><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Artículo</FONT></b></TD><TD align="right"><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Cantidad</FONT></b></TD><TD align="right"><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Precio</FONT></b></TD><td align="right"><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Precio Total</FONT></b></td></TR>');
                document.writeln('<TR BGCOLOR="F8F8F8"><TD colspan="4"><HR></TD></TR>');

		itemlist = 0;
		for (var i = 0; i <= fulllist.length; i++) {
                        
			if (fulllist.substring(i,i+1) == '[') {
				thisitem = 1;
				itemstart = i+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 BGCOLOR="'+tablerowcolor+'"> <td><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>'+theitem+'</FONT></td>');
				document.writeln('<td align=right><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>'+thequantity+'</FONT></td><td align=right><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>'+theprice+'</FONT></td><td align=right><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>'+alterError(itemtotal)+'</FONT></td></tr>');
				document.writeln('<INPUT TYPE="hidden" NAME="Articulo'+itemlist+'" VALUE="'+theitem+'" SIZE="40">');
				document.writeln('<INPUT TYPE="hidden" NAME="Cantidad'+itemlist+'" VALUE="'+thequantity+'" SIZE="40">');
				document.writeln('<INPUT TYPE="hidden" NAME="Precio'+itemlist+'" VALUE="'+theprice+'" SIZE="40">');
 				document.writeln('<INPUT TYPE="hidden" NAME="Total '+itemlist+'" VALUE="'+alterError(itemtotal)+'" SIZE="40">');
allcart = allcart+ "Articulo"+itemlist+": "+theitem+"<br>Cantidad"+itemlist+": "+thequantity+"<br>Precio"+itemlist+": "+theprice+"<br>Total"+itemlist+": "+alterError(itemtotal)+"<br>";
           //+ theitem+'<br>'+thequantity+'<br>'+thequantity+'<br>'+theprice+'<br>'+alterError(itemtotal);
                     if (tablerowcolor == '#F0F0F0') {
                                  tablerowcolor = "#F8F8F8";
                                } else {
                                  tablerowcolor = "#F0F0F0";
                                }

			} 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="F8F8F8"><TD colspan="4"><HR></TD></TR>');
		document.writeln('<tr BGCOLOR="#C0C0C0"><td colspan=3><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Total</FONT></b></td><td align=right><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Euro '+alterError(totprice)+'</FONT></b></td></tr>');
		document.writeln('<tr BGCOLOR="#C0C0C0"><td colspan=3><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Precio de Transporte</FONT></b></td><td align=right><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Euro '+'15.00'+'</FONT></b></td></tr>');
		
		
		
		
		document.writeln('<tr BGCOLOR="#C0C0C0"><td colspan=3><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Precio Total</FONT></b></td><td align=right><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Euro '+alterError(totprice+15)+'</FONT></b></td></tr>');
		document.writeln('<INPUT TYPE="hidden" NAME="Total_con_Transporte" VALUE="'+alterError(totprice+15.00)+'" SIZE="40">');
		document.writeln('</TABLE>');

		document.writeln('<INPUT TYPE="hidden" NAME="cart" VALUE="'+allcart+'" SIZE="40">');
		
	}