jQuery.fn.imageScroller = function(params){
	var p = params || {
		speed:4000,
		slideup:300,
		slidedown:500
	};
	
	var bodybox = $("#flashPic");
	var picbox = $("#flashPic a");
	var textbox = $('#flashText');
	var navbox = $('#flashNav span');
	var titlebox = $('#flashText h3');
	var descbox = $('#flashText p');
	var count = picbox.length;
	var current = 0;
	var intervalID = null;

	var stop = function(){window.clearInterval(intervalID);}

	picbox.css({opacity: 0.0});
	picbox.eq(0).css({opacity: 1.0}).addClass('current');
	titlebox.html($('#flashPic a:first').find('img').attr('alt'));
	descbox.html($('#flashPic a:first').find('img').attr('title'));
	textbox.css({bottom:0});
	$('#flashNav').children('span:first').addClass('hover');

	var slide = function(opts){
		if(!$("#flashText").is(":animated")){
			if (opts) {
				current = opts-1;
			} else {
				current = (current >= (count - 1)) ? 0:(++current);
			};
			var _current = ($('#flashPic a.current')? $('#flashPic a.current') : $('#flashPic a:first'));
			var next = opts?$('#flashPic a').eq(opts-1):((_current.next().length)?_current.next():$('#flashPic a:first'));
			var title = next.find('img').attr('alt');	
			var desc = next.find('img').attr('title');	
			next.css({opacity: 0.0}).addClass('current').animate({opacity: 1.0},1000);
			$('#flashText').animate({bottom:-50},p.slideup, function (){
					titlebox.html(title);
					descbox.html(desc);				
					$('#flashText').animate({bottom:0},p.slidedown);	
			});		
			_current.animate({opacity: 0.0},1000).removeClass('current');
			navbox.removeClass("hover").eq(current).addClass("hover");
		}
	}

	var go = function() {
		stop();
		intervalID = window.setInterval(function() {
			slide();
		},p.speed);
	};
	var itemMouseOver = function(target, items) {
		stop();
		var i = $.inArray(target, items);
		slide(i+1);
	};
	navbox.hover(function() {
		if ($(this).attr('class') != 'hover') {
			itemMouseOver(this,navbox);
		} else {
			stop();
		}
	},go);
	bodybox.hover(stop,go);
	go();
};
