var scrollerinhoud=new Array()
scrollerinhoud[0]='<h1> Communie 2012 </h1>Nieuwe promoties voor het Communie en Lentefeest 2012.<br> <a href="fotografie-communie.php">Kijk hier voor meer info</a>'
scrollerinhoud[1]='<h1>Gratis onderhoud!!</h1>Vanaf januari, gratis onderhoud bij een nieuwe website<br><br><a href="webdesign-promotie.php">Kijk hier voor meer info</a>'
//scrollerinhoud[2]='<h1>The Muddevils</h1>Zondag 30 oktober was ik aanwezig op de MTB Tourtocht van The Muddevils om hen op de gevoelige plaat vast te leggen.<br><br><a href="muddevils.php">Bekijk hier de foto\'s</a>'
scrollerinhoud[2]='<h1>Websites in ontwikkeling</h1><a href="http://www.vagnation.be" target="_blank">www.vagnation.be</a><br>'
scrollerinhoud[3]='<h1>Recente projecten</h1><a href="http://www.souvavy.be" target="_blank">www.souvavy.be</a><br><a href="http://www.rodekruisbuggenhout.be" target="_blank">www.rodekruisbuggenhout.be</a><br><a href="http://www.klusdienstserco.be" target="_blank">www.klusdienstserco.be</a><br><br>Volledig overzicht <a href="webdesign-referenties.php">portfolio</a>'
//scrollerinhoud[2]='<h1>Studio actie</h1>Tijdens de maand april is er een speciale "studioreportage" actie.<br> <a href="shoot.php"> Kijk hier voor meer info</a>'
//scrollerinhoud[1]='<h1>Communie 2011</h1><br><br>Een reportage op locatie of in de studio! <a href="communie.php"> Kijk hier voor meer info</a> '
//scrollerinhoud[2]='<h1>Projecten in opbouw</h1><br><br><a href="http://www.renco.be" target="_blank" class="link-normal">www.renco.be</a><br><a href="http://www.klusdienstserco.be" target="_blank" class="link-normal">www.klusdienstserco.be</a>'
//scrollerinhoud[3]=''
//scrollerinhoud[4]=''
//scrollerinhoud[5]=''

function nieuwsscroller(inhoud, divId, divClass, pauze){
this.inhoud=inhoud //inhoud berichten array
this.scrollboxid=divId //ID van de scroller box
this.pauze=pauze //pauze tussen de berichten (in milliseconden)
this.muisovervlag=0 //boolean vlag om bij muisover de scroller te pauzeren
this.hiddendivpointer=1 //index berichten array voor verborgen div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+inhoud[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+inhoud[1]+'</div></div>')
var scrollerinstance=this
if (window.addEventListener) //start onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //start onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //start in DOM browsers na 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

nieuwsscroller.prototype.initialize=function(){
this.scrollboxdiv=document.getElementById(this.scrollboxid)
this.visiblediv=document.getElementById(this.scrollboxid+"1")
this.hiddendiv=document.getElementById(this.scrollboxid+"2")
this.visibledivtop=parseInt(nieuwsscroller.getCSSpadding(this.scrollboxdiv))
this.visiblediv.style.width=this.hiddendiv.style.width=this.scrollboxdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.scrollboxid).onmouseover=function(){scrollerinstance.muisovervlag=1}
document.getElementById(this.scrollboxid).onmouseout=function(){scrollerinstance.muisovervlag=0}
if (window.attachEvent) //opruimen IE geheugenlek na unload
window.attachEvent("onunload", function(){scrollerinstance.scrollboxdiv.onmouseover=scrollerinstance.scrollboxdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.pauze)
}

nieuwsscroller.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.pauze)
}
}

nieuwsscroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

nieuwsscroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

nieuwsscroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.muisovervlag==1) // pauzeer bij muisover
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.inhoud.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.inhoud[this.hiddendivpointer]
this.animateup()
}
}

nieuwsscroller.getCSSpadding=function(scrollboxobj){
if (scrollboxobj.currentStyle)
return scrollboxobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //indien DOM2
return window.getComputedStyle(scrollboxobj, "").getPropertyValue("padding-top")
else
return 0
}


