// Slider

var slider_int_left = false;
var slider_int_right = false;
var panorama_width = 2300;
var move_step = 5;


function highlight_arrow (img, activate, direction)
{
  // подсвечиваем стрелку
  (activate) ? $(img).prev().addClass('arrows-active') : $(img).prev().removeClass('arrows-active');
  // выключаем движение, если увели мышь
  if ( ! activate ) { stop_slider_move(); stop_slider_move(); }
  // двигаем подложку в нужном направлении   
  if (direction == 'left' && activate)
  {
    slider_int_left = setInterval(function() {
      if (parseInt($('.site-head .inner').css('left').replace('px', '')) >= (panorama_width/2 + ((document.body.clientWidth/2 - panorama_width/2)) + move_step) * -1 )
      {
        stop_slider_move(); return false;
      }
      $('.site-head .inner').css('left', parseInt(parseInt($('.site-head .inner').css('left').replace('px', '')) + move_step)+'px');
    }, 30);
  }
  else if (direction == 'right' && activate)
  {
    thumbs_width = $('.thumbs-content').innerWidth();
    wrapper_width = $('#thumbs-wrapper').innerWidth();
    slider_int_right = setInterval(function() {
      if ( parseInt($('.site-head .inner').css('left').replace('px', '')) <= ((panorama_width/2 + (panorama_width - document.body.clientWidth)/2) - move_step) * -1 )
      {
        stop_slider_move(); return false;
      }
      $('.site-head .inner').css('left', parseInt(parseInt($('.site-head .inner').css('left').replace('px', '')) - 5)+'px');
    }, 30);
  }
}


function stop_slider_move() { window.clearInterval(slider_int_left); window.clearInterval(slider_int_right); }

function slider_pos ()
{
  $('.site-head .inner').css('left', (panorama_width/2*-1)+'px');
  $('.site-head .inner').css('margin-left', '50%');
  //alert('resize');
}