
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


<!-- http://www.permadi.com/tutorial/jsImgSlide/index2.html  -->

function Slide(imageFilename, delay, transitionEffectId, link, linkText)
{
   // properties:
	this.image=new Image();
	this.image.src=imageFilename;
	this.delay=delay;
	if (transitionEffectId==-1)
		this.transition=-1;
	if (transitionEffectId==-2)
		this.transition=-2;
	else if (transitionEffectId>=0 && transitionEffectId<Slide.prototype.numFilters)
  	   this.transition=Slide.prototype.filters[transitionEffectId];
	this.link=link;
	this.linkText=linkText;
	
	// functions to 
	this.isReady=function(){return this.image.complete;};
	// returns the current filter and rotates filter 
	this.getFilter=function()
	{
	  // -1 indicates no filter
 	  if (this.transition==-1)
 	  	return 0;
	  //  -2 indicates use any
	  if (this.transition && this.transition!=-2)
  	    return this.transition;
	  Slide.prototype.currentFilter++;
	  if (Slide.prototype.currentFilter>Slide.prototype.numFilters)
		 Slide.prototype.currentFilter=0;
	  return Slide.prototype.filters[Slide.prototype.currentFilter];
	};
	// returns the number of miliseconds of the delay value specified
	this.getDelay=function(){return this.delay*1000;};
	this.getImage=function(){return this.image;};
	this.getImageWidth=function(){return this.image.width;};
	this.getImageHeight=function(){return this.image.height;};
	this.getImageSrc=function(){return this.image.src;};
	this.getSize=function(){return this.size;};
	this.getLink=function(){return this.link;};
	this.getLinkText=function()
	{
	  if (this.linkText=="")
	    return"&nbsp;";
	  return this.linkText;
	};
   // increment counter (counts how many slides there are)
	Slide.prototype.size++;	   
}

//**********************************
// When user click the link, this will opens a new window to 
// display the content of linked page
//**********************************
function openLink()
{
	var link=slides[curImage].getLink();
	if (link!=0)
	{
       window.open(link);
	}
}

// Static method.  It increments static variables "numFilters" and stores filters in "filters" static array
Slide.prototype.addFilter=function(filter){Slide.prototype.filters[Slide.prototype.numFilters++]=filter};
// how fast or slow the transition animation will play (in seconds)
var transitionSpeed=2;
var slides=new Array();
var curImage=-1;
// NO NEED TO CHANGE THIS PORTION
Slide.prototype.transitionSpeed=transitionSpeed;				// seconds
Slide.prototype.size=0;
Slide.prototype.numFilters=0;
Slide.prototype.currentFilter=0;
Slide.prototype.filters=new Array();
//********************************************
// LIST OF TRANSITIONS
// you may take out the ones you don't want to use or add more.
//*******************************************
Slide.prototype.addFilter("blendTrans(duration="+transitionSpeed+");");					  // 0 fade
Slide.prototype.addFilter("revealTrans(transition=5, duration="+transitionSpeed+");");  // 1 wipe down
Slide.prototype.addFilter("revealTrans(transition=0, duration="+transitionSpeed+");");  // 2 
Slide.prototype.addFilter("revealTrans(transition=1, duration="+transitionSpeed+");");  // 3
Slide.prototype.addFilter("revealTrans(transition=2, duration="+transitionSpeed+");");  // 4
Slide.prototype.addFilter("revealTrans(transition=3, duration="+transitionSpeed+");");  // 5
Slide.prototype.addFilter("revealTrans(transition=10, duration="+transitionSpeed+");"); // 6
Slide.prototype.addFilter("revealTrans(transition=11, duration="+transitionSpeed+");"); // 7
Slide.prototype.addFilter("revealTrans(transition=12, duration="+transitionSpeed+");"); // 8
Slide.prototype.addFilter("revealTrans(transition=4, duration="+transitionSpeed+");");  // 9
Slide.prototype.addFilter("revealTrans(transition=20, duration="+transitionSpeed+");"); // 10
Slide.prototype.addFilter("revealTrans(transition=14, duration="+transitionSpeed+");"); // 11

function slidePicture()
{
 	if (document.images)
	{
		var oldCurImage=curImage;
		curImage++;
		if (curImage>=slides[0].getSize())
			curImage=0;
	
		var canBeFiltered=false;
		if (document.images.myImage)// && 
		{
  		   target=document.images.myImage;
  		   if (document.images.myImage.style)// && document.images.myImage.style.filters)
  		   {
			  canBeFiltered=true;
			}
		}
		if (document.all && document.getElementById("myImage"))
		{
			target= document.getElementById("myImage");
			// If the browser doesn't support "style" or
			// if user specified filter value of 0, then do not use filter
			if (target.style && slides[curImage].getFilter()!=0)
				canBeFiltered=true;
		}
		
       // 	Check if the next image is loaded yet.
       // Note here, if you put an invalid filename on
       // your list, the slide might get stuck here,
       // So make sure all the image filenames are
       // correct.
		if (slides[curImage].isReady())
		{
			if (canBeFiltered)
			{
      			target.style.filter=slides[curImage].getFilter();
      			if (target.filters && target.filters[0])
      			{
		       	target.filters[0].Apply();
		       }
 	       }
 	       
			//target.src=slides[curImage].getImageSrc();
			//alert(slides[curImage].getImageSrc());
			crossfade(document.getElementById('myImage'), slides[curImage].getImageSrc(), '2', 'Accessible Website Menu [white]')
			// netscape 4.8 doesn support these, so you might want to use
			// same sized image if you want it to look nice on that browser
			target.height=slides[curImage].getImageHeight();
			target.width=slides[curImage].getImageWidth();
			
			// chane link text
			if (document.getElementById && document.getElementById("myImageLink"))
 				document.getElementById("myImageLink").innerHTML=slides[curImage].getLinkText();
 				//crossfade(document.getElementById('myImage'), , '2', 'Accessible Website Menu [white]')

			if (canBeFiltered)
			{
			   	if (target.filters && target.filters[0])
			   	{
	  		      	target.filters[0].Play();
	  		    }
			}
			// This basically says:
			// Execute this function again after showing
			// the image for the time specified in the delay.
			//crossfade(document.getElementById('myImage'), , '2', 'Accessible Website Menu [white]')
			setTimeout("slidePicture()", slides[curImage].getDelay());
		}	
		// Next image is not loaded yet, restore counter
		// and check back in 500 miliseconds
		else
		{
			curImage=oldCurImage;
			setTimeout("slidePicture()", 500);
			
		}
	}
}

