carouselInterval=null;
$(document).ready(function(){
    $(".carousel-wrapper").each(function(){var d=this;var b=$("ul.carousel li",d).size();$("ul.carousel-navigation li:first").addClass("active");$("ul.carousel-navigation li",d).each(function(g){var f=$(this).html();$(this).html('<span class="background"></span><a class="'+parseInt(g+1)+'" href="javascript:;"><span>'+f+"</span></a>")});$("ul.carousel",d).data("position",1);var e=window.setInterval(function(){incrementCarousel(d)},5000);$(this).data("timer",e)});
    $(".carousel-navigation li a").click(function(){var b=$(this).parents(".carousel-wrapper");var d=b.data("timer");clearInterval(d);var d=window.setInterval(function(){incrementCarousel(b)},5000);b.data("timer",d);$("ul.carousel",b).data("position",$(this).attr("class"));updateCarousel(b)})});
function incrementCarousel(e){var d=parseInt($("ul.carousel",e).data("position"));var b=parseInt($("ul.carousel li",e).length);d++;if(d>b){d=1}$("ul.carousel",e).data("position",d);updateCarousel(e)}
function updateCarousel(e){
    var b=parseInt($("ul.carousel",e).data("position"))-1;
    $("ul.carousel-navigation > li",e).removeClass("active");
    $("ul.carousel-navigation > li",e).eq(b).addClass("active");
    var d=b*-1*parseInt($("ul.carousel li:first",e).css("width"));
    $("ul.carousel",e).animate({"opacity": "toggle"}, 500, 'linear', function() {
        $("ul.carousel",e).css('left', d+"px");
        $("ul.carousel",e).animate({"opacity": "toggle"},500);
    });
}

