var headline_count_hs;
var headline_interval_hs;
var old_headline_hs = 0;
var current_headline_hs=0;

var headline_count1;
var headline_interval1;
var old_headline1 = 0;
var current_headline1=0;

var headline_count2;
var headline_interval2;
var old_headline2 = 0;
var current_headline2=0;

var headline_count3;
var headline_interval3;
var old_headline3 = 0;
var current_headline3=0;

//guanggao_gs
$(document).ready(function(){
  headline_count_hs = $("div.guanggao_hs").size();
  
  $("div.guanggao_hs:eq("+current_headline_hs+")").css('top','1px');
  if(headline_count_hs>1){
  headline_interval_hs = setInterval(headline_rotate_hs,6000); //time in milliseconds
  $('#gguanggao_hs').hover(function() {
    clearInterval(headline_interval_hs);
  }, function() {
    headline_interval_hs = setInterval(headline_rotate_hs,6000); //time in milliseconds
    //headline_rotate();
  });
  }
});

function headline_rotate_hs() {
  current_headline_hs = (old_headline_hs + 1) % headline_count_hs; 
  $("div.guanggao_hs:eq(" + old_headline_hs + ")").animate({top: -40},"slow", function() {
    $(this).css('top','80px');
    });
  $("div.guanggao_hs:eq(" + current_headline_hs + ")").show().animate({top: 1},"slow");  
  old_headline_hs = current_headline_hs;
}

//guanggao1
$(document).ready(function(){
  headline_count1 = $("div.guanggao1").size();
  
  $("div.guanggao1:eq("+current_headline1+")").css('top','1px');
  if(headline_count1>1){
  headline_interval1 = setInterval(headline_rotate1,6000); //time in milliseconds
  $('#gguanggao1').hover(function() {
    clearInterval(headline_interval1);
  }, function() {
    headline_interval1 = setInterval(headline_rotate1,6000); //time in milliseconds
    //headline_rotate();
  });
  }
});

function headline_rotate1() {
  current_headline1 = (old_headline1 + 1) % headline_count1; 
  $("div.guanggao1:eq(" + old_headline1 + ")").animate({top: -111},"slow", function() {
    $(this).css('top','222px');
    });
  $("div.guanggao1:eq(" + current_headline1 + ")").show().animate({top: 1},"slow");  
  old_headline1 = current_headline1;
}
//guanggao2
$(document).ready(function(){
  headline_count2 = $("div.guanggao2").size();
  
  $("div.guanggao2:eq("+current_headline2+")").css('top','1px');
  if(headline_count2>1){
  headline_interval2 = setInterval(headline_rotate2,5000); //time in milliseconds
  $('#gguanggao2').hover(function() {
    clearInterval(headline_interval2);
  }, function() {
    headline_interval2 = setInterval(headline_rotate2,5000); //time in milliseconds
    //headline_rotate();
  });
  }
});

function headline_rotate2() {
  current_headline2 = (old_headline2 + 1) % headline_count2; 
  $("div.guanggao2:eq(" + old_headline2 + ")").animate({top: -100},"slow", function() {
    $(this).css('top','200px');
    });
  $("div.guanggao2:eq(" + current_headline2 + ")").show().animate({top: 1},"slow");  
  old_headline2 = current_headline2;
}
//guanggao3
$(document).ready(function(){
  headline_count3 = $("div.guanggao3").size();
  
  $("div.guanggao3:eq("+current_headline3+")").css('top','1px');
  if(headline_count3>1){
  headline_interval3 = setInterval(headline_rotate3,6000); //time in milliseconds
  $('#gguanggao3').hover(function() {
    clearInterval(headline_interval3);
  }, function() {
    headline_interval3 = setInterval(headline_rotate3,6000); //time in milliseconds
    //headline_rotate();
  });
  }
});

function headline_rotate3() {
  current_headline3 = (old_headline3 + 1) % headline_count3; 
  $("div.guanggao3:eq(" + old_headline3 + ")").animate({top: -176},"slow", function() {
    $(this).css('top','252px');
    });
  $("div.guanggao3:eq(" + current_headline3 + ")").show().animate({top: 1},"slow");  
  old_headline3 = current_headline3;
}