// JavaScript Document
/***********************************************
* 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
***********************************************/

var slideshow_width='375px' //SET IMAGE WIDTH
var slideshow_height='500px' //SET IMAGE HEIGHT
var poz=4000 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)


var fadeimages=new Array()
var fadelink=new Array()
var ix=0;
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages[ix]="images/homePhotos/USANH.JPG"; fadelink[ix]="http://craigszwed.net/store/index.php?do=photocart&viewGallery=10060";
ix++; fadeimages[ix]="images/homePhotos/MorePhotos.JPG"; fadelink[ix]="http://craigszwed.net/store/index.php?do=photocart&viewGallery=10050";
ix++; fadeimages[ix]="images/homePhotos/SpecialEdits.jpg"; fadelink[ix]="http://craigszwed.net/store/index.php?do=photocart&viewGallery=10019";
ix++; fadeimages[ix]="images/homePhotos/ItalyFlorence.JPG"; fadelink[ix]="http://craigszwed.net/store/index.php?do=photocart&viewGallery=10035";
ix++; fadeimages[ix]="images/homePhotos/USAMI.JPG"; fadelink[ix]="http://craigszwed.net/store/index.php?do=photocart&viewGallery=10059";
ix++; fadeimages[ix]="images/homePhotos/People.JPG"; fadelink[ix]="http://craigszwed.net/store/index.php?do=photocart&viewGallery=10018";
ix++; fadeimages[ix]="images/homePhotos/Mexico.JPG"; fadelink[ix]="http://craigszwed.net/store/index.php?do=photocart&viewGallery=10038";
ix++; fadeimages[ix]="images/homePhotos/USAFL.jpg"; fadelink[ix]="http://craigszwed.net/store/index.php?do=photocart&viewGallery=10056";
ix++; fadeimages[ix]="images/homePhotos/NatureLandscapes.JPG"; fadelink[ix]="http://craigszwed.net/store/index.php?do=photocart&viewGallery=10065";
ix++; fadeimages[ix]="images/homePhotos/NatureBirdsBees.jpg"; fadelink[ix]="http://craigszwed.net/store/index.php?do=photocart&viewGallery=10062";
ix++; fadeimages[ix]="images/homePhotos/USACT.JPG"; fadelink[ix]="http://craigszwed.net/store/index.php?do=photocart&viewGallery=10055";
ix++; fadeimages[ix]="images/homePhotos/ItalyPisa.JPG"; fadelink[ix]="http://craigszwed.net/store/index.php?do=photocart&viewGallery=10036";
ix++; fadeimages[ix]="images/homePhotos/ShapesTextures.JPG"; fadelink[ix]="http://craigszwed.net/store/index.php?do=photocart&viewGallery=10052";
ix++; fadeimages[ix]="images/homePhotos/NatureFish.JPG"; fadelink[ix]="http://craigszwed.net/store/index.php?do=photocart&viewGallery=10061";
ix++; fadeimages[ix]="images/homePhotos/USACA.JPG"; fadelink[ix]="http://craigszwed.net/store/index.php?do=photocart&viewGallery=10054";


////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]
}


var ie4=document.all
var dom=document.getElementById


if (ie4||dom) {
  document.write('<div 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;filter:alpha(opacity=10);-moz-opacity:10"></div><div id="canvas1" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10;visibility: hidden"></div></div>')
} else {
  document.write('<a href="'+fadelink[0]+'"><img border="0" name="defaultslide" src="'+fadeimages[0]+'"></a>')
}


var curpos=5
var degree=5
var curcanvas="canvas0"
var curimageindex=0
var nextimageindex=1


function fadefoto() {
  if (curpos<100) {
    curpos+=5
    if (tempobj.filters) {
      tempobj.filters.alpha.opacity=curpos
	} else { 
	 tempobj.style.opacity=curpos/100 
	}
  } else {
    clearInterval(dropslide)
    nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
    tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
    tempobj.innerHTML='<a href="'+fadelink[nextimageindex]+'"><img border="0" src="'+fadeimages[nextimageindex]+'"></a>'
    nextimageindex=(nextimageindex<fadeimages.length-1)? nextimageindex+1 : 0
    var tempobj2=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
    tempobj2.style.visibility="hidden"
    setTimeout("rotateimage()",poz)
  }
}


function rotateimage() {
  if (ie4||dom) {
    resetfoto(curcanvas)
    var crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
    crossobj.style.zIndex++
    tempobj.style.visibility="visible"
    var temp='setInterval("fadefoto()",70)'
    dropslide=eval(temp)
    curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
  } else {
    document.images.defaultslide.src=fadeimages[curimageindex]
    //  curimageindex=Math.round(Math.random()*ix)
    curimageindex=(curimageindex<fadeimages.length-1)? curimageindex+1 : 0
  }
}


function resetfoto(what) {
  curpos=5
  var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
  if (crossobj.filters) {
    crossobj.filters.alpha.opacity=curpos
  } else {
	crossobj.style.opacity=curpos/100
  }
}


function startfoto() {
  var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
  crossobj.innerHTML='<a href="'+fadelink[curimageindex]+'"><img border="0" src="'+fadeimages[curimageindex]+'"></a>'
  rotateimage()
}


if (ie4||dom) {
  window.onload=startfoto
} else {
  setInterval("rotateimage()",poz)
}
