jQuery.fn.thumbPager = function(options) {
	options = $.extend({
		pageSize:	4
	}, options || {});

	//$('#featured-properties').
	var container = this;
	var cid = '#' + container.attr('id');
	var slides = $(cid+' .pic-frame');
	var current = 0;
	var prevBtn = $(cid+' .prev');
	var nextBtn = $(cid+' .next');
	
	var drawSlides = function(){
		$.each(slides, function(i, val){
			if (i >= current && i < current+options.pageSize){
				$(slides[i]).show();
				/*
				if ($(slides[i]).css('display') == 'block'){
					$(slides[i]).fadeOut('fast').fadeIn('fast');
				} else {
					$(slides[i]).fadeTo('fast', 1).fadeIn('fast');
				}
				*/
			} else {
				$(slides[i]).hide();
				//$(slides[i]).fadeOut('fast');
			}
		});
	}
	
	$(prevBtn).click(function(){
		if (current > 0) { 
			current -- ;
			drawSlides();
		}
		// disable the prev button if it's at the start
		if (current <= 0) { 
			$(this).parent().addClass('disabled');
		}
		// enable the next button
		$(nextBtn).parent().removeClass('disabled');
	});
	
	$(nextBtn).click(function(){
		if (current + options.pageSize < slides.length) { 
			current ++ ;
			drawSlides();
		}
		// disable the next button if it's at the end
		if (current + options.pageSize >= slides.length) { 
			$(this).parent().addClass('disabled');
		}
		// enable the prev button if there are more
		$(prevBtn).parent().removeClass('disabled');
	});
	
	// assuming it starts at 0 disable the prev button first
	$(prevBtn).parent().addClass('disabled');
	
	drawSlides();
	return this;
}
