
$.fn.ssStart = function (options) {
	var defaults = {
		displaySeconds	: 3,
		tweenSeconds	: 1,
		crossFade		: 1, // cross / fadeout
		imageSource		: 'image_list.php',
		randomize		: 0, // randomizes the images
		height			: 0,
		width			: 0
	};

	var opts = $.extend(defaults, options);
	var $this = $(this);
	$.ajax({
		url	: opts.imageSource,
		success : function (data){
			imagesDiv = $('<div />');
			images = data.split('\n');
			for (img in images) {
				newImage = $('<img />');
				newImage.attr('src', images[img]);
				if (opts.width > 0) newImage.css({'width':opts.width+'px'});
				if (opts.height > 0) newImage.css({'height':opts.height+'px'});
				imagesDiv.append(newImage);
			}
			if (opts.height + opts.width > 0) {
				if(opts.height > 0) imagesDiv.css({'height':opts.height + 'px'});
				if(opts.width > 0) imagesDiv.css({'width':opts.width + 'px'});
			}
			$this.append(imagesDiv);
			imagesDiv.cycle({
				fx		: 'fade',
				timeout : (opts.displaySeconds * 1000),
				speed	: (opts.tweenSeconds * 1000),
				random	: opts.randomize,
				sync	: (opts.crossFade)
			});
		}
	});
};

