function SliderComponent(obj){
  slide           = $('#'+obj.conteiner);
	slide_conteiner = $('#'+obj.conteiner_info); 
	size      = $('#'+obj.conteiner+' div.new-goods-prod').size();
  step      = obj.step;
  THIS      = this;
  $(window).resize(function(){
	   THIS.Init();
  });
  this.Init();
}
SliderComponent.prototype.Init  = function() {
	conteiner_info = slide_conteiner.width();
  count     = Math.floor(conteiner_info/step);
	//step_left = (step*count);
  //max_steps = Math.ceil(size / count)-1;
  //min_steps = size - count;
  
  var bcount = 1;
  step_left = (step*bcount);
  max_steps = Math.ceil(size / bcount)-count;
  min_steps = size - bcount;
  
  current_step = 0;
  left  = 0;
  proceed_now = false;

    if(count>=size){
    $('#back_slider').hide();
    $('#next_slider').hide();
    }

    $('#hidden_div').css({
            'marginLeft':'30px',    
            'position':'relative',
            'overflow':'hidden',
            'height':'100%',
            'width':(step*count)+'px'
    });
  $('#slider_div').css({
      'width':'30000px',
      'position':'relative'
  });  
}
SliderComponent.prototype.back  = function(event) {
      
      event.preventDefault();
      if(current_step <= 0) {
         left= step_left*max_steps;
         left *= -1; 
         slide.animate({
           left: left
         })
         current_step = max_steps; return; 
      }
      
      if(proceed_now) return;
      proceed_now = true;
      
      current_step--;
            
      left += eval(step_left);
      slide.animate({
         left: left
      }, 'slow', function(){
         proceed_now = false;
      })
}

SliderComponent.prototype.next  = function(event) {
      event.preventDefault();
      
      if(current_step >= max_steps) {
         left = 0   
         slide.animate({
           left: left
         })
         current_step=0; return;
      }
      
      if(proceed_now) return;
      proceed_now = true;
      
      current_step++;
      
      left -= eval(step_left);
      slide.animate({
         left: left
      }, 'slow', function(){
         proceed_now = false;
      })
}


