function evalmindelivery(gourl){
	//alert (gourl);
    $.ajax({
        url:'/cart_process.php?action=serialize_cart',
        dataType:"json",
        async:false,
        success:function(cart){
        if(!cart.order) return;
        var canGo = true; var isempty = true;
				var delivery = true;
        for(var i=0; i< cart["order"].length; i++){
            var totalPrice = 0;
            for(var j=0; j< cart["order"][i].length; j++) {
                if(cart["order"][i][j]["delivery_type"] == 'del' && cart["order"][i][j]['can_delete'] == 1)
                {
                    totalPrice += cart["order"][i][j]["quantity"]*cart["order"][i][j]["price"];
                }
								else if(cart["order"][i][j]["delivery_type"] != 'del')
								{
									delivery = false;
								}
								
                isempty = false;
            }
						if(cart.order[i][0])
						{
							var delivery_price = parseFloat(cart["order"][i][0]["delivery_price"]);
							if(delivery_price > totalPrice && delivery == true){
                canGo = false;
                showdialog('cartalert','alert','Unfortunately <b>'
                +(cart["order"][i][0]["restaurant_name"].replace('\'','&amp;'))
                +'</b> restaurant has a minimum delivery price of <b>&pound;'+delivery_price.toFixed(2)
                +'</b>.<br />Please add to your order or choose collection.');
                continue;
							}
						}
        }
        
        if(isempty){
            canGo = false;
            showdialog('cartalert','alert','To proceed to checkout, you need to add at least one meal to your cart');
        }
        if(canGo == true && gourl != null){
            window.location.href = gourl;
        }else{
          window.mindelres = canGo;
          return canGo;
        }
    }});
}
