function generator_init()
{
	$$('div#item_info a').each(
		function(el)
		{
			el.addEvent('click',
				function(e)
				{
					e.stop();
					e.preventDefault();

					new Asset.images(['./media/images/loading.gif'],
						{
						    onComplete: function()
							{
								new Request(
									{  
										url: el.get('href') +'?nc='+ new Date().getTime().toString(),
										onRequest: function()
										{
											el.addClass('hide');
											el.getPrevious().removeClass('hide');
										},
										onComplete: function(repsonce)
										{
											el.removeClass('hide');
											el.getPrevious().addClass('hide');
											
											var info = repsonce.split('|');
											
											// Cart quantity
											if(info[0] == 1)
											{
												$('sh_amount').set('text', info[0] + ' item');
											}
											else
											{
												$('sh_amount').set('text', info[0] + ' items');
											}
											// Cart total euro
											if(info[1] > 0)
											{
												$('sh_total').set('text', info[1]);
												
												// After removing "vat_notice" this was giving an error.
												// We might turn on "vat_notice" at some point, so let's comment this out.
												// check shop.js
												//$('vat_notice').removeClass('hide');
											}
											else
											{
												$('sh_total').set('text', info[1]);
											}
										}
									}
								).send();
						    }
						}
					);
				}
			);
		}
	);
}
window.addEvent('domready', generator_init);
