	
	
	function slideShow(slideShowContainer){
	
		var self=this;
		this.containerId=slideShowContainer;
		this.items=[];
		this.currentIndex=null;
		this.timer=null;
		this.currentOpacity=0;
	
		this.setOpacity=function(obj,val){
			
			try{ obj.style.filter = 'alpha(opacity=' + val + ')'; }catch(e){};
			try{ obj.style.MozOpacity = val/100; }catch(e){};
			try{obj.style.opacity = val/100; }catch(e){};
			
		}

		this.getNextItem=function(){
			
			for(i=0; i<this.items.length; i++){
				this.items[i].style.zIndex=10;
			}
			this.items[this.currentIndex].style.zIndex=1000;
			
			nextIndex=this.currentIndex+1;
			if(nextIndex > this.items.length-1){
				this.currentIndex=0
			}
			else{
				this.currentIndex=nextIndex;
			}
			
		}
		
		this.continueTransition=function(){
			
			if(self.currentOpacity>100){
				
				self.currentOpacity=100;
				self.stopTransition();
				self.getNextItem();
				window.setTimeout(self.pauseTransition,4000);
				
			}
			else{
				
				self.currentOpacity++;
				self.setOpacity(self.items[self.currentIndex],self.currentOpacity);
				
			}
			
		}
		
		this.pauseTransition=function(){
		
			prevIndex=self.currentIndex-1;
			if(prevIndex >=0){
				self.setOpacity(self.items[prevIndex],0);
			}
			else{
				self.setOpacity(self.items[self.items.length-1],0);
			}
			
			self.startTransition();
		
		}
		
		this.startTransition=function(){
			
			this.currentOpacity=0;
			this.timer=window.setInterval(self.continueTransition,10);
			
		}
		
		this.stopTransition=function(){
			
			window.clearInterval(this.timer);
			
		}
	
		this.start=function(){
			
			for(i=0; i<document.getElementById(this.containerId).childNodes.length; i++){
				if(document.getElementById(this.containerId).childNodes[i].nodeType==1){
					document.getElementById(this.containerId).childNodes[i].style.zIndex=10;
					this.items.push(document.getElementById(this.containerId).childNodes[i]);
				}
			}
			
			if(this.items.length>0){
				this.currentIndex=0;
				this.startTransition();
			}
			
		}
	
	}
	
	
