/*Example message arrays for the two demo scrollers*/

var pausecontent=new Array()
pausecontent[0]='<br /><br /><br /><br /><br />RCP did a great job on our Integrity Management Plan (IMP). The IMP we had in place prior to their involvement was hard to follow. Thanks to RCP, the current IMP is concise, informative and much easier to follow. We are very pleased with the end result. We have used RCP for other projects in the past, and are glad we used them for our IMP.<br /><em>-Mirant</em><br /><br />The input from RCP was very valuable and helped to round out the skills of the audit team.Thank you for working with us on such short notice.<br /><em>-Shell</em><br /><br />RCP’s workshops on the federal gas and hazardous liquid pipeline regulations gave me an excellent introduction into the field of pipeline safety.  While I have much to learn, they provided me with a solid foundation on which to build my knowledge.<br /><em>-Pipeline Safety Trust</em><br /><br /><br />RCP did an outstanding job when they came up.  They were very patient and easy to work with while dealing with a rookie.  I certainly appreciated the time and effort they have all put in helping me out.<br /><em>-Belle Fourche</em><br /><br />I appreciate the work RCP did for Air Liquide.  Their advice and expertise proved invaluable.  They did an outstanding job and such efforts should be recognized.  If a situation arises in the future involving their field of expertise, I will be sure to give RCP a call.<br /><em>-Air Liquide</em><br /><br />After we had our first meeting with RCP, they gave us a solid proposal that explained their plan of action. It defined the steps we needed to take and created a program that we could use.<br /><em>-Pacific Energy</em><br /><br />RCP met and exceeded our expectations. Their consultants were always available to answer our questions, and they were flexible enough to make any necessary adjustments. They also understood our project thoroughly, and that made it easy to work with them. We’re always looking for partners that provide quality service and fast response. We found one in RCP.<br /><em>-ExxonMobil</em><br /><br />They had the right solutions. Their extraordinary attention to detail and technical knowledge produced results we couldn’t be more satisfied with.<br /><em>-Formosa</em><br /><br />From the start to finish of our project, RCP was there every step of the way. Our consultant was top-notch and kept us informed – we didn’t waste time or money. We got what we expected and paid for.<br /><em>-Valero</em><br /><br />'
pausecontent[1]='RCP was fast, responsive, and developed a line of communication that made the project more efficient and effective. They had a terrific understanding of the assignment, and we plan on working with them in the future.<br /><em>-PB Energy</em><br /><br />We choose RCP because of their reputation. The capabilities of the consultants exceeded our expectations. They did what they said they’d do and they did it well.<br /><em>-Duke</em><br /><br />RCP deserves nothing but praise in their efforts with our development and risk analysis project. They were highly professional and demonstrated a work ethic that was very valuable to this assignment. If someone calls us looking for a recommendation or reference, RCP would get it.<br /><em>-Marathon Ashland Petroleum</em><br /><br />The insight and management skill RCP brought to our audit was superb. They worked well with our team and it was a pleasure to work with them.<br /><em>-BP</em><br /><br />RCP helped keep our project ahead of schedule and under budget. They were approachable, knowledgeable, and skilled. We were highly satisfied with the result, and plan to use them again in the future.<br /><em>-Buckeye</em><br /><br />RCP’s consultants are top-notch: they are knowledgeable, insightful, easy to work with, and totally responsive. We will definitely recommend RCP for all of our ongoing program development needs.<br /><em>-Suncor Energy</em><br /><br />RCP recently completed our OQ Program for which I’m very grateful. I have been pleased with the work that RCP has done for us and I would like to “spread the word.”<br /><em>-Atchison Steel</em><br /><br />'


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=this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
this.tickerdiv.onmouseover=function(){scrollerinstance.mouseoverBol=1}
this.tickerdiv.onmouseout=function(){scrollerinstance.mouseoverBol=0}
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+1)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-1+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-1+"px"
setTimeout(function(){scrollerinstance.animateup()}, 75)
}
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
}
