// alterError - fixes a rounding bug in Netscape 2
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);
}

// buyItem - adds an item to the shooping basket
function buyItem(newItem, newPrice, newQuantity) {
	if (newQuantity <= 0) {
		rc = alert('The quantity entered is incorrect');
	} else {
		if (confirm('Add '+newQuantity+' x '+newItem+' to basket')) {
			index = document.cookie.indexOf("TheBasket");
			countbegin = (document.cookie.indexOf("=", index) + 1);
    			countend = document.cookie.indexOf(";", index);
        		if (countend == -1) {
    	    			countend = document.cookie.length;
        		}
	                document.cookie="TheBasket="+document.cookie.substring(countbegin, countend)+"["+newItem+"|"+newPrice+"|"+newQuantity+"]";
		}
	}
}

// resetShoppingBasket - resets to shopping basket to empty
function resetShoppingBasket() {
	index = document.cookie.indexOf("TheBasket");
	document.cookie="TheBasket=.";
}

//--This is one of many scripts which are available at: *---
//--http://www.JavaScript.nu?javascript *---
//--This script is FREE, but you MUST let these lines *---
//--remain if you steal this script. *---
function bookmark(url, description)
{ //***---This text will be shown to the visitor if it has Netscape.
	netscape="First push OK and then hit CTRL+D to add a bookmark to this site." ;
	if (navigator.appName=='Microsoft Internet Explorer')
		window.external.AddFavorite(url, description);
	else (navigator.appName=='Netscape')
		alert(netscape);
}
