﻿$(function () {
	$('#slides').slides({
		preload: true,
		preloadImage: 'img/loading.gif',
		play: 5000,
		pause: 2500,
		hoverPause: true,
		next: 'prev',
		prev: 'next',
		paginationClass: 'slide-pagination',
		slideEasing: 'easeInOutQuint',
		animationStart: function (current) {
			$('.caption').animate({
				bottom: -35
			}, 100);
			if (window.console && console.log) {
				// example return of current slide number
				console.log('animationStart on slide: ', current);
			};
		},
		animationComplete: function (current) {
			$('.caption').animate({
				bottom: 0
			}, 200);
			if (window.console && console.log) {
				// example return of current slide number
				console.log('animationComplete on slide: ', current);
			};
		},
		slidesLoaded: function () {
			$('.caption').animate({
				bottom: 0
			}, 200);
		}
	});



	//Default Action
	$(".Paneltab_content").hide(); //Hide all content
	$("div.showTabs a:first").addClass("active").show(); //Activate first tab
	$(".Paneltab_content:first").show(); //Show first tab content
	var PanelSelectedTab = 1;
	var PanelInterval = setInterval(PanelTimer, 3000);


	//On Click Event
	$("div.showTabs a").click(function () {
		PanelSelectedTab = parseInt($(this).html());
		//var CategoryTitle = NewsCatNames[PanelSelectedTab - 1];
		//$("#NewsCatTitle").html(CategoryTitle);
		$("div.showTabs a").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".Paneltab_content").hide(); //Hide all tab content
		var activeTab = $(this).attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content

		if (PanelSelectedTab == $("div.showTabs a").length) {
			PanelSelectedTab = 1;
		} else {
			PanelSelectedTab = PanelSelectedTab + 1;
		}
		return false;
	});

	function PanelTimer() {
		$("#tabNumber" + PanelSelectedTab).click();
	}

	$(".Paneltab_content").mouseenter(function () {
		clearInterval(PanelInterval);
	});
	$(".Paneltab_content").mouseleave(function () {
		clearInterval(PanelInterval);
		PanelInterval = setInterval(PanelTimer, 3000);
	});



	$(".Showcasetab_content").hide();
	$("div.tabsShowcase a:first").addClass("active").show();
	$(".Showcasetab_content:first").show();
	$("div.tabsShowcase a").click(function () {
		$("div.tabsShowcase a").removeClass("active");
		$(this).addClass("active");
		$(".Showcasetab_content").hide();
		var activeTab = $(this).attr("href");
		$(activeTab).fadeIn();
		return false;
	});

	$('.slide-image').jCarouselLite({
		btnNext: '.image-gallery #btn-right',
		btnPrev: '.image-gallery #btn-left',
		speed: 800,
		visible: 4,
		scroll: 4,
		easing: 'easeOutBack',
		direction: 'rtl'
	});

	$('.slide-ads').jCarouselLite({
		btnNext: '.ads-case #btn-right',
		btnPrev: '.ads-case #btn-left',
		visible: 1,
		speed: 800,
		auto: 3000,
		scroll: 1,
		easing: 'easeOutQuint',
		direction: 'rtl'
	});


});


