/*
 *
 * Copyright (c) 2006/2007 Sam Collett (http://www.texotela.co.uk)
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * Version 2.0
 * Demo: http://www.texotela.co.uk/code/jquery/newsticker/
 *
 * $LastChangedDate$
 * $Rev$
 *
 */
(function($) {
	$.fn.newsTicker = $.fn.newsticker = function(b) {
		b = b || 6000;
		initTicker = function(a) {
			stopTicker(a);
			a.items = $("li", a);
			a.items.not(":eq(0)").hide().end();
			a.currentitem = 0;
			startTicker(a)
		};
		startTicker = function(a) {
			a.tickfn = setInterval(function() {
				doTick(a)
			},
			b)
		};
		stopTicker = function(a) {
			clearInterval(a.tickfn)
		};
		pauseTicker = function(a) {
			a.pause = true
		};
		resumeTicker = function(a) {
			a.pause = false
		};
		doTick = function(a) {
			if (a.pause) return;
			a.pause = true;
			$(a.items[a.currentitem]).fadeOut("slow", function() {
				$(this).hide();
				a.currentitem = ++a.currentitem % (a.items.size());
				$(a.items[a.currentitem]).fadeIn("slow", function() {
					a.pause = false
				})
			})
		};
		this.each(function() {
			if (this.nodeName.toLowerCase() != "ul") return;
			initTicker(this)
		}).addClass("newsticker").hover(function() {
			pauseTicker(this)
		},
		function() {
			resumeTicker(this)
		});
		return this
	}
})(jQuery);

$(document).ready(function() {
	$("#secondarydestinationsa").newsTicker(6000);
	$("#secondarydestinationsb").newsTicker(6000);
	$("#secondarydestinationsc").newsTicker(6000);
	$("#secondarydestinationsd").newsTicker(6000);
	setTimeout(function () {$("#secondarydestinationsa").newsTicker(6000)}, 1000);
	setTimeout(function () {$("#secondarydestinationsb").newsTicker(6000)}, 2500);
	setTimeout(function () {$("#secondarydestinationsc").newsTicker(6000)}, 4000);
	setTimeout(function () {$("#secondarydestinationsd").newsTicker(6000)}, 5500);
});