// Slideshow version 2.0 edited for http://www.marysvale.org
// CREDITS:
// Random Order Slideshow with Messages
// by Gary Bushman
// Copyright (c) 2002 Bushman. All rights reserved.
// Permission given to use the script provided that this notice remains as is.
// 1/1/2002
// All lines beginning ( // ) are instructions and comments
///////////////////////////////////////////////////////////////////////////
// CONFIGURATION STARTS HERE
///////////////////////////////////////////////////////////////////////////
//
// Place the following script tag into your webpage where you want the slideshow to apear. ( without the leadding // )
//
// <script language="JavaScript1.2" src="slideshow.js"></script><noscript><img border="0" src="slideshow/001.jpg" width="200" height="133"></noscript> 
//
// Place in a table cell for exact placement on a page.
// Also note 001.jpg will be displayed in browsers with java turned off
//
// Replace the URLs of the slides and the corresponding messages.
// Please note that the URL and the correponding message are separated by a pipe "|".
// Watch how the "," and the " " are set!
// NOTE: to make words containing an apostrophe (') such at it's or isn't - you must spell them as it\'s of isn\'t 
// You may add as many slides as you like.
//
// Define Images here 
var img1="http://www.marysvale.org/slideshow/001.jpg|Time to hit the trail."
var img2="http://www.marysvale.org/slideshow/002.jpg|Yes, that looks like real beauty!"
var img3="http://www.marysvale.org/slideshow/003.jpg|A cool picnic in the shade."
var img4="http://www.marysvale.org/slideshow/004.jpg|Big Game Country."
var img5="http://www.marysvale.org/slideshow/005.jpg|Who is stronger?"
var img6="http://www.marysvale.org/slideshow/006.jpg|Isn\'t Life Beautiful."
var img7="http://www.marysvale.org/slideshow/007.jpg|Hey, let\'s go wading."
var img8="http://www.marysvale.org/slideshow/008.jpg|Banzi!"
var img9="http://www.marysvale.org/slideshow/009.jpg|It\'s time to relax."

var img10="http://www.marysvale.org/slideshow/010.jpg|A Hikers Paradise."
var img11="http://www.marysvale.org/slideshow/011.jpg|Where The Buffalo Roam."
var img12="http://www.marysvale.org/slideshow/012.jpg|The Biggest Horn Gets the Right of Way!"
var img13="http://www.marysvale.org/slideshow/013.jpg|Quack, Quack, here Ducky, Here Ducky!"
var img14="http://www.marysvale.org/slideshow/014.jpg|Camp In The High Country."
var img15="http://www.marysvale.org/slideshow/015.jpg|Now Where Did I Put Those Worms?"
var img16="http://www.marysvale.org/slideshow/016.jpg|Horse Back Riding."
var img17="http://www.marysvale.org/slideshow/017.jpg|Autumn in the Quakies."
var img18="http://www.marysvale.org/slideshow/018.jpg|King Of The Mountain."
var img19="http://www.marysvale.org/slideshow/019.jpg|Quiet Time On The Lake."

var img20="http://www.marysvale.org/slideshow/020.jpg|Beautiful High Moutain Valleys."
var img21="http://www.marysvale.org/slideshow/021.jpg|Hey Guys, Check Out The Tourists!"
var img22="http://www.marysvale.org/slideshow/022.jpg|Fall In The High Country."
var img23="http://www.marysvale.org/slideshow/023.jpg|Camp Along The River."
var img24="http://www.marysvale.org/slideshow/024.jpg|Deer Hunters Heaven!"
var img25="http://www.marysvale.org/slideshow/025.jpg|ATV HEAVEN!"
var img26="http://www.marysvale.org/slideshow/026.jpg|Peddle Power!"
var img27="http://www.marysvale.org/slideshow/027.jpg|Eagle Country!"
var img28="http://www.marysvale.org/slideshow/028.jpg|Try A Horse Back Ride."
var img29="http://www.marysvale.org/slideshow/029.jpg|Try A Little Ice Fishing."

var img30="http://www.marysvale.org/slideshow/030.jpg|Where Did The Road Go?"
var img31="http://www.marysvale.org/slideshow/031.jpg|All 4X4\'s Welcome."
var img32="http://www.marysvale.org/slideshow/032.jpg|Shoot The Rapids on the Sevier River."
var img33="http://www.marysvale.org/slideshow/033.jpg|Snow mobiles Are Welcome Too!"
var img34="http://www.marysvale.org/slideshow/034.jpg|Hey Rocky, Where\'s Bullwinkle?"
var img35="http://www.marysvale.org/slideshow/035.jpg|kayaking on the Sevier River."
var img36="http://www.marysvale.org/slideshow/036.jpg|It\'s Jeep Country Too."
var img37="http://www.marysvale.org/slideshow/037.jpg|Rocky Mountain Big Horn Sheep."
var img38="http://www.marysvale.org/slideshow/038.jpg|Beautifull Scenery"
var img39="http://www.marysvale.org/slideshow/039.jpg|NO Show Off\'s Please!"

