var timeout_page = 7000;
var timeout_delay = 4000;
var timeout_slide = 750;
var interrupt = false;

function newsScroller_next() {
   if( interrupt ) return false;

   var max_page = $('ul.news-scroller > li').length;
   var cur_page = $('ul.news-scroller > li.on');
   var num_cur  = cur_page.prevAll().length;
   var num_next = ( ( num_cur + 1 ) % max_page ) + 1;
   var new_page = $('ul.news-scroller > li:nth-child('+ num_next +')');

   cur_page.removeClass('on').fadeOut( timeout_slide  );
   new_page.addClass('on').fadeIn( timeout_slide  );

   setTimeout('newsScroller_next()', timeout_page );
}


$( function() {
   $('#b_nav li:last-child a:not(.on)').mouseover( function() {
      $('#b_nav .snav-mask').show();
   }).mouseout( function() {
      $('#b_nav .snav-mask').hide();
   });

   $('#b_nav li:last-child a.on').each( function() {
      $('#b_nav .snav-mask').show();
   });

   $('ul.news-scroller > li:first').show().addClass('on');
   setTimeout('newsScroller_next()', timeout_page - timeout_delay );

   $( window ).resize( function() {
      var f_height = $('#b_feature').height() + 85;
      var c_height = $('#c_content').height();
      if( f_height > c_height ) {
         $('#c_content').height( f_height );
      }
   });

   $( window ).resize();
});

