//<![CDATA[
$("div#capabilitiesText div.message:first").css('display', 'inline');
            
var ele   = $('#capabilitiesMessage');
var speed = 25, scroll = 25, scrolling;
var theHeight = $(ele).height();


$('#upArrow').click(function() {
    // Scroll the element up
    /*scrolling = window.setInterval(function() {
        ele.scrollTop( ele.scrollTop() - scroll );
    }, speed);
    */
    $(ele).animate({scrollTop: (ele.scrollTop() - theHeight)}, 'slow');
});

$('#downArrow').click(function() {
    // Scroll the element down
    //alert(ele.scrollTop());
    /*
    scrolling = window.setInterval(function() {
        ele.scrollTop( ele.scrollTop() + scroll );
    }, speed);
    */

    $(ele).animate({scrollTop: (ele.scrollTop() + theHeight)}, 'slow');    

});

$('#upArrow, #downArrow').bind({
    click: function(e) {
        // Prevent the default click action
        e.preventDefault();
    },
    mouseleave: function() {
        if (scrolling) {
            window.clearInterval(scrolling);
            scrolling = false;
        }
    }
});

$("div#capabilities div.item").mouseover(function() {
    $(this).addClass('over');
});
$("div#capabilities div.item").mouseout(function() {
    $(this).removeClass('over');
});

$("div#capabilities div.item").click(function() {
    var itemClicked = $('#'+$(this).attr("id"));
    var numberClicked = $("div#itemWrapper div.item").index(itemClicked) + 1;

    $("div#capabilitiesText div.message").css('display', 'none');
    $("div#capabilitiesText div#capabilitiesMessage" + numberClicked).fadeIn(750);

    $("div#capabilities div.item").removeClass('active');
    $(this).addClass('active');
});
//]]>
