﻿$(document).ready(function () {
	$("#ctaFeaturesPanel li:first").addClass("active"); var imageWidth = $("#ctaItemsWrapper").width(); var imageSum = $("#ctaItems>li").size(); var imageReelWidth = imageWidth * imageSum; var controlWidth = $("#ctaFeaturesPanel").width() / imageSum; $("#ctaItems").css({ 'width': imageReelWidth }); rotate = function () { var triggerID = $active.attr("id") - 1; var image_reelPosition = triggerID * imageWidth; $("#ctaFeaturesPanel li").removeClass('active'); $active.addClass('active'); $("#ctaItems").animate({ left: -image_reelPosition }, 350); $("img#ctaFeaturesIndicator").animate({ left: triggerID * controlWidth }, 350); }; rotateSwitch = function () {
		play = setInterval(function () {
			$active = $('#ctaFeaturesPanel li.active').next(); if ($active.length === 0) { $active = $('#ctaFeaturesPanel li:first'); }
			rotate();
		}, 8000);
	}; rotateSwitch(); $("#ctaFeaturesPanel li").hover(function () { $active = $(this); clearInterval(play); rotate(); }, function () { clearInterval(play); rotateSwitch(); }); $("#ctaItemsWrapper").hover(function () { clearInterval(play); }, function () { clearInterval(play); rotateSwitch(); });
});
