/********************************************************************************
Scroll without scrollbarr.
(C) Knooppunt Internetproducties
Update  : E Toering http://www.knoop.nl  (20-12-2001) Opera compatibility
                                         (15-02-2002) Hide nav. if not needed
 Waarde Collega, gaarne niet "RIPPEN"    (20-02-2003) divText included in script.. irratating
 Ik heb hier een berg werk van gehad...  (25-02-2003) onmousewheel added
                                         (26-02-2003) scrollbarr function added
********************************************************************************/
document.write('<style type="text/css">#divText{position:absolute; top:0; left:0}</style>');
/***************************************** Aan te passen variabelen *************/
scrollbotom = 0;
frame_left_minus   = 250;
frame_top_minus    =   1;
frame_bottom_minus =   0;

scroll_image_width =  11;
scroll_image_height=  15;
ScrollMargin       =  8;
/***************************************** Aan te passen variabelen (frameset...)*/
frame_width_minus  =   0;
frame_height_minus =  79;
/********************************************************************************/

function checkBrowser(){
	var n=navigator,nu=n.userAgent.toLowerCase(),no=n.userAgent.indexOf('opera');
  this.ver   =n.appVersion.toLowerCase();
  this.dom   =document.getElementById                             ?1:0
  this.op5   =(nu.indexOf('opera') > 0)                           ?1:0;
  this.op7   =(this.op5&&eval(nu.substring(no+6,no+7))>6)         ?1:0;
  this.ns4   =(document.layers && !this.dom)                      ?1:0;
  this.ns5   =(this.dom && parseInt(this.ver) >= 5)               ?1:0;
  this.ie4   =(document.all && !this.dom)                         ?1:0;
  this.ie5   =(this.ver.indexOf("msie 5")>-1&&this.dom)           ?1:0;
  this.ie55  =(this.ver.indexOf("msie 5.5")>-1&&this.dom)         ?1:0;
  this.ie6   =((this.ver.indexOf("msie 6")>-1
	           || this.ver.indexOf("msie 7")>-1
	           || this.ver.indexOf("msie 8")>-1)&&this.dom&&!this.op5)?1:0;
  this.ie4mac=this.ie4 && nu.indexOf("mac")>-1;
  this.ie5mac=this.ie5 && nu.indexOf("mac")>-1;
  this.bw    =(this.ie6 || this.ie55 ||  this.ie5 || this.ie4 || this.ns4 || this.ns5 || this.ie5mac || this.op5);
  return this;
}
bw=new checkBrowser();

if     (bw.ns4)                        {doc2="document[";               sty="]";      htm="].document";xpos="e.pageX";ypos="e.pageY"}
else if(bw.ie4||bw.ie5||bw.ie6||bw.op5){doc2="document.all[";           sty="].style";htm="].document";xpos="event.x";ypos="event.y"}
else if(bw.dom)                        {doc2="document.getElementById(";sty=").style";htm=")";         xpos="event.x";ypos="event.y"}

if(bw.ns4 || bw.ns5 || bw.op5) {
                      get_width  = window.innerWidth;
                      get_height = window.innerHeight;                }
else if(bw.ie4 || bw.ie5 || bw.ie55 || bw.ie6) {
                      get_width  = document.body.offsetWidth;
                      get_height = document.body.offsetHeight;        }
her_positioneer = 0;
if (get_width < 200) {her_positioneer = 1;
                      get_width  = Math.floor(screen.availWidth*.9) - frame_width_minus;
                      get_height = Math.floor(screen.availHeight*.8)- frame_height_minus; }
if (get_width < 200) {get_width  = Math.floor(screen.width*.8)      - frame_width_minus;
                      get_height = Math.floor(screen.height*.7)     - frame_height_minus; }
if (get_width < 200) {get_width  = 620                              - frame_width_minus;
                      get_height = 340                              - frame_height_minus; }
if (her_positioneer) {parent.window.resizeTo(get_width+frame_width_minus,get_height+frame_height_minus);
                      parent.window.moveTo(0,0);                      }

ScrollWndHeight  =get_height;
ScrollWndWidth   =get_width - frame_left_minus - scroll_image_width - ScrollMargin;
ScrollArrowHeight=get_height - frame_bottom_minus - ScrollMargin;
ScrollArrowWidth =get_width  - scroll_image_width - ScrollMargin + 3;
ScrollBgHeight   =get_height;

