
function slideSwitch(){
 var $active = $('#slideshow img.active');
 var $next = $active.next();
 
 var $next =  $active.next().length ? $active.next(): $('#slideshow img:first'); 

 $active.addClass('last-active');
 
 $next.css({"display" : "none"})
      .addClass('active').css({"display" : "block"});
     
		  $active.removeClass('active last-active');

}

/*------------product scroller----------------*/
/*atentie, valori hard-coded, dependente de CSS*/
 function initPanes(){
      //var lungimeContainer = $('#progres-panes-container').innerWidth();
      var numarPanouri = $('.progres-pane').length;
      var lungimePanou = $('.progres-pane').outerWidth();
      var lungimeSlide = numarPanouri * (lungimePanou);

      $('#progres-pane-view').css({
                                  'width':lungimeSlide+'px'
                                  });
      $('.progres-pane').css({
                             'float':'left'
                             });

    }

 function moveLeft(){
       //var lungimeContainer = $('#progres-panes-container').innerWidth();
       //nextPoz = -(currentPane)*lungimeContainer+13;
       //158
       var nextPoz;
       var lungimeBanda = $('#progres-pane-view').innerWidth();
       var curPoz = $('#progres-pane-view').css('left');
       if(parseInt(curPoz) <= -(lungimeBanda-156)){
         nextPoz = 0;
       }else{
         nextPoz = parseInt(curPoz)-156;
       }

       $('#progres-pane-view').animate({
                                      'left':nextPoz
                                      }, 500);
    }
 function moveRight(){
       //var lungimeContainer = $('#progres-panes-container').innerWidth();
       //nextPoz = -(currentPane)*lungimeContainer+13;
       //158
       var nextPoz;
       var lungimeBanda = $('#progres-pane-view').innerWidth();
       var curPoz = $('#progres-pane-view').css('left');
       if(parseInt(curPoz) == 0){
         nextPoz = -lungimeBanda+156;
       }else{
         nextPoz = parseInt(curPoz)+156;
       }

       $('#progres-pane-view').animate({
                                      'left':nextPoz
                                      }, 500);
    }
/*------------product scroller----------------*/


$(document).ready(function(){
    initPanes();
   $(function(){$('.lbox').lightBox();}); // LIGHTBOX
	$(function(){$('.lbox2').lightBox();}); // LIGHTBOX
	$(function(){$('.lbox3').lightBox();}); // LIGHTBOX
	$(function(){$('.thumb a').lightBox();}); // LIGHTBOX
    setInterval("moveLeft();",3500);
      $(function(){
	  setInterval( "slideSwitch()", 5000 );
      });
});
