  
var hilightInterval;

function initHilightInterval(){
	hilightInterval = setInterval('hilightSlide("next")', 4000);
}

function hilightSlide(type)
{
	//if no IMGs have the show class, grab the first image  
    var current = $('.hilight p a.show');
    current.animate({opacity: 0.0}, 1000)  
    current.removeClass('show');
	current.css('z-index','0');
  	if(type == 'next'){
  		//Get next image, if it reached the end of the slideshow, rotate it back to the first image  
	    var next = ((current.next().length != 0) ? current.next() : $('.hilight p a:first'));
	    next.animate({opacity: 1.0}, 1000);
	    next.addClass('show');
		next.css('z-index','1');
  	}else{
  		var next = ((current.prev().length != 0) ? current.prev() : $('.hilight p a:last'));
	    next.animate({opacity: 1.0}, 1000);
	    next.addClass('show');
		next.css('z-index','1');
  	}
}

$(function() {
	$('.hilight p').css('background', 'none');
	$('.hilight p a').css('opacity', '0.0');
	$('.hilight p a').css('display', 'block');
	$('.hilight p a').css('z-index', '0');
	
	var first = $('.hilight p a:first');
    first.animate({opacity: 1.0}, 1000)  
    first.addClass('show');
	first.css('z-index','1');
    
    //initHilightInterval()
    
    $('.hilight .prev').click(function(e){
    	e.preventDefault(); //Cancel the link behavior
    	hilightSlide('prev');
    	//clearInterval(hilightInterval);
    	//initHilightInterval()
    });
    $('.hilight .next').click(function(e){
    	e.preventDefault(); //Cancel the link behavior
    	hilightSlide('next');
    	//clearInterval(hilightInterval);
    	//initHilightInterval()
    });
});
  



