var fadebgcolor = "#000000"

var img1 = "images/home_gallery/1.jpg";
var img2 = "images/home_gallery/2.jpg";
var img3 = "images/home_gallery/3.jpg";
var img4 = "images/home_gallery/4.jpg";
var img5 = "images/home_gallery/5.jpg";
var img6 = "images/home_gallery/6.jpg";
var img7 = "images/home_gallery/7.jpg";
var img8 = "images/home_gallery/8.jpg";
var img9 = "images/home_gallery/9.jpg";
var img10 = "images/home_gallery/10.jpg";
var img11 = "images/home_gallery/11.jpg";
var img12 = "images/home_gallery/12.jpg";
var img13 = "images/home_gallery/13.jpg";
var img14 = "images/home_gallery/14.jpg";
var img15 = "images/home_gallery/15.jpg";
var img16 = "images/home_gallery/16.jpg";
var img17 = "images/home_gallery/17.jpg";
var img18 = "images/home_gallery/18.jpg";
var img19 = "images/home_gallery/19.jpg";
var img20 = "images/home_gallery/20.jpg";
var img21 = "images/home_gallery/21.jpg";
var img22 = "images/home_gallery/22.jpg";
var img23 = "images/home_gallery/23.jpg";
var img24 = "images/home_gallery/24.jpg";
var img25 = "images/home_gallery/25.jpg";
var img26 = "images/home_gallery/26.jpg";
var img27 = "images/home_gallery/27.jpg";
var img27 = "images/home_gallery/28.jpg";

var caption1 = "";
var caption2 = "";
var caption3 = "";
var caption4 = "";
var caption5 = "";
var caption6 = "";
var caption7 = "";
var caption8 = "";
var caption9 = "";
var caption10 = "";
var caption11 = "";
var caption12 = "";
var caption13 = "";
var caption14 = "";
var caption15 = "";
var caption16 = "";
var caption17 = "";
var caption18 = "";
var caption19 = "";
var caption20 = "";
var caption21 = "";
var caption22 = "";
var caption23 = "";
var caption24 = "";
var caption25 = "";
var caption26 = "";
var caption27 = "";
var caption28 = "";

var link1 = "";
var link2 = "";
var link3 = "";
var link4 = "";
var link5 = "";
var link6 = "";
var link7 = "";
var link8 = "";
var link9 = "";
var link10 = "";
var link11 = "";
var link12 = "";
var link13 = "";
var link14 = "";
var link15 = "";
var link16 = "";
var link17 = "";
var link18 = "";
var link19 = "";
var link20 = "";
var link21 = "";
var link22 = "";
var link23 = "";
var link24 = "";
var link25 = "";
var link26 = "";
var link27 = "";
var link28 = "";





// #################################################################
// ##############   CHANGE NOTHING BELOW THIS!   ###################
// #################################################################

var fadeimages=new Array()
var image = "";
var link = "";
var caption = "";
for(i = 1; i <=27; i++) {
   image = eval('img' + i);
   link = eval('link' + i);
   caption = eval('caption' + i);
   if (image) {
      if (image != "") {
         fadeimages[i-1]=[image, link, "", caption];
      }
   }
}


//var fadeimages2=new Array() //2nd array set example. Remove or add more sets as needed.
//SET IMAGE PATHS. Extend or contract array as needed
//fadeimages2[0]=["wp-content/themes/theimagecollective/home_footer/photo1.jpg", "", ""] //plain image syntax
//fadeimages2[1]=["wp-content/themes/theimagecollective/home_footer/photo2.jpg", "http://", ""] //image with link syntax
//fadeimages2[2]=["wp-content/themes/theimagecollective/home_footer/photo3.jpg", "http://", "_new"] //image with link and target syntax
 
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){
//delay = 300;  // to override home page param
this.pausecheck=pause
this.mouseovercheck=0
this.delay=delay
this.degree=10 //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 == "R")
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 + 40
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)
document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div></div>')
else
document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')
 
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 if (obj.tempobj.style.opacity&&!obj.tempobj.filters)
obj.tempobj.style.opacity=obj.degree/101
}
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)
}
}
 
fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
var slideCaption=""
if (this.theimages[picindex][1]!="") { //if associated link exists for image
   slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
}
slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
if (this.theimages[picindex][1]!="") { //if associated link exists for image
   slideHTML+='</a>'
}
if (this.theimages[picindex][3]!="") { //if associated caption exists for image
   slideCaption = '<p class="caption">' + this.theimages[picindex][3] + '</p>';
}
picobj.innerHTML = slideHTML + slideCaption

}
 
 
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+"])",70)
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
}
 
fadeshow.prototype.resetit=function(){
this.degree=5
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=this.degree/100
else if (crossobj.style.opacity&&!crossobj.filters)
crossobj.style.opacity=this.degree/101
}
 
 
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()
}

