 function prodClass()
 {
   this.name = new String();
   this.description = new String();
   this.priceEx = 0;
   this.priceInc = 0;
   this.VATPercent = 0;
   this.amountForFreePost = 0;
   this.amountForDiscount = 0;
   this.discountPercent = 0;
   this.quantity = 0;

   this.priceDOMelement = new String();
   this.inputDOMElement = new String();
 }

 prodClass.prototype.qualifyForDiscount = function ()
 {
  if ((this.amountForDiscount != 0) && (this.quantity >= this.amountForDiscount))
  {
   return true;
  }
  else
  {
   return false;
  }
 }

 prodClass.prototype.displayPrice = function (incOrEx)
 {
  if (eval("document.getElementById('" + this.priceDOMElement + "')"))
  {
    var price = this.priceEx;
    if (incOrEx == 'Inc')
    {
     price = this.addVAT(price);
    }

    var priceStr = addZeroes(price);

    eval("document.getElementById('" + this.priceDOMElement + "').innerHTML = '" + priceStr + "'")
  }
 }

 prodClass.prototype.calcBasePriceInc = function ()
 {
   var price = this.priceEx;
   price = this.addVAT(price);
   return addZeroes(price);
 }

 prodClass.prototype.calcBasePriceEx = function ()
 {
   var price = this.priceEx;
   return addZeroes(price);
 }

 prodClass.prototype.calcTotalEx = function ()
 {
  var pEx = this.priceEx;
  pEx = parseInt((pEx * 100), 10) / 100;
  var total = pEx * this.quantity;
  var discount = 0;

  if (this.qualifyForDiscount())
  {
   discount = total * (this.discountPercent / 100);
   total = total - discount;
  }

  return total;
//    if (Number.toPrecision)
//    {
//     var total2 = total.toPrecision(2);
//     document.write("P: " + total2);
//     document.close();
//    }
//    else
//    {
//     var total2 = Math.round(total * 100) / 100;
//     document.write("r: " + total2);
//     document.close();
//    }
 }

 prodClass.prototype.addVAT = function (value)
 {
  var price = value + (value * this.VATPercent / 100) + 0.005;
  return parseInt((price * 100), 10) / 100;
 }

 prodClass.prototype.calcTotalInc = function ()
 {
  var subTotal = this.priceEx;
  subTotal = this.addVAT(subTotal);
  subTotal = subTotal * this.quantity;
  return subTotal;
 }

 prodClass.prototype.getDesc = function (curSym, incVAT)
 {
  purchaseStr = "";
  if (this.quantity > 0)
  {
   purchaseStr = this.quantity;
//   purchaseStr = purchaseStr + " " + this.type;
//   if ((this.type != "") && (this.quantity > 1))
//   {
//    purchaseStr = purchaseStr + "es";
//   }
   purchaseStr = purchaseStr + " of " + this.strippedName + " " + this.description;
   purchaseStr = purchaseStr + " @ ";
   if (incVAT)
   {
    purchaseStr = purchaseStr + curSym + this.calcBasePriceInc() + " each";
   }
   else
   {
    purchaseStr = purchaseStr + curSym + this.calcBasePriceEx() + " each";
   }
  }

  return purchaseStr;
 }

 prodClass.prototype.getName = function (curSym, incVAT)
 {
  purchaseStr = "";
  if (this.quantity > 0)
  {
   purchaseStr = this.quantity;
//   purchaseStr = purchaseStr + " " + this.type;
//   if ((this.type != "") && (this.quantity > 1))
//   {
//    purchaseStr = purchaseStr + "es";
//   }
   purchaseStr = purchaseStr + " of " + this.strippedName;
   purchaseStr = purchaseStr + " @ ";
   if (incVAT)
   {
    purchaseStr = purchaseStr + curSym + this.calcBasePriceInc() + " each";
   }
   else
   {
    purchaseStr = purchaseStr + curSym + this.calcBasePriceEx() + " each";
   }
  }

  return purchaseStr;
 }
