var slideshowspeed;
var fadeduration=300; //Speed of overlap of two slides: in milliseconds
var fadeimages=new Array();
fadeimages[0]="http://mths.schoolfusion.us/modules/groups/homepagefiles/cms/486457/Image/slideshow/rotator1mths.jpg";
var slideshowpicnum = 0;
var slideshowcount = fadeimages.length;
//preload of images
var preLoad = new Array();
for (i = 0; i < slideshowcount; i++) {
preLoad[i] = new Image();
preLoad[i].src = fadeimages[i];
}
//Called function from cms_ui.php
function fadeshow(fadeimages, width, height, var1, speed, var2, var3) {
//alert(slideshowcount);
if(slideshowcount==0) {
document.write("
");
return;
}
if(slideshowcount==1) {
document.write("");
document.write("

");
document.write("
");
return;
}
document.write("");
var slideshow = document.getElementById('slideshowrotator');
//
slideshow.innerHTML='';
var slideshowOuter = document.getElementById('slideshowOuter');
slideshowOuter.innerHTML="
";
slideshowOuter.innerHTML=slideshowOuter.innerHTML+"
";
slideshowspeed=speed;
startSlideshow();
}
//Start the slideshow
function startSlideshow() {
var first = slideshowpicnum;
slideshowpicnum = slideshowpicnum + 1;
if (slideshowpicnum > (slideshowcount - 1)) slideshowpicnum = 0;
var second = slideshowpicnum;
blendimage('rotatorImg1', 'rotatorImg2', fadeimages[first], fadeimages[second], fadeduration);
setTimeout('startSlideshow()', slideshowspeed);
}
function blendimage(imageid1, imageid2, imagefile1, imagefile2, millisec) {
var speed = Math.round(millisec / 100);
var timer = 0;
changeOpac(100, imageid1);
changeOpac(0, imageid2);
document.getElementById(imageid1).src = imagefile1;
document.getElementById(imageid2).src = imagefile2;
var o;
for(i = 0; i <= 100; i+=10) {
o=100-i;
//setTimeout("changeOpac(" + o + ",'" + imageid1 + "')",(timer * speed));
setTimeout("changeOpac(" + i + ",'" + imageid2 + "')",(timer * speed));
timer+=10;
}
}
function changeOpac(opacity, id) {
var object = document.getElementById(id).style;
object.opacity = (opacity / 100);
object.MozOpacity = (opacity / 100);
object.KhtmlOpacity = (opacity / 100);
object.filter = "alpha(opacity=" + opacity + ")";
}