var ScrollInterval = 10000;
var FadeInterval = 10000;
var BlinkInterval = 2000;

var bnrMove = function() {
  $("#page-1").animate({backgroundPosition: '1000px 0'},{duration:ScrollInterval})
              .animate({backgroundPosition: '0 0'},{duration:ScrollInterval});
  $("#page-2").animate({backgroundPosition: '-1000px 0'},{duration:ScrollInterval})
              .animate({backgroundPosition: '0 0'},{duration:ScrollInterval});
  $("#page-3").animate({backgroundPosition: '-1000px 445px'},{duration:ScrollInterval})
              .animate({backgroundPosition: '0 445px'},{duration:ScrollInterval});
  $("#page-4").animate({backgroundPosition: '1000px 469px'},{duration:ScrollInterval})
              .animate({backgroundPosition: '0 469px'},{duration:ScrollInterval});
};

$(document).ready(function() {
  bnrMove();
  $("#page-1").everyTime(ScrollInterval*2+100,bnrMove);
  //$("#bnr-ch-02").animate({opacity: 1},{duration:BlinkInterval});
  //$("#bnr-ch-02").everyTime(FadeInterval,bnrFade);

  $('#content .pic').hover(function() {
    bp = $(this).css('background-position');
    bp = bp.split(" ");
    bp[0] = parseInt(bp[0]);
    bp[1] = parseInt(bp[1]);
    if (bp[1]>0) {
      bp[1] = parseInt(bp[1])+10;
    } else {
      bp[1] = parseInt(bp[1])-10;
    }
    bpn = bp[0]+'px '+bp[1]+'px';
    $(this).css('background-position', bpn);
    //$(this).animate({backgroundPosition: bpn},{duration:5000});
  }, function() {
    bp = $(this).css('background-position');
    bp = bp.split(" ");
    bp[0] = parseInt(bp[0]);
    bp[1] = parseInt(bp[1]);
    if (bp[1]>0) {
      bp[1] = parseInt(bp[1])-10;
    } else {
      bp[1] = parseInt(bp[1])+10;
    }
    bpn = bp[0]+'px '+bp[1]+'px';
    $(this).css('background-position', bpn);
    //$(this).animate({backgroundPosition: bpn},{duration:500});
  });



});

