// diapo home
function diapo(){
	current++;
	if(current==$('.slide_content .item').length) current = 0;
	showElement(current);	
	
	clearTimeout(timer);
	timer = setTimeout("diapo()",9000);	
}

function showElement(index){
	$('.slide_content .active_item').animate({opacity: 0}, 1000,function(){
		$(this).removeClass('active_item');
	})
	$('.slide_content .item').eq(index).animate({opacity: 1}, 1500,function(){
		$(this).addClass('active_item');
	})
	
	$('.navSlider li a.on').removeClass('on');
	$('.navSlider li a').eq(index).addClass('on');
}

var current = 0 ;
var timer;
$(function(){
	timer = setTimeout("diapo()",9000);	
	$('.navSlider a').click(function(){	
		var indexElem = $('.navSlider a').index($(this));
		current = indexElem;
		showElement(current);
		
		clearTimeout(timer);
		timer = setTimeout("diapo()",12000);	
		return false;
	})
})
