/***********************************************
* 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()}, 150)
}
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
}

// -------------------------------------------------------------------
// functions for generating random numbers, names and passwords
// -------------------------------------------------------------------

function getRandomNum(lbound, ubound) {
	return (Math.floor(Math.random() * (ubound - lbound)) + lbound);
}

function getRandomChar(number, lower, upper, other, extra) {
	var numberChars = "0123456789";
	var lowerChars = "abcdefghijklmnopqrstuvwxyz";
	var upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var otherChars = "`~!@#$%^&*()-_=+[{]}\\|;:'\",<.>/? ";
	var charSet = extra;
	if (number == true)
	charSet += numberChars;
	if (lower == true)
	charSet += lowerChars;
	if (upper == true)
	charSet += upperChars;
	if (other == true)
	charSet += otherChars;
	return charSet.charAt(getRandomNum(0, charSet.length));
}

function getPassword(length, extraChars, firstNumber, firstLower, firstUpper, firstOther,
latterNumber, latterLower, latterUpper, latterOther) {
	var rc = "";
	if (length > 0)
	rc = rc + getRandomChar(firstNumber, firstLower, firstUpper, firstOther, extraChars);
	for (var idx = 1; idx < length; ++idx) {
		rc = rc + getRandomChar(latterNumber, latterLower, latterUpper, latterOther, extraChars);
	}
	return rc;
}

function scrollMe(scrtable, type, CSS_classname, pause_in_miliseconds, numberofcols) {

	scrtable.style.display="none";
	var rows=scrtable.rows;
	var content=new Array(); 
	for (var i=0; i<rows.length; i++) {
		if (type==1) {
			content[i]= "<table width='100%'><tr>" + rows[i].innerHTML + "</tr></table>";
		} else {
			content[i]="";
			if (typeof numberofcols == 'undefined' ) numberofcols = rows[i].cells.length;
			for (var j=0; j<numberofcols; j++) {
				content[i]+="<tr><td>" + rows[i].cells[j].innerHTML + "</td></tr>";
			}
			content[i]= "<table width='100%'>" + content[i] + "</table>";
		}
	}
	var generatedId = getPassword(10, "", false, true, false, false, true, true, true, false);
	//new pausescroller(name_of_message_array, CSS_ID, CSS_classname, pause_in_miliseconds)
	new pausescroller(content, generatedId, CSS_classname, pause_in_miliseconds);
}

function scrollElements(type, CSS_classname, pause_in_miliseconds) {
//scroll all elements with same classname
	var tableElements=document.getElementsByTagName('table');
	for (var i=0;i<tableElements.length; i++) {
		if (tableElements[i].className == CSS_classname) {
			scrollMe(tableElements[i], type, CSS_classname, pause_in_miliseconds);
		}
	}
}	

function hasClassName(element,className) {
	while (element.parentNode) { 
		if (element.parentNode.className==className) {
			return true;
		}
		element=element.parentNode; 
	}  
	return false; 
}  


/* ------------------------------------snow--------------------------------- */

