$(window).load(
  function() {
    $("#imagelist .jCarouselLite").jCarouselLite("auto", {
      easing: "linear",
      visible: 3,
      auto: 1,
      autoLayout: false,
      start: 0,
      speedPxps: 50,
      startDelay: 0,
      scroll: 1
    });
  }
);

$(document).ready(
  function() {
    $('#navegacao #navegalinksanterior')
    .click(
      function() {
        return false;
      }
    ).mousedown(
      function() {
        $('#imagelist .jCarouselLite').jCarouselLite("options", {afterEnd: null, scroll: -1, speedPxps: 200});
        return false;
      }
    ).mouseup(
      function() {
        $('#imagelist .jCarouselLite').jCarouselLite("options", {afterEnd: null, scroll: -1, speedPxps: 100});
        return false;
      }
    ).hover(
      function() {
        $('#imagelist .jCarouselLite').jCarouselLite("options", {afterEnd: null, scroll: -1, speedPxps: 100});
      },
      function() {
        $('#imagelist .jCarouselLite').jCarouselLite("options", {afterEnd: null, scroll: -1, speedPxps: 50});
      }
    );
    $('#navegacao #navegalinksproxima')
    .click(
      function() {
        return false;
      }
    ).mousedown(
      function() {
        $('#imagelist .jCarouselLite').jCarouselLite("options", {afterEnd: null, scroll: 1, speedPxps: 200});
        return false;
      }
    ).mouseup(
      function() {
        $('#imagelist .jCarouselLite').jCarouselLite("options", {afterEnd: null, scroll: 1, speedPxps: 100});
        return false;
      }
    ).hover(
      function() {
        $('#imagelist .jCarouselLite').jCarouselLite("options", {afterEnd: null, scroll: 1, speedPxps: 100});
      },
      function() {
        $('#imagelist .jCarouselLite').jCarouselLite("options", {afterEnd: null, scroll: 1, speedPxps: 50});
      }
    );
    $('#imagelist, #headernavegaimagens').hover(
      function() {
        $('#imagelist .jCarouselLite').jCarouselLite("stop", {afterEnd: null, speedPxps: 50});
      },
      function() {
        $('#imagelist .jCarouselLite').jCarouselLite("start", {afterEnd: null, speedPxps: 50});
      }
    );
    $('#navegaimagensbox, #navegaimagensbox *').focus(
      function() {
        $(this).blur();
      }
    );
    $('#navegalinks a').click(
      function() {
        var t = ($($(this).attr('href')).parents('li').prevAll('li').length);
        $('<div id="general_overlay">&nbsp;</div>').prependTo('#navegacao').css('opacity', '0.01').show();
        $('#imagelist .jCarouselLite').jCarouselLite("goto", {absolutetarget: t, speedPxps: 20000, afterEnd: function(elem, vis) {$(this).parent().jCarouselLite("options", {speedPxps: 50, afterEnd: null});$('#general_overlay').hide().remove();}});
        return false;
      }
    );
  }
);
