
//Class slideShow

		slideShow.prototype.img_holder1;
		slideShow.prototype.img_holder2;
		slideShow.prototype.image_array;
		slideShow.prototype.image_number = 0;
		slideShow.prototype.change_speed;
		slideShow.prototype.fade_speed;
		slideShow.prototype.randomNum;
		slideShow.prototype.IntervalId;
		slideShow.prototype.Fade_IntervalId;
		slideShow.prototype.begin_IntervalId;
		slideShow.prototype.opacity = 100;
		slideShow.prototype.imageActive = true;
		slideShow.prototype.play = true;
		
		function slideShow(Images, speed, fd_speed, type)
		{				
			document.write('<div id="slideShowHolder"><img id="photo_holder2" src="" style="position:absolute;" /><img id="photo_holder1" src="" /></div>');
			this.img_holder1 = document.getElementById('photo_holder1');
			this.img_holder2 = document.getElementById('photo_holder2');
			this.image_array = Images;
			this.image_number = 0;
			this.wooYayIntervalId = 0;
			this.Fade_IntervalId = 0;
			this.change_speed = speed * 1000;
			this.fade_speed = fd_speed;
			this.randomNum = type;			
			imgCt = this.image_array.length;
			this.lastRandom = Math.floor((Math.random()* imgCt));
		}
		
		////////////// Starting Methods /////////////////////////
		slideShow.prototype.beginSlideShow = function()
		{			
			this.changeImg();	
			this.opacity = 0;
			this.img_holder1.style.filter = 'alpha(opacity = ' + this.opacity + ')';
			this.img_holder1.style.MozOpacity=this.opacity/100;
			this.img_holder1.style.opacity=this.opacity/100;
			this.img_holder1.style.khtmlOpacity=this.opacity/100;
			
			this.img_holder2.style.filter = 'alpha(opacity = ' + this.opacity + ')';
			this.img_holder2.style.MozOpacity=this.opacity/100;
			this.img_holder2.style.opacity=this.opacity/100;
			this.img_holder2.style.khtmlOpacity=this.opacity/100;
			
			var instant = this;
			this.begin_IntervalId = setInterval(function() {instant.beginFade()}, this.fade_speed);	
		}
		
		slideShow.prototype.beginFade = function()
		{
			this.opacity = this.opacity + 5;
			this.img_holder2.style.filter = 'alpha(opacity = ' + this.opacity + ')';
			this.img_holder2.style.MozOpacity=this.opacity/100;
			this.img_holder2.style.opacity=this.opacity/100;
			this.img_holder2.style.khtmlOpacity=this.opacity/100;
			
			if(this.opacity >= 100)
			{
				this.img_holder1.style.filter = 'alpha(opacity = ' + this.opacity + ')';
				this.img_holder1.style.MozOpacity=this.opacity/100;
				this.img_holder1.style.opacity=this.opacity/100;
				this.img_holder1.style.khtmlOpacity=this.opacity/100;
				this.stopBeginFade();	
			}
		}

		slideShow.prototype.stopBeginFade = function()
		{
			clearInterval(this.begin_IntervalId);
		}
		
		/////////// Amination and image change methods /////////////////////////
		slideShow.prototype.changeImg = function()
		{	
			this.stopSlideshow();
			this.opacity = 100;
			this.img_holder2.style.filter = 'alpha(opacity = ' + this.opacity + ')';
			this.img_holder2.style.MozOpacity=this.opacity/100;
			this.img_holder2.style.opacity=this.opacity/100;
			this.img_holder2.style.khtmlOpacity=this.opacity/100;

			if(this.randomNum == true)
			{
				imgCt = this.image_array.length;
				randomNum = Math.floor((Math.random()* imgCt));
				
				this.img_holder2.src = this.image_array[this.lastRandom];	
				this.image_number = randomNum;
				this.img_holder1.src = this.image_array[this.image_number];
				this.lastRandom = randomNum;
				this.randomNum = false;
			}
			else
			{
				this.img_holder2.src = this.image_array[this.image_number];	
				this.image_number = this.image_number + 1;
	
				if(this.image_number == this.image_array.length)
				{				
					this.image_number =  0;
				}		
		
				this.img_holder1.src = this.image_array[this.image_number];			
			}
			
			this.playSlideshow();
		}			

		slideShow.prototype.fadeImage = function()
		{
			this.opacity = this.opacity - 5;
			this.img_holder2.style.filter = 'alpha(opacity = ' + this.opacity + ')';
			this.img_holder2.style.MozOpacity=this.opacity/100;
			this.img_holder2.style.opacity=this.opacity/100;
			this.img_holder2.style.khtmlOpacity=this.opacity/100;
			
			if(this.opacity <= 0)
			{
				this.changeImg();
			}
		}	
		
		slideShow.prototype.playSlideshow = function()
		{
			var instant = this;
			this.IntervalId = setTimeout(function() {instant.startSlideshow()}, this.change_speed);	
		}
		
		slideShow.prototype.startSlideshow = function()
		{
			var instant = this;
			this.Fade_IntervalId = setInterval(function() {instant.fadeImage()}, this.fade_speed);	
		}
		
		slideShow.prototype.stopSlideshow = function()
		{
			clearInterval(this.Fade_IntervalId);
		}
		
//EndClass

