$(function(){
	var c_f = 0;
	//var c_l = $(".teaser-items").children("li").length;
	var c_l = 3;
	var s_t_i = 3000;
	var timeout;
	var t_c_f =0;
	var top =-1;
	/*
	$(".teaser-header").children("ol").children("li").children("a").click(function(){
	t_c_f = $(".teaser-header").children("ol").children("li").index($(this).parent());
		stop();
		change(t_c_f);

		if(t_c_f == c_l-1){
			t_c_f = 0 ;
		}else{
			t_c_f ++;
		}
	});
	*/
	play();
	function stop(){
		clearTimeout(timeout);
	}
	
	function play(){
		clearTimeout(timeout);
		change(t_c_f);
		t_c_f = c_f + 1;
		if(t_c_f >= c_l){
			t_c_f = 0;
		}
		timeout = setTimeout(play,s_t_i);
	}

	function change(t_c_f){
		
		if(t_c_f == 0 && c_f == 0){
		
		}else{
			$(".teaser-items").children("li").eq(c_f).fadeOut();
			$(".teaser-items").children("li").eq(t_c_f).fadeIn();
		}
		/*
		$(".teaser-header").children("ol").children("li").removeClass("selected");
		$(".teaser-header").children("ol").children("li").eq(t_c_f).addClass("selected");
		*/
		if(t_c_f >= c_l){
			top = -1;
		}else{
			top = -1-(30*t_c_f)-t_c_f;
		}
		//$(".teaser-header li").css({top:top+"px"});
		
		c_f = t_c_f;
	}

});

