function addToCart(element, productid, pricingitemid, option, itemprice)
{

	var calculatedPrice=itemprice;
	
	var key="quick_"+pricingitemid;
	var value=globalQuickprice[key];
		
	if(value)
		calculatedPrice=value.substring(1);
		
	element.innerHTML="adding to cart...";
	var price=itemprice;
	var basket=option;


// this is somthing of a hack, I use the random number to differentiate different items in the cart that have the same intrinsic choices
// so, for instance, if someone had two items in the shopping cart, both of the same product and quantity selection, this random number ensures that 
// the shopping cart id of the two items will be different 999999 times out of a million
	var randomnumber=Math.floor(Math.random()*1000001);

		
	var options={onComplete:function(){$('newitemadded').innerHTML='New item added';}};
	var url='/php/basket.php?mode=add&productid='+productid+'&pricingitemid='+pricingitemid;
	url=url+'&price='+calculatedPrice+'&basket='+basket+'&random='+randomnumber;
		
	if(	$('envelopes') )
		if($('checkboxEnvelopes'))
			if($('checkboxEnvelopes').checked==true)
				url=url+'&stockid='+$('envelopes').value;
			    					
	var ajax = new Ajax.Updater('shopping_cart_div', url, options);
		
	new PeriodicalExecuter(function(pe) {
 				element.innerHTML='Add to cart';
   			pe.stop();
		}, 1);

}

function removeFromCart(item_id)
{
	var options={};
	var url='/php/basket.php?mode=remove&id='+item_id;
	var ajax = new Ajax.Updater('shopping_cart_div', url, options);
}

function viewCart()
{
	var options={};
	var url='/php/basket.php?mode=display';
	var ajax = new Ajax.Updater('shopping_cart_div', url, options);
}


function viewCartSimple()
{
		var options={};
		var url='/php/basket.php?mode=displaysimple';
		var ajax = new Ajax.Updater('shopping_cart_simple_div', url, options);
}

function viewCartSimplePink()
{
		var options={};
		var url='/php/basket.php?mode=displaysimplepink';
		var ajax = new Ajax.Updater('shopping_cart_div', url, options);
}
