//Fade-in image slideshow- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

var slideshow_width=150 //SET IMAGE WIDTH
var slideshow_height=110 //SET IMAGE HEIGHT
var pause=2000 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)
var hiddenpause=1000
var curimageindex=new Array()
var nextimageindex=new Array()
var tempobj=new Array()
var curpos=10
var degree=10
var curcanvas="canvas0"

////NO need to edit beyond here/////////////

function preloadslides(num) {
	var preloadedimages=new Array()
	
	for (p=0;p<fadeimages[num].length;p++){
		preloadedimages[p]=new Image()
		preloadedimages[p].src=fadeimages[num][p]
	}
}

function printshow(num) {

	var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
	var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1

	if (fadetxt[num]) {	
		if (ie4||dom)
		document.write('<div style="position:relative;width:'+slideshow_width+'px;height:'+slideshow_height+'px;overflow:hidden;background-color:'+backgroundcolor+';"><div id="canvas0'+num+'" style="position:absolute;width:'+slideshow_width+'px;height:'+slideshow_height+'px;top:0;left:0;filter:alpha(opacity=0);-moz-opacity:0;background-color:'+backgroundcolor+';"></div><div id="canvas1'+num+'" style="position:absolute;width:'+slideshow_width+'px;height:'+slideshow_height+'px;top:0;left:0;filter:alpha(opacity=0);-moz-opacity:10;background-color:'+backgroundcolor+';"></div></div>')
		else
		document.write(fadetxt[num][0])
		
		curimageindex[num]=0
		nextimageindex[num]=(fadetxt[num][1]?1:0)
	}
}

function fadepic(){

if (curpos<100){
	curpos+=10
	for (i=0;i<canvascount;i++) {
		if (fadetxt[i].length) {
			if (tempobj[i].filters)
				tempobj[i].filters.alpha.opacity=curpos
			else if (tempobj[i].style.MozOpacity)
			tempobj[i].style.MozOpacity=curpos/100
		}
	}
} else {
	clearInterval(dropslide)
	nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
	for (i=0;i<canvascount;i++) {
		if (fadetxt[i].length) {
			tempobj[i]=ie4? eval("document.all."+nextcanvas+i) : document.getElementById(nextcanvas+i)
			tempobj[i].innerHTML=fadetxt[i][nextimageindex[i]]
			nextimageindex[i]=(nextimageindex[i]<fadeimages[i].length-1)? nextimageindex[i]+1 : 0
		}
	}
	setTimeout("rotateimage()",pause)
}

}


function rotateimage(){

if (ie4||dom){
	resetit(curcanvas)
	for (i=0;i<canvascount;i++) {
		if (fadetxt[i].length) {
			var crossobj=tempobj[i]=ie4? eval("document.all."+curcanvas+i) : document.getElementById(curcanvas+i)
			crossobj.style.zIndex++
		}
	}
	var temp='setInterval("fadepic()",100)'
	dropslide=eval(temp)
	curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
}
else
	for (i=0;i<canvascount;i++) {
		if (fadetxt[i].length) {
			document.images.defaultslide.src=fadeimages[i][curimageindex[i]]
			curimageindex[i]=(curimageindex[i]<fadeimages.length-1)? curimageindex[i]+1 : 0
		}
	}
}


function resetit(what){

	curpos=0
	
	for (i=0;i<canvascount;i++) {
		
		var crossobj=ie4? eval("document.all."+what+i) : document.getElementById(what+i)
		
		if (crossobj) {
			if (crossobj.filters)
			crossobj.filters.alpha.opacity=curpos
			else if (crossobj.style.MozOpacity)
			crossobj.style.MozOpacity=curpos/100
		}
	}
}

function startit(){
	for (i=0;i<canvascount;i++) {
		if (fadetxt[i].length) {
			var crossobj=ie4? eval("document.all."+curcanvas+i) : document.getElementById(curcanvas+i)
			crossobj.innerHTML=fadetxt[i][0]
		}
	}
	rotateimage()
}
