// MWW JavaScript Document

//select syntax
//jQuery('#NewsList'); instead of $('#NewsList');
//to avoid conflicts with prototype

var headline_count;
var headline_interval;
var current_headline = 0;
var old_headline = 0;
	
jQuery(document).ready(function() {

	//jQuery.noConflict();
	
	//alert(jQuery('li').length + 'elements');
	//alert('5 elements');
	  
	//var fontSize = jQuery('#obitListing').css('font-size');
  	//alert(fontSize);

   	headline_count = jQuery("div.obitListing").size();
	
   	jQuery("div.obitListing:eq(" + current_headline + ")").css('top', '5px');
	
/*	$('#scrollObits').css({position: 'absolute', overflow: 'hidden'})
	$('div.obitListing')
	  .css({position: 'absolute', height: '195px'})
	  .not(current_headline)
	  .css('top','210px');	*/
	
	
	
	
	//alert(headline_count + ' elements'); 
	 
	headline_interval = setInterval(headline_rotate,7000); //time in milliseconds
	$('#scrollObits').hover(function() {
		clearInterval(headline_interval);
	}, function() {
		headline_interval = setInterval(headline_rotate,7000); //time in milliseconds
		headline_rotate();
	});
});

function headline_rotate() {
	current_headline = (old_headline + 1) % headline_count;
	 
	 jQuery("div.obitListing:eq(" + old_headline + ")").animate({top: -205},"slow", function(){
	   $(this).css('top', '210px');
	 });
	 
   $("div.obitListing:eq(" + current_headline + ")").show().animate({top: 5},"slow");  
   old_headline = current_headline;

}
//TYGFMG