// JavaScript Document
var stoppen = 0;
var count = 0;
var maxval
var timeOutID = 0;
var direction = 0;


function initVal()
{
	maxval = ref_overflow.scrollHeight;
}


function leegmaken(v)
{
	if(v.value == 'zoeken')
	{
		v.value = "";
	}
}
function changeImage(p)
{
	var ran_number = Math.round(Math.random()*7); 
	var d = document.getElementById("image2");
	if (p == 1)
	{
		d.src = "images/p0" + ran_number + ".jpg";
	}
	else
	{
		d.src = "images/0" + ran_number + ".jpg";
	}
	setTimeout('changeImage()',8000);
}


function goscroll()
{
	if (stoppen == 0)
	{
		if (direction == 0) 
		{
			ref_overflow.scrollTop = count;
			count++; 
				if (count > (ref_overflow.scrollHeight - ref_overflow.clientHeight)-1)
				{
					direction = 1;
					timeOutID = 1;
				}
		}
		else 
		{
			ref_overflow.scrollTop = count;
			count--; 
			if (count < 1)
			{
				direction = 0;
				timeOutID = 1;
			}
		}
		if (timeOutID == 1) 
		{
			setTimeout("goscroll()", 1500);
			timeOutID = 0;
		}
		else
		{
			setTimeout("goscroll()", 100);
			timeOutID = 0;
		}
	}
}