$(document).ready(function(){
	
	$(".imageSlider .jCarouselLite").jCarouselLite({
		btnNext: "#footerslider a.tnext",
		btnPrev: "#footerslider a.tprev",
		visible: 10,
		scroll: 1,
		speed: 500,
		auto: 3000
	});

	tline();
	setInterval('tline()',20000);
	
	theRotator();
	
    $(".citBlock a").hover(
      function () {
		newSelection = $(this).attr("rel");
        $(".Ibigimg").hide();
		$("#"+newSelection).show();
      }, 
      function () {
      }
    );

	
});

function tline() {
	$("#topline").animate({ opacity: "show" }, 5000).delay(10000).animate({ opacity: "hide" }, 5000);
	$("#topline .line1").animate({opacity: "show", left: "+=100"}, 5000).delay(15000).animate({opacity: "hide", left: "-=100"}, 1);
	$("#topline .line2").animate({opacity: "show", right: "+=82"}, 5000).delay(15000).animate({opacity: "hide", right: "-=82"}, 1);
}

function theRotator() {
	//Устанавливаем прозрачность всех картинок в 0
	$('div#rotator ul li').css({opacity: 0.0});
	//Берем первую картинку и показываем ее (попути включаем полную видимость)
	$('div#rotator ul li:first').css({opacity: 1.0});
	//Вызываем функцию rotator для запуска слайдшоу, 5000 = смена картинок происходит раз в 5 секунд
	setInterval('rotate()',4000);
}
 
function rotate() {	
	//Берем первую картинку
	var current = ($('div#rotator ul li.show')?  $('div#rotator ul li.show') : $('div#rotator ul li:first'));
	//Берем следующую картинку, когда дойдем до последней начинаем с начала
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rotator ul li:first') :current.next()) : $('div#rotator ul li:first'));	
	//Подключаем эффект растворения/затухания для показа картинок, css-класс show имеет больший z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);
	//Прячем текущую картинку
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
};
