var carouselClicked = !1, activeBtnNumber = 0;
$(document).ready(function() {
    function e(a, b) {
        var c = b, c = c == a.size() ? 0 : b;
        $("#pnlNav").children("li").each(function() {
            var a = $(this);
            a.attr("id") == "slideNav_" + parseInt(c) ? a.find("img").attr("src", "images/btn_pnl_nav_active.png") : a.find("img").attr("src", "images/btn_pnl_nav_inactive.png")
        });
        $("#pnlBins").children("li").each(function() {
            $(this).attr("id") == "pnlBin_0" + parseInt(c) ? $(this).find(".arrow").addClass("active") : $(this).find(".arrow").removeClass("active")
        })
    }
    function f() {
        d == 1 && ($("#bd_pp").fadeOut(600), $("#pp").fadeOut(600), d = 0)
    }
    $.swapImage(".swapImage");
    $("#pnlCarousel").jcarousel({ animation: 1200, auto: 8, easing: "easeInOutCubic", initCallback: function(a) {
        $("#pnlNav a").bind("click", function() {
            var b = $(this).attr("rel"), c = parseInt(b) - 1;
            carouselClicked = !0;
            a.startAuto(0);
            e(a, c);
            a.scroll($.jcarousel.intval(b));
            return !1
        });
        a.clip.hover(function() {
            a.stopAuto()
        }, function() {
            a.startAuto()
        })
    }, itemVisibleOutCallback: { onAfterAnimation: function(a, b, c) {
        c == 4 && a.startAuto(0);
        a.size();
        carouselClicked == !1 && (activeBtnNumber == a.size() && (activeBtnNumber = 0), activeBtnNumber++, e(a, activeBtnNumber))
    } 
    }, scroll: 1, wrap: "last"
    });
    $("#cemBtn").click(function() {
        var a = $("#subPgs").height(), b = $("#subPgs").width();
        $("#pp").height();
        $("#pp").width();
        $("#bd_pp").css({ height: a, width: b });
        d == 0 && ($("#bd_pp").css({ opacity: "0.95" }), $("#bd_pp").fadeIn(600), $("#pp").fadeIn(600), d = 1)
    });
    $("#popupContactClose").click(function() {
        f()
    });
    $(document).keypress(function(a) {
        a.keyCode == 27 && d == 1 && f()
    });
    var d = 0;
    $(".chart img").each(function() {
        $(this).fadeTo(0, 0.7)
    });
    $(".chart img").mouseenter(function() {
        $(this).hasClass("active") || $(this).stop().fadeTo(300, 1)
    }).mouseleave(function() {
        $(this).hasClass("active") || $(this).stop().fadeTo(300, 0.7)
    });
    $(".chart a").click(function() {
        var a = $(this).find("img").attr("id");
        $(".chart a").each(function() {
            var b = $(this).find("img"), c = b.attr("id");
            c == a ? (b.addClass("active"), b.attr("src", "../images/" + c + "_lrg.png"), b.stop().fadeTo(0, 1)) : (b.attr("src", "../images/" + c + "_up.png"), b.removeClass("active"), b.stop().fadeTo(0, 0.7))
        });
        $(".info li").each(function() {
            $(this).attr("id") == a + "_list" ? $(this).show(300) : $(this).hide()
        })
    })
});
