var timerObj;

var time1 = 5000;

var time2 = 15000;

$(document).ready(function() {
   
   $('.choices a').click(function() {
       
       var id = ($(this).parent('li').attr('id').replace('news_', ''));
       
       showNews(id, time2);
       
   });
   
   $('.choices a').dblclick(function() {
       
       var id = ($(this).parent('li').attr('id').replace('news_', ''));
       
       showNews(id, false);
       
   });
    
   timerObj = setTimeout("showNews(1, time1)", time1);
 
});

function showNews(id, timer){
    
    clearTimeout(timerObj);
    
    $(".choices .active").removeClass('active');
       
    $('.newsWrap .news').hide();
       
    $(".choices li#news_"+id).addClass('active');
      
    $('.newsWrap #news'+id).show();
    
    var nextID = (id + 1)%3;
   
    if(timer > 0)
       timerObj = setTimeout("showNews("+nextID+", "+time1+")", timer);
    
}
