var scroll_state = 0;
var scroll_item_count = 6;
var move_pxs = 150;

var n_scroll_state = 0;
var n_scroll_item_count = 1;
var n_move_pxs = 260;


function showNextThumb( max )
{
  if( scroll_state < ( max - scroll_item_count ) )
  {
    $('#flexterscroll').animate({left: '-=150'}, 290);
    scroll_state = scroll_state+1;
  }
  else
  {
    var t = max - scroll_item_count;
    $('#flexterscroll').animate({left: '+='+(t*150)}, 400);
    scroll_state = 0;
  }
}

function showPreviousThumb( max )
{
  if( scroll_state > 0 )
  {
    $('#flexterscroll').animate({left: '+=150'}, 290);
    scroll_state = scroll_state-1;
  }
  else
  {
    var t = max - scroll_item_count;
    $('#flexterscroll').animate({left: '-='+(t*150)}, 400);
    scroll_state = ( max - scroll_item_count );
  }
}

function showNextNews( max )
{
  if( n_scroll_state < ( max - n_scroll_item_count ) )
  {
    $('#newsscrolldiv').animate({left: '-=260'}, 290);
    n_scroll_state = n_scroll_state+1;
  }
  else
  {
    var t = max - n_scroll_item_count;
    $('#newsscrolldiv').animate({left: '+='+(t*260)}, 700);
    n_scroll_state = 0;
  }
}

function showPreviousNews( max )
{
  if( n_scroll_state > 0 )
  {
    $('#newsscrolldiv').animate({left: '+=260'}, 290);
    n_scroll_state = n_scroll_state-1;
  }
  else
  {
    var t = max - n_scroll_item_count;
    $('#newsscrolldiv').animate({left: '-='+(t*260)}, 700);
    n_scroll_state = ( max - n_scroll_item_count );
  }
}

