var gfeedfetcher_loading_image="modules/mod_camp26_special_ajaxrss/ajaxrss_inc/indicator.gif"
function gfeedpausescroller(divid,divClass,delay,linktarget){
this.tickerid=divid
this.delay=5000
this.mouseoverBol=0
this.hiddendivpointer=1
this.itemsperpage=1
document.write('<div id="'+divid+'" class="'+divClass+'" style="position: relative; overflow: hidden">')
document.write('<div class="innerDiv" style="position: absolute; width: 100%" id="'+divid+'1"><span style="position: absolute">Initializing RSS scroller...</span></div>')
document.write('<div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divid+'2"></div>')
gfeedfetcher.call(this,divid+"unneeded",divClass+"unneeded",linktarget)
document.write('</div>')
this.itemcontainer="<div>"
this.feedcontainer.style.display="none"
this.feedcontainer=document.getElementById(divid+'1')
this.tickerdiv=document.getElementById(divid)
this.visiblediv=document.getElementById(divid+"1")
this.hiddendiv=document.getElementById(divid+"2")
this.visibledivtop=parseInt(this.tickerdiv.currentStyle? this.tickerdiv.currentStyle["paddingTop"] : window.getComputedStyle? window.getComputedStyle(this.tickerdiv,"").getPropertyValue("padding-top"): 0)
this.tickerdivwidth=this.tickerdiv.currentStyle? parseInt(this.tickerdiv.currentStyle["width"]): this.tickerdiv.offsetWidth
this.tickerdivheight=this.tickerdiv.currentStyle? parseInt(this.tickerdiv.currentStyle["height"])+50 : 0}
gfeedpausescroller.prototype=new gfeedfetcher
gfeedpausescroller.prototype.constructor=gfeedpausescroller
gfeedpausescroller.prototype._displayresult=null
gfeedpausescroller.prototype.entries_per_page=function(num){
this.itemsperpage=num}
gfeedpausescroller.prototype._signaldownloadcomplete=function(){
this.feedsfetched+=1
if(this.feedsfetched==this.feedurls.length)
this._populateticker(this.feeds)}
gfeedpausescroller.prototype._populateticker=function(feeds){
gfeedfetcher._sortarray(feeds,this.sortstring)
this.visiblediv.style.width=this.hiddendiv.style.width=parseInt(this.tickerdivwidth)-(this.visibledivtop*2)+"px"
this.itemsperpage=(this.itemsperpage>=feeds.length)? 1 : this.itemsperpage
var feedslice1=feeds.slice(0,this.itemsperpage)
this.hiddendivpointer=this.itemsperpage
var feedslice2=feeds.slice(this.hiddendivpointer,this.hiddendivpointer+this.itemsperpage)
this.visiblediv.innerHTML=formatrssmessage(feedslice1,this.showoptions,this.itemcontainer,this.linktarget)
this.hiddendiv.innerHTML=formatrssmessage(feedslice2,this.showoptions,this.itemcontainer,this.linktarget)
this._initscroller()}
gfeedpausescroller.prototype._initscroller=function(){
var scrollerinstance=this
this.getinline(this.visiblediv,this.hiddendiv)
this.hiddendiv.style.visibility="visible"
this.visiblediv.style.width=this.hiddendiv.style.width=parseInt(this.tickerdivwidth)-(this.visibledivtop*2)+"px"
this.tickerdiv.onmouseover=function(){scrollerinstance.mouseoverBol=1}
this.tickerdiv.onmouseout=function(){scrollerinstance.mouseoverBol=0}
if(window.attachEvent)
window.attachEvent("onunload",function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance._animateup()},this.delay)}
function formatrssmessage(feedslice,showoptions,itemcontainer,linktarget){
var rssoutput=(itemcontainer=="<li>")? "<ul>\n" : ""
for(var i=0;i<feedslice.length;i++){
var itemtitle="<b "+"class=\"titlefield\">"+feedslice[i].title+"</b>"
var itemlabel=/label/i.test(showoptions)? '<span class="labelfield">['+feedslice[i].ddlabel+']</span>' : " "
var itemdate=gfeedfetcher._formatdate(feedslice[i].publishedDate,showoptions)
var itemdescription=/description/i.test(showoptions)? "<br />"+feedslice[i].content :/snippet/i.test(showoptions)? "<br />"+feedslice[i].content :""
rssoutput+=itemcontainer+itemtitle+" "+itemlabel+"\n"+itemdescription+itemcontainer.replace("<","</")+"\n\n"}
rssoutput+=(itemcontainer=="<li>")? "</ul>\n" : ""
return rssoutput}
gfeedpausescroller.prototype._animateup=function(){
var scrollerinstance=this
if(parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-3+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-3+"px"
setTimeout(function(){scrollerinstance._animateup()},40)}
else{
this.getinline(this.hiddendiv,this.visiblediv)
this._swapdivs()
setTimeout(function(){scrollerinstance._rotatemessage()},this.delay)}}
gfeedpausescroller.prototype._swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer}
gfeedpausescroller.prototype.getinline=function(div1,div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight || this.tickerdivheight,div1.offsetHeight)+"px"}
gfeedpausescroller.prototype._rotatemessage=function(){
var scrollerinstance=this
if(this.mouseoverBol==1)
setTimeout(function(){scrollerinstance._rotatemessage()},100)
else{
var i=this.hiddendivpointer
var ceiling=this.feeds.length
this.hiddendivpointer=(i+this.itemsperpage>ceiling-1)? 0 : i+this.itemsperpage
var feedslice=this.feeds.slice(this.hiddendivpointer,this.hiddendivpointer+this.itemsperpage)
this.hiddendiv.innerHTML=formatrssmessage(feedslice,this.showoptions,this.itemcontainer,this.linktarget)
this._animateup()}}
