﻿// JScript File
var objHttpReq;
var spinner;
//var m_DefaultSize;
//var m_DefaultColor;
String.prototype.trim = function () {
    return this.replace(/^\s+|\s+$/g, "");
}
String.prototype.ltrim = function () {
    return this.replace(/^\s+/, "");
}
String.prototype.rtrim = function () {
    return this.replace(/\s+$/, "");
}


function GetInvStoreList() {
    if (!document.getElementById("StoreInvList")) return;
    if (window.XMLHttpRequest) {
        // Not IE
        objHttpReq = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        try {
            objHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                objHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e1) {
                objHttpReq = null;
            }
        }
    }
    if (objHttpReq != null) {
        var SKU = document.getElementById("divSKU").innerHTML;
        // var SKU = frmAdd.ProductID.value;
        objHttpReq.onreadystatechange = ProcessStoreInventoryResponse;
        aURL = "/app_templates/skin_1/getstoreinventory.aspx?SKU=" + SKU
        ShowInvSpinner()
        // document.getElementById("divInventory").innerHTML = "<center><img style=\"margin-top:10px;margin-bottom:10px\" src=\"/app_themes/skin_1/images/spinner.gif\" /></center>";
        objHttpReq.open("GET", aURL, true);
        objHttpReq.send(null);
    }
    return false;

}
           

function GetInventory(){
    if (!document.getElementById("divSKU")) return;
	if (window.XMLHttpRequest) {
		// Not IE
	    objHttpReq = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		try{
		    objHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
			    objHttpReq = new ActiveXObject("Microsoft.XMLHTTP");						
			}
			catch(e1){
			    objHttpReq = null;
			}
		}
	}
if (objHttpReq != null) {
	    var SKU = document.getElementById("divSKU").innerHTML;
	    // var SKU = frmAdd.ProductID.value;
	    var SIZECODE = document.getElementById("Size").value;
	    var COLORCODE = document.getElementById("Color").value;
	    if (!SIZECODE) return;
	    if (!COLORCODE) return;
	    // var COLORID = document.getElementById("divCOLORCODE").innerHTML;
	    // var SIZEID = document.getElementById("divSIZECODE").innerHTML;
	    objHttpReq.onreadystatechange = ProcessInventoryResponse;
	    aURL = "/app_templates/skin_1/getstoreinventory.aspx?SKU=" + SKU + "&ColorCode=" + COLORCODE + "&Size=" + SIZECODE 
	    ShowCartSpinner()
        // document.getElementById("divInventory").innerHTML = "<center><img style=\"margin-top:10px;margin-bottom:10px\" src=\"/app_themes/skin_1/images/spinner.gif\" /></center>";
	    objHttpReq.open("GET", aURL, true);
	    objHttpReq.send(null);
	}
	return false;
}



function RefreshMiniCart() {
    if (!document.getElementById("MiniCartContents")) return;
    if (window.XMLHttpRequest) {
        // Not IE
        objHttpReq = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        try {
            objHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                objHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e1) {
                objHttpReq = null;
            }
        }
    }
    if (objHttpReq != null) {
        objHttpReq.onreadystatechange = ProcessCartRefreshResponse;
        aURL = "/VPOSimpleCart.aspx"
        
        /* document.getElementById("MiniCartContents").innerHTML = "<center><img style=\"margin-top:10px;margin-bottom:10px\" src=\"/app_themes/skin_1/images/spinner.gif\" /></center>"; */
        $("#MiniCartContents").slideDown(400);
        ShowCartSpinner();
        objHttpReq.open("GET", aURL, true);
        objHttpReq.send(null);
    }
    return false;
}


function ProcessCartRefreshResponse() {
    if (objHttpReq.readyState == 4) {
        if (objHttpReq.status == 200) {
            document.getElementById("MiniCartContents").innerHTML = objHttpReq.responseText;
            UpdateMiniCartTotalQuan();
            HideCartSpinner();
            //alert($("#Color").val().trim());
        }
        else {
            alert(objHttpReq.status);
        }
    }
}



