$(document).ready(function(){
	
	// Remove focus outline on all links when clicked
	$("a").focus(function(){
	  $(this).blur();
	});
	
	var current_banner = 1,
	banner_count = $('#banner_list li').size();
	var interval;
	
	
	function intfunc() {
		$('#banner_bullets li:eq('+current_banner+')').click();
	}
	
	$('#banner_bullets li').click(function() {
		clearTimeout(interval);
		
		$('#banner_bullets li').removeClass('current');
		$(this).addClass('current');
		
		bannerIndex = parseInt($(this).attr('rel').replace(/[^0-9]/g,'')) - 1;
		targetMargin = -1 * (bannerIndex * 960);
		
		console.log(bannerIndex + ' : ' + targetMargin);
		$('#banner_list').animate({
			'marginLeft': targetMargin
		},500);
		
		interval = setTimeout(intfunc,5000)
		current_banner = (current_banner+1) % banner_count;
	});	
	
	interval = setTimeout(intfunc,5000)
	
});
