 function showEntry(id){
 		$('#event-info div:visible').fadeOut(300);
 		
 		$("#event-info").animate({height: $(id).outerHeight() + 30}, 300, function(){
	      $(this).height("auto");
	      $(id).fadeIn(300);
	      $.scrollTo(0,0, {duration: 300});
	      selectDate();
	   });
 }
 
 function selectDate(){

 		var theID = "#"+$("#event-info div:visible").attr("id");
   	var newDl = null;
   		
		/*$('.main-column dl a').each(function(){
				if ($(this).attr('href') == theID) {
					newDl = $(this).parents('dl');		
				}
		});*/
		
		newDl = $('.main-column dl a[href='+theID+']').parents('dl');

 		$('.main-column dl.selected').removeClass('selected');
 		
 		$(newDl).addClass('selected');
 }

$(document).ready(function(){
   
   $('.main-column dl').click(function() { 
   if(($(this).attr("class")) != "tba" && ($(this).attr("class")) != "archive"  && ($(this).attr("class")) != "selected"){
	   
	   var newDiv = $(this).find('a').attr('href');
	   
	   showEntry(newDiv);
	   
	   selectDate(this);
	   	
	   	return false; 
   }
   
   if(($(this).hasClass("archive"))){
	   var loc = $(this).find('a').attr('href');
	   
	   window.location = loc;
	   
	   return false;
   
   }
   
   });
   
   $('ul#navigator li.next-link a').click(function(){
   
   		var newDiv = $('#event-info').children('div:visible').next('div');
   		
   		if(newDiv.length < 1){ newDiv = $('#event-info').children('div').get(0); }
   		
   		showEntry(newDiv);
   		
   		return false;
   		
   });
   
   $('ul#navigator li.prev-link a').click(function(){
   
   		var newDiv = $('#event-info').children('div:visible').prev('div');
   		
   		if(newDiv.length < 1){ newDiv = $('#event-info').children('div:last'); }
   		
   		showEntry(newDiv);
   		
   		return false;
   		
   });
   
 });
