

function paddCarouselInit(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();
		}
	);
}

function paddToggle(classname,value) {
	jQuery(classname).focus(function() {
		if (value == jQuery(classname).val()) {
			jQuery(this).val('');
		}
	});
	jQuery(classname).blur(function() {
		if ('' == jQuery(classname).val()) {
			jQuery(this).val(value);
		}
	});
}

function paddAppendSpans(box) {
	jQuery(box + ' ul li a').wrapInner('<span></span>')
}

function padd_sidebartabs_init() {
	if (!jQuery("#sidebar-tabs").length) {
		return;
	} else {
		jQuery("#sidebar-tabs").tabs({ cookie: { expires: 30 } });
	}
}

jQuery(document).ready(function() {
	jQuery.noConflict();

	jQuery('div#padd-mainmenu ul').supersubs({
		minWidth: 12,
		maxWidth: 27,
		extraWidth: 1 
	}).superfish({
		hoverClass: 'hover'
	}); 

	paddToggle('input#s','Zoek op de site');

	jQuery('div.search form').click(function () {
		jQuery('input#s').focus();
	});
	
	jQuery('ul#carousel').jcarousel({
		auto: 9,
		animation: 0,
		wrap: 'last',
		initCallback: paddCarouselInit,
		itemVisibleInCallback: {
			onBeforeAnimation: function (a,b,c,d) {
				jQuery(b).css('opacity','0');
			},
			onAfterAnimation: function (a,b,c,d) {
				mod = c%3;
				mod = (mod == 0) ? 3 : mod;
				jQuery(b).animate({opacity: 0},1000*mod).animate({opacity: 1},500).animate({opacity: 1},4000).animate({opacity: 0},500);
			}
		},
		itemVisibleOutCallback: {
			onBeforeAnimation: function (a,b,c,d) {
				
			},
			onAfterAnimation: function (a,b,c,d) {
			
			}
		}
	});

	paddToggle('input#comment-author','Naam');
	paddToggle('input#comment-email','Email');
	paddToggle('input#comment-url','Website');
	paddToggle('textarea#comment-comment','Reactie');
	
	padd_sidebartabs_init();

});

