var headline_count;
var headline_interval;
var old_headline = 0;
var current_headline = 0;

var headline_count2;
var headline_interval2;
var old_headline2 = 0;
var current_headline2 = 0;

$(document).ready(function(){
  headline_count = $("#slideshow .featured").size();  
  if(headline_count > 1) {	  
  $("#slideshow .featured:eq("+current_headline+")").css('top', '7px');
  headline_interval = setInterval(headline_rotate_s1,10000);
  
  $('#slideshow').hover(function() {
	clearInterval(headline_interval);
  }, function() {
	headline_interval = setInterval(headline_rotate_s1,10000);
	headline_rotate_s1();
  });
  }
  
 headline_count2 = $("#slideshow2 .featured").size();
 
 if(headline_count2 > 1) { 
  $("#slideshow2 .featured:eq("+current_headline2+")").css('top', '7px');
  headline_interval2 = setInterval(headline_rotate_s2,10000);
  
  $('#slideshow2').hover(function() {
	clearInterval(headline_interval2);
  }, function() {
	headline_interval2 = setInterval(headline_rotate_s2,10000);
	headline_rotate_s2();
  });
  }
});
  
function headline_rotate_s1() {
  current_headline = (old_headline + 1) % headline_count;
  $("#slideshow .featured:eq(" + old_headline + ")")
	.animate({top: -152},"slow", function() {
	  $(this).css('top', '157px');
	});
  $("#slideshow .featured:eq(" + current_headline + ")")
	.animate({top: 7},"slow");
  old_headline = current_headline;
}

function headline_rotate_s2() {
  current_headline2 = (old_headline2 + 1) % headline_count2;
  $("#slideshow2 .featured:eq(" + old_headline2 + ")")
	.animate({top: -152},"slow", function() {
	  $(this).css('top', '157px');
	});
  $("#slideshow2 .featured:eq(" + current_headline2 + ")")
	.animate({top: 7},"slow");
  old_headline2 = current_headline2;
}