var OrderUI = {
		serviceUrl : 'application/UI/CartUIService.php',
		
		onCancelClick: function(id)
		{
			$('#price_options_'+ id).slideUp('fast');
			return false;
		},
		
		showOptions: function(id)
		{
			$('#price_options_'+ id).slideDown('fast');
			return false;
		},
		
		reloadTinyCart: function()
		{
			$.post(OrderUI.serviceUrl, 
					{'act':'tiny_cart'},
					function(response)
					{
						$('#tiny_cart').html(response);
					});
		},
		
		addToCart: function(id, hasSize, hasExtra)
		{
			$U.showProgress();
			
			var size = null;
			var extra = null;
			if(hasSize)
			{
				size = $U.radioVal('optSize_' + id);
			
				if(size == null) 
				{
					return false;
				}
			}
			
			if(hasExtra)
			{
				extra = $U.radioVal('optPrice_' + id);
			}
			
			$.post(OrderUI.serviceUrl, 
					{'act':'add', 'id' : id, 'size' : size, 'extra' : extra},
					function(response)
					{
						OrderUI.reloadTinyCart();
						
						alert('Item has been added successfully.');
						
						$('#price_options_'+ id).slideUp();
						
						$U.hideProgress();
					});
			
			return false;
		},
		
		loadCart: function()
		{
			$.post(OrderUI.serviceUrl, 
					{'act':'cart'},
					function(response)
					{
						$('#cart_contents').html(response);
					});
		},
		
		clearCart: function()
		{
			if(confirm('Are you sure you want to clear the cart items?'))
			{
				$U.showProgress();
				
				$.post(OrderUI.serviceUrl, 
					{'act':'clear_cart'},
					function(response)
					{
						OrderUI.loadCart();
						
						$U.hideProgress();
					});
			
				return false;
			}
			
			return false;
		},
		
		init: function()
		{
		}
	};