jQuery(function($) {

    // HOW IT WORKS
    /////////////////////////////
    var pos = 0,
        width = 0,
        $text = $(".inner-scroll p");
    
    $text.each(function() {
        width += $(this).outerWidth();
    });

    $text.parent().width(width);

	var $howitworks = $("#how-it-works").marquee({ state: ".slide-control", display: ".slide-images img" })
        .bind("change", function(evt, index) {
            $text.parent().animate({ left: -1*(index*$text.outerWidth()) +"px" });
        });


    // DID YOU KNOW
    /////////////////////////////
    var $didyouknow = $("#did-you-know"),
        $slides = $didyouknow.find(".slide").show();

    var innerWidth = $slides.width()*$slides.length;
    $slides.width($slides.width())
        .parent().width(innerWidth);

    $didyouknow.marquee({ right: ".next", left: ".prev", display: ".inner-wrap div", speed: 6000,
        change: function(evt, index) {
            $slides.parent().animate({ left: -1*(index*$slides.width()) +"px" });
        }
    });
    //    $slides = $didyouknow.find(".slide").show();


    /*
    var index = 0;
    $didyouknow.find(".next").bind("click", function() {
        index = (index+1) % $slides.length;
        $slides.parent().stop().animate({ left: -1*(index*$slides.width()) +"px" });
    });
    $didyouknow.find(".prev").bind("click", function() {
        index = (index-1) % $slides.length;
        $slides.parent().stop().animate({ left: -1*(index*$slides.width()) +"px" });
    });
    */
    
});