/* letItSnow (array wi
   snow: array with "snowflake" images
   no: number or falling rate
   speed: speed of falling, the lower the number the faster the image moves
*/

	var ns4up = (document.layers) ? 1 : 0;  // browser sniffer
	var ie4up = (document.all) ? 1 : 0;
	var ns6up = (document.getElementById&&!document.all) ? 1 : 0;
	var dx, xp, yp;    // coordinate and position variables
	var am, stx, sty;  // amplitude and step variables
	var i, doc_width = 800, doc_height = 1800;
	var no=15, speed=10;
	
	function snowNS() {  // Netscape main animation function
		for (i = 0; i < no; ++ i) {  // iterate for every dot
			yp[i] += sty[i];                
			if (yp[i] > doc_height-50) {
				xp[i] = Math.random()*(doc_width-am[i]-30);
				yp[i] = 0;
				stx[i] = 0.02 + Math.random()/10;
				sty[i] = 0.7 + Math.random();
				doc_width = self.innerWidth;
				doc_height = self.innerHeight;
			}
			dx[i] += stx[i];
			document.layers["dot"+i].top = yp[i]+pageYOffset;
			document.layers["dot"+i].left = xp[i] + am[i]*Math.sin(dx[i]);
		}
	    setTimeout("snowIE_NS6()", speed);
	}
	
	
	function snowIE_NS6() {  // IE main animation function
		for (i = 0; i < no; ++ i) {  // iterate for every dot
			yp[i] += sty[i];
			if (yp[i] > doc_height-50) {
				xp[i] = Math.random()*(doc_width-am[i]-30);
				yp[i] = 0;
				stx[i] = 0.02 + Math.random()/10;
				sty[i] = 0.7 + Math.random();
				doc_width = ns6up?window.innerWidth-5:document.body.clientWidth;
				doc_height = ns6up?window.innerHeight-5:document.body.clientHeight;
			}
			dx[i] += stx[i];
			if (ie4up){
				document.all["dot"+i].style.pixelTop = yp[i]; /* +document.body.scrollTop; */
				document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);
			}
			else if (ns6up){
				document.getElementById("dot"+i).style.top=yp[i]+window.pageYOffset+"px";
				document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px";
			}
		}
	}

function letItSnow (snow) {

	if (ns4up||ns6up) {
		doc_width = self.innerWidth;
		doc_height = self.innerHeight;
	} else if (ie4up) {
		doc_width = document.body.clientWidth;
		doc_height = document.body.clientHeight;
	}
	
	dx = new Array();
	xp = new Array();
	yp = new Array();
	am = new Array();
	stx = new Array();
	sty = new Array();
	j = 0;
	
	for (i = 0; i < no; ++ i) {
		dx[i] = 0;                        // set coordinate variables
		xp[i] = Math.random()*(doc_width-50);  // set position variables
		yp[i] = Math.random()*doc_height;
		am[i] = Math.random()*20;         // set amplitude variables
		stx[i] = 0.02 + Math.random()/10; // set step variables
		sty[i] = 0.7 + Math.random();     // set step variables
		if (ns4up) {                      // set layers
			if (i == 0) {
				document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src=\""+ snow[j] + "\" border=\"0\"></layer>");
			} else {
				document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src=\""+ snow[j] + "\" border=\"0\"></layer>");
			}
		} else if (ie4up||ns6up) {
			if (i == 0) {
				document.write("<div id=\"dot"+ i +"\" style=\"position: absolute; z-index: "+ i +";visibility: visible; top: 15px; left: 15px; width:1px;\"><img src=\"" + snow[j] + "\" border=\"0\"></div>");
			} else {
				document.write("<div id=\"dot"+ i +"\" style=\"position: absolute; z-index: "+ i +";visibility: visible; top: 15px; left: 15px; width:1px;\"><img src=\"" + snow[j] + "\" border=\"0\"></div>");
			}
		}
		if (j == (snow.length-1)) { j = 0; } else { j += 1; }
	}

	if (ns4up) {
		snowNS();
	} else if (ie4up||ns6up) {
		window.setInterval("snowIE_NS6()", speed);
	}
}


/* ------------------------------------fading message in snow--------------------------------- */

// CREDITS:
// Headline Fader with snow-effect
// By Peter Gehrig
// Copyright (c) 2003 Peter Gehrig. All rights reserved.
// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at http://www.hypergurl.com

// IMPORTANT:
// If you add this script to a script-library or script-archive
// you have to add a highly visible link to
// http://www.24fun.com on the webpage
// where this script will be featured

// Type the messages into the text-Array here. Add as many as you like.


var text=new Array("GELUKKIG", "NIEUWJAAR!")

// Type a link for each message. If you don't want to add a link add a "#" instead

var textlink=new Array("#","#")

// Type the target-window for each link. Accepted values are "_blank", "_top", 
// "_parent" or the name of any frame
var texttarget=new Array("_blank","_blank")