var img40="http://www.marysvale.org/slideshow/040.jpg|."
var img41="http://www.marysvale.org/slideshow/041.jpg|."
var img42="http://www.marysvale.org/slideshow/042.jpg|."
var img43="http://www.marysvale.org/slideshow/043.jpg|."
var img44="http://www.marysvale.org/slideshow/044.jpg|."
var img45="http://www.marysvale.org/slideshow/045.jpg|."
var img46="http://www.marysvale.org/slideshow/046.jpg|."
var img47="http://www.marysvale.org/slideshow/047.jpg|."
var img48="http://www.marysvale.org/slideshow/048.jpg|."
var img49="http://www.marysvale.org/slideshow/049.jpg|."

var img50="http://www.marysvale.org/slideshow/050.jpg|."
var img51="http://www.marysvale.org/slideshow/051.jpg|."
var img52="http://www.marysvale.org/slideshow/052.jpg|."
var img53="http://www.marysvale.org/slideshow/053.jpg|."
var img54="http://www.marysvale.org/slideshow/054.jpg|."
var img55="http://www.marysvale.org/slideshow/055.jpg|."
var img56="http://www.marysvale.org/slideshow/056.jpg|."
var img57="http://www.marysvale.org/slideshow/057.jpg|."
var img58="http://www.marysvale.org/slideshow/058.jpg|."
var img59="http://www.marysvale.org/slideshow/059.jpg|."

var img60="http://www.marysvale.org/slideshow/060.jpg|."
var img61="http://www.marysvale.org/slideshow/061.jpg|."
var img62="http://www.marysvale.org/slideshow/062.jpg|."
var img63="http://www.marysvale.org/slideshow/063.jpg|."
var img64="http://www.marysvale.org/slideshow/064.jpg|."
var img65="http://www.marysvale.org/slideshow/065.jpg|."
var img66="http://www.marysvale.org/slideshow/066.jpg|."
var img67="http://www.marysvale.org/slideshow/067.jpg|."
var img68="http://www.marysvale.org/slideshow/068.jpg|."
var img69="http://www.marysvale.org/slideshow/069.jpg|."

var img70="http://www.marysvale.org/slideshow/070.jpg|."
var img71="http://www.marysvale.org/slideshow/071.jpg|."
var img72="http://www.marysvale.org/slideshow/072.jpg|."
var img73="http://www.marysvale.org/slideshow/073.jpg|."
var img74="http://www.marysvale.org/slideshow/074.jpg|."
var img75="http://www.marysvale.org/slideshow/075.jpg|."
var img76="http://www.marysvale.org/slideshow/076.jpg|."
var img77="http://www.marysvale.org/slideshow/077.jpg|."
var img78="http://www.marysvale.org/slideshow/078.jpg|."
var img79="http://www.marysvale.org/slideshow/079.jpg|."

var img80="http://www.marysvale.org/slideshow/080.jpg|."
var img81="http://www.marysvale.org/slideshow/081.jpg|."
var img82="http://www.marysvale.org/slideshow/082.jpg|."
var img83="http://www.marysvale.org/slideshow/083.jpg|."
var img84="http://www.marysvale.org/slideshow/084.jpg|."
var img85="http://www.marysvale.org/slideshow/085.jpg|."
var img86="http://www.marysvale.org/slideshow/086.jpg|."
var img87="http://www.marysvale.org/slideshow/087.jpg|."
var img88="http://www.marysvale.org/slideshow/088.jpg|."
var img89="http://www.marysvale.org/slideshow/089.jpg|."

var img90="http://www.marysvale.org/slideshow/090.jpg|."
var img91="http://www.marysvale.org/slideshow/091.jpg|."
var img92="http://www.marysvale.org/slideshow/092.jpg|."
var img93="http://www.marysvale.org/slideshow/093.jpg|."
var img94="http://www.marysvale.org/slideshow/094.jpg|."
var img95="http://www.marysvale.org/slideshow/095.jpg|."
var img96="http://www.marysvale.org/slideshow/096.jpg|."
var img97="http://www.marysvale.org/slideshow/097.jpg|."
var img98="http://www.marysvale.org/slideshow/098.jpg|."
var img99="http://www.marysvale.org/slideshow/099.jpg|."

