counter = 1; 

function change_active()
{
	
	//var $active = $('#slideshow DIV.active');
	if(typeof(playSlideshow) != 'undefined')
	{
		clearInterval(playSlideshow);
	}
	//alert('Here');
	$('.caption').fadeOut('slow');
	$('#feature_1,#feature_2,#feature_3,#feature_4').removeClass('active');
	$('#feature_'+counter).addClass('active');
		$('.link').each(function(index) {
		$(this).removeClass('active_block');

	});
	var $active = $('#slideshow DIV.active');
	 
	$('#slideshow DIV.active .caption').fadeIn('slow');
	$('#link_'+counter).addClass('active_block');
 
	
	counter++;
	if(counter > 4)
	{
		counter = 1;
	}
	
	switch_slide();
}

 function switch_slide(){
	 	if(typeof(playSlideshow) != 'undefined')
	{
		clearInterval(playSlideshow);
	}
	
	 playSlideshow = setInterval( "change_active()", 5000 );
	
	}

$(function() {
  
  change_active();

		// click links to move to specific slides
		var $slidelink = $(".feature_playlist a.link");
		$slidelink.click(function(){
		
		id = $(this).attr ("id");

		counter = id.substr(id.length-1); 
		change_active();
		
			
		});
  

$('#slide').hover(function() {
   clearInterval(playSlideshow);
},
function() {
	switch_slide();
	
});

$('.feature_playlist').hover(function() {
   
},
function() {
});

});
