// JavaScript Document
/*
Vertical Pausing Slideshow - freely adapted from:
Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
For full source code, 100's more DHTML scripts, and TOS, visit http://www.dynamicdrive.com
Modified by jscheuer1 for continuous content slideshow, optional pause at top.
as first seen in http://www.dynamicdrive.com/forums
Credit MUST stay intact for legal use.
*/

//Specify the marquee's width (in pixels)
var marqueewidth="205px"
//Specify the marquee's height
var marqueeheight="189px"
//Specify the marquee's marquee speed (larger is faster 1-10)
var marqueespeed=2
//Specify initial pause before scrolling in milliseconds
var initPause=2000
//Specify start with Full(1)or Empty(0) Marquee
var full=1
//Pause marquee onMousever (0=no 1=yes)?
var pauseit=0
//Specify images' border
var imgBorder=0
//Specify images' border color
var imgBorderColor='green'
//Specify pause at top duration in milliseconds, 0 for continuous
var toppause=2000
//Specify image height for top pause
var iheight=100

var photos=new Array();
//Specify images, optional link, optional target:

photos[0]=['http://www.zionshope.org/flash/VScroller/test/thumbs/2011_Tribulation.jpg', 'http://www.zionshope.org/insight_letters/201112_Tribulation/tribulation_1112.aspx', '_blank']

photos[1]=['http://www.zionshope.org/flash/VScroller/test/thumbs/2011_Christmas_3col.jpg', 'http://www.zionshope.org/insight_letters/201111_Christmas/Christmas_1111.aspx', '_blank']

photos[2]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Thanksgiving_3col.jpg', 'http://www.zionshope.org/insight_letters/201111_Thanksgiving/thanksgiving_1111.aspx', '_blank']

photos[3]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Repentance_3col.jpg', 'http://www.zionshope.org/insight_letters/201110_Repentance/link_repentance_1110.aspx', '_blank']


photos[4]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Passover_3col.jpg', 'http://www.zionshope.org/2011_Passover/link_Passover_0411.aspx', '_blank']


photos[5]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Grace_3col.jpg', 'http://www.zionshope.org/insight_letters/201101_Grace/link_grace_1101.aspx', '_blank']


photos[6]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Hot_Heart_3col.jpg', 'http://www.zionshope.org/insight_letters/201012_hot_heart/link_heart_1012.aspx', '_blank']


photos[7]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Reason_3col.jpg', 'http://www.zionshope.org/insight_letters/201012_Reason/link_reason_1012.aspx', '_blank']



photos[8]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Thanks_3col.jpg', 'http://www.zionshope.org/insight_letters/201011_Give_Thanks/link_thanks_1011.aspx', '_blank']


photos[9]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Hearts_3col.jpg', 'http://www.zionshope.org/insight_letters/201011_changed_heart/link_heart_1011.aspx', '_blank']

photos[10]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Fight_3col.jpg', 'http://www.zionshope.org/insight_letters/201010_fight/link_fight_1010.aspx', '_blank']

photos[11]=['http://www.zionshope.org/flash/VScroller/test/thumbs/world_3col.jpg', 'http://www.zionshope.org/insight_letters/201007_world/link_world_1007.aspx', '_blank']

photos[12]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Christian_3col.jpg', 'http://www.zionshope.org/insight_letters/201006_Christian/link_christian_1006.aspx', '_blank']

photos[13]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Calvary_3col.jpg', 'http://www.zionshope.org/insight_letters/201003_Calvary/link_calvary_1003.aspx', '_blank']

photos[14]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Balance_3col.jpg', 'http://www.zionshope.org/insight_letters/201002_balance/link_balance_1002.aspx', '_blank']

photos[15]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Compass_3col.jpg', 'http://www.zionshope.org/insight_letters/201001_Compass/link_compass_1001.aspx', '_blank']

