  var antal;
  var i=0;
 var current =0;
$(function(){
		  antal = $('.gal-img-box').length /6;
		  i=0;
		  current =0;
		   $('#gal-next-btn').click(function(){
           if(current < antal -1){
			   current++;
			   $('#gal-long').animate({
    left: '-=615'
  }, 500, function() {
    // Animation complete.
  });
		   }
			dispArrow();
		
		
													 
													 });
		   $('#gal-prev-btn').click(function(){
			 if(current > 0){
			   current--;
			     $('#gal-long').animate({
    left: '+=615'
  }, 500, function() {
    // Animation complete.
  });
		   }
			dispArrow();
		
			
			});
		  
		//  alert(antal);
		$('#gal-long').css('width',(700*antal+3));
		  while(antal > i){
		  $('#gal-long').append('<div class="gal-pageing-box"></div>');
		  $('#temp .gal-img-box:lt(6)').clone().appendTo('.gal-pageing-box:last');
		  $('#temp .gal-img-box:lt(6)').remove();
		   i++;
		   }
		   })

  function dispArrow(){
		if(current < 1){
				$('#gal-prev-btn').css('background-image', 'url(/images/non-prev.png)')
				}else{
				$('#gal-prev-btn').css('background-image', 'url(/images/prev.png)')	
				}
			if(current > antal -1){
				$('#gal-next-btn').css('background-image', 'url(/images/non-next.png)')
				}else{
				$('#gal-next-btn').css('background-image', 'url(/images/next.png)')	
				}  
  }
		   