var img100="http://www.marysvale.org/slideshow/100.jpg|Dare To Climb."
var img101="http://www.marysvale.org/slideshow/101.jpg|River Rafting on the Sevier River."
var img102="http://www.marysvale.org/slideshow/102.jpg|Tranquil Lakes."
var img103="http://www.marysvale.org/slideshow/103.jpg|Wild Life Viewing."
var img104="http://www.marysvale.org/slideshow/104.jpg|Elk Hunters Delight."
var img105="http://www.marysvale.org/slideshow/105.jpg|."
var img106="http://www.marysvale.org/slideshow/106.jpg|."
var img107="http://www.marysvale.org/slideshow/107.jpg|."
var img108="http://www.marysvale.org/slideshow/108.jpg|."
var img109="http://www.marysvale.org/slideshow/109.jpg|."

// If you edit the following line DO NOT LET IT LINE WRAP it must be all on one line.
// To add more images insert   ,img(number)
var slideshow=new Array(img1,img2,img3,img4,img5,img6,img7,img8,img9,img10,img11,img12,img13,img14,img15,img16,img17,img18,img19,img20,img21,img22,img23,img24,img25,img26,img27,img28,img29,img30,img31,img32,img33,img34,img35,img36,img37,img38,img39,img40,img41,img42,img43,img44,img45,img46,img47,img48,img49,img50,img51,img52,img53,img54,img55,img56,img57,img58,img59,img60,img61,img62,img63,img64,img65,img66,img67,img68,img69,img70,img71,img72,img73,img74,img75,img76,img77,img78,img79,img80,img81,img82,img83,img84,img85,img86,img87,img88,img89,img90,img91,img92,img93,img94,img95,img96,img97,img98,img99,img100,img101,img102,img103,img104,img105,img106,img107,img108,img109) 

// the font-family of the messages
var fntfamily="Verdana"

// the font-size of the messages (ranging from 1 to 6)
var fntsize=1

// the font-color of the messages 
// instead of "yellow" you also could write "FFFF00"
var fntcolor="yellow"

// the background-color of the messages
// instead of "black" you also could write "000000"
var bgrndcolor="black"

// the width of the slides (pixels)
var imagewidth=200

// the height of the slides (pixels)
var imageheight=133

// the minimum interval between each slide (seconds)
var standstill=4

///////////////////////////////////////////////////////////////////////////
// CONFIGURATION ENDS HERE
///////////////////////////////////////////////////////////////////////////

// do not change the code below
var imgstop=0
var imgsleft=0
var mestop=imageheight
var mesleft=0
var firstslide=true
var starttime
var nowtime
var imgurl=new Array()
var message=new Array()
var imgurlandmessagearray=new Array()
var imgurlandmessage
var imgpreload=new Array()
var playertop=0
var playerleft=0
var i_imgs=0
var i_loop=0
var i_preloadloop=0
var i_transition=0
var timerrotate=false
var timercheck=false
var contentimg
var contentmes
var slideshowlength=slideshow.length

var topdivheight=imageheight+40

var ns6=document.getElementById&&!document.all?1:0
var standstill=standstill*1000

function init() {
    firstslide=true
    i_imgs=0
    i_loop=0
    i_preloadloop=randommaker(slideshowlength)
    if (timerrotate) {
        clearTimeout(timerrotate)
        clearTimeout(timercheck)
    }
    imgurl=new Array
    message=new Array
    for (i=0;i<=slideshow.length-1;i++) {
        imgurlandmessage=slideshow[i].split("|")
        imgurl[i]=imgurlandmessage[0]
        message[i]=imgurlandmessage[1] 
    }

    if (document.all) {
        imgs.innerHTML=""
        mes.innerHTML=""
	    document.all.imgs.style.posTop=imgstop
        document.all.imgs.style.posLeft=imgsleft
		document.all.mes.style.posTop=mestop
        document.all.mes.style.posLeft=mesleft
        checkpreloadtime()
        preloadimage()
        checkifloaded()
    }
    if (ns6) {
        document.getElementById('imgs').innerHTML=""
        document.getElementById('mes').innerHTML=""
        document.getElementById('imgs').style.top=imgstop
        document.getElementById('imgs').style.left=imgsleft
        document.getElementById('mes').style.top=mestop
        document.getElementById('mes').style.left=mesleft
        checkpreloadtime()
        preloadimage()
        checkifloaded()
    }
	if (document.layers) {
        document.topdiv.document.imgs.document.write("")
        document.topdiv.document.imgs.document.close()
        document.topdiv.document.mes.document.write("")
        document.topdiv.document.mes.document.close()
	    document.topdiv.document.imgs.top=imgstop
        document.topdiv.document.imgs.left=imgsleft
		document.topdiv.document.mes.top=mestop
        document.topdiv.document.mes.left=mesleft
        checkpreloadtime()
        preloadimage()
        checkifloaded()
    }
}