if ( ScrollWndWidth < 250 ) { ScrollWndWidth = get_width*.9 }

if(!bw.ns4) {
  ScrollWndHeight  += 0;
  ScrollWndWidth   += 0;
  ScrollArrowHeight+= 0;
  ScrollArrowWidth -= 3;
  ScrollBgHeight   += 0;
}
/********************************************************************************/

/********************************************************************************
Layer defenities
********************************************************************************/
document.write('<style type="text/css">#divText{position:absolute; top:0; left:0;}</style>');

function GetUpArrow(){
  document.write("<div id=\"divUp\" style=\"position:absolute;top:"+eval(ScrollMargin+frame_top_minus)+";left:"+ScrollArrowWidth+";z-index:203;Visibility: hidden;\">\n\r\n\r");
}
function GetDownArrow(){
  document.write("<div id=\"divDown\" style=\"position:absolute;top:"+eval(ScrollArrowHeight-scroll_image_height)+";left:"+ScrollArrowWidth+";z-index:204;Visibility: hidden;\">\n\r\n\r");
}
function GetScrollLayer(){
       if(bw.ie4 || bw.ns4  || bw.ns5 || bw.op5) { document.write("<div id=\"divCont\" style=\"position:absolute;width:"+ScrollWndWidth+";height:"+ScrollWndHeight+";top:0;left:0;clip:rect(0 "+(ScrollWndWidth)+" "+(ScrollWndHeight)+" 0);z-index:200;\">"); }
  else if(bw.ie5 || bw.ie55 || bw.ie6)           { document.write("<div id=\"divCont\" style=\"position:absolute;width:"+ScrollWndWidth+";height:"+ScrollWndHeight+";top:0;left:0;z-index:200;\">"); }
}

var BgBarHeight;
function GetBgBar(){
	BgBarHeight = eval(ScrollArrowHeight-ScrollMargin-frame_top_minus);
	document.write("<div id=\"BgBar\" style=\"position:absolute;                top:"+eval(ScrollMargin+frame_top_minus)+";left:"+ScrollArrowWidth+";width:"+scroll_image_width+";height:"+BgBarHeight+";z-index:201;Visibility: hidden;\">\n\r\n\r");
}
var BarMultipier, BarMax, BarHeight;
function GetBar(){
	BarMax   =eval(Math.floor(BgBarHeight-2*scroll_image_height));
	BarHeight=eval(Math.floor((get_height+5)/oScroll.scrollHeight*BarMax)-3);
	if ( BarHeight < scroll_image_width ) { BarHeight = eval(scroll_image_width)}
	BarMultipier = BarMax/oScroll.scrollHeight;
	document.write("<div id=\"Bar\" style=\"position:absolute;                top:"+eval(ScrollMargin+scroll_image_height+2)+";left:"+ScrollArrowWidth+";width:"+eval(scroll_image_width)+";height:"+BarHeight+";z-index:202;Visibility: hidden;\">\n\r\n\r");
}


/********************************************************************************
begin script scrolling content
********************************************************************************/
var speed=50
var Barloop, loop, timer, remember_pos = "leeg";
function makeObj(obj,nest){
  nest=(!nest) ? '':'document.'+nest+'.'
  this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
  this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
  this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
  this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
  this.up=goUp;this.down=goDown;
  this.moveItScroll=moveItScroll; this.x; this.y;
  this.obj = obj + "Object"
  eval(this.obj + "=this")
  return this
}
function moveItScroll(x,y){
	y=Math.ceil(y/2)*2;
  this.x=x;this.y=y
  this.css.left=this.x
  this.css.top=this.y
	if ( scrollbar ) {
		var initpos = eval(ScrollMargin+scroll_image_height+2);
		var pos = eval(initpos-y*BarMultipier);
//		if ( pos < initpos ) { pos = initpos}
		Bar_laag = eval(doc2 + '"Bar"' + sty);
		if (pos > ScrollArrowHeight-scroll_image_height-BarHeight ) { pos = ScrollArrowHeight-scroll_image_height-BarHeight }
		Bar_laag.top = pos;
	}
//document.Info.text.value = this.y+"|"+oScroll.y+"\n"+document.Info.text.value; //eval(ypos)+"\n"+pos
}

