/***********************************************
* Pausing up-down scroller- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var pausecontent=new Array()
pausecontent[0]='<a href="/about/SDRA/friends/Addisons_big.html"><img src="/images/logos/Addisons.png" alt="Addisons Restaurant" title="Addisons Restaurant" border="0"></a>';
pausecontent[1]='<a href="/about/SDRA/friends/Barrington_big.html"><img src="/images/logos/Barrington.png" alt="Barrington Insurance Brokers" title="Barrington Insurance Brokers" border="0"></a>';
pausecontent[2]='<a href="/about/SDRA/friends/Cote_big.html"><img src="/images/logos/Cote_Drywall.png" alt="C&ocirc;t&eacute; Drywall" title="C&ocirc;t&eacute; Drywall" border="0"></a>';
pausecontent[3]='<a href="/about/SDRA/friends/Country_Traditions_big.html"><img src="/images/logos/Country_Traditions.png" alt="Country Traditions" title="Country Traditions" border="0"></a>';
pausecontent[4]='<a href="/about/SDRA/friends/Countryside_Carpentry_big.html"><img src="/images/logos/Countryside_Carpentry.png" alt="Countryside Carpentry" title="Countryside Carpentry" border="0"></a>';
pausecontent[5]='<a href="/about/SDRA/friends/Fobert_big.html"><img src="/images/logos/Fobert_Forestry.png" alt="Fobert Forestry" title="Fobert Forestry" border="0"></a>';
pausecontent[6]='<a href="/about/SDRA/friends/FOODLAND_big.html"><img src="/images/logos/Foodland.png" alt="Northbrook Foodland" title="Northbrook Foodland"border="0"></a>';
pausecontent[7]='<a href="/about/SDRA/friends/Greenshield_big.html"><img src="/images/logos/Greenshield.png" alt="Greenshield" title="Greenshield" border="0"></a>';
pausecontent[8]='<a href="/about/SDRA/friends/Hearth_Home_big.html"><img src="/images/logos/Hearth_Home.png" alt="Hearth<i>at</i>Home" title="Hearth<i>at</i>Home" border="0"></a>';
pausecontent[9]='<a href="/about/SDRA/friends/HOME_big.html"><img src="/images/logos/Home.png" alt="Home Hardware" title="Home Hardware" border="0"></a>';
pausecontent[10]='<a href="/about/SDRA/friends/Interior_Zone_big.html"><img src="/images/logos/Int_zone.png" alt="Interior Zone" title="Interior Zone" border="0"></a>';
pausecontent[11]='<a href="/about/SDRA/friends/JCH_big.html"><img src="/images/logos/JCH_Logging.png" alt="JCH Logging" title="JCH Logging" border="0"></a>';
pausecontent[12]='<a href="/about/SDRA/friends/Marble_Lake_Lodge_big.html"><img src="/images/logos/Marble_Lake_Lodge.png" alt="Marble Lake Lodge" title="Marble Lake Lodge" border="0"></a>';
pausecontent[13]='<a href="/about/SDRA/friends/Mumby_big.html"><img src="/images/logos/Mumby.png" alt="Joe Mumby" title="Joe Mumby" title="Joe Mumby" border="0"></a>';
pausecontent[14]='<a href="/about/SDRA/friends/Northbrook_Outfitters_big.html"><img src="/images/logos/Northbrook Outfitters.png" alt="Northbrook Outfitters" title="Northbrook Outfitters" border="0"></a>';
pausecontent[15]='<a href="/about/SDRA/friends/Nowell_Construction_big.html"><img src="/images/logos/Nowell_Construction10.png" alt="Ron Nowell Construction" title="Ron Nowell Construction" border="0"></a>';
pausecontent[16]='<a href="/about/SDRA/friends/RONA_big.html"><img src="/images/logos/Hooks_Rona.png" alt=" Hook\'s Rona" title="Hook\'s Rona" title="Hook\'s Rona" border="0"></a>';
pausecontent[17]='<a href="/about/SDRA/friends/Ronfeld_big.html"><img src="/images/logos/Ronfeld_Electric.png" alt="Ronfeld Electric" title="Ronfeld Electric" border="0"></a>';
pausecontent[18]='<a href="/about/SDRA/friends/Shay_Photography_big.html"><img src="/images/logos/Shay_Photo.png" alt="Shay Photography" title="Shay Photography" border="0"></a>';
pausecontent[19]='<a href="/about/SDRA/friends/Smarts_big.html"><img src="/images/logos/Smarts_Marina.png" alt="Smart\'s Marina" title="Smart\'s Marina" border="0"></a>';
pausecontent[20]='<a href="/about/SDRA/friends/Smittys_big.html"><img src="/images/logos/Smittys.png" alt="Smitty\'s Furniture" title="Smitty\'s Furniture" border="0"></a>';
pausecontent[21]='<a href="/about/SDRA/friends/Staceys_big.html"><img src="/images/logos/Staceys10.png" alt="Stacey\'s Custom Graphics" title="Stacey\'s Custom Graphics"  border="0"></a>';
pausecontent[22]='<a href="/about/SDRA/friends/Total_big.html"><img src="/images/logos/Total.png" alt="Total Pest Management" title="Total Pest Management" border="0"></a>';
pausecontent[23]='<a href="/about/SDRA/friends/Truelove_big.html"><img src="/images/logos/Truelove_Carpentry.png" alt="Truelove Carpentry" title="Truelove Carpentry" border="0"></a>';
pausecontent[24]='<a href="/about/SDRA/friends/ViP_big.html"><img src="/images/logos/ViP_Moving.png" alt="ViP Moving" title="ViP Moving" border="0"></a>';
pausecontent[25]='<a href="/about/SDRA/friends/Winney_big.html"><img src="/images/logos/Chris_Winney.png" alt="Chris Winney" title="Chris Winney" border="0"></a>';

var jj= Math.floor(Math.random() * pausecontent.length)
var kk=(jj==pausecontent.length-1)? 0 : jj+1

function pausescroller(content, divId, divClass, delay){
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=kk //index of message array for hidden div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[jj]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[kk]+'</div></div>')
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

pausescroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 50)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}

