﻿  var arrStyles = new Array();
    function StyleItems()
      {
         this.CurrentQuantity = arguments[0]
         this.QuantityField = arguments[1];
         this.ProductName = arguments[2];
         this.StyleID = arguments[3];
      }
      
      function CheckStyles(objSource, objArgs)
      {
      
        var isFirstItem = true;
        for (var i = 0; i<arrStyles.length; i++)
        {
            var oldQuantity = arrStyles[i].CurrentQuantity;
            var currentQuantity = document.getElementById(arrStyles[i].QuantityField).value;
            var sProductName = arrStyles[i].ProductName;
             
            if (oldQuantity > currentQuantity)
            {
                if(confirm(sProductName + " product's status is now inactive but decreasing it's quantity in the shopping cart it's available quantity will be increased. Do you want to activate this product's style?"))
                {
                    var sID = arrStyles[i].StyleID;
                    if (!isFirstItem)
                        sID = "," + sID 
                        document.getElementById("hdnStyleIDs").value += sID                   
                    
                    isFirstItem = false;    
                        
                }
            }
        }
        objArgs.IsValid = true;
        return;
      }
      
      function AddStyle()
      {
       var objStyle = new StyleItems(arguments[0], arguments[1], arguments[2], arguments[3]);
       arrStyles.push(objStyle);
      }