photos[16]=['http://www.zionshope.org/flash/VScroller/test/thumbs/New_Year_3col.jpg', 'http://www.zionshope.org/insight_letters/122009_New_Year/link_new_year_0912.aspx', '_blank']

photos[17]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Christmas_3col.jpg', 'http://www.zionshope.org/insight_letters/122009_Christmas/link_christmas_0912.aspx', '_blank']

photos[18]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Jerusalem_3col.jpg', 'http://www.zionshope.org/insight_letters/102009_jerusalem/link_jerusalem_0910.aspx', '_blank']

photos[19]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Sin_3col.jpg', 'http://www.zionshope.org/insight_letters/082009_sin/link_sin_0908.aspx', '_blank']

photos[20]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Danger_3col.jpg', 'http://www.zionshope.org/insight_letters/072009_danger/link_danger_0907.aspx', '_blank']

photos[21]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Wisdom_3col.jpg', 'http://www.zionshope.org/insight_letters/062009_wisdom/link_wisdom_0906.aspx', '_blank']

photos[22]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Warnings_3col.jpg', 'http://www.zionshope.org/insight_letters/062009_warnings/link_warnings_0906.aspx', '_blank']

photos[23]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Promises_3col.jpg', 'http://www.zionshope.org/insight_letters/052009_hope_change/link_promises_0905.aspx', '_blank']

photos[24]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Babylon_3col.jpg', 'http://www.zionshope.org/insight_letters/042009_babylon/link_babylon_0904.aspx', '_blank']

photos[25]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Kings_3col.jpg', 'http://www.zionshope.org/insight_letters/022009_kings_of_earth/link_kings_0902.aspx', '_blank']

photos[26]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Hope_3col.jpg', 'http://www.zionshope.org/insight_letters/012009_hope/link_hope_0901.aspx', '_blank']

photos[27]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Truth_3col.jpg', 'http://www.zionshope.org/insight_letters/012009_truth_siege/link_truth_0901.aspx', '_blank']

photos[28]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Journey_3col.jpg', 'http://www.zionshope.org/insight_letters/122008_wisemen/link_wisemen_0901.aspx', '_blank']

photos[29]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Hanukkah_3col.jpg', 'http://www.zionshope.org/insight_letters/112008_hanukkah/link_hanukkah_0811.aspx', '_blank']

photos[30]=['http://www.zionshope.org/flash/VScroller/test/thumbs/Letter_3col.jpg', 'http://www.zionshope.org/insight_letters/112008_openletter/link_letter_0811.aspx', '_blank']

////NO NEED TO EDIT BELOW THIS LINE////////////
var preload=new Array()
for (var i_tem = 0; i_tem < photos.length; i_tem++){
preload[i_tem]=new Image()
preload[i_tem].src=photos[i_tem][0]
}

var actualheight=marqueecontent=''
var copyspeed=marqueespeed
var pausespeed=(pauseit)? 0 : copyspeed
var iedom=document.all||document.getElementById
var cross_marquee, cross_marquee2, ns_marquee, firstImage, mout=1
marqueewidth=parseInt(marqueewidth)+2*imgBorder+'px'

