// (c)2007 Zarr - http://www.zarr.com/ // To use this JS fader,use javascript in your template/page similar to below // // var homepage1 = new Array() //SET IMAGE PATHS. Extend or contract array as needed homepage1[0] = ["/images/template/main_pic_1_blank.jpg", "", ""] //plain image syntax homepage1[1] = ["/images/template/main_pic_1a.jpg", "", ""] //plain image syntax homepage1[2] = ["/images/template/main_pic_1b.jpg", "", ""] //plain image syntax homepage1[3] = ["/images/template/main_pic_1c.jpg", "", ""] //plain image syntax var homepage2 = new Array() //SET IMAGE PATHS. Extend or contract array as needed homepage2[0] = ["/images/template/main_pic_2_blank.jpg", "", ""] //plain image syntax homepage2[1] = ["/images/template/main_pic_2a.jpg", "", ""] //plain image syntax homepage2[2] = ["/images/template/main_pic_2b.jpg", "", ""] //plain image syntax homepage2[3] = ["/images/template/main_pic_2c.jpg", "", ""] //plain image syntax var homepage3 = new Array() //SET IMAGE PATHS. Extend or contract array as needed homepage3[0] = ["/images/template/main_pic_3_blank.jpg", "", ""] //plain image syntax homepage3[1] = ["/images/template/main_pic_3a.jpg", "", ""] //plain image syntax homepage3[2] = ["/images/template/main_pic_3b.jpg", "", ""] //plain image syntax homepage3[3] = ["/images/template/main_pic_3c.jpg", "", ""] //plain image syntax var homepage4 = new Array() //SET IMAGE PATHS. Extend or contract array as needed homepage4[0] = ["/images/template/main_pic_4_blank.jpg", "", ""] //plain image syntax homepage4[1] = ["/images/template/main_pic_4a.jpg", "", ""] //plain image syntax homepage4[2] = ["/images/template/main_pic_4b.jpg", "", ""] //plain image syntax homepage4[3] = ["/images/template/main_pic_4c.jpg", "", ""] //plain image syntax var homepage5 = new Array() //SET IMAGE PATHS. Extend or contract array as needed homepage5[0] = ["/images/template/main_pic_5_blank.jpg", "", ""] //plain image syntax homepage5[1] = ["/images/template/main_pic_5a.jpg", "", ""] //plain image syntax homepage5[2] = ["/images/template/main_pic_5b.jpg", "", ""] //plain image syntax homepage5[3] = ["/images/template/main_pic_5c.jpg", "", ""] //plain image syntax var homepage6 = new Array() //SET IMAGE PATHS. Extend or contract array as needed homepage6[0] = ["/images/template/main_pic_6_blank.jpg", "", ""] //plain image syntax homepage6[1] = ["/images/template/main_pic_6a.jpg", "", ""] //plain image syntax homepage6[2] = ["/images/template/main_pic_6b.jpg", "", ""] //plain image syntax homepage6[3] = ["/images/template/main_pic_6c.jpg", "", ""] //plain image syntax var homepage7 = new Array() //SET IMAGE PATHS. Extend or contract array as needed homepage7[0] = ["/images/template/main_pic_7_blank.jpg", "", ""] //plain image syntax homepage7[1] = ["/images/template/main_pic_7a.jpg", "", ""] //plain image syntax homepage7[2] = ["/images/template/main_pic_7b.jpg", "", ""] //plain image syntax homepage7[3] = ["/images/template/main_pic_7c.jpg", "", ""] //plain image syntax var fadebgcolor = "white" ////NO need to edit beyond here///////////// var fadearray = new Array() //array to cache fadeshow instances var fadeclear = new Array() //array to cache corresponding clearinterval pointers var dom = (document.getElementById) //modern dom browsers var iebrowser = document.all function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder) { this.pausecheck = pause this.mouseovercheck = 0 this.rotatecheck = 0 this.delay = delay this.degree = 30 //initial opacity 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 displayorder != "undefined") theimages.sort(function() { return 0.5 - Math.random(); }) //thanks to Mike (aka Mwinter) :) this.theimages = theimages this.imageborder = parseInt(borderwidth) this.postimages = new Array() //preload images for (p = 0; p < theimages.length; p++) { this.postimages[p] = new Image() this.postimages[p].src = theimages[p][0] } var fadewidth = fadewidth + this.imageborder * 2 var fadeheight = fadeheight + this.imageborder * 2 if (iebrowser && dom || dom) //if IE5+ or modern browsers (ie: Firefox) document.write('
') else document.write('
') if (iebrowser && dom || dom) //if IE5+ or modern browsers such as Firefox this.startit() else { this.curimageindex++ setInterval("fadearray[" + this.slideshowid + "].rotateimage()", this.delay) } } function fadepic(obj) { if (obj.degree < 100) { obj.degree += 10 if (obj.tempobj.filters && obj.tempobj.filters[0]) { if (typeof obj.tempobj.filters[0].opacity == "number") //if IE6+ obj.tempobj.filters[0].opacity = obj.degree else //else if IE5.5- obj.tempobj.style.filter = "alpha(opacity=" + obj.degree + ")" } else if (obj.tempobj.style.MozOpacity) obj.tempobj.style.MozOpacity = obj.degree / 101 else if (obj.tempobj.style.KhtmlOpacity) obj.tempobj.style.KhtmlOpacity = obj.degree / 100 } else { clearInterval(fadeclear[obj.slideshowid]) obj.nextcanvas = (obj.curcanvas == obj.canvasbase + "_0") ? obj.canvasbase + "_0" : obj.canvasbase + "_1" obj.tempobj = iebrowser ? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas) obj.populateslide(obj.tempobj, obj.nextimageindex) obj.nextimageindex = (obj.nextimageindex < obj.postimages.length - 1) ? obj.nextimageindex + 1 : 0 setTimeout("fadearray[" + obj.slideshowid + "].rotateimage()", obj.delay) obj.delay = 13000 } } fadeshow.prototype.populateslide = function(picobj, picindex) { var slideHTML = "" if (this.theimages[picindex][1] != "") //if associated link exists for image slideHTML = '' slideHTML += '' if (this.theimages[picindex][1] != "") //if associated link exists for image slideHTML += '' picobj.innerHTML = slideHTML } fadeshow.prototype.rotateimage = function() { if (this.pausecheck == 1) //if pause onMouseover enabled, cache object var cacheobj = this if (this.mouseovercheck == 1) setTimeout(function() { cacheobj.rotateimage() }, 100) else if (iebrowser && dom || dom) { this.resetit() var crossobj = this.tempobj = iebrowser ? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas) crossobj.style.zIndex++ fadeclear[this.slideshowid] = setInterval("fadepic(fadearray[" + this.slideshowid + "])", 90) this.curcanvas = (this.curcanvas == this.canvasbase + "_0") ? this.canvasbase + "_1" : this.canvasbase + "_0" } else { var ns4imgobj = document.images['defaultslide' + this.slideshowid] ns4imgobj.src = this.postimages[this.curimageindex].src } this.curimageindex = (this.curimageindex < this.postimages.length - 1) ? this.curimageindex + 1 : 0 this.rotatecheck = this.rotatecheck + 1 } fadeshow.prototype.resetit = function() { this.degree = 30 var crossobj = iebrowser ? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas) if (crossobj.filters && crossobj.filters[0]) { if (typeof crossobj.filters[0].opacity == "number") //if IE6+ crossobj.filters(0).opacity = this.degree else //else if IE5.5- crossobj.style.filter = "alpha(opacity=" + this.degree + ")" } else if (crossobj.style.MozOpacity) crossobj.style.MozOpacity = this.degree / 101 else if (crossobj.style.KhtmlOpacity) crossobj.style.KhtmlOpacity = obj.degree / 100 } fadeshow.prototype.startit = function() { var crossobj = iebrowser ? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas) this.populateslide(crossobj, this.curimageindex) if (this.pausecheck == 1) { //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER var cacheobj = this var crossobjcontainer = iebrowser ? iebrowser["master" + this.slideshowid] : document.getElementById("master" + this.slideshowid) crossobjcontainer.onmouseover = function() { cacheobj.mouseovercheck = 1 } crossobjcontainer.onmouseout = function() { cacheobj.mouseovercheck = 0 } } this.rotateimage() }