	var $ = jQuery;
  	jQuery.noConflict();
		(function($) { 
			$(function(){
  				$('#countdown h3').bfcounter('October 8, 2010')
  			});
  			
		  	$.fn.extend({
			  	bfcounter: function(date){
				  	return this.each(function(){
				  		$this = $(this);
				  		now = new Date();
				 		eventDate = new Date(date);
				  		msEachDay = 24 * 60 * 60 * 1000 ;

				  		daysRemaining = (eventDate.getTime() - now.getTime()) / msEachDay;
				  		daysRemaining = Math.round(daysRemaining);	  	
					 	$this.html(daysRemaining);  	
				  	});
				},
				addSlide: function(userOptions){
					options = {
						img : '/images/registerButton.png',
						icon : '/images/star150.gif',
						h2	: 'SPI Bikefest',
						h4	: 'Default Caption to add to this test post.........',
						a	: 'http://spibikefest.com/'
					}
					$.extend(options, userOptions); 
								  		
					$ul		= $(this).find('ul'),
					$item	= $('<li/>'),
					$a		= $item.append('<a/>').find('a').attr('href', options.a),
					$img	= $a.append('<img/>').find('img').attr('src', options.img),
					$info	= $a.append('<div id="info"/>').find('#info'),
					$icon	= $info.append('<img id="icon"/>').find('#icon').attr('src', options.icon),
					$h2		= $info.append('<h2/>').find('h2').append(options.h2),
					$h4		= $info.append('<h4/>').find('h4').append(options.h4);
					$ul.append($item);
					
			  	},
				BFslide: function(){
					num = 0;
					$ul	= $(this).find('ul:first'),
					$items = $ul.find('li'),
					itemWidth = $items.filter(':first').width();
					ulWidth = $items.length * itemWidth;
					$ul.css('width', ulWidth),
					leftPos = 0,
					itemcount = $items.length;
				
					$pagination = $(this).find('#pagination');
				
				
					$items.each(function(i){
						$pagination.append('<div class="bullet" value="'+ i +'"/>');
					});
					$pagination.find('.bullet:first').addClass('selected');
					
					$bullets = $pagination.find('.bullet');
					setInterval(function(){
						leftPos = leftPos - (itemWidth);
						if(leftPos == (-ulWidth)) leftPos = 0;
						$ul.animate({left : leftPos}, 1000);
					
						page = (leftPos* itemcount) / (ulWidth* -1);
						$bullets.removeClass('selected').filter('[value='+ page +']').addClass('selected');
					
					}, 10000);
			  	}	
		  	});
  		})(jQuery);