//cbsm newsscroller1.js

/***********************************************
* 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.
***********************************************/

var pausecontent=new Array()
//pausecontent[0] = '<a href="http://www.cocoabeachsurfmuseum.org/pdf1/picaresque.pdf"><b>Surf Movie!</b></a><br />There will be a showing of Mikey DeTemples longboard surf file PICARESQUE ar the Cocoa Beach Library on Saturday April 10th at 6:30pm.'
//pausecontent[0] = '<a href="http://www.boardsandwaves.com"><b>2010 BOARDS & WAVES EXPO</b></a><br />April 17 & 18 at the Cocoa Expo Sports Center.  The East coasts only consumer expo for surfers. Open to the public with over 70 exhibits including surfboards, fins, SUP, and accessorioes. A portion of theproceeeds will benefit SURFRIDER and The Cocoa Beach High Surf Team'
//pausecontent[0] = '<b>NORLAND High Surfers Reunion</b><br />The Norland High Surfers reunion will be held at THE COCOA BEACH SURF MUSEUM on April 16. <br /><br /><b>This is a private event, the Museum will be closed to the public</b>'
//pausecontent[0] = '<a href="http://www.cocoabeachsurfmuseum.org/calendar.aspx"><b>Museum Picnic</b></a><br />The Cocoa Beach Surf Museum is having a Picnic at PICNIC TABLES on Saturday May 8th from 11:00 AM to 5:00 PM'
//pausecontent[6] = '<a href="http://www.cocoabeachsurfmuseum.org/exhibit_dickcatri_2010.aspx"><b>Dick Catri Exhibit</b></a><br />The exhibit featuring the accomplishments and history of Dick Catri is open for one more week at The Cocoa Beach Surf Museum.  The last day for public viewing of this exhibit is Friday, July 9th. 2010.'
//pausecontent[7] = '<a href="http://www.cocoabeachsurfmuseum.org/event_watermanschallenge_2010.aspx"><b>WATERMANS CHALLENGE!</b></a><br />The 9th annual Cocoa Beach Surf Museum WATERMANS CHALLENGE was held June 4th through June 6th.  Once again, through the help of our volunteers the event was a great success.  See you again next year for the full decade of WATERMANS CHALLENGE event!'
//pausecontent[1] = '<a href="http://www.cocoabeachsurfmuseum.org/exhibit_flwow_2010.aspx"><b>SURF MOVIE</b></a><br />The Cocoa Beach Surf Museum will sponsor a free womens surf movie as part of the FLORIDA WOMEN OF THE WAVES celebration on Friday July 23rd 2010, 7:00 PM at The Cocoa Beach Public Library, 550 N. Brevard Ave, Cocoa Beach 32931.'
//pausecontent[2] = '<a href="http://www.cocoabeachsurfmuseum.org/exhibit_flwow_2010.aspx"><b>LADIES SURFING SOCIAL</b></a><br />The Cocoa Beach Surf Museum will host a Ladies Surfing Social on Saturday July 24th 2010, from 9:00 AM to 12:00 PM behind The International Palms Resort in Cocoa Beach as part of the FLORIDA WOMEN OF THE WAVES celebration.'
pausecontent[0] = '<a href="http://www.cocoabeachsurfmuseum.org/exhibit_flwow_2010.aspx"><b>FLORIDA WOMEN OF THE WAVES</b></a><br />The FLORIDA WOMENOF THE WAVES exhibit is on dispaly at the Museum.  The Exhibit features important Florida Female Surfers from the 1960s up to and including the newest up and comers in the sport.  Stop by and see the women who have, and are, making surfing history.'
pausecontent[1] = '<a href="http://www.easternsurf.com/thisjustin_030210/"><b>Master Legends Exhibit featured on ESM</b></a><br />EasternSurf.com (ESM) coverage of the Master Legends Exhibit opening at The Cocoa Beach Surf Museum, featuring works by Bruce Williamson, Fred Cheney, Patrick Madden, and Bud Gardner.'
pausecontent[2] = '<a href="http://www.easternsurf.com/thisjustin_072110b/"><b>FLwow Exhibit featured on ESM</b></a><br />EasternSurf.com (ESM) coverage of the Florida Women of the Waves Exhibit at The Cocoa Beach Surf Museum'
pausecontent[3] = '<b>Surf Museum Volunteer Meeting</b><br />The Volunteers for THE COCOA BEACH SURF MUSEUM will meet on Wednesday, September 1 from 7:00pm to 8:30pm at The Cocoa Beach Surf Museum located inside the Ron Jons Water Sports building.  If you would like to volunteer or are interested in museum activities stop by.'
pausecontent[4] = '<a href="http://www.surfrider.org/cocoabeach"><b>SURFRIDER FOUNDATION monthly meeting</b></a><br />The Cocoa Beach chapter of the Surfrider Foundation will hold their monthly meeting at The Cocoa Beach Surf Museum on Tuesday, September 21st from 6:00pm to 8:00pm'
pausecontent[5] = '<a href="http://www.cocoabeachsurfmuseum.org/paddleboard.aspx"><b>2010 PADDLEBOARD EVENTS</b></a><br />The fourth annual BALSA BILL and OCEAN NATRUAL PADDLE CHALLENGE will be held August 21, 2010.  Come out and enjoy a day of competiton and fun while supporting the events worthy causes.'
pausecontent[6] = '<a href="http://www.cocoabeachsurfmuseum.org/paddleboard.aspx"><b>2010 PADDLEBOARD EVENTS</b></a><br />The Paddleboard Committee of The Cocoa Beach Surf Museum will hold the mighty CAUSEWAY TO CAUSEWAY 22 MILE PADDLE CHALLENGE on October 9th, 2010.  Better start eating your wheaties now.'
pausecontent[7] = '<a href="http://keeppaddlin.org/"><b>CYNITHIA AGUILAR - CUBA TO KEYWEST</b></a><br />Incredible female paddler Cynthia Aguilar will take on a Cuba to Key West paddle to benefit the MAKE A WISH FOUNDATION.'
pausecontent[8] = '<a href="http://www.cocoabeachsurfmuseum.org/friends_bestwesternCB.aspx"><b>BEST WESTERN CB OFFERS SURFER RATE</b></a><br />The Best Western Ocean Beach Hotel at Cocoa Beach Located at the Cocoa Beach Pier is now offering special discounts for Surfing visitors. Not only a great saving, Best Western is donating $5.00 for each room night to the Cocoa Beach Surfing Museum.  For reservations call  321 783 =7621  ext 366 '
pausecontent[9] = '<a href="http://www.nkfsurf.com/"><b>NKF SURF CONTEST</b></a><br />The NATIONAL KIDNEY FOUNDATION will conduct the 25th annual NKF PRO AM SURF FESTIVAL September 3 - 6 at the Cococa Beach Pier.  Come out to surf and support the Salicks ongoing efforts for this worthy cause'
pausecontent[10] = '<a href="http://www.facebook.com/?ref=home#!/event.php?eid=100875423305997/"><b>FLORIDA WOMEN FOR THE NKF</b></a><br />Florida Women Surfers are rallying in a grass roots effort to support the NKF.  The goal is to have as many women as possible come out to surf in the contest.  An event page has been started on Facebook.  Go Ladies! '
pausecontent[11] = '<a href="http://www.cocoabeachsurfmuseum.org/exhibit_FLwow_2010_photoAlbum.aspx/"><b>FLORIDA WOMEN OF THE WAVES PHOTO ALBUMS</b></a><br />Photos from the Florida Women OF THE WAVES events.  Check back regularly as we will be adding many more photos'


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
}