// JavaScript Document
/*Example message arrays for the two demo scrollers*/
 
var pausecontent=new Array()
pausecontent[0]='Thank you all very much for your help. You guys made this an excellent ordeal. If I ever have anything like this again, you will be my first call! <br/><br/>  Blake Bowles, Mansfield' 
pausecontent[1]='Thank you so much! You guys never fail – you always meet our tight deadlines! <br/><br/> Cindy Minor, Sun Graphics, Inc'
pausecontent[2]='Thank you so very much for all your hard work that when into our Air Guard trailer. It looks amazing! Honestly we couldn’t be happier with the end result and the feedback has been tremendous. It was a terrific event and the comments on the trailer were awesome, people can’t stop talking about it. The stickers are a big hit too. Thanks again for everything; we look forward to doing business together again soon.<br/><br/> Dana Togliatti and Team, Air National Guard Mansfield, Ohio'

pausecontent[3]='I raved about your work to Jeff when he delivered the Pioneer banners this afternoon, but let me tell you directly –GREAT- WONDERFUL- AWESOME JOB!!!! Each one turned out so well. Thanks for your expertise in the design of them. I would like to feature you with the banners in an upcoming school newsletter, if you are willing. I think it would be great to show a graduate – in this case you! – in your career getting to work on a Pioneer project.<br/><br/> Laurie Kirk, Pioneer Career and Technology Center Shelby, OH'

pausecontent[4]='Thanks for sending your guys over to hang our message posters in our office hallway! I appreciate your willingness and generosity. It is always a pleasure to do bisness with you. <br/><br/> Tim Armstrong, Crosswords Church Mansfield, Ohio'

pausecontent[5]='All I can say is WOW or should that be WOOF. The graphics look fantastic. We have had tons of comments on the trailer. I made sure I told everyone that Premier Graphics did it. Your help has been great. I thank you so much for a job well done and with quick turnaround. I really did appreciate your efforts to get it to us by our deadline. <br/><br/> David Damron, Mansfield – Richland County Humane Society'

pausecontent[6]='Just a quick note to let you know that we are very pleased with the lettering on the new van. You and your staff did a great job! Our new ‘moving sign’ looks great. <br/><br/> Tim & Jim Irwin'

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

