$(window).load(function() {
	/*
	 * call this function on a scrollable node to add some more clones on the right side of the carousel
	 * as the jQuery Tools Scrollable plugin is build to just show one item on screen at once (not
	 * multiple small elements). This function fills up the empty space right to the carousel with dummy
	 * nodes
	 * @param int addItems [OPTIONAL] define the number of clone items to aditionally add to the wrapper
	 * @return void
	 */
	$.fn.scrollableAddClones = function(addItems) {
	  // grab scrollable plugin
	  var scrollable;
	  if (!(scrollable = $(this).data('scrollable')) || !scrollable.getConf().circular)
		 return;
	  // grab scrollable elements and remember it's count
	  var nodes = scrollable.getItems();
	  var length = nodes.length;
	  // grab class for the nodes
	  var clonedClass = scrollable.getConf().clonedClass;
	  // get wrap object to append the clones to
	  var wrap = scrollable.getItemWrap();
	  // fill as much nodes as needed for 500 pixels
	  if (!addItems) addItems = Math.ceil(500 / nodes.eq(1).width());
	  // create fake container to add the clones to (max 15 clones)
	  var newNodesAppend = $('<span />');
	  for (var i = 1; i <= (addItems < 15 ? addItems : 15); i++)
		 nodes.eq(i % length).clone().addClass(clonedClass).appendTo(newNodesAppend);
	  // insert HTML
	  newNodesAppend.children().appendTo(wrap);
	}
	$('#slideshow').nivoSlider({
		effect:'sliceUpDownLeft', //Specify sets like: 'fold,fade,sliceDown'
		slices:15,
		animSpeed:500, //Slide transition speed
		pauseTime:5000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:true, //Next & Prev
		directionNavHide:true, //Only show on hover
		controlNav:false, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
		controlNavThumbsFromRel:false, //Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});
	jQuery('#mycarousel').jcarousel({
    		wrap: 'circular',
			scroll: 3,
			auto: 5,
			animation: 'slow',
			easing: 'swing'
    	});
	$(".scrollable").scrollable({circular: true},{speed:800}).autoscroll({ autoplay: true },{steps:4},{interval:2800});
	$(".scrollable").scrollableAddClones();

});