function UpdateMiniCartTotalQuan() {
    var newCountHTML = $("#MiniCartCount").html()
    $("#CartContainsText").text(newCountHTML)
}


function ProcessInventoryResponse(){
    if (objHttpReq.readyState == 4) {
        if (objHttpReq.status == 200) {
            document.getElementById("divInventory").innerHTML = objHttpReq.responseText;
		    
		}
		else{
			//alert(obj.status);
		}
	}
}

function ProcessStoreInventoryResponse(){
    if (objHttpReq.readyState == 4) {
        if (objHttpReq.status == 200) {
            document.getElementById("StoreInvList").innerHTML = objHttpReq.responseText;
            WireUpInvStoreListJavascript($('#InvScript').html());
            BuildSizeColorStoreInventoryArray;  
              
		}
		else{
			//alert(obj.status);
		}
	}
}


function addCart(varProductID, varVariantID) {
    if (!document.getElementById("Color").value) { alert('Please select a color'); return; }
    if (!document.getElementById("Size").value) { alert('Please select a size'); return; }
    if (!document.getElementById('Quantity_' + varProductID + '_' + varVariantID).value.match(/^\d+$/)) { alert('Please enter a number'); return; }
    document.getElementById('Color_' + varProductID + '_' + varVariantID).value = $("#Color").val().trim();
    document.getElementById('Size_' + varProductID + '_' + varVariantID).value = $("#Size").val().trim();
    var args = '0_' + varProductID + '_' + varVariantID;
    __doPostBack('AddToCart', args);
}


function removeItem(CartRecID) {

    var onCompleteCallBack = Function.createDelegate(this, this.onRemoveFromCartComplete);
    var service = new ActionService();
    var cartType = 0;
    
    if (service) {
        // alert('got service, posting remove cart ID ' + CartRecID);

        service.RemoveFromCart(CartRecID,
                        onRemoveFromCartComplete);
    }
   
//    var args = '0_' + varProductID + '_' + varVariantID;
//    __doPostBack('AddToCart', args);

}


function onRemoveFromCartComplete(status) {
    RefreshMiniCart();
    // $("#showme").append("Blah blach bluggg <br />");
}




          var Toggle
          Toggle = false

//          $("#NewAddToCart").live("mouseover", function () {
//              if ($(this).hasClass("SoldOut")) {
//                  $(this).tooltip();
//                  //$(this).tooltip({ relative: true }).dynamic({ bottom: { direction: 'up', bounce: true} });
//                  $(this).data('tooltip').show();
//                  // $(this).addClass("tooledUp");
//              }
//              else {
//                  $(this).data('tooltip').hide();
//                  $(this).unbind();
//              }
//          });

