	(function($) {
		$.fn.ticker = function(options) {

			var settings = {
				delay: 3800,
				speed: 400,
				repeat: false,
				callback: false
			}

			var t = 0;

			tick = function(id) {
				speed = settings.speed;

				ele = $('#' + id).get();
				child = $(ele).children().eq(0).get();

				temp = document.createElement('span');
				temp.innerHTML = $(child).html();

				document.body.appendChild(temp);
				innerWidth = $(temp).width();
				$(temp).remove();

				$(ele).css({
					height: $(ele).height()
				});

				$(child).css({
					width: innerWidth,
					left: $(ele).outerWidth(),
					position: 'absolute',
				});


				$(child)
					.animate({
						left: ($(ele).outerWidth() / 2) - ($(child).outerWidth() / 2)
					})
					.delay(settings.delay)
					.animate({
						left: '-' + ($(child).outerWidth())	
					}, {
						complete: function() {
							if (settings.callback) {
								settings.callback.call(child, ++t);
							}
							if (settings.repeat) {
								if ($(child).hasClass('stopRepeat')) {
									settings.repeat = false;
								} else {

									setTimeout(function() {
										tick(id);
									}, 500);
								}
							}
						}
					});		

			}
			return $(this).each(function() {

				if (options) {
					$.extend(settings, options)
				}
				ele = this;
				ticker = document.createElement('div');
				ticker.id = 'ticker-' + Math.floor(Math.random() * 10000);
				$(ticker).css({
					position: 'relative',
					overflow: 'hidden',
				});
				$(this).after(ticker);
				$(this).appendTo(ticker);

				tick(ticker.id);
			});
		}
	})(jQuery);
	$(document).ready(function() {
		messages = new Array("Welcome to the new-look Windfyre! Connect to irc.windfyre.net to chat!", "Play IdleRPG, the silent competition in #idle", "Free chatrooms for your website!", "Listen to live radio at star107media.com!", "Play a 24/7 UNO game in #247uno!"); // Put your messages in here, each on in a new entry
		count = messages.length; // Length of the messages array
		curr = 1; // Index of the current message. 1 because the first message is added manually

		$('span').text(messages[0]).ticker({
			repeat: true,
			callback: function(tick) {
				// tick is the amount of times it has scrolled already. Without repeat: true will always be 1

				if (curr == count) {
					curr = 0; // Reset if it gets to the end
				}

				$(this).text(messages[curr++]);
			}
		})
	});
