	var smallBagEffect;
	var blnSmallBag = false;
	var bigBagEffect;
	var blnShowBigBag = false;
	
	function showSmallBag()
	{
		if (!blnShowBigBag)
		{
			if (typeof(smallBagEffect) == 'object')
				smallBagEffect.cancel();

			if (blnSmallBag == false)
			{
				var bagHeight = $('smallBag').getHeight();
				$('smallBag').style.top = -bagHeight +"px";
				smallBagEffect = new Effect.Move($('smallBag'),{
					x:0,
					y:bagHeight,
					duration: 0.5,
					mode: 'relative',
					afterFinish: function() {
						blnSmallBag = true;
					}
				});
			}
		}
	}

	function hideSmallBag()
	{
		if (!blnShowBigBag)
		{
			if (typeof(smallBagEffect) == 'object')
				smallBagEffect.cancel();

			var bagHeight = $('smallBag').getHeight();
			
			smallBagEffect = new Effect.Move($('smallBag'),{
				x:0,
				y:-bagHeight,
				duration: 0.5,
				delay:0.5,
				mode: 'relative',
				afterFinish: function() {
					blnSmallBag = false;
					if ($('scrollWrapper'))
						$('scrollWrapper').style.zIndex = 3;
				}
			});
		}
	}
	
	function stopSmallBag()
	{
		if (typeof(smallBagEffect) == 'object')
			smallBagEffect.cancel();
	}
	
	function showBigBag()
	{
		if (!blnShowBigBag)
		{
			blnShowBigBag = true;
			blnSmallBag = false;
			if (typeof(bigBagEffect) == 'object')
				bigBagEffect.cancel();

			$('bigbag').style.left = -1240+"px";

			bigBagEffect = new Effect.Move($('bigbag'),
			{
				x:1240,
				y:0,
				mode: 'relative',
				duration: 1.2
			});
		}
	}

	function hideBigBag()
	{
		if (itemRemoved)
		{
			window.location.reload();
		}
		else
		{
			blnShowBigBag = false;
			if (typeof(bigBagEffect) == 'object')
				bigBagEffect.cancel();
			
			//$('overviewWrapper').style.overflowY = 'hidden';
			var bagHeight = $('smallBag').getHeight();
			$('smallBag').style.top = -bagHeight+"px";
			
			bigBagEffect = new Effect.Move($('bigbag'),
			{
				x:-1240,
				y:0,
				mode: 'relative',
				duration: 0.8,
				afterFinish: function ()
				{
					if ($('scrollWrapper'))
						$('scrollWrapper').style.zIndex = 3;
				}
			});
		}
	}

	function bagMouseOver(obj)
	{
		if (!blnShowBigBag)
		{
			obj.id = 'over';
			showSmallBag();
			if ($('scrollWrapper'))
				$('scrollWrapper').style.zIndex = 2;
		}
	}

	function bagMouseOut(obj)
	{
		if (blnShowBigBag)
		{
			obj.id = '';
		}
		else
		{
			obj.id = '';
			hideSmallBag();
		}
	}
				
	var countriesVisible = false;
	var effect;

	function showCountries(obj)
	{
		if (!countriesVisible)
		{
			obj.up().addClassName('open');
			effect = new Effect.Appear(obj, {duration:0.5, from:0, to:1});
			countriesVisible = true;
		}
	}
			
	function selectCountry(country)
	{
		new Ajax.Request('/ajax/setcountry.asp',
		{
			method:'post',
			parameters: {country: country},
			onSuccess: function(transport)
			{
				var response = transport.responseText;
				var data = response.evalJSON();
				$('delivery').innerHTML = data.verzendkosten;
				$('total').innerHTML = data.totaal;
				$('countrybox').innerHTML = country;
				$('countries').style.display = "none";
				$('countries').parentNode.removeClassName('open');
				if ($('checkout'))
					$('checkout').removeClassName('disabled');
				countriesVisible = false;
				//alleen bij betaalwijze
				if($('deliverto'))
				{
					$('aflland').value = country;
					if(data.samecountry)
					{
						$('same').disabled=false;
						$('showmessage').addClassName('hide');
					}
					else
					{
						$('same').disabled=true;
						$('other').checked=true;
						deliverto('other');
						$('showmessage').removeClassName('hide');
					}
				}
			}
		});
	}
	
	function selectCustomerCountry(country)
	{
		$('countrybox2').innerHTML = country;
		$('country').value = country;
		$('countries2').style.display = "none";
		$('countries2').parentNode.removeClassName('open');
		countriesVisible = false;
	}

	var itemRemoved = false;
	function removeItem(product, size, nummer)
	{
		itemRemoved = true;
		new Ajax.Request('/ajax/removeitem.asp',
		{
			method:'post',
			parameters: {
				product: product,
				size: size
			},
			onSuccess: function(transport)
			{
				var response = transport.responseText;
				var data = response.evalJSON();

				if (data.subtotaal==0)
					$('overview').innerHTML = "<div class='containerMargin'></div><span>Er zitten geen artikelen in uw winkelmand</span>"
				else
				{
					$('subtotal').innerHTML = data.subtotaal;
					$('total').innerHTML = data.totaal;
					$('delivery').innerHTML = data.verzendkosten;
					$('item'+nummer).remove();
				}
			}
		});
	}

	function checkout(obj)
	{
		if (!obj.hasClassName('disabled'))
			document.location.href = '/bestellen/gegevens.asp'
		else
			alert('U heeft nog geen landkeuze gemaakt.');
	}
	
	function deliverto(address)
	{
		if	(address == 'same')
		{
			$('deliveryAddress').addClassName('hide');
			$('afleveren').value = 0;
		}
		else
		{
			$('deliveryAddress').removeClassName('hide');
			$('afleveren').value = 1;
		}
	}