

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

var pausecontent=new Array()
pausecontent[0]='<h4> Merrilyn Huges Says:</h4> Ben provides a professional service, offering good advice to a novice in this area. His work was clean, clear and precise and all printing was done punctually.<br><a href="http://www.theaca.net.au/find_coun/results.php?pageNum_RSCoun=3&totalRows_RSCoun=85&postcode=&selState=WA&suburb=">KEYSTONE COUNSELLING</a>'
pausecontent[1]='<h4> Tony Wood-Collier Says:</h4> Ben has done printing for our company which was well priced, printed as required and delivered on time. His services are highly recommended.<br><a href="http://www.coolmakers.com.au">COOLMAKERS AIR CONDITIONING</a>'
pausecontent[2]='<h4> Kerry Brunton Says:</h4> I have never had the pleasure of meeting Ben face to face. To do business with someone on the other side of Australia can be considered risky, but Ben made me feel as if he was looking over my shoulder and guideing me as if he were in the room with me. Ben lives up to all he claims... read it... believe it.. and try him! <br><a href="http://au.linkedin.com/pub/kerry-brunton/13/922/139">I4MARKETING</a>'
pausecontent[3]='<h4> Rhett Jenkins Says:</h4>Ben has transformed the corporate image of Protector CPT and provided us with the marketing tools we have needed to build our client base. Thanks for the good work.<br><a href="http://www.protectorcpt.com.au">PROTECTOR RENDERING</a>'
pausecontent[4]='<h4> Chris Busby Says:</h4> We used Strive Designs for the design and printing of promotional material and found Ben extremely helpful and his work to an excellent standard. We have no hesitation in recommending Strive Designs to anyone wanting high quality design and print work at a reasonable cost.<br><a href="http://www.australianwoodcraft.com.au/">AUSTRALIAN WOODCRAFT GALLERIES</a>'
pausecontent[5]='<h4> Mark Lynch Says:</h4> I continue to use Ben for graphic design work for my companies, Glass West and Swanguard Door & Window Security Screens. Ben is an expert at timely, dynamic solutions within the miserly budgets I give him to work within. Provided that you are not a competitor to either of my companies, I gladly recommend Ben and his services.<br><a href="http://www.glasswest.com.au/">GLASS WEST</a>'
pausecontent[6]='<h4> Kylie Hutchings Says:</h4>Ben is always very helpful and very reliable. He produces great work and has excellent knowledge of his field.<br><a href="http://www.signs-merredin.websyte.com.au/">SIGNS ETC.</a>'
pausecontent[7]='<h4> Jim Scifleet Says:</h4> I needed business cards in a hurry and Ben provided a quality product at a very reasonable price in a matter of days.<br><a href="http://www.sundownercampers.net.au">SUNDOWNER CAMPERS</a>'
pausecontent[8]='<h4> Julie & Eamonn Gavin Say:</h4>We have been using Strive Designs now for over two years, we always receive prompt friendly service, nothing is ever too hard, the artwork is excellent and the price is the lowest in Perth. Thanks Ben for all your time and hard work, we just wish everyone that we dealt with was as customer focused as you are.<br><a href="http://www.gavintransport.com.au">GAVIN TRANSPORT</a>'


var pausecontent2=new Array()
pausecontent2[0]='<a href="http://www.news.com">News.com: Technology and business reports</a>'
pausecontent2[1]='<a href="http://www.cnn.com">CNN: Headline and breaking news 24/7</a>'
pausecontent2[2]='<a href="http://news.bbc.co.uk">BBC News: UK and international news</a>'

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

