var slide = function() {
   var $started,
       $stoped;
   return {
	    $started : function(){  $started = setInterval("Tg_Slide()", 6000 /* slide durration miliseconds */); },  
        $stoped : function(){
		   clearInterval($started);
		}
   }
}();

slide.$started();

Tg_Slide();
//function for each click on li
$(document).ready(function(){
var $toStop;
$("ul.bund li").click(function(){
		    clearTimeout($toStop);
			    slide.$stoped(); // stops slideshow because user selected a bullet navigation
			    $toStop = setTimeout(function(){ slide.$started(); }, 4000); // continue  slideshow after 4 seconds
            tg_Change($(this));
			return false;
			
	});
});	

//this is slide_show function 
function Tg_Slide(){
			var $active = $('.bund li.active');
			if ($active.length == 0) $active = $('.bund li:last') ;
			var $next =  $active.next("li").length ? $active.next("li")
			: $('.bund li:first');   
			$active.removeClass("active");
		    tg_Change($next);
}
//this changes slide content/text
function tg_Change($element){
		$(".bund li.active").removeClass("active");
		$element.addClass('active');
		$(".feat-text").find('.esi').slideUp("fast").delay(300);
		$element.find(".esi").clone().appendTo(".feat-text").slideDown(1200, re_img($element));
		

}
//this for change the image
function re_img($element){
	var src = $element.find("img").attr('src');
	$(".featured-img img").hide().delay(50);
	$(".featured-img img").attr('src', src).fadeIn(1000);

	
}



