jQuery.fn.makeCarousel = function(interval, animtime, animtype){
	var obj = this;
	var w = parseInt(obj.css('width'));
	var h = parseInt(obj.css('height'));
	obj.find('ul').before('<span id="fcsCnav"></span>');
	obj.find('#fcsCnav')
		.css('position','absolute')
		.css('z-index','5')
		.css('right','0px')
		.css('padding','4px 8px 4px 8px')
		.css('background-color','#FFFFFF')
		.css('opacity',0.8);
	obj.find('ul').wrap('<div style="position:absolute; left:0px;" id="fcsCstage"></div>');
	
	var items = obj.find('li');
	items.css('width',w+'px').css('height',h+'px');
	if(animtype=='fade') items.eq(0).css('z-index','4');
	items.each(function(i){
		if(i==0){
			obj.find('#fcsCnav').html('<span id="' + i + '"><img src="images/dot.gif" /></span>');
		}else{
			obj.find('#fcsCnav span:last').after('<span id="' + i + '"><img src="images/dot.gif" /></span>');
		};
		if(animtype=='scroll') $(this).css('left',i*w + 'px');
	});
	obj.find('#fcsCnav span')
		.css('cursor','pointer')
		.css('padding','2px')
		.click(function(){
			var c = obj.find("#fcsCnav img[src='images/bluedot.gif']").attr('src','images/dot.gif');
			var n = $(this);
			if(c.parent().attr('id') != null){
				c = parseInt(c.parent().attr('id'));
				n.find('img').attr('src','images/bluedot.gif');
				n = parseInt(n.attr('id'));
			}else{
				c = 0;
				n = 0;
				obj.find("#fcsCnav img").eq(0).attr('src','images/bluedot.gif');
				items.eq(0).css('z-index','4');
			};
			if(c!=n){
				switch(animtype){
					case 'fade':
						items.stop().css('z-index','1');
						items.eq(c).css('z-index','3').css('opacity',1.0);
						items.eq(n).css('z-index','4').css('opacity',0.0).animate({opacity: 1.0},animtime);;
						//obj.find('#fcsCstage').stop().animate({left:'-' + this.id*w + 'px'},animtime);
					break;
					case 'scroll':
						obj.find('#fcsCstage').stop().animate({left:'-' + this.id*w + 'px'},animtime);
					break;
				}
			}
		});
	function next(){
		if(obj.find('#fcsCstage:animated').length == 0){
			var c = obj.find("#fcsCnav img[src='images/bluedot.gif']").parent().attr('id');
			var next = 0;
			if(c!=null){
				next = (c == (obj.find('#fcsCnav span').length-1)) ? 0 : ++c;
			};
			obj.find('#fcsCnav span').eq(next).click();
		}
	};
	var to = setInterval(function(){next()},interval);
	obj.mouseover(function(){clearInterval(to)}).mouseout(function(){to = setInterval(function(){next()},interval)});
	next();
	return obj;
}