// Set the font for the headline-fader
var textfont="Arial"

// Set the font-color for the headline-fader (hexadecimal triplet values recommended)
var textfontcolor="#AAAAFF"

// Set the rollover-color for the headline-fader (hexadecimal triplet values recommended)
var textfontcolorrollover="#ffff00"

// Set the font-size for the headline-fader (points)
var textfontsize=11

// Set the background-color for the headline-fader (hexadecimal triplet values recommended)
var textbgcolor="#000000"

// Set the width of the headline-fader (pixels)
var textwidth=295

// Set the height of the headline-fader (pixels)
var textheight=100

// Set the pause between the messages (seconds)
var textpause=2

// Set the borderwidth (pixels)
var textborder=3

// Set the border-color (hexadecimal triplet values recommended)
var textbordercolor="#AAAAFF"

// Set the horizontal text-position. Allowed values are "center" or "left" or "right"
var textalign="center"

// Set the vertical text-position. Allowed values are "middle" or "top" or "bottom"
var textvalign="middle"

// Set the number of snowflakes (more than 20 - 30 not recommended)
var snowmax=20

// Set the colors for the snow. Add as many colors as you like
var snowcolor=new Array("#aaaacc","#ddddFF","#ccccDD")

// Set the fonts, that create the snowflakes. Add as many fonts as you like
var snowtype=new Array("Arial Black","Arial Narrow","Times","Comic Sans MS")

// Set the letter that creates your snowflake (recommended:*)
var snowletter="*"

// Set the speed of sinking (recommended values range from 0.3 to 2)
var sinkspeed=0.6

// Set the maximal-size of your snowflaxes (points)
var snowmaxsize=16

// Set the minimal-size of your snowflaxes (points)
var snowminsize=8

// Set font-style. Acceptable values are "normal" or "italic"
var textitalic="normal"

// Set font-weight. Acceptable values are "normal" or "bold"
var textweight="bold"

// do not edit below this line
var textdecoration="none"
var transparency=100
var transparencystep=5
var x_pos=0
var y_pos=0
var i_text=0
if (textitalic=="italic") {var textitalicA="<i>"; var textitalicB="</i>"}
else {var textitalicA="<i>"; var textitalicB="</i>"}
if (textweight=="bold") {var textweightA="<b>"; var textweightB="</b>"}
else {var textweightA=""; var textweightB=""}
var textweightA="<b>"
var textweightB="</b>"
var tickercontent
var pausefade=40
var oneloopfinished=false
var snow=new Array()
var marginbottom
var marginright
var timer
var i_snow=0
var x_mv=new Array();
var crds=new Array();
var lftrght=new Array();
var textfontsizeHTML=Math.floor(textfontsize/4)
textpause*=1000

if (textfontsizeHTML<1) {textfontsizeHTML=1}
if (textfontsizeHTML>=7) {textfontsizeHTML=7}

var browserinfos=navigator.userAgent 
var ns4=document.layers
var ns6=document.getElementById&&!document.all&&!browserinfos.match(/Opera/)
var ie=document.all&&!browserinfos.match(/Opera/)
var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/)
var opera=browserinfos.match(/Opera/)  

function changecontent() {
	getcontent()
	i_text++
	if (i_text>=text.length) {i_text=0}	
	if (ie) {
		ticker.innerHTML=content
		fadein()
	}
	if (ns6) {
		document.getElementById('ticker').innerHTML=content
		fadein()
	}
	if (opera) {
		document.getElementById('ticker').innerHTML=content
		var texttimer=setTimeout("changecontent()",textpause*1.5)
	}
	if (ns4) {
		document.roof.document.ticker.document.write(content)
		document.roof.document.ticker.document.close()
		var texttimer=setTimeout("changecontent()",textpause)
	}	
}

