if(typeof(jQuery) != 'undefined'){
	$ = jQuery;
	
	$(document).ready(function(){
		$('.slideshowlink').remove();
		
		$('.ngg-galleryoverview').jcarousel({
	        auto: 3,
	        wrap: 'circular',
	        visible: 4,
	        animation: 'slow',
	        scroll: 1,
	        initCallback: mycarousel_initCallback
	    });
	    
	    $('.comments-link').click(function(){
	    	$(this).next('div').fadeToggle('slow');
	    	
	    	return false;
	    });
	});
	
	function dump(obj) {
	    var out = '';
	    for (var i in obj) {
	        out += i + ": " + obj[i] + "\n";
	    }
		
	    alert(out);
		
	    // or, if you wanted to avoid alerts...
	
	    var pre = document.createElement('pre');
	    pre.innerHTML = out;
	    document.body.appendChild(pre)
	}
	
	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.fadeToggle = function(speed, easing, callback) {
	    return this.animate({opacity: 'toggle'}, speed, easing, callback);
	};
}

