jQuery(document).ready(function($) {
     $("input.wpsc_buy_button").click(function() {
          if($(this).parents("form:first").find("select.wpsc_select_variation[value=0]:first").length) { // if have variations and not selected prevent from clicking through
               return false;
          }
         var itemCount = parseInt($("#header-cart em.count").text()); // selects the current count of the header cart items
         var itemQuantity = parseInt($(this).parents("#single_product_page_container, table.list_productdisplay td, #products_page_container .productcol").find("input[name=wpsc_quantity_update]").val());
         if (itemQuantity > 1) {
               itemCount += itemQuantity;
          } else {
               itemCount++;
          }
          $("#header-cart em.count").text(itemCount);
     });
});



