var space = 500;
var speed = 50;
var cont;
var pane;
var tt;
var tt2;
function initScroll() {
	if(cont = document.getElementById("bgpic")) {
		pane = document.getElementById("pane1");
		pane.style.opacity = 0;
		pane.style.filter = "alpha(opacity=0)";
		tt = setInterval("loop()", 10);
	}
}
function loop() {
	space = space - 10;
	if(space < 0) {
		clearInterval(tt);
		tt2 = setInterval("showPane()", 10);
		
		space = 0;
	}
	cont.style.backgroundPosition = space + "px 0px";
}
function showPane() {
	p = parseInt(pane.style.opacity*100);
	p = p + 5;
	if(p >= 100) {
		clearInterval(tt2);
		p = 99;
	}
	pane.style.opacity = p/100;
	pane.style.filter = "alpha(opacity=" + p + ")";
}
var intervd;
var intervu;
var posit;
var speed = 5;
function loadMenu() {
	intervd = new Array();
	intervu = new Array();
	posit = new Array();
	mm = document.getElementById("main_menu");
	ml = mm.getElementsByTagName("li");
	for(i=0;i<ml.length;i++) {
		mlu = ml[i].getElementsByTagName("ul");
		if(mlu.length > 0) {
			mlu[0].id = "sub" + i;
		}
		if(ml[i].className == "m0") {
			ml[i].id = "menu" + i;
			if(mlu.length > 0) {
				ml[i].onmouseover = function(i) {
					schuifSub(this);
					schuif(this);
				}
				ml[i].onmouseout = function() {
					deschuif(this);
					hideSub(this);
				}
			} else {
				ml[i].onmouseover = function() {
					schuif(this);
				}
				ml[i].onmouseout = function() {
					deschuif(this);
				}
			}
		} else {
			if(mlu.length > 0) {
				ml[i].onmouseover = function(i) {
					schuifSub(this);
				}
				ml[i].onmouseout = function() {
					hideSub(this);
				}
			}
		}
	}
}
var thesub;
function hideSub(who) {
	mlu = who.getElementsByTagName("ul");
	mlu[0].way = false;
	
	tmpo = parseInt(mlu[0].style.opacity * 100);
	thesub[mlu[0].id] = setTimeout("schuifSubSub('" + mlu[0].id + "', " + tmpo + ")", 39);
}
function schuifSub(who) {
	if(!thesub) {
		thesub = new Array();
	}
	mlu = who.getElementsByTagName("ul");
	tmpo = parseInt(mlu[0].style.opacity * 100);
	if(!tmpo) {
		tmpo = 0;
	}
	mlu[0].way = true;
	
	thesub[mlu[0].id] = setTimeout("schuifSubSub('" + mlu[0].id + "', " + tmpo + ")", 39);
	mlu[0].style.display = "block";
}
function schuifSubSub(who, s) {
	if(thesub[who]) {
		clearTimeout(thesub[who]);
	}
	w = document.getElementById(who);
	if(w.way) {
		if(s >= 80) {
			s = 80;
		} else {
			s2 = s + 10;
			thesub[who] = setTimeout("schuifSubSub('" + who + "', " + s2 + ")", 39);
		}
	} else {
		if(s <= 0) {
			s = 0;
			w.style.display = "none";
		} else {
			s2 = s - 10;
			thesub[who] = setTimeout("schuifSubSub('" + who + "', " + s2 + ")", 39);
		}
	}
	w.style.opacity = s/100;
	w.style.filter = "alpha(opacity=" + s + ")";
}

