/**
 * © Skinik
**/
function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};




jQuery.fn.imagesLoaded = function(callback){
  var elems = this.filter('img'),
      len   = elems.length;

  elems.bind('load',function(){
      if (--len <= 0){ callback.call(elems,this); }
  }).each(function(){
     // cached images don't fire load sometimes, so we reset src.
     if (this.complete || this.complete === undefined){
        var src = this.src;
        // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
        // data uri bypasses webkit log warning (thx doug jones)
        this.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
        this.src = src;
     }
  });

  return this;
};

jQuery(document).ready(function() {
//	jQuery('#post-2 img',this).imagesLoaded(function() { alert('images loaded!') });
//	jQuery('#post-2 img',this).imagesLoaded(function() {
		jQuery('#post-2').delay(10000).jcarousel({
			animation: 'slow', /* sliding speed */
			auto: 4, /* time for change slide */
			scroll:1, /* item for slide */
			wrap: 'circular', /* sliding method */
			initCallback: mycarousel_initCallback
		});

//	});
});

