/*##############################################################################
Ordering functions
##############################################################################*/

function addToCart(id, express) {
	if (!express)
		express = false;
	else if (express !== true)
		return false;

	if (typeof id != 'number') {
		return false;
	}
	// get the quantity and the price
	var quantity = $('#quantity-'+id).val();
	var price = $('#price-'+id).attr('title');
	// restore values
	$('#quantity-'+id).val(1);

	// add to cart
	if (quantity > 0) {
		$('#orderCart').load(BASE+'php-pieces/addToCart.php?lang='+LANG, {addToCart: 'true', orderId: id, orderQuantity: quantity, orderPrice: price, express: express}, function() {
				$(this).slideDown('fast');
				if (typeof expressError == 'undefined') {
					$.add2cart('food-'+id, 'theCart', function() {
						$('#food-'+id+'_shadow').remove();
					});
					$('#quantity-'+id).parent().parent().addClass('ordered');
				}
				$('html, body').animate({scrollTop: 0}, "slow");
		});
	}
}
