I have a shopping cart and I am adding two items to it at once using the code below.

If you click under the wall art section all the way through and select 'add to cart' it only adds one item to the cart. If you hit the browsers back button and try it again, the code works and both items are added to the cart.

Any ideas why this is happening?
http://www.feelgoodlightups.com/flash/index.html

PHP Code:
<script type="text/javascript"><!--
    $(
'.add-items').live('click', function(evt) {
        if (
evt.button != 0) return; // ignore right-click
        
evt.preventDefault();
        
        var 
items = $(this).attr('href').substr(1).split(',');
        
// now items is ['G400191', 'G410003']
        
        // Disable the link to prevent repeated orders
        
$(this).attr('disabled','disabled');
        
        
// Execute the orders using ajax
        
var remaining_requests_cnt items.length;
        for (var 
0items.lengthi++) {
            $.
ajax({
                
url'/cgi/cart.cgi?'+items[i],
                
success: function() {
                    if (--
remaining_requests_cnt == 0) {
                        
top.location.href="http://www.feelgoodlightups.com/cgi/cart.cgi?viewcart";
                    }
                },
                
error: function() {
                    
alert('Error occurred. Check the content of your cart.');
                    
location.reload();
                },
            })
        }
    });
//--></script> 
PHP Code:
<div class="framePrice">
    <
div align="left" style="width:auto; height:auto; margin:auto; font-family:Arial, Helvetica, sans-serif; font-weight:bold; color:#666;">
        <
p>Silver Frame<br />
          
Astronomy 400191<br />
        $
79.00</p>
    <
div align="left" style="width:auto; height:auto; margin:auto;"></div>
        <
div align="left" style="width:auto; height:auto; margin:auto;"></div>
        <
div align="left" style="width:auto; height:auto; margin:auto; margin-top:10px;"
            <
a href="#G400191,G410003" class="add-items"><img src="images/cart.png" alt="add to cart" width="71" height="26" border="0" /></a>

        </
div>
    </
div>
</
div

cheers,