function fadein() {
	if (transparency<100){
		transparency+=transparencystep
		if (ie) {
			document.all.ticker.filters.alpha.opacity=transparency
		}
		if (ns6) {
			document.getElementById('ticker').style.MozOpacity=transparency/100
		}
		var fadetimer=setTimeout("fadein()",pausefade)
	}
	else {
		clearTimeout(fadetimer)
		setTimeout("fadeout()",textpause)
	}
}

function fadeout() {
	if (transparency>0){
		transparency-=transparencystep
		if (ie) {
			document.all.ticker.filters.alpha.opacity=transparency
		}
		if (ns6) {
			document.getElementById('ticker').style.MozOpacity=transparency/100
		}
		var fadetimer=setTimeout("fadeout()",pausefade)
	}
	else {
		clearTimeout(fadetimer)
		setTimeout("changecontent()",1000)
	}
}

function getcontent() {
	if (ie) {
		var tablewidth=textwidth-2*textborder
		var tableheight=textheight-2*textborder
	}
	else {
		var tablewidth=textwidth
		var tableheight=textheight
	}
	if (ie || ns6 || opera) {	
		var padding=parseInt(textborder)+3
		content="<table width="+tablewidth+" height="+tableheight+" cellpadding="+padding+" cellspacing=0 border=0><tr valign="+textvalign+"><td align="+textalign+">"
		content+="<a href=\""+textlink[i_text]+"\" target=\""+texttarget[i_text]+"\" style=\"position:relative;font-family:\'"+textfont+"\';font-size:"+textfontsize+"pt;font-weight:"+textweight+";text-decoration:"+textdecoration+";color:"+textfontcolor+";font-style:"+textitalic+";\" onMouseOver=\"this.style.color=\'"+textfontcolorrollover+"\'\" onMouseOut=\"this.style.color=\'"+textfontcolor+"\'\">"
		content+=text[i_text]
		content+="</a></td></tr></table>"
	}
	else {	
		content="<table width="+tablewidth+" height="+tableheight+" cellpadding="+textborder+" cellspacing=0><tr valign="+textvalign+"><td align="+textalign+">"
		content+="<a href=\""+textlink[i_text]+"\" target=\""+texttarget[i_text]+"\" style=\"position:relative;font-family:\'"+textfont+"\';font-size:"+textfontsize+"pt;font-weight:"+textweight+";text-decoration:"+textdecoration+";color:"+textfontcolor+";font-style:"+textitalic+";\">"
		content+=text[i_text]
		content+="</a></td></tr></table>"

		framecontent="<table width="+tablewidth+" height="+tableheight+" cellpadding=0 cellspacing=0 border="+textborder+"><tr><td>"
		framecontent+="<font color=\""+textbgcolor+"\">"
		framecontent+="."
		framecontent+="</font>"
		framecontent+="</td></tr></table>"
	}
}

function randommaker(range) {		
	rand=Math.floor(range*Math.random())
    return rand
}

function initsnow() {
	marginbottom = textheight
	marginright = textwidth
	var snowsizerange=snowmaxsize-snowminsize
	for (i=0;i<=snowmax;i++) {
		crds[i] = 0;                      
    	lftrght[i] = Math.random()*15;         
    	x_mv[i] = 0.03 + Math.random()/10;
		snow[i]=document.getElementById("s"+i)
		snow[i].style.fontFamily=snowtype[randommaker(snowtype.length)]
		snow[i].size=randommaker(snowsizerange)+snowminsize
		snow[i].style.fontSize=snow[i].size
		snow[i].style.color=snowcolor[randommaker(snowcolor.length)]
		snow[i].sink=sinkspeed*snow[i].size/5
		snow[i].posx=randommaker(marginright-snow[i].size)
		snow[i].posy=randommaker(2*marginbottom-marginbottom-2*snow[i].size)
		snow[i].style.left=snow[i].posx +"px"
		snow[i].style.top=snow[i].posy +"px"
	}
	movesnow();changecontent()
}

