
 var headline_count;
 var headline_interval;
 var old_headline = 0;
 var current_headline = 0;
 var dist=0;
 $(document).ready(function(){
   headline_count = $("div.headline").size();
   $("div.headline:eq("+current_headline+")").css('top','5px');
 
   
   $('#zabieg1').click(function() {
    headline_rotate_next('-280');
   });
   $('#zabieg2').click(function() {
    headline_rotate_next('-420');
   });
   $('#zabieg3').click(function() {
    headline_rotate_next('-580');
   });
   $('#zabieg4').click(function() {
    headline_rotate_next('-740');
   });
   $('#zabieg5').click(function() {
    headline_rotate_next('-870');
   });
   $('#zabieg6').click(function() {
    headline_rotate_next('-980');
   });
   $('#zabieg7').click(function() {
    headline_rotate_next('-1080');
   });
   $('#zabieg8').click(function() {
    headline_rotate_next('-1220');
   });
   $('#zabieg9').click(function() {
    headline_rotate_next('-1300');
   });


   
 });
 
 function headline_rotate_next(dist) {
  // current_headline = (old_headline + 1) % headline_count;
   $("div.headline:eq(" + old_headline + ")").animate({top: dist},"slow", function() {
     //$(this).css('top','600px');
   });
   //$("div.headline:eq(" + current_headline + ")").show().animate({top: 5},"slow");
  // old_headline = current_headline;
   
}
