(function($) {
	$.fn.divshow = function(options) {
		var container = $(this),
		slides, current = 0,
		options = $.extend({
			interval : 6000,
			url : '/?callback=testimonials' 
		}, options);
		
		var ds = {
			slide: function() {
				// reset max
				if (current >= (slides.length - 1)) { // && options.loop == true
					current = 0;					
				}
				if ('title' in slides[current]) {
					var show_title = slides[current].title;
					var show_content = slides[current].content;
					container.fadeOut(function() {
						container.html('<b class="showtitle">&quot;' + show_title + '&quot;</b><br /><div class="showbox">' + show_content + '</div>').fadeIn();
					});
				}
				current++;
			},
			init: function() {
	           	$.ajax({
	           		type: 'GET',
	           		url: options.url,
	           		dataType: 'json',
	        		success: function(data) {
	           			slides = data;
	           			ds.slide();
	    				setInterval(ds.slide, options.interval);
	        		}
	        	});
				return true;
			}
		};
		return ds.init();
	}
})(jQuery);
