		  jQuery(document).ready(function() {
		  var currentPosition = 0;
		  var slideWidth = 960;//jQuery('.slide').outerWidth();//957
		  var slides = jQuery('.slide');
		  var numberOfSlides = slides.length;
		  var direction = 1;  // 1 forward, -1 reverse
		  var playID = 0;
		  
		  // Remove scrollbar in JS
		  jQuery('#slide-container').css('overflow', 'hidden');
		
		  // Wrap all .slides with #slideInner div
		  slides
		  .wrapAll('<div id="slideInner"></div>')
		  // Float left to display horizontally, readjust .slides width
		  .css({
		    'float' : 'left',
		    'width' : slideWidth
		  });
		
		  // Set #slideInner width equal to total width of all slides
		  jQuery('#slideInner').css('width', slideWidth * numberOfSlides);
		
		  var linkList = '';
		  for(var i=0; i < numberOfSlides; i++) {
		  	linkList += '<a href="#wrapper" title="' + i + '"></a>';
		  	slides.eq(i).attr('id', i);
		  }
		 
		  
		  // Insert left and right arrow controls in the DOM
		  jQuery('#slider')
		    .append('<div id="ctrl">'+linkList+'</div>');
		

		  //jQuery('.slide:first').before(jQuery('.slide:last')); 
		  jQuery('#ctrl a[title="0"]').attr('class', 'active');
		  // Create event listeners for .controls clicks
		  jQuery('#ctrl a')
		    .bind('click', function(){
		      currentPosition = parseInt(jQuery(this).attr('title'));
		      //direction = 1;
		      jQuery('#ctrl a').removeClass();
		  	  jQuery(this).attr('class', 'active');
		      //var curMarginLeft = parseInt(jQuery('#slideInner').css('marginLeft'));
		     //alert(curMarginLeft);
		      // Move slideInner using margin-left
		      jQuery('#slideInner').animate({
		        'marginLeft' : slideWidth*(-currentPosition)
		      });
		      
		      /*
		      
		       jQuery('#slideInner').animate({
		        'marginLeft' : curMarginLeft + slideWidth*(-direction)
		      }, function() {
				 	if(direction == 1) {
				    	jQuery('.slide:last').after(jQuery('.slide:first'));
				 	}else{
				    	jQuery('.slide:first').before(jQuery('.slide:last'));
				 	}
			    	jQuery('#slideInner').css({'marginLeft' : '-960px'});
				 	
		      });
		      
		      */
		      clearInterval(playID);
		      autoplay();
		    });
		
		  
		  autoplay = function(){
			    playID = setInterval(function(){  //Set timer - this will repeat itself every 7 seconds
			    	//alert(currentPosition);
			    	if(currentPosition >= numberOfSlides-1) {
			    		//currentPosition = 0;
			    		direction = -1;
			    	}
			    	
			    	if(currentPosition <= 0) {
			    		direction = 1
			    	}
			    	
			    	if(direction > 0) {
			    		currentPosition += 1;
			    	}else {
			    		currentPosition -= 1;
			    	}
			    	//alert(currentPosition);
			    	jQuery('#ctrl a[title="'+currentPosition+'"]').click();
			    	
			    	/*var curMarginLeft = parseInt(jQuery('#slideInner').css('marginLeft'));
			    	//alert(curMarginLeft + ' : ' + slideWidth*(-direction));
			    	jQuery('#slideInner').animate({
				        'marginLeft' : slideWidth*(-currentPosition)
				      });
				     */

			    }, 8000); //12 secs
			};
		  autoplay();
		  });
