
/***********************************************
* DHTML slideshow script-  © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice must stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

/* This script has been modified to suit the needs of this web site.  Visit the site above for the latest source code. */
var which=0

var linkornot=0
for(var lnk in photoslink){
if(!lnk) lnk = ""
if(lnk.length > 0){ linkornot=1 }
}

/* Don't invoke these insertXXX() functions more than once per document */
function insertImage(){
if (linkornot==1) {document.write('<a href="'+ photoslink[0] +'">') }
document.write('<img src="'+photos[0]+'" id="photoslider" alt="Loading image..." style="filter:revealTrans(duration=2,transition=23);border-style:none;" >')
if (linkornot==1) {document.write('</a>')}
}

function insertBlurb(){
document.write('<span id="blurb">'+ blurbs[0] +'</span>')
}

function insertPreviousCtl(){
    document.write('<a id="previousControl" href="#" onClick="backward();return false"> </a>')
}
function insertNextCtl(){
    document.write('<a id="nextControl" href="#" onClick="forward();return false">')
    if(photos.length > 1) document.write(nextLink)
    document.write('</a>')
}

function applyeffect(){
var p = document.getElementById('photoslider')
if(p && p.filters){ 
p.filters.revealTrans.Transition=Math.floor(Math.random()*23)
p.filters.revealTrans.stop()
p.filters.revealTrans.apply()
}
}

function playeffect(){
var p = document.getElementById('photoslider')
if(p && p.filters){
p.filters.revealTrans.play()
}
}

function keeptrack(){
window.status="Image "+(which+1)+" of "+photos.length
}

function setBlurb(index){
document.getElementById('blurb').innerHTML=blurbs[index]
}

function transitionTo(index){
applyeffect();
var img=document.getElementById('photoslider');
img.onLoad = setBlurb(index);
img.src = photos[index];
playeffect();
keeptrack();
}

function backward(){
if (which>0){
which--
transitionTo(which)
if(which==0) document.getElementById('previousControl').innerHTML=""
if(which < photos.length-1) document.getElementById('nextControl').innerHTML=nextLink
}
}

function forward(){
if (which<photos.length-1){
which++
transitionTo(which)
if(which > 0) document.getElementById('previousControl').innerHTML=previousLink
if(which==photos.length-1) document.getElementById('nextControl').innerHTML=""
}
}

