jQuery(function($) {
	var opts = {
		el: '#twitter-feed',
		items: new Array(),
		count: 0,
		total: -1,
		delay: 6000,
		animate: true
	};

	$(opts.el+' p').each(function(i) {
		opts.items[i] = $(this).html();
		opts.total++;
	}).hide();

	runTweeter();

	function runTweeter() {
		if(opts.animate == true) {
			if($(opts.el+' p').length > 0) {
				$(opts.el).children('p').fadeOut(500, function() {
					$(this).parent(0).empty().append('<p style="display: none;">'+opts.items[opts.count]+'</p>').children('p').fadeIn(500);
				});
			} else {
				$(opts.el).empty().append('<p style="display: none;">'+opts.items[opts.count]+'</p>').children('p').fadeIn(750);
			}
		} else {
			$(opts.el).empty().append('<p>'+opts.items[opts.count]+'</p>');
		}
		setTimeout(function() {
			if(opts.count == opts.total) {
				opts.count = 0;
			} else {
				opts.count++;
			}
			runTweeter();
		}, opts.delay);
	}
});
