(function($){
	$(function() {
		$("div.slideshow").each(function() {
			var $this = $(this),
			pagination = $this.find("ul.pagination li"),
			opts = {
				btnGo: pagination
			},
			interval = setInterval(function() {
				var next = pagination.filter(".active").next();
				if (!next.length) {
					next = pagination.first();
				}
				next.trigger("click", false);
			}, 5000);
			
			pagination.click(function(e, stopInterval) {
				var li = $(this);
				pagination.removeClass("active");
				li.addClass("active");
				if (stopInterval !== false) {
					clearInterval(interval);
				}
			});
			
			$this.find("div.carousel").jCarouselLite(opts);
		});
		$("div.videoCarousel div.carousel").jCarouselLite({
			btnNext: ".next",
			btnPrev: ".prev",
			circular: true,
			visible: 6
		});
		$("div.videoCarousel img").hover(
			function() {
				$(this).addClass('hover');
				var videoThumb = $(this).parent().ParseClass(true).videoTitle;
				$("span.hoverLabel").text(videoThumb);
			},
			function() {
				$(this).removeClass('hover');
			}
		);

		if ($("div.homePromos div.carousel ul li").length > 4) {
			$("div.homePromos div.carousel").jCarouselLite({
				btnNext: ".next",
				btnPrev: ".prev",
				circular: true,
				visible: 4
			});
		} else {
			$("div.homePromos span.prev").hide();
			$("div.homePromos span.next").hide();
		}

	});
})(jQuery);
