/***********************************************
* 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.
***********************************************/

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=1 //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[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</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
}




/*Example message arrays for the two demo scrollers*/

var pausecontent=new Array()
pausecontent[0]='<div class="testi-item"> <span class="testi-date">January 29, 2009</span> <span class="testi-data"><a href="pov137.html">“I am a believer”. I have never lost any faith in ARX, it does what it says it will  better than any product in its class....</a></span> <span class="testi-user"><span class="usernm"><strong>Mike</strong></span></span> </div> <div class="testi-item"> <span class="testi-date">November 26, 2008</span> <span class="testi-data"><a href="pov136.html">“Thanks for a wonderful product that really works!. I have used your product in two Bentley&lsquo;s and one Cadillac, with impressive results....“</a></span> <span class="testi-user"><span class="usernm"><strong>James Mason</strong></span></span> </div>'

pausecontent[1]='<div class="testi-item"> <span class="testi-date">November 19, 2008 </span> <span class="testi-data"><a href="pov135.html">I just had the car inpected and the results were amazing. The car passed like a new car. The NOx was a 100 with the standard being 1006 and the HC&lsquo;s were a 4 with the standard being 132.....</a></span> <span class="testi-user"><span class="usernm"><strong>Jared</strong></span></span> </div><div class="testi-item"> <span class="testi-date">November 15, 2008</span> <span class="testi-data"><a href="pov134.html">I would like to comment on a recent application of Auto-rx on a 2000 Pontiac GP with the 3.1 engine.....</a></span> <span class="testi-user"><span class="usernm"><strong>BMW techguy</strong></span></span> </div>'

pausecontent[2]='<div class="testi-item"> <span class="testi-date">October 10, 2008</span> <span class="testi-data"><a href="pov129.html">I thought that I would finally come and give a testimony about my experiences with Auto-Rx.  Ive used it in several vehicles now ...</a></span> <span class="testi-user"><span class="usernm"><strong>Jared</strong></span></span> </div><div class="testi-item"> <span class="testi-date">August 14, 2008</span> <span class="testi-data"><a href="pov128.html">I had a thought for you, small block chevy engines like the 1 on my El Camino have looser tolerances than today&lsquo;s engines, meaning that with .....</a></span> <span class="testi-user"><span class="usernm"><strong>BMW techguy</strong></span></span> </div>'

pausecontent[3]='<div class="testi-item"> <span class="testi-date">August 4, 2008 </span> <span class="testi-data"><a href="pov127.html">Just a brief note of what arx can do for fuel efficiency. Before clean and rinse phase I was only able to obtain 17-18 mpg on the interstates in a 2004....</a></span> <span class="testi-user"><span class="usernm"><strong>Jared</strong></span></span> </div><div class="testi-item"> <span class="testi-date">August 3, 2008</span> <span class="testi-data"><a href="pov126.html">Your product worked very well in cleaning up my E40D transmission. The filter caught some crud and there was some in the bottom of the pan but otherwise....</a></span> <span class="testi-user"><span class="usernm"><strong>Ryan</strong></span></span> </div>'

pausecontent[4]='<div class="testi-item"> <span class="testi-date">August 2, 2008 </span> <span class="testi-data"><a href="pov125.html">Clean phase is done and I am at 2,000 on first rinse phase. I will do a second clean and rinse as specified. My dipstick had hard baked on deposits ....</a></span> <span class="testi-user"><span class="usernm"><strong>Jared</strong></span></span> </div><div class="testi-item"> <span class="testi-date">July 4, 2008</span> <span class="testi-data"><a href="pov121.html">There is room for some ARX logos on the side...I&lsquo;m extremely happy with your product, I&lsquo;ll run it for you at no cost if you send me...</a></span> <span class="testi-user"><span class="usernm"><strong>Ryan</strong></span></span> </div>'

pausecontent[5]='<div class="testi-item"> <span class="testi-date">August 19, 2009 </span> <span class="testi-data"><a href="pov101.html">I was an ASE certified tech....I have never seen anything like this....if it did not hurt a wet clutch motorcycle, it is safe for your engine....based on my findings for mileage tests it was better than ....</a></span> <span class="testi-user"><span class="usernm"><strong>Steve</strong></span></span> </div><div class="testi-item"> <span class="testi-date">August 19, 2009</span> <span class="testi-data"><a href="pov101.html">1995 Plymouth Voyager 3.0L. Fuel mileage was around 18.3 before Auto-Rx and 22.3 after. Valve train was very quiet also....</a></span> <span class="testi-user"><span class="usernm"><strong>Steve</strong></span></span> </div>'

pausecontent[6]='<div class="testi-item"> <span class="testi-date">May 12, 2009 </span> <span class="testi-data"><a href="pov61.html">I have just finished 2 clean-rinse cycles on my girlfriend&#39;s 2000 Corolla, which is notorious for faulty designed rings. By the first rinse phase, I started...</a></span> <span class="testi-user"><span class="usernm"><strong>Mike C. </strong></span></span> </div><div class="testi-item"> <span class="testi-date">May 12, 2009</span> <span class="testi-data"><a href="pov29.html">Back again for more! Bought a "new-to-me" used truck and this will help get it up to my high standards of maintenance. Three cars and my motorcycle...</a></span> <span class="testi-user"><span class="usernm"><strong>Chris</strong></span></span> </div>'