//          $("#NewAddToCart").live("mouseout", function () {
//              if ($(this).hasClass("SoldOut")) {
//                  //$(this).tooltip();
//                  //$(this).tooltip({ relative: true }).dynamic({ bottom: { direction: 'up', bounce: true} });
//                  $(this).data('tooltip').hide();
//                  // $(this).addClass("tooledUp");
//              }
//          });


          
          function CreateOutOfStockTooltip() {
              $('#NewAddToCart').addClass('SoldOut');

              if ($("#NewAddToCart").data('tooltip') != null) {
                  if ($("#NewAddToCart").data('tooltip').original_show) {
                      $("#NewAddToCart").data('tooltip').show = $("#NewAddToCart").data('tooltip').original_show;
                      $("#NewAddToCart").data('tooltip').original_show = null;
                  }
              }
              else {
                  $("#NewAddToCart").attr('Title', "<br />Sorry! We're currently sold out of this colour and size combination. Please try another.");
              }


              $("#NewAddToCart").tooltip({  effect: 'fade', fadeOutSpeed: 200,  position: 'bottom center'});
              // $("#NewAddToCart").tooltip({ relative: true }).dynamic({ bottom: { direction: 'up', bounce: true} });
              // $("#NewAddToCart").tooltip({ effect: 'fade', fadeOutSpeed: 200 });
              $("#NewAddToCart").data('tooltip').show();
              setTimeout("AutoHideTooltip();", 4300); 
              
              // $("#NewAddToCart").tooltip({ fadeOutSpeed: 10, delay: 1000, api: true }).hide();
          }

          

          function AutoHideTooltip() {
              $("#NewAddToCart").data('tooltip').hide();
          }

          function RemoveOutOfStockTooltip() {
              $("#NewAddToCart").removeAttr('Title');
              $('#NewAddToCart').removeClass('SoldOut');
              if (!$('#NewAddToCart').data('tooltip')) { return };
                $('#NewAddToCart').data('tooltip').hide();
                //$(".tooltipclass").remove();
                if ($("#NewAddToCart").data('tooltip').original_show == null) {
                    $("#NewAddToCart").data('tooltip').original_show = $("#NewAddToCart").data('tooltip').show;
                    $("#NewAddToCart").data('tooltip').show = function () { }
                }
          }




          function ToggleOutOfStockTooltip() {
              
              Toggle = !Toggle
              if (Toggle) {
                  CreateOutOfStockTooltip();

                  // $("#NewAddToCart").data('tooltip').show = function () { }

                  

//                  $("#NewAddToCart").tooltip({
//                        tipClass:'tooltipclass',
//                    });
                  // $("#NewAddToCart").tooltip();
                  
              }
              else {
                

                  //$("a.NewAddToCartButton").attr('Title', "");
                  //$("#NewAddToCart").tooltip();
                  //$("#NewAddToCart").data('tooltip').hide();
                  //$("#NewAddToCart").data('tooltip').text('');
                  RemoveOutOfStockTooltip();
                  
                  
              }

              
              
          }


          function CartResults() {
              if ($('#NewAddToCart').hasClass('Adding')) { return }
              if ($('#NewAddToCart').hasClass('SoldOut')) { return }

              var onCompleteCallBack = Function.createDelegate(this, this.onAddToCartComplete);
              
          var service = new ActionService();
          var cartType = 0;
          var qty = $("#txtQuantity").val();
          if (service) {
          $('a.NewAddToCartButton').addClass('Adding');

          var ColorOptions = this.getColorOptions();
          var SizeOptions = this.getSizeOptions()

          if (ColorOptions.length == 0 ||
              SizeOptions.length == 0) {
              alert('Please make a colour and size selection.');
              return;
          }




          // alert('got service, posting variantID = ' + this.getVariantId() + ' : productID = ' + this.getProductId() + ' : Size = ' + this.getSizeOptions() + ' : Color = ' + this.getColorOptions());
          // update the add to cart image:
          service.AddToCart(this.getProductId(),
          this.getVariantId(),
          cartType,
          qty,
          this.getShippingAddressId(),
          this.getVariantStyle(),
          this.getTextOption(),
          this.getCustomerEnteredPrice(),
          ColorOptions,
          SizeOptions,
          this.getUpsellItems(),
          this.getCartRecordId(),
          this.getIsEditKit(),
          this.getKitItems(),
          onCompleteCallBack);
          }
          }

          function getProductId(){
          return $("#ProductID").val();
          }

          function getVariantId(){
          return $("#VariantID").val();
          }

          function getShippingAddressId(){
          return '';
          }

          function getVariantStyle(){
          return '';
          }

          function getTextOption(){
          return '';
          }

          function getCustomerEnteredPrice(){
          return '';
          }

          function getColorOptions(){
              return $("#Color").val().trim();
          }

          function getSizeOptions(){
            return $("#Size").val().trim();
          }

          function getUpsellItems(){
          return '';
          }

          function getCartRecordId(){
          return '';
          }

          function getIsEditKit(){
          return '';
          }

          function getKitItems(){
          return '';
          }

          function onAddToCartComplete(status){
          RefreshMiniCart();
          $('a.NewAddToCartButton.Adding').removeClass('Adding');
          // $("#showme").append("Blah blach bluggg <br />");
          
          }



          function UpdateColorSizeDivFormatting() {
              var Container
              var SelectedSizeDiv
              var SelectedColorDiv

              // do we have a selected size?
              var SelectedSizeArray = $('#Size').val().split(',');
              var ParsedSizeString = ''
              if (SelectedSizeArray) {
                  // we have a size:
                  ParsedSizeString = SelectedSizeArray[0];
              }

              var SelectedSizeDivID = "Size" + ParsedSizeString
              var ParsedColorCode
              // do we have a selected color?
              var SelectedColorArray = $('#Color').val().split(',');
              var ParsedColorString = ''
              if (SelectedColorArray) {
                  // we have a color:
                  ParsedColorString = SelectedColorArray[0];
                  ParsedColorCode = SelectedColorArray[1]
              }

              var SelectedColorDivID = "Color" + ParsedColorString



              // update sizes display
              Container = $("#divSizes")[0]
              for (var obj = Container.firstChild; obj; obj = obj.nextSibling) {
                  // loop through each color or size sector row
                  if (obj.id == SelectedSizeDivID) {
                      obj.className = "ColorSizeRowActive";
                      // if (fIsSoldOut) { $(obj).addClass("SoldOut"); } else { $(obj).removeClass("SoldOut"); }
                  }
                  else { obj.className = "ColorSizeRow"; }
              }


              // update colors display
              Container = $("#divColors")[0]
              var fIsSoldOut = false;
              for (var obj = Container.firstChild; obj; obj = obj.nextSibling) {
                  // loop through each color 
                  // get the color text:
                  var currentColorText = obj.innerHTML;

                  if (currentColorText) {
                      fIsSoldOut = false;
                      if (ParsedSizeString != '') { fIsSoldOut = !CheckHasInventory(ParsedSizeString, currentColorText); }

                      if (obj.id == SelectedColorDivID) {
                          obj.className = "ColorSizeRowActive";
                      }
                      else { obj.className = "ColorSizeRow"; }

                      if (fIsSoldOut) { $(obj).addClass("SoldOut"); } else { $(obj).removeClass("SoldOut"); }
                  }
              }

              fIsSoldOut = !CheckHasInventory(ParsedSizeString, ParsedColorString);
              if (fIsSoldOut) { CreateOutOfStockColorSizeTooltip(); CreateOutOfStockTooltip(); }
              else { RemoveOutOfStockTooltip(); }


              // update the available in store inventory
              UpdateStoreInventoryFormatting(ParsedColorCode, ParsedSizeString);
          }


          function UpdateStoreInventoryFormatting(color, size) {
              // StoreInvLink
              

              // alert('checking color:' + color + ', size:' + size)
              $('.StoreInvLink').each(function (index) {
                  if (CheckHasStoreInventory(this, color, size)) {
                      this.style.color = "";
                  } else {
                      this.style.color = "silver";
                  }

              });

          }

          function CheckHasStoreInventory(a, colorcode, size) {
              var fHasInv;
              fHasInv = false;

              if (colorcode == null) { colorcode = '' };
              if (size == null) { size = '' };

              // loop through the inv array:
              for (var i = 0, len = m_SizeColorStoreInventoryArray.length; i < len; ++i) {

                  if ((m_SizeColorStoreInventoryArray[i][0] == colorcode.trim()) && (m_SizeColorStoreInventoryArray[i][1] == size) && (m_SizeColorStoreInventoryArray[i][2] == a.id)) {
                      // we found the size and color
                      fHasInv = true;
                  }

                  // Just check the size:
                  if ((colorcode == '') && (m_SizeColorStoreInventoryArray[i][1] == size) && (m_SizeColorStoreInventoryArray[i][2] == a.id)) {
                      // we found the size 
                      fHasInv = true;
                  }

                  // Just check the color:
                  if ((size == '') && (m_SizeColorStoreInventoryArray[i][0] == colorcode.trim()) && (m_SizeColorStoreInventoryArray[i][2] == a.id)) {
                      // we found the color
                      fHasInv = true;
                  }


                  // Just check the product:
                  if ((size == '') && (colorcode == '') && (m_SizeColorStoreInventoryArray[i][2] == a.id)) {
                      // we found the product
                      fHasInv = true;
                  }
              }

              // alert(a.id + ': ' + fHasInv);
               return fHasInv;
              
          }

          function CheckHasInventory(a_Size, a_Color) {
              if ((!a_Size) || (!a_Color) || (a_Size == '') || (a_Color == '')) { return true; }

              if (GetInventoryFromArray(a_Size, a_Color)) {return true;} 
              else { return false; }
          }

          

          function GetInventoryFromArray(Size, Color) {

              for (var i = 0, len = m_SizeColorInventoryArray.length; i < len; ++i) {
                  if ((m_SizeColorInventoryArray[i][0] == Size) && (m_SizeColorInventoryArray[i][1] == Color)) {
                      // we found the size and color
                      return m_SizeColorInventoryArray[i][2]; 
                      }
                }
          }


          function CreateOutOfStockColorSizeTooltip() {
            
          }


          function SelectColor(a_Color, a_ColorCode) {

              // update the selected color form field:
              $("#Color").val(a_Color.trim() + ',' + a_ColorCode.trim());
              //alert('||' + $("#Color").val() + '||'); 
              // alert($("#Color").val());

              var divColorSelector = document.getElementById('Color' + a_Color);
              
              UpdateColorSizeDivFormatting();
             // if (fIsSoldOut) { CreateOutOfStockColorSizeTooltip(); CreateOutOfStockTooltip(); }
             // else { RemoveOutOfStockTooltip(); }
              setcolorpic(a_Color);
              if ($("#Size").length > 0) { DisplayInventoryLookupText(); }
          }
          
          
          function asdfSetColor(e, Color) {
              document.getElementById('Color').value = Color;
              var p = document.getElementById(e.id);
              if (!p) p = event.srcElement;

              var fIsSoldOut = !CheckHasInventory(Size, Color);
              HighlightColorSizeDiv(p, fIsSoldOut);
              if (fIsSoldOut) {
                  CreateOutOfStockColorSizeTooltip();
                  CreateOutOfStockTooltip();
              }
               else {
                  RemoveOutOfStockTooltip(); 
              }

              setcolorpic(Color);
              VPOupdateImageDescription(Color);

              var Size = document.getElementById('Size').value;

              if (Size.length > 0) {
              DisplayInventoryLookupText();
          }

          }

          function DisplayInventoryLookupText(){
          // var newHtml = "<div' onclick='GetInventory=''()' >Please click here to verify inventory levels for the colour and size you selected.</div>";
          var newHtml;
          newHtml = '<div style=\'cursor: pointer; cursor:hand;\' onclick=\'GetInventory()\' >Please click here to verify inventory levels for the colour and size you selected.</div>';
          if (document.getElementById('divInventory') != null) {
              document.getElementById('divInventory').innerHTML = newHtml;
          }
          }

          function DisplayInventory(z) {
              document.getElementById('Color').value = z;
              var Size = document.getElementById('Size').value;
              if (Size.length > 0) {
                  DisplayInventoryLookupText();
              }
          }



          function SelectSize(a_Size) {
          // update the selected size form field:
          $("#Size").val(a_Size + ', ' + a_Size);

          // alert($("#Color").val());

          var divSizeSelector = document.getElementById('Size' + a_Size);

          UpdateColorSizeDivFormatting();

          
          if ($("#Color").length > 0) { DisplayInventoryLookupText(); }
          }





          function SetSize(e, z) {
          document.getElementById('Size').value = z;
          // HighlightColorSizeDiv(e);

          UpdateColorSizeDivFormatting

          var Color = document.getElementById('Color').value;
          if (Color.length > 0) {
                DisplayInventoryLookupText(); 
              }
          }

          function setcolorlisttoactiveitem(color) {
          if (!color) return;
          var eName = 'Color' + color;
          var p = document.getElementById(eName);
          UpdateColorSizeDivFormatting;
          //if (p) HighlightColorSizeDiv(p);
          }



