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

var pausecontent=new Array()
pausecontent[0]='<class=cBodyCopy><a href="http://familydoctor.org/118.xml" target="_blank" class="cBodyCopy">ADHD affects 4 - 12% of school-age children.</a>'
pausecontent[1]='<class=cBodyCopy><a href="http://www.mentalhealthamerica.net/go/information/get-info/ad/hd/ad/hd-and-kids/ad/hd-and-kids" target="_blank" class="cBodyCopy">40 - 60% of children with ADHD have serious learning difficulties.</a>'
pausecontent[2]='<class=cBodyCopy><a href="http://www.sbhihelp.org/files/nimhadhdpub.pdf" target="_blank" class="cBodyCopy">Diet restrictions help about 5% of children with ADHD.</a>'
pausecontent[3]='<class=cBodyCopy><a href="http://www.sbhihelp.org/files/nimhadhdpub.pdf" target="_blank" class="cBodyCopy">25% of the close relatives in the families of ADHD children also have ADHD.</a>'
pausecontent[4]='<class=cBodyCopy><a href="http://www.sbhihelp.org/files/nimhadhdpub.pdf" target="_blank" class="cBodyCopy">About 20 - 40% of ADHD children may eventually develop conduct disorder.</a>'
pausecontent[5]='<class=cBodyCopy><a href="http://www.sbhihelp.org/files/nimhadhdpub.pdf" target="_blank" class="cBodyCopy">About 80% of children who need medication for ADHD still need it as teenagers.</a>'
pausecontent[6]='<class=cBodyCopy><a href="http://www.nami.org/Template.cfm?Section=By_Illness&Template=/TaggedPage/TaggedPageDisplay.cfm&TPLID=54&ContentID=23049" target="_blank" class="cBodyCopy">About 50% of those with severe mental disorders also suffer from substance abuse.</a>'
pausecontent[7]='<class=cBodyCopy><a href="http://www.nami.org/Template.cfm?Section=By_Illness&Template=/TaggedPage/TaggedPageDisplay.cfm&TPLID=54&ContentID=23049" target="_blank" class="cBodyCopy">37% of alcohol abusers have at least one serious mental illness.</a>'
pausecontent[8]='<class=cBodyCopy><a href="http://www.nami.org/Template.cfm?Section=By_Illness&Template=/TaggedPage/TaggedPageDisplay.cfm&TPLID=54&ContentID=23049" target="_blank" class="cBodyCopy">53% of drug abusers have at least one serious mental illness.</a>'
pausecontent[9]='<class=cBodyCopy><a href="http://www.nami.org/Template.cfm?Section=By_Illness&Template=/TaggedPage/TaggedPageDisplay.cfm&TPLID=54&ContentID=23049" target="_blank" class="cBodyCopy">29% of those with mental illness abuse either alcohol or drugs.</a>'
pausecontent[10]='<class=cBodyCopy><a href="http://www.nami.org/Template.cfm?Section=By_Illness&Template=/TaggedPage/TaggedPageDisplay.cfm&TPLID=54&ContentID=23049" target="_blank" class="cBodyCopy">47% of schizophrenics also have a substance abuse disorder.</a>'
pausecontent[11]='<class=cBodyCopy><a href="http://www.nami.org/Template.cfm?Section=By_Illness&Template=/TaggedPage/TaggedPageDisplay.cfm&TPLID=54&ContentID=23049" target="_blank" class="cBodyCopy">61% of those with bipolar disorder have a substance abuse disorder.</a>'
pausecontent[12]='<class=cBodyCopy><a href="http://www.baltimorepsych.com/Suicide.htm" target="_blank" class="cBodyCopy">Every two hours, a youth commits suicide.</a>'
pausecontent[13]='<class=cBodyCopy><a href="http://www.baltimorepsych.com/Suicide.htm" target="_blank" class="cBodyCopy">More teens die from suicide than from AIDS, cancer, heart disease, birth defects and lung disease.</a>'
pausecontent[14]='<class=cBodyCopy><a href="http://www.baltimorepsych.com/Suicide.htm" target="_blank" class="cBodyCopy">The suicide rate for male teens tripled between 1960 and 1980.</a>'
pausecontent[15]='<class=cBodyCopy><a href="http://www.baltimorepsych.com/Suicide.htm" target="_blank" class="cBodyCopy">67% of youth suicides involved mixed substance abuse.</a>'
pausecontent[16]='<class=cBodyCopy><a href="http://www.aacap.org/page.ww?name=Teen+Suicide&section=Facts+for+Families" target="_blank" class="cBodyCopy">Suicide is the third leading cause of death for those who are 15-24 years old.</a>'
pausecontent[17]='<class=cBodyCopy><a href="http://www.aacap.org/page.ww?name=Teen+Suicide&section=Facts+for+Families" target="_blank" class="cBodyCopy">Suicide is the sixth leading cause of death for those 5-14 years old.</a>'
pausecontent[18]='<class=cBodyCopy><a href="http://www.a1b2c3.com/suilodge/facovr1.htm" target="_blank" class="cBodyCopy">In the U.S., 80 people die from suicide each day, or 30,000 per year.</a>'
pausecontent[19]='<class=cBodyCopy><a href="http://www.a1b2c3.com/suilodge/facovr1.htm" target="_blank" class="cBodyCopy">Each year, 300,000 Americans survive a suicide attempt.</a>'
pausecontent[20]='<class=cBodyCopy><a href="http://www.a1b2c3.com/suilodge/facovr1.htm" target="_blank" class="cBodyCopy">3% of adults make one or more suicide attempts.</a>'
pausecontent[21]='<class=cBodyCopy><a href="http://www.a1b2c3.com/suilodge/facovr1.htm" target="_blank" class="cBodyCopy">1.4% of Americans end their lives by suicide.</a>'
pausecontent[22]='<class=cBodyCopy><a href="http://www.a1b2c3.com/suilodge/facovr1.htm" target="_blank" class="cBodyCopy">Suicide is the eighth leading cause of death in the U.S.</a>'
pausecontent[23]='<class=cBodyCopy><a href="http://www.sbhihelp.org/files/schizophrenia-booket-2006.pdf" target="_blank" class="cBodyCopy">One percent of the general population has schizophrenia.</a>'
pausecontent[24]='<class=cBodyCopy><a href="http://www.sbhihelp.org/files/schizophrenia-booket-2006.pdf" target="_blank" class="cBodyCopy">Ten percent of those with a schizophrenic parent or sibling will also develop the disease.</a>'
pausecontent[25]='<class=cBodyCopy><a href="http://www.nmha.org/infoctr/factsheets/51.cfm" target="_blank" class="cBodyCopy">Symptoms of schizophrenia usually appear between ages 13 and 25.</a>'
pausecontent[26]='<class=cBodyCopy><a href="http://www.nmha.org/infoctr/factsheets/51.cfm" target="_blank" class="cBodyCopy">In the U.S., approximately 2.5 million people are schizophrenic.</a>'
pausecontent[27]='<class=cBodyCopy><a href="http://win.niddk.nih.gov/publications/binge.htm" target="_blank" class="cBodyCopy">About 2 percent of U.S. adults have binge eating disorder.</a>'
pausecontent[28]='<class=cBodyCopy><a href="http://www.sbhihelp.org/files/nimheatingdisorders.pdf" target="_blank" class="cBodyCopy">An estimated 0.5 to 3.7 percent of females suffer from anorexia nervosa in their lifetime.</a>'
pausecontent[29]='<class=cBodyCopy><a href="http://www.sbhihelp.org/files/nimheatingdisorders.pdf" target="_blank" class="cBodyCopy">An estimated 1.1 percent to 4.2 percent of females have bulimia nervosa in their lifetime.</a>'
pausecontent[30]='<class=cBodyCopy><a href="http://www.sbhihelp.org/files/nimheatingdisorders.pdf" target="_blank" class="cBodyCopy">Between 2-5 percent of Americans experience binge-eating disorder in a 6-month period.</a>'
pausecontent[31]='<class=cBodyCopy><a href="http://www.healthyminds.org/multimedia/eatingdisorders.pdf" target="_blank" class="cBodyCopy">Eating disorders most often affect women between the ages of 12 and 35.</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]+'</ul></div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</ul></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 original time was 500
setTimeout(function(){scrollerinstance.initialize()}, 1000)
}

// -------------------------------------------------------------------
// 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"
// Original time was set to 50 below
setTimeout(function(){scrollerinstance.animateup()}, 70)
}
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) was 100
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
}
