function slideShow(divid,imageid,imageFiles,displaySecs,delayStart){
	this.durationFade=0;
	
	this.slideCache = new Array(); 
	this.divid=divid;
	this.imageid=imageid;
	this.imageFiles=imageFiles;
	this.displaySecs=displaySecs ;
	
	this.slideOK=true;
	
	
	var self = this; 
		setTimeout(function(){ 
			self.RunSlideShow(); 
		}, delayStart*1000); 
	
	this.RunSlideShow = function() { 
		var imageSeparator = this.imageFiles.indexOf(";"); 
		var nextImage = this.imageFiles.substring(0,imageSeparator); 
		
		//this.changeOpac(0); 
		this.blendimage(nextImage,this.durationFade); 
		
		var futureImages= this.imageFiles.substring(imageSeparator+1,this.imageFiles.length)+ ';' + nextImage; 
		this.imageFiles=futureImages
		var self = this; 
		setTimeout(function(){ self.RunSlideShow(); }, (this.displaySecs+ this.durationFade)*1000); 
		this.durationFade=(this.durationFade==0)?2:this.durationFade;
		// Cache the next image to improve performance. 
		imageSeparator = futureImages.indexOf(";"); 
		nextImage = futureImages.substring(0,imageSeparator); 

		if (this.slideCache[nextImage] == null) 
		{ 
			this.slideCache[nextImage] = new Image; 
			this.slideCache[nextImage].src = nextImage; 
		} 
	}
	
	this.changeOpac = function(opacity) { 
		var object = document.getElementById(this.imageid).style; 
		object.opacity = (opacity / 100); 
		object.MozOpacity = (opacity / 100); 
		object.KhtmlOpacity = (opacity / 100); 
		object.filter = "alpha(opacity=" + opacity + ")"; 
	} 
	
	
	this.noError= function (){
		this.slideOK=false;
		var self = this; 
		setTimeout(function(){ self.RunSlideShow(); }, (this.displaySecs+ this.durationFade)*1000); 
		return true
	}	
	
	this.blendimage = function(imagefile, millisec) { 


		//alert( navigator.appName +"----"+navigator.appName.indexOf("MSIE",0)  +"----"+ navigator.appVersion )
		
		if (this.slideOK && navigator.appName.indexOf("Microsoft",0)>=0)  {
			/*
			document.getElementById(this.imageid).style.filter="blendTrans(duration="+ (millisec*1000) +")";
			document.getElementById(this.imageid).filters.blendTrans(duration=5).Apply();
   			document.getElementById(this.imageid).filters.blendTrans.Play();
			document.getElementById(this.imageid).src=imagefile;
			*/


			document.getElementById(this.imageid).style.filter="blendTrans(duration="+ (this.durationFade) +")";
			window.onerror=this.noError
			if (document.getElementById(this.imageid).filters ){
					document.getElementById(this.imageid).filters.blendTrans.Apply();
					document.getElementById(this.imageid).filters.blendTrans.Play();
			}


			document.getElementById(this.imageid).src=imagefile;
			

			
		}else{
		
			var speed = Math.round(millisec*1000 / 150); 		
			//make new image 
			//set the current image as background 
			//document.getElementById(this.divid).style.backgroundImage = "url(" + imagefile + ")"; 
			
			document.getElementById(this.divid).style.backgroundImage = "url(" + document.getElementById(this.imageid).src + ")"; 
			
			//make image transparent 
			this.changeOpac(0); 
			//document.getElementById(this.imageid).src =document.getElementById(this.imageid).src  ; 
			
			//document.getElementById(this.imageid).src =imagefile  ; 
			eval("var self = this; setTimeout(function(){ document.getElementById('"+ self.imageid +"').src ='"+ imagefile +"'; }, "+ speed +") ")
			
			//fade in image 
			var step=2
			//for(i =step; i <= 100; i+=step) 
		
			for(var i=100-step; i>=0; i-=step) 
			{ 
				eval("var self = this; setTimeout(function(){ self.changeOpac("+ (i) +"); }, "+ (i) * speed +"); ")
				
			} 
			
		}
	} 
}

/* Usage :

<div style="background-repeat: no-repeat;" id="slideshow1Div">
    <img src="http://www.macommunevueduciel.com/documents/FTP/211/173487_Small.jpg" style="border: 0 none; filter: alpha(opacity=0); -moz-opacity: 0; opacity: 0;" alt="" 
    id="slideshow1Image" />
</div> 
<script>
var slideshow1=new slideShow('slideshow1Div','slideshow1Image','http://www.macommunevueduciel.com/documents/FTP/211/173487_Small.jpg;http://www.macommunevueduciel.com/documents/FTP/211/173497_Small.jpg;http://www.macommunevueduciel.com/documents/FTP/211/173496_Small.jpg;http://www.macommunevueduciel.com/documents/FTP/211/173495_Small.jpg;http://www.macommunevueduciel.com/documents/FTP/211/173494_Small.jpg;http://www.macommunevueduciel.com/documents/FTP/211/173493_Small.jpg;http://www.macommunevueduciel.com/documents/FTP/211/173492_Small.jpg;http://www.macommunevueduciel.com/documents/FTP/211/173491_Small.jpg;http://www.macommunevueduciel.com/documents/FTP/211/173490_Small.jpg;http://www.macommunevueduciel.com/documents/FTP/211/173489_Small.jpg;http://www.macommunevueduciel.com/documents/FTP/211/173488_Small.jpg;http://www.macommunevueduciel.com/documents/FTP/211/173486_Small.jpg;http://www.macommunevueduciel.com/documents/FTP/211/173485_Small.jpg',3,0); 
</script>

*/
