// This Java script file  contains a set of functionsused for shopping cart pages

// addtocart function
// accepts the product id to be added
function addtocart (prodid_occid) {
  var new_id = prodid_occid+"_prod_class";
  //alert(new_id);
  //document.getElementById('pcid').value = document.getElementById(new_id).value;
  //alert(document.getElementById(new_id).value);
  //alert(document.getElementById('pcid').value);
  document.sendToCart.pcid.value = document.getElementById(new_id).value;
  document.getElementById('cart_action').value = 'add';
  var occasions = prodid_occid.split("_",2);
  var occasion = occasions[1];
  document.getElementById('occasion_id').value = occasion;

      return true;

}

// addtocart function
// accepts the product id to be added
function removefromcart (prod_id) {

  document.getElementById('pid').value = prod_id;
  document.getElementById('cart_action').value = 'remove';
  return true;
}

// ChangeQty function
// accepts the new quantity for the product in order
function changeQty (id) {

  var qty = document.getElementById(id+'_qty').value;
  if (qty) {
    document.getElementById('pid').value = id;
    document.getElementById('cart_action').value = 'chngQty';
    document.getElementById(id+'_qty').value = qty;
    return true;
  } else {
    return false;
  }
}