function GoBgBar(e){
	var Bar_pos = eval(doc2 + '"Bar"' + sty).top;
	if (bw.ie4||bw.ie5||bw.ie6) { Bar_pos = parseInt(Bar_pos, 10); }  //.replace(/\D/gi,'')
	if (get_width-eval(xpos) > ScrollMargin-2
	 && get_width-eval(xpos) < ScrollMargin+scroll_image_width+2

	 && eval(ypos) > eval(ScrollMargin+frame_top_minus+scroll_image_height+2)
	 && eval(ypos) < eval(ScrollMargin+frame_top_minus-scroll_image_height+ScrollArrowHeight-ScrollMargin-frame_top_minus)

	 && ( eval(ypos) < Bar_pos || eval(ypos) > Bar_pos+BarHeight )
	   ) {
		if      (eval(ypos) < Bar_pos           ) { oScroll.up( -oCont.clipHeight+frame_bottom_minus+5) }
		else if (eval(ypos) > Bar_pos+BarHeight ) { oScroll.down(oCont.clipHeight-frame_bottom_minus-5) }
		return false;
	} else { return true }
}
function GoBar(e){
	if (get_width-eval(xpos) > ScrollMargin-2
	 && get_width-eval(xpos) < ScrollMargin+scroll_image_width+2

	 && eval(ypos) > eval(ScrollMargin+frame_top_minus+scroll_image_height+2)
	 && eval(ypos) < eval(ScrollMargin+frame_top_minus-scroll_image_height+ScrollArrowHeight-ScrollMargin-frame_top_minus)
	 ) {
		if ( remember_pos != "leeg" ) {
			var pos;
  	  pos = eval(ypos)-remember_pos;
	//		window.status= eval(xpos)+'  '+get_width;
			remember_pos = eval(ypos);
			pos/=BarMultipier;
	//document.Info.text.value = "--->"+eval(ypos)+"|"+remember_pos+"|"+eval(oScroll.y+oScroll.scrollHeight-oCont.clipHeight)+"\n"+document.Info.text.value; //eval(ypos)+"\n"+pos
			if      ( oScroll.y-pos                                      >0){pos=oScroll.y}
			else if ( oScroll.y+oScroll.scrollHeight-oCont.clipHeight-pos<0){pos=oScroll.y+oScroll.scrollHeight-oCont.clipHeight}
			oScroll.moveItScroll(0,Math.floor(oScroll.y-pos));
		}
	}
	return false;
}
function SetBar(e){ remember_pos = eval(ypos); }
function NoBar(e) { remember_pos = "leeg";     }

function showhide(laag,waarde){
	var show_hide_laag = eval(doc2 + '"'+laag+'"' + sty);
	show_hide_laag.visibility = waarde
}

//Makes the object go up
function goDown(move){
  if(this.y>-this.scrollHeight+oCont.clipHeight+1){
		if      ( oScroll.y-move                                      >0){move=oScroll.y}
		else if ( oScroll.y+oScroll.scrollHeight-oCont.clipHeight-move<0){move=oScroll.y+oScroll.scrollHeight-oCont.clipHeight}
    this.moveItScroll(0,this.y-move)
    if(loop) setTimeout(this.obj+".down("+move+")",speed)
    showhide('divUp','visible')
	} else if (!scrollbar) {showhide('divDown','hidden')}
}
//Makes the object go down
function goUp(move){
  if(this.y<0){
		if      ( oScroll.y-move                                      >0){move=oScroll.y}
		else if ( oScroll.y+oScroll.scrollHeight-oCont.clipHeight-move<0){move=oScroll.y+oScroll.scrollHeight-oCont.clipHeight}
    this.moveItScroll(0,this.y-move)
    if(loop) setTimeout(this.obj+".up("+move+")",speed)
    showhide('divDown','visible')
  } else if (!scrollbar) {showhide('divUp','hidden')}
}

//Calls the scrolling functions. Also checks whether the page is loaded or not.
function scroll(speed){
  if(loaded){
    loop=true;
    if(speed>0) oScroll.down(speed)
    else        oScroll.up(speed)
  }
}

