$(function() {
    
    var curPos = 0;

    $('a.mov').hover(function() {
        $(this).stop().animate({ opacity: 0.8 }, 200, 'swing');
    }, function() {
        $(this).stop().animate({ opacity: 1.0 }, 200, 'swing');
    });

    $('#imgReelI img').css({
        opacity: 0.1
    });

    $('#img-'+curPos).css({
        opacity: 1.0
    });

    $('#movRight').click(function() {
        $('#img-'+curPos).stop().animate({
            opacity: 0.1
        }, 200, 'swing');

        curPos++;

        if ( curPos == imgs.length )
            curPos = 0;

        $('#img-'+curPos).stop().animate({
            opacity: 1.0
        }, 500, 'swing');

        var newPos = ( curPos * 572 ) + 430;

        $('#imgReelI').stop().animate({
            left: '-' + newPos + 'px'
        }, 200, 'swing');
    
        return false;
    });

    $('#movLeft').click(function() {
        $('#img-'+curPos).stop().animate({
            opacity: 0.1
        }, 200, 'swing');
        curPos--;

        if ( curPos < 0 )
            curPos = imgs.length -1 ;

        $('#img-'+curPos).stop().animate({
            opacity: 1.0
        }, 500, 'swing');

        var newPos = ( curPos * 572 ) + 430;

        $('#imgReelI').stop().animate({
            left: '-' + newPos + 'px'
        }, 200, 'swing');
    
        return false;
    });

});
