	var J = jQuery.noConflict();
	
   J(document).ready(function() {  
									
	    // home slideshow (image rotator)
	
		J(function() {
			var stack = [];
		
			// preload images into an array starting with the 3rd image...the first two are hard coded.  We do this to help ease the initial page load
			for (var i = 3; i < 7; i++) {
				var img = new Image(860,380);
				img.src = '/wp-content/themes/thecyclinghouse/images/homebanners/homebanner' + i + '.jpg';
				 J(img).bind('load', function() { 
            stack.push(this); 
        });
				
			} 
		
			  J("#homebanner a").cycle({
				  fx:     'fade', 
				  timeout: 6000,
				  delay:   -2000,
				  //pager:  '#pagernav',
				  //pagerEvent: 'mouseover',
				  prev:    '#prev',
				  next:    '#next',
				  //pauseOnPagerHover: true,
				  before:  onBefore
			  });
			  
			  
			// add images to slideshow
			function onBefore(curr, next, opts) {
				if (opts.addSlide) // <-- important!
					while(stack.length)
                opts.addSlide(stack.pop());  
							};
		});	   
  }); 
