var af_ban_id2, af_last_id2;
var is_show_banner2 = 1; 
var mouse_under2 = 0; 
var user_look_time2 = 10000;

function fnBanRotate2() {
  var box = $("#ban_rotate2");
  if (box.length > 0) {    
    af_ban_id2 = $("#bban1").attr("ban")*1;
    af_last_id2 = $("#bban0").attr("ban")*1;
    click_next2($("#2ban"+af_ban_id2+""), af_ban_id2);

    $("#ban_rot_href2 a").click(function () {
      if (mouse_under == 1) {
        $(this).remove
        is_show_banner = 0;
        $('#ban_rotate2 div.rban').stopTime('timer1');
        $('#ban_rot_href2 a').removeClass('active').addClass('none').stopTime('timer_is_show_banner');
        $(this).addClass('active');
        var current_index = $(this).attr("ban")*1;
        current_delay = $('#2ban'+current_index+'').attr('delay')*1;
        if (current_delay) { user_look_time = current_delay; }
        
        $("div.show", box).removeClass('show').addClass('hide');
        $('#2ban'+current_index+'').removeClass('hide').addClass('show');
        
        $(this).oneTime(user_look_time, 'timer_is_show_banner2', function() {
          $(this).stopTime('timer_is_show_banner2');
          is_show_banner = 1;
          var banner_count = af_last_id2;
          var current_index = $(this).next('a').attr("ban")*1;
          if (!current_index) {
            current_index = af_ban_id2;
          }
          click_next2($('#2ban'+current_index+''), current_index);
        });
      }
      return false;
    });  
    $('#ban_rot_href2 a').hover( function () { mouse_under = 1; }, function () { mouse_under = 0; }  );    
  }
}

function click_next2(obj, d) {
  
  var box = $("#ban_rotate2");
  var current_delay = $('#2ban'+d+'').attr('delay')*1;
  $("div.show", box).removeClass('show').addClass('hide'); 
  obj.removeClass('hide').addClass('show');
  $('#ban_rot_href2 a').removeClass('active').addClass('none');
  $('a.2ab'+d+'', $("#ban_rot_href2")).addClass('active');
  $(obj).oneTime(current_delay, 'timer1', function(i) {
    var banner_count = af_last_id2;
    var current_index = $(this).next('div').attr("ban")*1;
    if (!current_index) {
      current_index = af_ban_id2;
    }
    
    $(obj).stopTime('timer2');
    if (is_show_banner) {
      click_next2($('#2ban'+current_index+''), current_index);
    }
  });
  return false;      
}
