$.fn.basicslideshow = function(options) {
	var defaults = {
		"prevButton"	: $(this).find("a.prev"),
		"nextButton"	: $(this).find("a.next"),
		"itemList"		: $(this).find("ul.items"),
		"loop"			: true,
		"interval"		: 10000,
		"speed"			: 200
	};
	
	var methods = {
		slide	: function(slides, direction, loop, position) {
			/*alert(index);*/
				if(loop == null)
					loop = false;
					
				var slideshow = $(".slideshow");		
				
				if(slides.length <= 1)
					return false;
				
				var current = options.itemList.children(".active");
				var display = current.css("display");
				current.css({"display": display});
				current.stop(true, true).fadeOut(options.speed).removeClass("active");
				
				switch(direction)
				{
					default:
					case "forward":
						var next = slides.eq(current.index()+1);
						if(next.length == 0)
							next = current.parent().children("li").first();
						break;
					case "back":
						var next = slides.eq(current.index()-1);
						if(next.length == 0)
							next = current.parent().children("li").last();
						break;
					case "to":
						var next = slides.eq(position);
						if(next.length == 0)
							next = current.parent().children("li").first();
						break;
				}
				
				next.stop(true, true).fadeIn(options.speed).addClass("active");
				
				if(loop == true)
				{
					setTimeout(function(){
						methods.slide(slides, direction, loop)
					}, options.interval);
				}
		 }
	}

	var options = $.extend(defaults, options);
	
	var items = options.itemList.children("li");
	
	//if(options.loop == true)
		methods.slide(items, "forward", options.loop);
	
	options.prevButton.bind('click touchstart', function(){ methods.slide(items, "back"); return false; });
	options.nextButton.bind('click touchstart', function(){ methods.slide(items, "forward"); return false; });
	
};