for (var i_tem = 0; i_tem < photos.length; i_tem++){
if (typeof photos[i_tem][1]!=='undefined'){
marqueecontent+='<a href="'+photos[i_tem][1]+'"'
marqueecontent+=typeof photos[i_tem][2]!=='undefined'? ' target="'+photos[i_tem][2]+'"' : ''
marqueecontent+='>'
}
if (i_tem==0)
marqueecontent+='<img id="firstOne" src="'+photos[i_tem][0]+'" alt="Image #'+[i_tem+1]+'" style="border:'+imgBorder+'px solid '+imgBorderColor+';"><br>'
else
marqueecontent+='<img src="'+photos[i_tem][0]+'" alt="Image #'+[i_tem+1]+'" style="border:'+imgBorder+'px solid '+imgBorderColor+';"><br>'
marqueecontent+=typeof photos[i_tem][1]!=='undefined'? '</a>' : ''
}
if (iedom||document.layers){
with (document){
if (iedom){
write('<div style="overflow:hidden;"><div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden" onMouseover="copyspeed=pausespeed;mout=0;" onMouseout="copyspeed=marqueespeed;mout=1;">')
write('<div id="iemarquee" style="position:absolute;left:0px;top:0px;width:100%;"><table align="center"><tr><td height="'+marqueeheight+'" align="center" valign="middle"></td></tr></table>')
write('</div><div id="iemarquee2" style="position:absolute;left:0px;top:0px;width:100%;">')
write('</div></div></div>')
}
else if (document.layers){
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee">')
write('<layer name="ns_marquee2" width='+marqueewidth+' height='+marqueeheight+' left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
write('</ilayer>')
}
}
}

function populate(){
if (document.all)
for (var i_tem = 0; i_tem < preload.length; i_tem++)
if (typeof preload[i_tem].complete=='boolean'&&!preload[i_tem].complete){
setTimeout("populate();", 0000)
return;
}
if (iedom){
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
cross_marquee2=document.getElementById? document.getElementById("iemarquee2") : document.all.iemarquee2
cross_marquee.style.top=(full==1)? '0px' : parseInt(marqueeheight)+0+"px"
cross_marquee.innerHTML=marqueecontent
firstImage=document.getElementById? document.getElementById("firstOne") : document.all.firstOne
firstImage.style.borderTopWidth=imgBorder*2+'px'
cross_marquee2.innerHTML=marqueecontent.replace(/id="firstOne" /, '')
actualheight=cross_marquee2.offsetHeight
cross_marquee2.style.top=(parseInt(cross_marquee.style.top)+actualheight+0)+"px" //indicates following #1
}
else if (document.layers){
ns_marquee=document.ns_marquee.document.ns_marquee2
ns_marquee.top=parseInt(marqueeheight)+8
ns_marquee.document.write(marqueecontent)
ns_marquee.document.close()
actualheight=ns_marquee.document.height
}
inmotion=0
setTimeout('lefttime=setInterval("scrollmarquee()",20)',initPause)
}
window.onload=populate

function resumemarquee(){
if (mout){
copyspeed=marqueespeed
if (parseInt(cross_marquee.style.top)<(actualheight*(-1)))
cross_marquee.style.top=(parseInt(cross_marquee2.style.top)+actualheight)+"px"
if (parseInt(cross_marquee2.style.top)<(actualheight*(-1)))
cross_marquee2.style.top=(parseInt(cross_marquee.style.top)+actualheight)+"px"
cross_marquee2.style.top=parseInt(cross_marquee2.style.top)-copyspeed+"px"
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
lefttime=setInterval("scrollmarquee()",20)
}
else
setTimeout("resumemarquee()",20)
}

function scrollmarquee(){

if (iedom){
if (inmotion)
firstImage.style.borderTopWidth=imgBorder+'px'
if (inmotion&&toppause&&(parseInt(cross_marquee.style.top)-imgBorder)%(iheight+2*imgBorder)==0){
copyspeed=0
clearInterval(lefttime)
setTimeout("resumemarquee()", toppause)
return;
}
inmotion=1
if (parseInt(cross_marquee.style.top)<(actualheight*(-1)))
cross_marquee.style.top=(parseInt(cross_marquee2.style.top)+actualheight)+"px"
if (parseInt(cross_marquee2.style.top)<(actualheight*(-1)))
cross_marquee2.style.top=(parseInt(cross_marquee.style.top)+actualheight)+"px"
cross_marquee2.style.top=parseInt(cross_marquee2.style.top)-copyspeed+"px"
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
}

else if (document.layers){
if (ns_marquee.top>(actualheight*(-1)+8))
ns_marquee.top-=copyspeed
else
ns_marquee.top=parseInt(marqueeheight)+8
}
}
