/***********************************************
* Ultimate Fade-In Slideshow (v1.5): ¸ Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
 
var fadetexts=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadetexts[0]=["howdy"] //plain image syntax
fadetexts[1]=["stiff"] //image with link syntax
fadetexts[2]=["new"] //image with link and target syntax
 
var fadetexts2=new Array() //2nd array set example. Remove or add more sets as needed.
//SET IMAGE PATHS. Extend or contract array as needed
fadetexts2[0]=["dfsd"] //plain image syntax
fadetexts2[1]=["fdsa"] //image with link syntax
fadetexts2[2]=["_new"] //image with link and target syntax
 
var txtfadebgcolor=""
 
////NO need to edit beyond here/////////////
 
var fadetxtarray=new Array() //array to cache fadeshow instances
var fadetxtclear=new Array() //array to cache corresponding clearinterval pointers
 
var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all
 
function fadetxtshow(thetexts, fadewidth, fadeheight, borderwidth, delay, pause, displayorder, bgcolor){
this.displaytext = true;
this.pausecheck=pause;
this.mouseovercheck=0;
this.delay=delay;
this.degree=10; //initial opacity degree (10%)
this.curtextindex=0;
this.nexttextindex=1;
fadetxtarray[fadetxtarray.length]=this;
this.slideshowid=fadetxtarray.length-1;
this.textcanvasbase="text"+this.slideshowid;
this.textcurcanvas=this.textcanvasbase+"_0";
if (displayorder!="undefined")
	thetexts.sort(function() {return 0.5 - Math.random();}); //thanks to Mike (aka Mwinter) :)
this.thetexts=thetexts
this.textborder=parseInt(borderwidth)
this.posttexts=new Array() //preload images
for (p=0;p<thetexts.length;p++){
	this.posttexts[p]=thetexts[p][0]
}
//alert(displayorder);
var fadewidth=fadewidth+this.textborder*2
var fadeheight=fadeheight+this.textborder*2
//alert(bgcolor);
if (bgcolor == "undefined")
	bgcolor = "#FFFFFF";
 
	if (iebrowser&&dom||dom) {//if IE5+ or modern browsers (ie: Firefox)
		document.write('<div id="mastertext'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.textcanvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;-khtml-opacity:10;background-color:'+bgcolor+'"></div><div id="'+this.textcanvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;background-color:'+bgcolor+'"></div></div>')
	} else
		document.write('<div>'+this.posttexts[0]+'</div>')
 
	if (iebrowser&&dom||dom) {//if IE5+ or modern browsers such as Firefox
		this.startit()
	}else{
		this.curtextindex++
		setInterval("fadetxtarray["+this.slideshowid+"].rotatetext()", this.delay)
	}
}

function fadetext(obj){
if (obj.degree<100){
	obj.degree+=10
	if (obj.temptextobj.filters&&obj.temptextobj.filters[0]){
		if (typeof obj.temptextobj.filters[0].opacity=="number") { //if IE6+
			obj.temptextobj.filters[0].opacity=obj.degree//KO
		}else { //else if IE5.5-
			obj.temptextobj.style.filter="alpha(opacity="+obj.degree+")"
		}
	} else if (obj.temptextobj.style.MozOpacity) {
		obj.temptextobj.style.MozOpacity=obj.degree/101 //KO
	} else if (obj.temptextobj.style.KhtmlOpacity) {
		obj.temptextobj.style.KhtmlOpacity=obj.degree/100
	}
} else {
	clearInterval(fadetxtclear[obj.slideshowid])
	obj.nexttextcanvas=(obj.textcurcanvas==obj.textcanvasbase+"_0")? obj.textcanvasbase+"_0" : obj.textcanvasbase+"_1" //KO
	obj.temptextobj=iebrowser? iebrowser[obj.nexttextcanvas] : document.getElementById(obj.nexttextcanvas) //KO
	obj.populatetextslide(obj.temptextobj, obj.nexttextindex) //KO
	obj.nexttextindex=(obj.nexttextindex<obj.posttexts.length-1)? obj.nexttextindex+1 : 0
	if (obj.thetexts.length > 1)
	setTimeout("fadetxtarray["+obj.slideshowid+"].rotatetext()", obj.delay)
}
}

fadetxtshow.prototype.populatetextslide=function(textobject, textindex) {
var textHTML=""
if ((this.thetexts.length < 2 && textindex < 1) || this.thetexts.length > 1) {
if (this.thetexts[textindex][1]!="")
	textHTML+='<a href=\"'+this.thetexts[textindex][1]+"\">"
if (this.thetexts[textindex][0]!="") //if picture text exists
   textHTML+=this.thetexts[textindex][0]
if (this.thetexts[textindex][1]!="")
	textHTML+='</a>'
}
textobject.innerHTML=textHTML
}	
 
fadetxtshow.prototype.rotatetext=function(){
	if (this.pausecheck==1) //if pause onMouseover enabled, cache object
		var cacheobj=this
	if (this.mouseovercheck==1)
		setTimeout(function(){cacheobj.rotatetext()}, 100)
	else if (iebrowser&&dom||dom){
		this.resetit()
		var crosstextobj=this.temptextobj=iebrowser? iebrowser[this.textcurcanvas] : document.getElementById(this.textcurcanvas) //KO
		crosstextobj.style.zIndex++ //KO
		fadetxtclear[this.slideshowid]=setInterval("fadetext(fadetxtarray["+this.slideshowid+"])",50)
		this.textcurcanvas=(this.textcurcanvas==this.textcanvasbase+"_0")? this.textcanvasbase+"_1" : this.textcanvasbase+"_0" //KO
	} else {
		//var ns4imgobj=document.images['defaultslide'+this.slideshowid]
		//ns4imgobj.src=this.postimages[this.curimageindex].src
	}
	this.curtextindex=(this.curtextindex<this.posttexts.length-1)? this.curtextindex+1 : 0
}
 
fadetxtshow.prototype.resetit=function(){
this.degree=10
var textcrossobj=iebrowser? iebrowser[this.textcurcanvas] : document.getElementById(this.textcurcanvas)
if (textcrossobj.filters&&textcrossobj.filters[0]){
	if (typeof textcrossobj.filters[0].opacity=="number") { //if IE6+
		textcrossobj.filters(0).opacity=this.degree
	} else { //else if IE5.5-
		textcrossobj.style.filter="alpha(opacity="+this.degree+")"
	}
} else if (textcrossobj.style.MozOpacity) {
	textcrossobj.style.MozOpacity=this.degree/101
} else if (textcrossobj.style.KhtmlOpacity) {
	textcrossobj.style.KhtmlOpacity=obj.degree/100
}
} 
 
fadetxtshow.prototype.startit=function(){
var textcrossobj=iebrowser? iebrowser[this.textcurcanvas] : document.getElementById(this.textcurcanvas)
this.populatetextslide(textcrossobj, this.curtextindex)
if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
var cacheobj=this
var crossobjcontainer=iebrowser? iebrowser["mastertext"+this.slideshowid] : document.getElementById("mastertext"+this.slideshowid)
crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
}
this.rotatetext()
}
 