function movesnow() {
	for (i=0;i<=snowmax;i++) {
		crds[i] += x_mv[i];
		snow[i].posy+=snow[i].sink
		snow[i].style.left=snow[i].posx+lftrght[i]*Math.sin(crds[i]) +"px";
		snow[i].style.top=snow[i].posy +"px"
		
		if (snow[i].posy>=marginbottom || parseInt(snow[i].style.left)>(marginright-3*lftrght[i])){
			snow[i].posx=randommaker(marginright-snow[i].size)
			snow[i].posy=0
		}
	}
	var timer=setTimeout("movesnow()",50)
}

function showFadingMessageInSnow() {
	getcontent()
	if (ie || ns6 || opera) {
		if (ns6) {
			textwidth-=2*textborder
			textheight-=2*textborder
		}
		document.write("<table border=0 cellpadding=0 cellspacing=0><tr><td width="+textwidth+" height="+textheight+" valign=top>")
		document.write("<div id=\"roof\" style=\"position:relative;width:"+textwidth+"px;height:"+textheight+"px;font-family:\'"+textfont+"\';border-style:solid;border-color:"+textbordercolor+";border-width:"+textborder+"px;background-color:"+textbgcolor+";overflow:hidden\">")
		
		document.write("<div id=\"ticker\" style=\"position:absolute;top:"+-textborder+"px;left:"+-textborder+"px;width:"+textwidth+"px;height:"+textheight+"px;font-family:\'"+textfont+"\';font-size:"+textfontsize+"pt;font-weight:"+textweight+";font-style:"+textitalic+";border-style:solid;border-color:"+textbordercolor+";border-width:"+textborder+"px;background-color:"+textbgcolor+";overflow:hidden\;filter:alpha(opacity=100)\">")
		document.write("</div>")
		for (i=0;i<=snowmax;i++) {
		document.write("<div id='s"+i+"' style='position:absolute;top:-"+snowmaxsize+"'>"+snowletter+"</div>")
		}
		document.write("</div>")
		document.write("</td></tr></table>")
		if ( typeof window.addEventListener != "undefined" ) {
			window.addEventListener( "load", initsnow, false );
		} else if ( typeof window.attachEvent != "undefined" ) {
			window.attachEvent( "onload", initsnow);
		} else {
			if ( window.onload != null ) {
			var oldOnload = window.onload;
			window.onload = function ( e ) {
							oldOnload( e );
							initsnow();
							}
			}else {
				window.onload = initsnow();
			}
		}
		//	window.onload=initsnow
	}
	
	else if (ns4) {
			document.write("<table border=0 cellpadding=0 cellspacing=0><tr><td width="+textwidth+" height="+textheight+" valign=top>")
		document.write("<ilayer name=\"roof\" width="+textwidth+" height="+textheight+">")
			document.write("<layer name=\"tickerframe\" width="+textwidth+" height="+textheight+" top=0 left=0 bgcolor="+textbgcolor+">")
			document.write(framecontent)
			document.write("</layer>")
			document.write("<layer name=\"ticker\" width="+textwidth+" height="+textheight+" top=0 left=0>")
			document.write()
			document.write("</layer>")
			document.write("</ilayer>")
			document.write("</td></tr></table>")
		window.onload=changecontent
	}
}

/* Kopieer dit onderin index.php van de template om het te laten sneeuwen op de pagina
<!-- winter! -->
<script type="text/javascript">
<!-- 
	var snow = new Array();
	snow[0] = "<?php echo $mosConfig_live_site; ?>/images/stories/Misc/snowflake10.gif";
	snow[1] = "<?php echo $mosConfig_live_site; ?>/images/stories/Misc/snowflake9.gif";
	snow[2] = "<?php echo $mosConfig_live_site; ?>/images/stories/Misc/snowflake8.gif";
	snow[3] = "<?php echo $mosConfig_live_site; ?>/images/stories/Misc/snowflake7.gif";
	letItSnow (snow);
-->
</script>

*/