﻿var fadebgcolor = '#FFFFFF'; var fadearray = []; var fadeclear = []; function fadeshow(a, b, c, d, e, f, g) { this.pausecheck = f; this.mouseovercheck = 0; this.delay = e; this.degree = 10; this.curimageindex = 0; this.nextimageindex = 1; fadearray[fadearray.length] = this; this.slideshowid = fadearray.length - 1; this.canvasbase = 'canvas' + this.slideshowid; this.curcanvas = this.canvasbase + '_0'; if (typeof g != 'undefined') a.sort(function() { return 0.5 - Math.random() }); this.theimages = a; this.imageborder = parseInt(d); this.postimages = []; for (p = 0; p < a.length; p++) { this.postimages[p] = new Image(); this.postimages[p].src = a[p][0] } b += this.imageborder * 2; c += this.imageborder * 2; document.write('<div id="master' + this.slideshowid + '" style="position:relative;width:' + b + 'px;height:' + c + 'px;"><div id="' + this.canvasbase + '_0"style="position:absolute;width:' + b + 'px;height:' + c + 'px;top:0;left:0;filter:alpha(opacity=10);opacity:0.1;background-color:' + fadebgcolor + '"></div><div id="' + this.canvasbase + '_1" style="position:absolute;width:' + b + 'px;height:' + c + 'px;top:0;left:0;filter:alpha(opacity=10);opacity:0.1;background-color:' + fadebgcolor + '"></div></div>'); this.startit() }; function fadepic(a) { if (a.degree < 100) { a.degree += 10; a.tempobj.style.filter = 'alpha(opacity=' + a.degree + ')'; a.tempobj.style.opacity = a.degree / 100 } else { clearInterval(fadeclear[a.slideshowid]); a.nextcanvas = (a.curcanvas == a.canvasbase + '_0') ? a.canvasbase + '_0' : a.canvasbase + '_1'; a.tempobj = document.getElementById(a.nextcanvas); a.populateslide(a.tempobj, a.nextimageindex); a.nextimageindex = (a.nextimageindex < a.postimages.length - 1) ? a.nextimageindex + 1 : 0; setTimeout('fadearray[' + a.slideshowid + '].rotateimage()', a.delay) } }; fadeshow.prototype.populateslide = function(a, b) { var c = ''; if (this.theimages[b][1] != '') c = '<a href="' + this.theimages[b][1] + '" target="' + this.theimages[b][2] + '">'; c += '<img src="' + this.postimages[b].src + '" border="' + this.imageborder + 'px" >'; if (this.theimages[b][1] != '') c += '</a>'; a.innerHTML = c }; fadeshow.prototype.rotateimage = function() { if (this.pausecheck == 1) var a = this; if (this.mouseovercheck == 1) setTimeout(function() { a.rotateimage() }, 100); else { this.resetit(); var b = this.tempobj = document.getElementById(this.curcanvas); b.style.zIndex++; fadeclear[this.slideshowid] = setInterval('fadepic(fadearray[' + this.slideshowid + '])', 50); this.curcanvas = (this.curcanvas == this.canvasbase + '_0') ? this.canvasbase + '_1' : this.canvasbase + '_0' } this.curimageindex = (this.curimageindex < this.postimages.length - 1) ? this.curimageindex + 1 : 0 }; fadeshow.prototype.resetit = function() { this.degree = 10; var a = document.getElementById(this.curcanvas); a.style.opacity = this.degree / 100; a.style.filter = 'alpha(opacity=' + this.degree + ')' }; fadeshow.prototype.startit = function() { var a = document.getElementById(this.curcanvas); this.populateslide(a, this.curimageindex); if (this.pausecheck == 1) { var b = this; var c = document.getElementById('master' + this.slideshowid); c.onmouseover = function() { b.mouseovercheck = 1 }; c.onmouseout = function() { b.mouseovercheck = 0 } } this.rotateimage() };