(function () {
    var i, j, f;
    typeof f === "undefined" && (f = {
        log: function () {}
    });
    i = function () {
        function a() {
            var b;
            a.prototype.initLinks();
            a.prototype.initForms();
            a.prototype.initExpressShopWidget();
            b = new j;
            b.revolutions("loop");
            b.display(4500)
        }
        a.prototype.validateEmail = function (b) {
            return b.match(/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/)
        };
        a.prototype.initExpressShopWidget = function () {
            $("#express-shop-item-number, #express-shop-item-quantity").focus(function () {
                return $(this).val("")
            });
            return $("#ws-express-shop-form").submit(function () {
                var b, a, c;
                $(this);
                b = $(this).attr("action");
                c = {};
                $.each($(this).serializeArray(), function (e, a) {
                    return c[a.name] = a.value
                });
                a = parseInt(c["express-shop-item-quantity"]);
                a === 0 || isNaN(a) ? alert("Quantity must not be a number!") : $.post(b, c, function (a) {
                    return a.error ? alert(a.error) : (alert(a.product_name + " has been added to your cart."), $("#header-shopping-cart-count").html(a.cart_item_count))
                }, "json").error(function () {
                    return alert("error. could not add item to cart")
                });
                return !1
            })
        };
        a.prototype.initLinks = function () {
            $("#ws-new-acct-registration-link").click(function () {
                $("form#ws-new-acct-registration").toggle("slide");
                return !1
            });
            $("#ws-existing-customer-registration-link").click(function () {
                $("form#ws-existing-customer-registration").toggle("slide");
                return !1
            });
            return $("#ws-account-password-reminder-link").click(function () {
                $("form#ws-account-password-reminder").toggle("slide");
                return !1
            })
        };
        a.prototype.initForms = function () {
            $("form#ws-opt-in-email-form").submit(function () {
                var b, d;
                $(this);
                b = $(this).attr("action");
                d = {};
                $.each($(this).serializeArray(), function (a, b) {
                    return d[b.name] = b.value
                });
                a.prototype.validateEmail(d["ws-opt-in-email"]) === null ? alert("must be a valid email address!") : $.post(b, d, function (a) {
                    $("#ws-email-opt-in-btn").hide();
                    return $("#email-sign-up-confirmation").html(a)
                }, "html");
                return !1
            });
            $("#ws-account-username, #ws-account-password").focus(function () {
                return $(this).val("")
            });
            return $("form#ws-account-password-reminder").submit(function () {
                var a, d, c;
                d = $(this);
                a = $(this).attr("action");
                c = {};
                $.each($(this).serializeArray(), function (a, b) {
                    return c[b.name] = b.value
                });
                c.ws_logon_email === "" ? alert("email cant be blank.") : $.post(a, c, function (a) {
                    d.hide();
                    return $("#ws-forgot-logon-password-confirmation").html(a.message).show()
                }, "json").error(function () {
					d.hide();
					 return $("#ws-forgot-logon-password-confirmation").html('<h3>'+c.ws_logon_email+' will receive an email with a new password.</h3>').show()
                   
                });
                return !1
            })
        };
        return a
    }();
    j = function () {
        function a() {
            e = $("#ws-section-signature-products");
            c = $("#ws-section-signature-products ul").length;
            f.log(c);
            e.next("active-wsp-group").length === 0 && e.find("ul:first").css("display", "block")
        }
        var b, d, c, e, g, h;
        b = 0;
        e = d = null;
        h = c = 0;
        g = 1;
        a.prototype.cycle = function () {
            b++;
            f.log(b);
            e.find(".inactive-wsp-group").hide();
            e.find(".active-wsp-group").removeClass("active-wsp-group").addClass("inactive-wsp-group").fadeIn("slow").next("ul").addClass("active-wsp-group");
            if (b >= c) return h >= g && g !== "loop" ? (a.prototype.stop(d), e.find("ul:last").hide(), e.find("ul:first").fadeIn("slow")) : (h++, e.find("ul:first").addClass("active-wsp-group")), b = 0
        };
        a.prototype.revolutions = function (a) {
            return g = a
        };
        a.prototype.display = function (a) {
            a == null && (a = 1E4);
            return d = setInterval(this.cycle, a)
        };
        a.prototype.stop = function () {
            clearInterval(d);
            return e.find("ul:first").fadeIn("slow")
        };
        return a
    }();
    $(document).ready(function () {
        return new i
    })
}).call(this);
