function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

/* dropdown menu for IE */

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);



/* Check resolutie, bij 1024 of lager, schuif gehele site iets naar beneden zodat navigatie altijd zichtbaar is */

function checkRes() 
{
	
	if(screen.height <= 780)
	{
		//alert('klein scherm alert! '+screen.width+'x'+screen.height);
		//$('outer').setStyle('top', '55%');
	}
}



/* scroll script */

var clipTop = 0;
var clipWidth = 280;
var clipBottom = 350;
var topper = 0;
var lyrheight = 0;
var time,amount,theTime,theHeight,DHTML;

function init()
{
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	var x = new getObj('rightcontent');
	if (document.layers)
	{
		lyrheight = x.style.clip.bottom;
		lyrheight += 20;
		x.style.clip.top = clipTop;
		x.style.clip.left = 0;
		x.style.clip.right = clipWidth;
		x.style.clip.bottom = clipBottom;
	}
	else if (document.getElementById || document.all)
	{
		lyrheight = x.obj.offsetHeight;
		x.style.clip = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
	}
}

function scrollayer(layername,amt,tim)
{
	if (!DHTML) return;
	thelayer = new getObj(layername);
	if (!thelayer) return;
	amount = amt;
	theTime = tim;
	realscroll();
}

function realscroll()
{
	if (!DHTML) return;
	clipTop += amount;
	clipBottom += amount;
	topper -= amount;
	if (clipTop < 0 || clipBottom > lyrheight)
	{
		clipTop -= amount;
		clipBottom -= amount;
		topper += amount;
		return;
	}
	if (document.getElementById || document.all)
	{
		clipstring = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
		thelayer.style.clip = clipstring;
		thelayer.style.top = topper + 'px';
	}
	else if (document.layers)
	{
		thelayer.style.clip.top = clipTop;
		thelayer.style.clip.bottom = clipBottom;
		thelayer.style.top = topper;
	}
	time = setTimeout('realscroll()',theTime);
}

function stopscroll()
{
	if (time) clearTimeout(time);
}





function ShowScrollLinks()
{			
	if($('rightcontent'))
	{
		var realheight = $('rightcontent').offsetHeight;
		var maxheight = $('rightcontentcontainer').offsetHeight;
		
		if(realheight > maxheight)
		{
			$('scrollup').setStyle('visibility', 'visible');
			$('scrolldown').setStyle('visibility', 'visible');
		}
		else
		{
			$('scrollup').setStyle('visibility', 'hidden');
			$('scrolldown').setStyle('visibility', 'hidden');
		}	
	}
	
	if($('itemlist'))
	{
		var contentlistrealheight = $('itemlist').offsetHeight;
		var contentlistmaxheight = $('itemlistouter').offsetHeight;
		
		if(contentlistrealheight > contentlistmaxheight)
		{
			$('itemscrollup').setStyle('visibility', 'visible');
			$('itemscrolldown').setStyle('visibility', 'visible');
		}
		else
		{
			$('itemscrollup').setStyle('visibility', 'hidden');
			$('itemscrolldown').setStyle('visibility', 'hidden');
		}	
	}

	
	if($('textonly'))
	{
		var contentlistrealheight = $('textonlycontent').offsetHeight;
		var contentlistmaxheight = $('textonlycontentcontainer').offsetHeight;
		
		if(contentlistrealheight > contentlistmaxheight)
		{
			$('textonlyscrollup').setStyle('visibility', 'visible');
			$('textonlyscrolldown').setStyle('visibility', 'visible');
		}
		else
		{
			$('textonlyscrollup').setStyle('visibility', 'hidden');
			$('textonlyscrolldown').setStyle('visibility', 'hidden');
		}	
	}	
	
	
	//bepaal hoogte van contentright op basis van hoogte van heading
	if($('rh1'))
	{
		var h1height = $('rh1').offsetHeight;
		
		if(h1height > 22)
		{
			$('rightcontentcontainer').addClass('small');
			clipBottom = 319;
			$('scrolldown').setStyle('top', '310px');
		}	
	}	
	
}

function TextOnlyHeight()
{
	//bepaal hoogte van contentright op basis van hoogte van heading
	if($('textonlycontent'))
	{
		var realheight = $('textonlycontent').offsetHeight;
	
		if(realheight < 400)
		{
			$('textonly').setStyle('height', realheight+'px');
			newheight = realheight / 2;
			$('textonly').setStyle('margin-top', '-'+newheight+'px');
		}	
	}	
}

function SetScrollStartPos(startpos)
{
	autoscroll('itemlist',startpos,1);
}
