﻿function LNCurtisProduct(prodId, fullName, webPartNum, qtyAvail, webPrice, displayMode, availabilityPhrase, canAddToCart, strMainImageUrl) {
   this.ProductId = prodId;
   this.FullName = fullName;
   this.WebPartNumber = webPartNum;
   this.QuantityAvailable = qtyAvail;
   this.WebPrice = webPrice;
   this.DisplayMode = displayMode;
   this.AvailabilityPhrase = availabilityPhrase;
   this.AddToCartVisible = canAddToCart;
   this.MainImageUrl = strMainImageUrl;

   this.SizeCode = "invalid web part number";
   this.ColorCode = "invalid web part number";

   if (this.WebPartNumber.length == 26) {
      this.SizeCode = this.WebPartNumber.substring(18, 22);
      this.ColorCode = this.WebPartNumber.substring(23, 26);
   }
}

var CurrentProduct;
var CurrentProducts = new Object();

function AvailableSize(strSizeCode, strSizeName, arrAvailColorCodes, strMainImageUrl, webPrice) {
   this.SizeCode = strSizeCode;
   this.SizeName = strSizeName;
   this.AvailColorCodes = arrAvailColorCodes;
   this.MainImageUrl = strMainImageUrl;
   this.WebPrice = webPrice;
}
function AvailableColor(strColorCode, strColorName, arrAvailSizeCodes, strMainImageUrl, webPrice) {
   this.ColorCode = strColorCode;
   this.ColorName = strColorName;
   this.AvailSizeCodes = arrAvailSizeCodes;
   this.MainImageUrl = strMainImageUrl;
   this.WebPrice = webPrice;
}

var AvailableSizes = new Object();
var AvailableColors = new Object();

function FormatCurrency(strValue) {
   var strReturnValue = "";
   strValue = strValue + "";

   if (strValue.indexOf('.') < 0)
      strValue = strValue + ".00";

   if (strValue.substring(strValue.length - 2, strValue.length - 1) == ".")
      strValue = strValue + "0";
   
   for (var i = strValue.length - 1; i >= 0; i--) {
      if (strValue.length > 6 && strValue.length - i > 6 && ((strValue.length - i - 4) % 3 == 0))
         strReturnValue = "," + strReturnValue;
      strReturnValue = strValue.substr(i, 1) + strReturnValue;
   }


   

   strReturnValue = '$' + strReturnValue;

   return strReturnValue
}
function StripCommasFromNumbers(strValue) {
   var strReturnValue = "";
   strValue = strValue + "";
   for (var i = 0; i < strValue.length; i++) {
      if (strValue.substr(i, 1) != ",")
         strReturnValue = strReturnValue + strValue.substr(i, 1);
   }

   return strReturnValue
}
