		// Credits: Robert Penners easing equations (http://www.robertpenner.com/easing/).
		$.easing['BackEaseOut'] = function(p, t, b, c, d, s) {
			if (s == undefined) s = 1.3 /*1.70158*/;
			return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
		}		
		function mycarousel_initCallback(carousel) {
				// Pause autoscrolling if the user moves with the cursor over the clip.
				carousel.clip.hover(function() {
						carousel.stopAuto();
				}, function() {
						carousel.startAuto();
				});
				// Assign functionality to the controls.
				$('.jc-control li').bind('click', function() {
						carousel.scroll($.jcarousel.intval( $(this).children('span').text() ));
						$(this).addClass("attivo");
						$(this).siblings().removeClass("attivo");
						carousel.startAuto(0);
						return false;
				});
		};
		
		function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt) {
			var lis = $('.jc-control').children();
			for (var x=1; x<=lis.length; x++) {				
				if ( x == i ) $(lis[x-1]).addClass("attivo");				
			}
		};

		function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt) {
			var lis = $('.jc-control').children();
			for (var x=1; x<=lis.length; x++) {				
				if ( x == i ) $(lis[x-1]).removeClass("attivo");				
			}
		};
		
		$(document).ready(function() {
			
			$('input[type="text"]').addClass("idleField");
			$('input[type="text"]').focus(function() {
				$(this).removeClass("idleField").addClass("focusField");
				if (this.value == this.defaultValue) this.value = '';
				if(this.value != this.defaultValue)	this.select();
			});
			$('input[type="text"]').blur(function() {
				$(this).removeClass("focusField").addClass("idleField");
				if ($.trim(this.value) == '')	this.value = (this.defaultValue ? this.defaultValue : '');
			});
			
			$('#mycarousel').jcarousel({
        vertical: true,
				scroll: 1,
				easing: 'BackEaseOut',
        animation: 1000,
				/*auto: 4,*/
				wrap: 'last',
				initCallback: mycarousel_initCallback,
				itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onBeforeAnimation: mycarousel_itemVisibleOutCallback},
				// This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
			});
			
			$('#partners').jcarousel({
        scroll: 1,
				easing: 'BackEaseOut',
        animation: 1000,
				auto: 3,
				wrap: 'last',
				initCallback: mycarousel_initCallback
			});
			
		});
