//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='200px' 
var slideshow_height='150px' 
var pause=4000

var fadeimages=new Array()

fadeimages[0]="images/slideshow/slide1.jpg"
fadeimages[1]="images/slideshow/slide2.jpg"
fadeimages[2]="images/slideshow/slide3.jpg"
fadeimages[3]="images/slideshow/slide4.jpg"

////NO need to edit beyond here/////////////

var preloadedimages=new Array()
for (p=0;p<fadeimages.length;p++){
preloadedimages[p]=new Image()
preloadedimages[p].src=fadeimages[p]
}

fade=false
version=0
if (navigator.appVersion.indexOf("MSIE")!=-1){
temp=navigator.appVersion.split("MSIE")
version=parseFloat(temp[1])
}
IE6 = false
if (version>=6) IE6 = true
NS6 = (navigator.userAgent.indexOf('Gecko') != -1)
KHTML = (navigator.userAgent.indexOf('KHTML') != -1)
if (IE6||NS6||KHTML) fade=true
// OCB 11/22/04 Now uses IE6||NS6 for fading transitions - ie4||dom creates errors in ie<6

var ie4=document.all
var dom=document.getElementById
var curpos=10
var degree=10
var curcanvas="canvas0"
var curimageindex=Math.floor(Math.random()*fadeimages.length)
var nextimageindex=curimageindex+1

if (fade)
document.write('<div id="slideshow" style="position:relative;width:'+slideshow_width+';height:'+slideshow_height+';overflow:hidden;"><div id="canvas0" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;left:0;"></div><div id="canvas1" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;left:0;"></div></div>')
else
document.write('<img id="slideshow" name="defaultslide" src="'+fadeimages[curimageindex]+'">')
// OCB 11/22/04 Added id="slideshow" to pick up css style

function setOpacity(obj, opacity) {
  opacity = (opacity >= 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function fadepic(){
if (curpos<=100){
curpos+=5
setOpacity(tempobj,curpos)
}
else{
clearInterval(dropslide)
nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj.innerHTML='<img src="'+fadeimages[nextimageindex]+'">'
nextimageindex=(nextimageindex<fadeimages.length-1)? nextimageindex+1 : 0
setTimeout("rotateimage()",pause)
}
}

function rotateimage(){
if (fade){
resetit(curcanvas)
var crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.style.zIndex++
var temp='setInterval("fadepic()",50)'
dropslide=eval(temp)
curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
}
else
document.images.defaultslide.src=fadeimages[curimageindex]
curimageindex=(curimageindex<fadeimages.length-1)? curimageindex+1 : 0
}

function resetit(what){
curpos=10
var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
setOpacity(crossobj,curpos)
}

if (fade) {
var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.innerHTML='<img src="'+fadeimages[curimageindex]+'">'
rotateimage()
}
else
setInterval("rotateimage()",pause)
