		$(document).ready( function() {
			
			var totWidth=0;
			var positions = new Array();
	
			$('#slider .slide, #sliderSmall .slideSmall').each(function(i){
				
				/* Traverse through all the slides and store their accumulative widths in totWidth */
				
				positions[i]= totWidth;
				totWidth += $(this).width();
				
				/* The positions array contains each slide's commulutative offset from the left part of the container */
				
				if(!$(this).width())
				{
					alert("Please, fill in width & height for all your images!");
					return false;
				}
				
			});
			
			$('#slider, #sliderSmall').width(totWidth);
			
			$('#bullets ul li a').click( function(e, keepScroll) {
				$('li.bulletItem').removeClass('active').addClass('inactive');
				$(this).parent().addClass('active');
				
				var pos = $(this).parent().prevAll('.bulletItem').length;
			
				$('#slider, #sliderSmall').stop().animate({marginLeft:-positions[pos]+'px'},450);
				/* Start the sliding animation */
				
				e.preventDefault();	
				
				// Stopping the auto-advance if an icon has been clicked:
				if(!keepScroll) clearInterval(itvl);
			});
			
			$('#bullets ul li.bulletItem:first').addClass('active').siblings().addClass('inactive');
			
			var current = 1;
			var currentTestim = 0;
			function autoAdvance()
			{
				/*var slides = $('#slider'); 
				currentSlide = (currentSlide + 1 == slides.length ? 0 : currentSlide + 1);
				slides.hide('slow');
				slides.fadeTo('slow', 0);
				$(slides[currentSlide]).show('slow');
				$(slides[currentSlide]).fadeTo('slow', 1);*/
				if(current==-1) return false;
				
				$('#bullets ul li a').eq(current%$('#bullets ul li a').length).trigger('click',[true]);	// [true] will be passed as the keepScroll parameter of the click function on line 28
				current++;
			}
			var changeEvery = 5;
			var itvl = setInterval( function() { autoAdvance();}, changeEvery * 1000 );
		});
		
		