function checkifloaded() {   
   if (imgpreload.complete) { 
        nowtime=new Date()
        nowtime=nowtime.getTime()
        nowtime=nowtime-starttime
        var interval=standstill-nowtime
        if (interval<=0 ) {
            interval=1
        }
        if (firstslide) {
            interval=1
            firstslide=false
        }
        if (i_preloadloop==i_loop) {
            interval=1
        }
        timerrotate=setTimeout("rotateimages()", interval)
   }
   else {
        timercheck=setTimeout("checkifloaded()", 100)
   }
}

function preloadimage() { 
	imgpreload=new Image()
	imgpreload.src=imgurl[i_preloadloop]
}

function rotateimages() {
    i_loop=i_preloadloop
    i_preloadloop=randommaker()  
    checkpreloadtime()
    preloadimage()
    getcontent()
    if (document.all) {
        imgs.filters[i_transition].apply()
        imgs.innerHTML=contentimg
        imgs.filters[i_transition].play()
        i_transition++
        if (i_transition>21) {i_transition=0}
        mes.innerHTML=contentmes
    }    
    if (ns6) {
        document.getElementById('imgs').innerHTML=contentimg
        document.getElementById('mes').innerHTML=contentmes
    }
    if (document.layers) {
        document.topdiv.document.imgs.document.write(contentimg)
        document.topdiv.document.imgs.document.close()
        document.topdiv.document.mes.document.write(contentmes)
        document.topdiv.document.mes.document.close()
    }
    i_loop++
    checkifloaded()    
}

function randommaker() {		
	rand=Math.floor(slideshowlength*Math.random())
    return rand

}

function getcontent() {
    contentimg="<img src='"+imgurl[i_loop]+"'>"
    contentmes="<table cellpadding=2 cellspacing=0 border=0 bgcolor="+bgrndcolor+" width="+imagewidth+"><tr><td><font size="+fntsize+" color="+fntcolor+" face="+fntfamily+">"+message[i_loop]+"</font></td></tr></table>"
}

if (document.all) {
    document.write('<div id="topdiv" style="position:relative;width:'+imagewidth+'px;height:'+topdivheight+'px">')
    document.write('<div id="mes" style="position:absolute;"> </div>')
    document.write('<div id="imgs" style="position:absolute;filter: revealTrans(Transition=1, Duration=2) revealTrans(Transition=2, Duration=2) revealTrans(Transition=3, Duration=2)  revealTrans(Transition=4, Duration=2)  revealTrans(Transition=5, Duration=1)  revealTrans(Transition=6, Duration=2)  revealTrans(Transition=7, Duration=2)  revealTrans(Transition=8, Duration=1)  revealTrans(Transition=9, Duration=2)  revealTrans(Transition=10, Duration=1)  revealTrans(Transition=11, Duration=2)  revealTrans(Transition=12, Duration=2)  revealTrans(Transition=13, Duration=1)  revealTrans(Transition=14, Duration=2)  revealTrans(Transition=15, Duration=2)  revealTrans(Transition=16 Duration=1)  revealTrans(Transition=17, Duration=2)  revealTrans(Transition=18, Duration=2) revealTrans(Transition=19, Duration=1) revealTrans(Transition=20, Duration=2) revealTrans(Transition=21, Duration=2) revealTrans(Transition=22, Duration=2)"> </div>')
    document.write('</div>')     
}

if (ns6) {
    document.write('<div id="topdiv" style="position:relative;width:'+imagewidth+'px;height:'+topdivheight+'px">')
    document.write('<div id="mes" style="position:absolute;"> </div>')
    document.write('<div id="imgs" style="position:absolute;"> </div>')
    document.write('</div>')     
}

if (document.layers) {
    document.write('<ilayer name="topdiv" width='+imagewidth+' height='+topdivheight+'>')
    document.write('<layer name="mes"> </layer>')
    document.write('<layer name="imgs"> </layer>')
    document.write('</ilayer>')     
}

function checkpreloadtime() {
	starttime= new Date()
	starttime=starttime.getTime()
}

function checktime() {

}

window.onresize=new Function("window.location.reload()");
window.onload=init
