/***********************************************
* Fade-in image slideshow script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
//
// Modified to handle Safari.  Also uses a browser sniffer script (from Dynamic Drive)
// before this to determine if fading should be disabled.
//

//var slideshow_width='425px' //SET IMAGE WIDTH
//var slideshow_height='425px' //SET IMAGE HEIGHT
var pause=2500 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)
var flash=false; //flash the underlying page.  Make underlying page white to simulate camera flash.  

////NO need to edit beyond here/////////////
//var preloadedimages=new Array()
//for (p=0;p<fadeimages.length;p++){1
//preloadedimages[p]=new Image()
//preloadedimages[p].src=fadeimages[p]
//}

var ie4=document.all
var dom=document.getElementById

if (!(op5||op6||op7||kde) && (ie4||dom) )
document.write('<div class="container" style="width:'+slideshow_width+';height:'+slideshow_height+'"><div id="canvas0" style="width:'+slideshow_width+';height:'+slideshow_height+'"></div><div id="canvas1" style="width:'+slideshow_width+';height:'+slideshow_height+';visibility:hidden"></div><div class="overlay"></div></div>')
else
document.write('<table cellpadding="0" cellspacing="0"><tr><td class="main" height="'+slideshow_height+'" width="'+slideshow_width+'" valign="middle" align="center"><img name="defaultslide" src="'+fadeimages[0]+'"></td></tr></table>')

function setOpacity(obj,x){
if (obj.filters)
obj.filters.alpha.opacity=x;
else if (obj.style.MozOpacity)
obj.style.MozOpacity=x/101;
else if (obj.style.KhtmlOpacity)
obj.style.KhtmlOpacity=x/101;
else
obj.style.opacity=x/101;
}

function fadepic(curpos,nextimageindex,curr,name,height,width,timer,imgarray){
var tempobj;
if (curpos<100){
curpos+=5;
var curcanvas=name+""+curr;
tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas);
setOpacity(tempobj,curpos);
setTimeout("fadepic("+curpos+","+nextimageindex+","+curr+",'"+name+"','"+height+"','"+width+"',"+timer+",'"+imgarray+"')",40);
}else{
curr=(curr==0)? 1 : 0;
var curcanvas=name+""+curr;
images=eval(imgarray);
tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas);
tempobj.innerHTML='<table cellpadding="0" cellspacing="0"><tr><td class="main" height="'+height+'" width="'+width+'" valign="middle" align="center"><img src="'+images[nextimageindex]+'"></td></tr></table>'
nextimageindex=(nextimageindex<images.length-1)? nextimageindex+1 : 0;
tempobj.style.visibility="hidden";
timer=Math.floor(Math.random()*2000+timer);
setTimeout("rotateimage("+nextimageindex+","+curr+",'"+name+"',false,'"+height+"','"+width+"',"+timer+",'"+imgarray+"')",timer);
}
}

function rotateimage(nextimageindex,curr,name,first,height,width,timer,imgarray){
if (ie4||dom){
var curcanvas=name+""+curr;
var prevcanvas=(curr==0)? name+"1" : name+"0";
resetit(curcanvas);
var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas);
//alert(curcanvas);
if(!first){
  var tempobj2=ie4? eval("document.all."+prevcanvas) : document.getElementById(prevcanvas);
  var tmp=tempobj2.style.zIndex;
  tempobj2.style.zIndex=crossobj.style.zIndex;
  crossobj.style.zIndex=tmp;
  if(flash)
    tempobj2.style.visibility="hidden"
}
crossobj.style.visibility="visible";
setTimeout("fadepic(5,"+nextimageindex+","+curr+",'"+name+"','"+height+"','"+width+"',"+timer+",'"+imgarray+"')",40);
}
}

function resetit(what){
curpos=5
var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
setOpacity(crossobj,curpos);
}

function startit(){
var curcanvas="canvas0";
var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.innerHTML='<table cellpadding="0" cellspacing="0"><tr><td class="main" height="'+slideshow_height+'" width="'+slideshow_width+'" valign="middle" align="center"><img src="'+fadeimages[0]+'"></td></tr></table>'
crossobj.style.zIndex++;
rotateimage(1,0,"canvas",true,slideshow_height,slideshow_width,pause,'fadeimages');
}

if ( !(op5||op6||op7||kde) && (ie4||dom))
window.onload=startit
