function Slideshow(param){
	this.settings = {
		images:[],
		parent:null//container for slide show images
	};
	$.extend(this.settings, param);
	this.currentIndex = 0;
	$(document).ready($.proxy(this, 'init'));
}
Slideshow.prototype = {
	init:function(){
		if(this.settings.parent){	
			var l = this.settings.images.length,
				w = $(this.settings.parent).width(),
				h =  $(this.settings.parent).height();
			if(l>1){
				this.img2 = $(document.createElement('img'))
					.css({position:'absolute',zIndex:-2})
					.prependTo(this.settings.parent)
					.hide();
			}
			if(l>0){
				this.img1 = $(document.createElement('img'))
					.css({position:'absolute',zIndex:-1})
					.prependTo(this.settings.parent)
					.attr({src:this.settings.images[0], width:w, height:h});
			}
		}
	},
	slide:function(dir){
		if(dir!=-1 && dir!=0)dir=1;
		var l = this.settings.images.length;
		if(l>1){
			var index = this.currentIndex + dir;
			if(index<0)index = l-1;
			if(index>=l)index = 0;
			if(this.currentIndex != index){
				this.currentIndex = index;
				this.img1.stop().unbind('load').load($.proxy(this, 'loadHandler')).hide();
				this.img2.attr('src', this.img1.attr('src')).show();
				this.img1.attr('src', this.settings.images[this.currentIndex]);
			}
		}
	},
	loadHandler:function(){
		this.img1.fadeIn(750, $.proxy(this, 'animateHandler'));
	},
	animateHandler:function(){
		this.img1.stop();
		if(this.img2)this.img2.hide();//hide to increase performance
	}
}
