// jScrollPane
jQuery(document).ready(function() {
	// Generate the scrollpane on page load.
	if(document.getElementById("player_scrollbar")){
		$("#player_scrollbar").jScrollPane();
		
		// Then resize the scrollpane if necessary.
		$(document).mouseup(function(){
			$("#player_scrollbar").jScrollPane();
		});
	
	}
});

// jCarousel
jQuery(document).ready(function() {
	// Only activate the carousel if it's required (hide the navigation arrows otherwise).
	if(document.getElementById("carousel_items")){
		if(document.getElementById("carousel_items").value > 4){
			if(document.getElementById("player_wrapper")){
			    jQuery('#mycarousel').jcarousel({
			        'scroll':		2
			    });			
			}else{
			    jQuery('#mycarousel').jcarousel({
			        'scroll':		4
			    });			
			}
		}
	}
});