showSliderPreview = function(img) {
   if (img.attr("is_show") != "yes") {
       img.attr("src", img.attr("preview"));
       img.attr("is_show", "yes");
   }
}

$(document).ready(function(){

  $(".slider_image").slice(0, 5).each( function() { 
      showSliderPreview($(this));
  });

  $(function() {
    $(".slider_main").jCarouselLite({
        btnNext: ".slider_next",
        btnPrev: ".slider_prev",
        visible: 5,
        scroll: 1,
        circular: false,
        afterEnd: function(a) {
           for( var i = 0; i < a.length; i++ ) {
              img = $(a[i]).find("img:first");
              showSliderPreview(img);
           }
        }
    });
  });

 $('.slider_image').hover(
  function () {
    $(this).fadeTo('fast', 0.5);
  },
  function () {
    $(this).fadeTo('fast', 1.0);
  }
);

});