function schuif(who) {
	if(typeof(posit[who.id]) == "undefined") {
		posit[who.id] = 40;
	}
	if(!intervd[who.id]) {
		intervd[who.id] = setInterval("doSchuif('" + who.id + "')", 39);
	}
	if(intervu[who.id]) {
		clearInterval(intervu[who.id]);
		intervu[who.id] = false;
	}
}
function doSchuif(num) {
	posit[num] = posit[num] - speed;
	if(posit[num] < 1) {
		clearInterval(intervd[num]);
		intervd[num] = false;
		posit[num] = 1;
	}
	document.getElementById(num).style.backgroundPosition = "center -" + posit[num] + "px";
}
function deschuif(who) {
	if(intervd[who.id]) {
		clearInterval(intervd[who.id]);
		intervd[who.id] = false;
	}
	if(!intervu[who.id]) {
		intervu[who.id] = setInterval("doDeSchuif('" + who.id + "')", 39);
	}
}
function doDeSchuif(num) {
	posit[num] = posit[num] + speed;
	if(posit[num] > 40) {
		clearInterval(intervu[num]);
		posit[num] = 40;
	}
	document.getElementById(num).style.backgroundPosition = "center -" + posit[num] + "px";
}

var tmba, larray;
function zimg() {
	tmb = document.getElementById("thumbs");
	tmba = tmb.getElementsByTagName("div");
	
var ie = (document.all) ? 1 : 0;
var p = (ie) ? "filter" : "MozOpacity";
var v;	
	for(i = 0 ; i < tmba.length ; i++) {
		v = (ie) ? "alpha(opacity="+0+")" : 0;
  		tmba[i].style[p] = v;
	}
	
	larray = new Array(tmba.length);
	for(i=0;i<larray.length;i++) {
		larray[i] = i;
	}
	larray.sort(randOrd);
	//setTimeout("loopImages();", 1000);
}

function randOrd(){
	return (Math.round(Math.random())-0.5); 
}
var c = 0;
function loopImages() {
	num = larray[c];
	num2 = larray[c+1]
var ie = (document.all) ? 1 : 0;
var p = (ie) ? "filter" : "MozOpacity";
var v;	
	if(typeof(tmba[num]) != "undefined") {
		
		if( ie) {	
			m = parseInt(tmba[num].style.filter.replace('alpha(opacity=','') );	
		} else {
			m = parseInt(tmba[num].style.opacity * 100);
		}
		
		m = m + 10;
		if(m > 100) {
			m = 99;
			c++
		}
		if(m > 50) {
			if(typeof(tmba[num2]) != "undefined") {
				v = (ie) ? "alpha(opacity="+ (m-50) +")" : (m-50)/100;
				tmba[num2].style[p] = v;
			}
		}
		v = (ie) ? "alpha(opacity="+ m +")" : m/100;
		tmba[num].style[p] = v;		
	}
	if(typeof(tmba[c]) != "undefined") {
		setTimeout("loopImages();", 39);
	}
}

var ach;
function initbg() {
	ach = new Array()
	for(i = 0 ; i < achtergronden.length ; i++) {
		ach[i] = new Image();
		ach[i].src = achtergronden[i];
	}
	setTimeout("changebg()", 10000);
}
var content;
var contentbg;
var bgpos;
var bgloop;
function changebg() {
	randimage = Math.floor(Math.random() * (ach.length));
	
	if(typeof(contentbg) == "undefined") {
		contentbg = document.getElementById("contentbg");
		content = document.getElementById("content");
	}
	contentbg.style.backgroundImage = "url(" + ach[randimage].src + ")";
	bgpos = 971;
	contentbg.style.backgroundPosition = bgpos + "px 0px";
	bgloop = setInterval("loopBg()", 10);
	//setTimeout("changebg()", 10000);
}
function loopBg() {
	bgpos = bgpos - 10;
	if(bgpos <= 0) {
		bgpos = 0;
		clearInterval(bgloop);
		setTimeout("changebg()", 10000);
		
		content.style.backgroundImage = contentbg.style.backgroundImage;
	}
	content.style.backgroundPosition = (bgpos-971) + "px 0px";
	contentbg.style.backgroundPosition = bgpos + "px 0px";
}