//Stops the scrolling (called on mouseout)
function noScroll(){
  loop=false
  if(timer) clearTimeout(timer)
}
//Makes the object
var loaded;
var scrollbar;
function scrollInit(){
  oCont=new makeObj('divCont')
  oScroll=new makeObj('divText','divCont')
  oScroll.moveItScroll(0,0)
  oCont.css.visibility='visible'
  loaded=true;
  if(oScroll.scrollHeight-oCont.clipHeight > 2){
    showhide('divDown','visible');
		if(bw.dom) { document.onmousewheel = doWheel; }
  }
  if (bw.op5||bw.ns4) { setInterval("if (self.pageYOffset       >0||self.pageXOffset        >0){window.scrollTo(0,0)}",50)};
  if (bw.ie ||bw.ns6) { setInterval("if (document.body.scrollTop>0||document.body.scrollLeft>0){document.body.scrollTop=0;document.body.scrollLeft=0}",50)};

	if (scrollbotom==1) { setTimeout("oScroll.down(10000)",1000); }

}
function InitBar(){
	if (BarHeight < BarMax-2) {
  	scrollbar=true;
  	showhide('divUp','visible');
  	showhide('divDown','visible');
		showhide('Bar','visible');
		showhide('BgBar','visible');
	}
	mouseInit();
}
function topMenuInit() {} //oud...
/********************************************************************************
begin script sliding layer
********************************************************************************/
function moveTo(obj,x,y) {
  obj.xpos = x
  obj.ypos = y
  obj.left = obj.xpos
  obj.top = obj.ypos
}

function doWheel() {
	var delta = event.wheelDelta;
  if(delta<0) {
		if (oScroll.scrollHeight-oCont.clipHeight+oScroll.y > 0) { oScroll.down(-delta/8) }
		else                                                     { if (!scrollbar)showhide('divDown','hidden');oScroll.down(oScroll.scrollHeight-oCont.clipHeight) }
	} else {
		oScroll.up(-delta/8);
	}
}

function scrKeyDown(evt) {
	if (bw.ie4||bw.ie5||bw.ie6) {key = event.keyCode;}
	else if (bw.dom)            {key = evt.charCode;}
	else if (bw.ns4)            {key = evt.which;}

	// window.status = key;
	// Depending on key press (capital || lowercase || function key), scroll div.
	// alles  met een "." gedaan ivm invoervelden....
	if (key==.84 || key==.116 || key==36) oScroll.up(oCont.clipHeight-oScroll.scrollHeight);   // 'T', 't' or 'Home'
	if (key==.83 || key==.115 || key==33) oScroll.up(-oCont.clipHeight+5);                     // 'S', 's' or 'PgUp'
	if (key==.65 || key== .97 || key==38) oScroll.up(-10);                                     // 'A', 'a' or 'Up'
	if (key==.90 || key==.122 || key==40) oScroll.down(10);                                    // 'Z', 'z' or 'Down'
	if (key==.88 || key==.120 || key==34) oScroll.down(oCont.clipHeight-5);                    // 'X', 'x' or 'PgDn'
	if (key==.66 || key== .98 || key==35) oScroll.down(oScroll.scrollHeight-oCont.clipHeight); // 'B', 'b' or 'End'
}

function mouseInit() {
	var Bar_laag = eval(doc2 + '"Bar"'   + htm);
	var Bar_bg   = eval(doc2 + '"BgBar"' + htm);
	if (bw.ns4 && scrollbar==true) {
    Bar_laag.captureEvents(Event.MOUSEMOVE || Event.MOUSEDOWN || Event.MOUSEUP);
//    Bar_bg.captureEvents(Event.CLICK);
	}
	if (bw.ie4||bw.ie5||bw.ie6) { Bar_bg.onclick = GoBgBar; }
	Bar_laag.onmousedown = SetBar;
	Bar_laag.onmousemove = GoBar;
	Bar_laag.onmouseup   = NoBar;
// Capture key presses.
	if (bw.ie4||bw.ie5||bw.ie6) { document.onkeydown = scrKeyDown }
	else                        { if (bw.ns4 && scrollbar==true) { document.captureEvents(Event.KEYPRESS) }
																document.onkeypress = scrKeyDown;
	                            }
	window.focus();
	return true;
}

function nope()                            {return false}
function kill(e)                           {if(e.which==1){window.captureEvents(Event.MOUSEMOVE);window.onmousemove=nope}}
if(document.getElementById&& document.all) {document.onselectstart=nope}
if(document.getElementById&&!document.all) {document.onmouseup=kill}