//          function setcolorpic(z) {

//          }

          function VPOupdateImageDescription(z) {
          var mySplitResult = z.split(",");
          var ImageDescription;

              if (mySplitResult[0].length < 1)
                  { ImageDescription = "Default Image"; }
              else
                { ImageDescription = mySplitResult[0]; }

              document.getElementById('VPOImageDescription').innerHTML = ImageDescription;
          }

         

          //fgnass.github.com/spin.js
          (function (a, b, c) { function O(a) { H(arguments, function (b, d) { a[b] === c && (a[b] = d) }); return a } function N(a) { H(arguments, function (b, c) { a[m][M(a, b) || b] = c }); return a } function M(a, b) { var d = a[m], f, g; if (d[b] !== c) return b; b = b.charAt(0).toUpperCase() + b.slice(1); for (g = 0; g < E[e]; g++) { f = E[g] + b; if (d[f] !== c) return f } } function L(a, b) { var c = [j, b, ~ ~(a * 100)].join("-"), d = "{" + j + ":" + a + "}", f; if (!F[c]) { for (f = 0; f < E[e]; f++) try { K.insertRule("@" + (E[f] && "-" + E[f].toLowerCase() + "-" || "") + "keyframes " + c + "{0%{" + j + ":1}" + b + "%" + d + "to" + d + "}", K.cssRules[e]) } catch (g) { } F[c] = 1 } return c } function J(a, b, c) { c && !c[t] && J(a, c), a.insertBefore(b, c || null); return a } function I(a) { var c = b.createElement(a || "div"); H(arguments, function (a, b) { c[a] = b }); return c } function H(a, b) { var c = ~ ~((a[e] - 1) / 2); for (var d = 1; d <= c; d++) b(a[d * 2 - 1], a[d * 2]) } var d = "width", e = "length", f = "radius", g = "lines", h = "trail", i = "color", j = "opacity", k = "speed", l = "shadow", m = "style", n = "height", o = "left", p = "top", q = "px", r = "childNodes", s = "firstChild", t = "parentNode", u = "position", v = "relative", w = "absolute", x = "animation", y = "transform", z = "Origin", A = "Timeout", B = "coord", C = "#000", D = m + "Sheets", E = "webkit0Moz0ms0O".split(0), F = {}, G; J(b.getElementsByTagName("head")[0], I(m)); var K = b[D][b[D][e] - 1], P = function (a) { this.opts = O(a || {}, g, 12, h, 100, e, 7, d, 5, f, 10, i, C, j, .25, k, 1) }, Q = P.prototype = { spin: function (b) { var c = this, d = c.el = c[g](c.opts); b && J(b, N(d, o, ~ ~(b.offsetWidth / 2) + q, p, ~ ~(b.offsetHeight / 2) + q), b[s]); if (!G) { var e = c.opts, f = 0, i = 20 / e[k], l = (1 - e[j]) / (i * e[h] / 100), m = i / e[g]; (function n() { f++; for (var b = e[g]; b; b--) { var h = Math.max(1 - (f + b * m) % i * l, e[j]); c[j](d, e[g] - b, h, e) } c[A] = c.el && a["set" + A](n, 50) })() } return c }, stop: function () { var b = this, d = b.el; a["clear" + A](b[A]), d && d[t] && d[t].removeChild(d), b.el = c; return b } }; Q[g] = function (a) { function s(b, c) { return N(I(), u, w, d, a[e] + a[d] + q, n, a[d] + q, "background", b, "boxShadow", c, y + z, o, y, "rotate(" + ~ ~(360 / a[g] * m) + "deg) translate(" + a[f] + q + ",0)", "borderRadius", "100em") } var b = N(I(), u, v), c = L(a[j], a[h]), m = 0, r; for (; m < a[g]; m++) r = N(I(), u, w, p, 1 + ~(a[d] / 2) + q, y, "translate3d(0,0,0)", x, c + " " + 1 / a[k] + "s linear infinite " + (1 / a[g] / a[k] * m - 1 / a[k]) + "s"), a[l] && J(r, N(s(C, "0 0 4px " + C), p, 2 + q)), J(b, J(r, s(a[i], "0 0 1px rgba(0,0,0,.1)"))); return b }, Q[j] = function (a, b, c) { a[r][b][m][j] = c }; var R = "behavior", S = "url(#default#VML)", T = "group0roundrect0fill0stroke".split(0); (function () { var a = N(I(T[0]), R, S), b; if (!M(a, y) && a.adj) { for (b = 0; b < T[e]; b++) K.addRule(T[b], R + ":" + S); Q[g] = function () { function s(c, e, l) { J(k, J(N(h(), "rotation", 360 / a[g] * c + "deg", o, ~ ~e), J(N(I(T[1], "arcsize", 1), d, b, n, a[d], o, a[f], p, -a[d] / 2, "filter", l), I(T[2], i, a[i], j, a[j]), I(T[3], j, 0)))) } function h() { return N(I(T[0], B + "size", c + " " + c, B + z, -b + " " + -b), d, c, n, c) } var a = this.opts, b = a[e] + a[d], c = 2 * b, k = h(), m = ~(a[e] + a[f] + a[d]) + q, r; if (a[l]) for (r = 1; r <= a[g]; r++) s(r, -2, "progid:DXImage" + y + ".Microsoft.Blur(pixel" + f + "=2,make" + l + "=1," + l + j + "=.3)"); for (r = 1; r <= a[g]; r++) s(r); return J(N(I(), "margin", m + " 0 0 " + m, u, v), k) }, Q[j] = function (a, b, c, d) { d = d[l] && d[g] || 0, a[s][r][b + d][s][s][j] = c } } else G = M(a, x) })(), a.Spinner = P })(window, document)


          function ShowCartSpinner() {
          var opts = {
              lines: 12, // The number of lines to draw
              length: 6, // The length of each line
              width: 2, // The line thickness
              radius: 5, // The radius of the inner circle
              color: '#FA971F', // #rbg or #rrggbb
              speed: 1, // Rounds per second
              trail: 100, // Afterglow percentage
              shadow: false  // Whether to render a shadow
          };
          var target = document.getElementById('ShowMiniCart');
          spinner = new Spinner(opts).spin(target);
          }

          function HideCartSpinner(){
              spinner.stop();


          } function ShowInvSpinner() {
              var opts = {
                  lines: 12, // The number of lines to draw
                  length: 6, // The length of each line
                  width: 2, // The line thickness
                  radius: 5, // The radius of the inner circle
                  color: '#FA971F', // #rbg or #rrggbb
                  speed: 1, // Rounds per second
                  trail: 100, // Afterglow percentage
                  shadow: false  // Whether to render a shadow
              };
              var target = document.getElementById('StoreInvList');
              spinner = new Spinner(opts).spin(target);
          }

          function HideInvSpinner() {
              spinner.stop();
          }



          function WireUpInvStoreListJavascript(text) {
              var oHead = document.getElementsByTagName('HEAD').item(0);
              var oScript = document.createElement("script");
              oScript.language = "javascript";
              oScript.type = "text/javascript";
              oScript.id = 'WiredUpInvScript';
              oScript.defer = true;
              oScript.text = text;
              oHead.appendChild(oScript);

              BuildSizeColorStoreInventoryArray();
          }


          function FormatCurrency(N) { N = parseFloat(N); if (!isNaN(N)) N = N.toFixed(2); else N = '0.00'; return N; }

