// Various jQuery functions

function display_tooltip(selector_name, html_content){
$(selector_name).hover(function(){
						   var offset = $(selector_name).offset();
						   var middle = $(selector_name).width() / 2;
						   var offset_left = offset.left + middle - 158;
						   $("#tooltip #content").html(html_content);
						   var box_height = $("#tooltip").height();

						   $("#tooltip").css("top", offset.top - box_height)
						   .css("left", offset_left)
						   .css("display", "block")
						   .animate({opacity:1.0}, 300);
						   },
				  function(){
					  		$("#tooltip").animate({opacity:0.0}, 0);
							$("#tooltip").css("display", "none");
							$("#tooltip #content").html("");
							}
					  );
}

function headlines()
{
//we want to set up the slider to auto rotate
number_of_headlines = $('#news_alert div').size();
if (number_of_headlines > 1)
{
headline_interval = setInterval(rotateHeadlines,8000); //time in milliseconds
   			   
//if we hover over one of the slides, we want to pause the animation
$('#news_alert div')
.hover(function() 
{
	clearInterval(headline_interval);
}, 
	   function() 
	   {
			headline_interval = setInterval(rotateHeadlines,8000); //time in milliseconds
	   });
}
				
}
				//this function changes to the next image in the set
function rotateHeadlines()
{
	var oCurHeadline = $("#news_alert div.current");
	var oNextHeadline = oCurHeadline.next();
		
	if (oNextHeadline.length == 0)
	{
		oNextHeadline = $("#news_alert div:first");
	}
	
			
	oCurHeadline.removeClass('current').addClass('previous');
	
	
	oCurHeadline.css({opacity:1.0})
	.removeClass('current')
	.animate({opacity:0.0}, 500); 
	
	
	oNextHeadline.css({opacity:0.0})
	.addClass('current')
	.animate({opacity:1.0}, 500, function() {oCurHeadline.removeClass('previous'); oNextHeadline.addClass('current'); });
}

