$(document).ready(function(){
	$.fn.easySlider;
	var count = 2;
	fadeInOutAuto();
	auto: true;

$("#autoplay").click(function(){
	fadeInOutAuto();
	$("#autoplay").hide("fast");
	$("#autostop").show("fast");
});

$("#autostop").click(function(){
	clearTimeout(auto);
	$("#autoplay").show("fast");
	$("#autostop").hide("fast");
});

function fadeInOutAuto(){	
		if(count == 6) {
			count = 1; endCount = 6; 
			}
			else{
				endCount = count;
			}
	titleNameSecond = "#slider"+count;
	for(i=1;i<=5;i++){
	titleNameFirst = "slider"+(i);
	document.getElementById(titleNameFirst).style.display = 'none';
	document.getElementById('img'+i).src = 'wp-content/themes/technovated/images/carausal_btn_deactive.gif';
	document.getElementById('project').innerHTML = $('#slider'+count+'-image').attr("title");
	}
	url();
	$(titleNameSecond).fadeIn('slow');	
	document.getElementById('img'+count).src = 'wp-content/themes/technovated/images/carausal_btn_active.gif';
	count = count+1;	
	auto = setTimeout(function () { fadeInOutAuto()}, 3000);	
}

function url(){
	document.getElementById('project').href = "";
	document.getElementById('project').href = "/what-weve-done/#" + $('#slider'+count+'-image').attr("alt");
}	

$("#list1").click(function(){
	clearTimeout(auto);					   
	CallfadeInOutAuto(1);
});
$("#list2").click(function(){
	clearTimeout(auto);					   
	CallfadeInOutAuto(2);
});
$("#list3").click(function(){
	clearTimeout(auto);					   
	CallfadeInOutAuto(3);
});
$("#list4").click(function(){
	clearTimeout(auto);					   
	CallfadeInOutAuto(4);
});
$("#list5").click(function(){
	clearTimeout(auto);					   
	CallfadeInOutAuto(5);
});

function CallfadeInOutAuto(show){
	if(count == 6) { 
		count = 1;
		endCount = 6; 
		}
		else{
			endCount = count;
		}
	titleNameSecond = "#slider"+show;
	count = show;
	for(i=1;i<=5;i++){
		titleNameFirst = "slider"+(i);
		document.getElementById('list'+i).className='';
		document.getElementById(titleNameFirst).style.display = 'none';
		document.getElementById('img'+i).src = 'wp-content/themes/technovated/images/carausal_btn_deactive.gif';
		document.getElementById('project').innerHTML = $('#slider'+count+'-image').attr("title");
	}
	url();
	$(titleNameSecond).fadeIn('slow');
	document.getElementById('img'+show).src = 'wp-content/themes/technovated/images/carausal_btn_active.gif';
}
});

