$(document).ready(function(){

//-----------------------------------------------
	
	$('.iw_fw_ContentCarousel_AutoScroll').each(function(){
		InitTimeOut($(this));
	});

//-----------------------------------------------

	function InitTimeOut(caro){
		var time = caro.find('.AutoScroll').val();
		if(time !== 'false'){	
			var speed = caro.find('.AnimationSpeed').val();
		    time = parseInt(time) + parseInt(speed);
			return timeout(time, caro);
		}
	}

//-----------------------------------------------

	function timeout(time, caro){
		return tt = setTimeout(function(){ 
			if(caro.is('.iw_fw_ContentCarousel_AutoScroll')){
				caro.parents('.iw_fw_ContentCarousel_wrap').find('.iw_fw_ContentCarousel_next').click();
				timeout(time, caro);
			}
		}, time);
	}

//-----------------------------------------------

	$('.iw_fw_ContentCarousel_wrap').hover(function(){
		$(this).find('.iw_fw_ContentCarousel').removeClass('iw_fw_ContentCarousel_AutoScroll');
	}, function(){
		$(this).find('.iw_fw_ContentCarousel').addClass('iw_fw_ContentCarousel_AutoScroll');
		clearTimeout(tt);
		InitTimeOut($(this).find('.iw_fw_ContentCarousel_AutoScroll'));
	});
	
	/*
	$('.iw_fw_ContentCarousel_AutoScroll').hover(function(){
		$(this).removeClass('iw_fw_ContentCarousel_AutoScroll');
	}, function(){
		$(this).addClass('iw_fw_ContentCarousel_AutoScroll');
		InitTimeOut($(this));
	});
    */
    
});



