// *****************************************************************************************************
// MENU SCRIPTS
// *****************************************************************************************************

// QUICKMENU START
// qm.js
var qm_si,qm_li,qm_lo,qm_tt,qm_th,qm_ts;var qp="parentNode";var qc="className";var qm_t=navigator.userAgent;var qm_o=qm_t.indexOf("Opera")+1;var qm_s=qm_t.indexOf("afari")+1;var qm_s2=qm_s&&window.XMLHttpRequest;var qm_n=qm_t.indexOf("Netscape")+1;var qm_v=parseFloat(navigator.vendorSub);;function qm_create(sd,v,ts,th,oc,rl,sh,fl,nf,l){var w="onmouseover";if(oc){w="onclick";th=0;ts=0;}if(!l){l=1;qm_th=th;sd=document.getElementById("qm"+sd);sd[w]=function(e){qm_kille(e)};document[w]=qm_bo;sd.style.zoom=1;if(sh)x2("qmsh",sd,1);if(!v)sd.ch=1;}else  if(sh)sd.ch=1;if(sh)sd.sh=1;if(fl)sd.fl=1;if(rl)sd.rl=1;sd.style.zIndex=l+""+1;var lsp;var sp=sd.childNodes;for(var i=0;i<sp.length;i++){var b=sp[i];if(b.tagName=="A"){lsp=b;b[w]=qm_oo;b.qmts=ts;if(l==1&&v){b.style.styleFloat="none";b.style.cssFloat="none";}}if(b.tagName=="DIV"){if(window.showHelp&&!window.XMLHttpRequest)sp[i].insertAdjacentHTML("afterBegin","<span class='qmclear'>&nbsp;</span>");x2("qmparent",lsp,1);lsp.cdiv=b;b.idiv=lsp;if(qm_n&&qm_v<8&&!b.style.width)b.style.width=b.offsetWidth+"px";new qm_create(b,null,ts,th,oc,rl,sh,fl,nf,l+1);}}};function qm_bo(e){clearTimeout(qm_tt);qm_tt=null;if(qm_li&&!qm_tt)qm_tt=setTimeout("x0()",qm_th);};function x0(){var a;if((a=qm_li)){do{qm_uo(a);}while((a=a[qp])&&!qm_a(a))}qm_li=null;};function qm_a(a){if(a[qc].indexOf("qmmc")+1)return 1;};function qm_uo(a,go){if(!go&&a.qmtree)return;if(window.qmad&&qmad.bhide)eval(qmad.bhide);a.style.visibility="";x2("qmactive",a.idiv);};;function qa(a,b){return String.fromCharCode(a.charCodeAt(0)-(b-(parseInt(b/2)*2)));}function qm_oo(e,o,nt){if(!o)o=this;if(window.qmad&&qmad.bhover&&!nt)eval(qmad.bhover);if(window.qmwait){qm_kille(e);return;}clearTimeout(qm_tt);qm_tt=null;if(!nt&&o.qmts){qm_si=o;qm_tt=setTimeout("qm_oo(new Object(),qm_si,1)",o.qmts);return;}var a=o;if(a[qp].isrun){qm_kille(e);return;}var go=true;while((a=a[qp])&&!qm_a(a)){if(a==qm_li)go=false;}if(qm_li&&go){a=o;if((!a.cdiv)||(a.cdiv&&a.cdiv!=qm_li))qm_uo(qm_li);a=qm_li;while((a=a[qp])&&!qm_a(a)){if(a!=o[qp])qm_uo(a);else break;}}var b=o;var c=o.cdiv;if(b.cdiv){var aw=b.offsetWidth;var ah=b.offsetHeight;var ax=b.offsetLeft;var ay=b.offsetTop;if(c[qp].ch){aw=0;if(c.fl)ax=0;}else {if(c.rl){ax=ax-c.offsetWidth;aw=0;}ah=0;}if(qm_o){ax-=b[qp].clientLeft;ay-=b[qp].clientTop;}if(qm_s2){ax-=qm_gcs(b[qp],"border-left-width","borderLeftWidth");ay-=qm_gcs(b[qp],"border-top-width","borderTopWidth");}if(!c.ismove){c.style.left=(ax+aw)+"px";c.style.top=(ay+ah)+"px";}x2("qmactive",o,1);if(window.qmad&&qmad.bvis)eval(qmad.bvis);c.style.visibility="inherit";qm_li=c;}else  if(!qm_a(b[qp]))qm_li=b[qp];else qm_li=null;qm_kille(e);};function qm_gcs(obj,sname,jname){var v;if(document.defaultView&&document.defaultView.getComputedStyle)v=document.defaultView.getComputedStyle(obj,null).getPropertyValue(sname);else  if(obj.currentStyle)v=obj.currentStyle[jname];if(v&&!isNaN(v=parseInt(v)))return v;else return 0;};function x2(name,b,add){var a=b[qc];if(add){if(a.indexOf(name)==-1)b[qc]+=(a?' ':'')+name;}else {b[qc]=a.replace(" "+name,"");b[qc]=b[qc].replace(name,"");}};function qm_kille(e){if(!e)e=event;e.cancelBubble=true;if(e.stopPropagation&&!(qm_s&&e.type=="click"))e.stopPropagation();}

// Add-on general code
var qmad = new Object(); qmad.bvis=""; qmad.bhide=""; qmad.bhover="";

// Add-on: Keep Subs In window 
var a = qmad.qm0 = new Object();	// right menu
a.subs_in_window_active = true;

qmad.qm1 = a;						// left menu

// Add-on: qm_auto_position_subs.js
qmad.apsubs=new Object();if(qmad.bvis.indexOf("qm_apsubs(b.cdiv,o);")==-1)qmad.bvis+="qm_apsubs(b.cdiv,o);";;function qm_apsubs(a){var z;if((z=window.qmv)&&(z=z.addons)&&(z=z.apsubs)&&!z["on"+qm_index(a)])return;if(!a.settingsid){var v=a;while(!qm_a(v))v=v[qp];a.settingsid=v.id;}var ss=qmad[a.settingsid];if(!ss)return;if(!ss.subs_in_window_active)return;var wh=qm_get_doc_wh();var sxy=qm_get_doc_scrollxy();var xy=qm_get_offset(a);var c1=a.offsetWidth+xy[0];var c2=wh[0]+sxy[0];if(c1>c2){a.style.left=(parseInt(a.style.left)-(c1-c2))+"px";if(a.hasrcorner)a.hasrcorner.style.left=(parseInt(a.hasrcorner.style.left)-(c1-c2))+"px";if(a.hasshadow)a.hasshadow.style.left=(parseInt(a.hasshadow.style.left)-(c1-c2))+"px";if(a.hasselectfix)a.hasselectfix.style.left=(parseInt(a.hasselectfix.style.left)-(c1-c2))+"px";}c1=a.offsetHeight+xy[1];c2=wh[1]+sxy[1];if(c1>c2){a.style.top=(parseInt(a.style.top)-(c1-c2))+"px";if(a.hasrcorner)a.hasrcorner.style.top=(parseInt(a.hasrcorner.style.top)-(c1-c2))+"px";if(a.hasshadow)a.hasshadow.style.top=(parseInt(a.hasshadow.style.top)-(c1-c2))+"px";if(a.hasselectfix)a.hasselectfix.style.top=(parseInt(a.hasselectfix.style.top)-(c1-c2))+"px";}};function qm_get_offset(obj){var x=0;var y=0;do{x+=obj.offsetLeft;y+=obj.offsetTop;}while(obj=obj.offsetParent)return new Array(x,y);};function qm_get_doc_scrollxy(){var sy=0;var sx=0;if((sd=document.documentElement)&&(sd=sd.scrollTop))sy=sd;else  if(sd=document.body.scrollTop)sy=sd;if((sd=document.documentElement)&&(sd=sd.scrollLeft))sx=sd;else  if(sd=document.body.scrollLeft)sx=sd;return new Array(sx,sy);};function qm_get_doc_wh(){db=document.body;var w=0;var h=0;if(tval=window.innerHeight){h=tval;w=window.innerWidth;}else  if((e=document.documentElement)&&(e=e.clientHeight)){h=e;w=document.documentElement.clientWidth;}else  if(e=db.clientHeight){if(!h)h=e;if(!w)w=db.clientWidth;}return new Array(w,h);}

// Add-on: qm_images.js
qmad.image=new Object();qmad.image.preload=new Array();if(qmad.bvis.indexOf("qm_image_switch(b,1);")==-1){qmad.bvis+="qm_image_switch(b,1);";qmad.bhide+="qm_image_switch(a.idiv,false,1);";if(window.attachEvent){window.attachEvent("onload",qm_image_preload);document.attachEvent("onmouseover",qm_image_off);}else  if(window.addEventListener){window.addEventListener("load",qm_image_preload,1);document.addEventListener("mouseover",qm_image_off,false);}document.write('<style type="text/css">.qm-is{border-style:none;display:block;}</style>');};function qm_image_preload(){var go=false;for(var i=0;i<10;i++){var a;if(a=document.getElementById("qm"+i)){var ai=a.getElementsByTagName("IMG");for(var j=0;j<ai.length;j++){if(ai[j].className.indexOf("qm-is")+1){go=true;var br=qm_image_base(ai[j]);if(ai[j].className.indexOf("qm-ih")+1)qm_image_preload2(br[0]+"_hover."+br[1]);if(ai[j].className.indexOf("qm-ia")+1)qm_image_preload2(br[0]+"_active."+br[1]);ai[j].setAttribute("qmvafter",1);if((z=window.qmv)&&(z=z.addons)&&(z=z.image))z["on"+i]=true;}}if(go){ai=a.getElementsByTagName("A");for(var j=0;j<ai.length;j++){if(window.attachEvent)ai[j].attachEvent("onmouseover",qmv_image_hover);else  if(window.addEventListener)ai[j].addEventListener("mouseover",qmv_image_hover,1);}}if(go)a.onmouseover=function(e){qm_kille(e)};}}};function qmv_image_hover(e){e=e||window.event;var targ=e.srcElement||e.target;while(targ&&targ.tagName!="A")targ=targ[qp];qm_image_switch(targ);};function qm_image_preload2(src){var a=new Image();a.src=src;qmad.image.preload.push(a);};function qm_image_base(a,full){var br=qm_image_split_ext_name(a.getAttribute("src",2));br[0]=br[0].replace("_hover","");br[0]=br[0].replace("_active","");if(full)return br[0]+"."+br[1];else return br;};function qm_image_off(){if(qmad.image.la&&qmad.image.la.className.indexOf("qmactive")==-1){qm_image_switch(qmad.image.la,false,1);qmad.image.la=null;}};function qm_image_switch(a,active,hide,force){if((z=window.qmv)&&(z=z.addons)&&(z=z.image)&&!z["on"+qm_index(a)])return;if(!active&&!hide&&qmad.image.la &&qmad.image.la!=a&&qmad.image.la.className.indexOf("qmactive")==-1)qm_image_switch(qmad.image.la,false,1);var img=a.getElementsByTagName("IMG");for(var i=0;i<img.length;i++){if(img[i].className&&img[i].className.indexOf("qm-is")+1){var br=qm_image_base(img[i]);if(!active&&!hide&&img[i].className.indexOf("qm-ih")+1&&(a.className.indexOf("qmactive")==-1||force)){qmad.image.la=a;img[i].src=br[0]+"_hover."+br[1];continue;}if(active&&img[i].className.indexOf("qm-ia")+1){img[i].src=br[0]+"_active."+br[1];continue;}if(hide)img[i].src=br[0]+"."+br[1];}}};function qm_image_split_ext_name(s){var ext=s.split(".");ext=ext[ext.length-1];var fn=s.substring(0,s.length-(ext.length+1));return new Array(fn,ext);}

// QUICKMENU END

function jMenuHide(jObj) {
	jObj.style.display = 'none';
}

function initMainMenu() {
	document.getElementById("MainMenuTable").align='right';		// Firefox fix
	qm_create(0,false,0,250,false,false,false,false);
	document.getElementById("MenuMain").style.display='';

	document.getElementById("MenuLocaTable").align='right';		// Firefox fix
	qm_create(1,false,0,250,false,false,false,false);
	document.getElementById("MenuLoca").style.display='';
}

function gtU(jHref) {
	jHref = jHref.replace(/\$/gi,'/');
	var jIsFastWordCheck = jHref.substr(jHref.length-1,jHref.length-1);

	if (jIsFastWordCheck!='/') { self.location.href=jHref; }
	else { 	jHref = jHref.substr(0,jHref.length-1);
			self.location.href=jHref+'.html'; }
}

// *****************************************************************************************************
// SCROLLBAR SCRIPTS
// *****************************************************************************************************

var Drag = {
	obj : null,
	init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
	{
		o.onmousedown	= Drag.start;
		o.hmode			= bSwapHorzRef ? false : true ;
		o.vmode			= bSwapVertRef ? false : true ;
		o.root = oRoot && oRoot != null ? oRoot : o ;
		if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) o.root.style.left   = "0px";
		if (o.vmode  && isNaN(parseInt(o.root.style.top   ))) o.root.style.top    = "0px";
		if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right  = "0px";
		if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";
		o.minX	= typeof minX != 'undefined' ? minX : null;
		o.minY	= typeof minY != 'undefined' ? minY : null;
		o.maxX	= typeof maxX != 'undefined' ? maxX : null;
		o.maxY	= typeof maxY != 'undefined' ? maxY : null;
		o.xMapper = fXMapper ? fXMapper : null;
		o.yMapper = fYMapper ? fYMapper : null;
		o.root.onDragStart	= new Function();
		o.root.onDragEnd	= new Function();
		o.root.onDrag		= new Function();
	},

	start : function(e)
	{
		var o = Drag.obj = this;
		e = Drag.fixE(e);
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		o.root.onDragStart(x, y);
		o.lastMouseX	= e.clientX;
		o.lastMouseY	= e.clientY;
		if (o.hmode) {
			if (o.minX != null)	o.minMouseX	= e.clientX - x + o.minX;
			if (o.maxX != null)	o.maxMouseX	= o.minMouseX + o.maxX - o.minX;
		} else {
			if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
			if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
		}
		if (o.vmode) {
			if (o.minY != null)	o.minMouseY	= e.clientY - y + o.minY;
			if (o.maxY != null)	o.maxMouseY	= o.minMouseY + o.maxY - o.minY;
		} else {
			if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
			if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
		}
		document.onmousemove	= Drag.drag;
		document.onmouseup		= Drag.end;
		return false;
	},
	drag : function(e)
	{
		e = Drag.fixE(e);
		var o = Drag.obj;
		var ey	= e.clientY;
		var ex	= e.clientX;
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		var nx, ny;
		if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
		if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
		if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
		if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);
		nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
		ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));
		if (o.xMapper)		nx = o.xMapper(y)
		else if (o.yMapper)	ny = o.yMapper(x)
		Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
		Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
		Drag.obj.lastMouseX	= ex;
		Drag.obj.lastMouseY	= ey;
		Drag.obj.root.onDrag(nx, ny);
		return false;
	},
	end : function()
	{
		document.onmousemove = null;
		document.onmouseup   = null;
		Drag.obj.root.onDragEnd(	parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), 
									parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));
		Drag.obj = null;
	},
	fixE : function(e)
	{
		if (typeof e == 'undefined') e = window.event;
		if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
		if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
		return e;
	}
};

function jGetHeight(jObj) {
	var jHeight = jObj.offsetHeight;
	if (!isNaN(jHeight)) { if (jHeight<1) { jHeight=1 } } else { jHeight = 1}
	return jHeight
}

function jGetTop(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) { curtop += obj.offsetTop; }
	}
	return curtop;
}

function getNewLocation(y, jSBH, jSDH) {
	var jPerc = y/noZero(jSBH);		// bereken percentage
	var jNewheight = jSDH*jPerc;	// bereken hoogte content
	if (jNewheight>jSDH) { jNewheight=jSDH }
	return jNewheight;
}

function noZero(jNum) {
	if (!isNaN(jNum)) { if (jNum<1) { jNum = 1 }}
	if (isNaN(jNum)) { jNum = 1 }
	return jNum;
}

var jAniScrollID, jFadScrollID

function animateScroll(jObj, jValue, jFinal) {
	if (jFinal<10) { jFinal = 10 }
	if (jValue>jFinal) {
		jAniScrollID = setTimeout('animateScroll("'+jObj+'", '+(jValue-5)+', '+jFinal+')', 5); 
		document.getElementById(jObj).style.height = jValue+'px';
	} else { document.getElementById(jObj).style.height = jFinal; }
}

function fadeScroll(jObj, jValue) {
	if (jValue>0) {
		jFadScrollID = setTimeout('fadeScroll("'+jObj+'", '+(jValue-2)+')', 5); 
		try { document.getElementById(jObj).style.opacity = jValue/100;
			  document.getElementById(jObj).style.filter = 'alpha(opacity=' + jValue + ')';
		} catch (e) { document.getElementById(jObj).style.display = 'none'; }
	} else { document.getElementById(jObj).style.display = 'none'; }
}

function jBGOver(jObj, jColor) {
	jObj.style.backgroundColor=jColor;
}

function jBGOut(jObj, jColor) {
	jObj.style.backgroundColor=jColor;
}

function initScroll(jContentHeight, jContentScrollWidth) {
  try {
	var jScrollBar				= document.getElementById("Scrollbar");
	var jScrollText				= document.getElementById("ContentScroll");
	var jScrollContainerHeight	= noZero(jGetHeight(document.getElementById('ScrollbarContainer')))
	var jScrollBarDrag			= Math.round(noZero(((jScrollContainerHeight / noZero(jGetHeight(jScrollText))) * jContentHeight))*1)/1;
	if (jScrollBarDrag<10) { jScrollBarDrag=10 }
	var jScrollBarHeight		= jScrollContainerHeight - jScrollBarDrag;
	var jScrollDivHeight		= noZero(jGetHeight(jScrollText)-jContentHeight);	// scrollable pixels

	if (jScrollDivHeight>2)	{														// show only if we have enough text
		jAniScrollID = setTimeout('animateScroll("Scrollbar", '+jContentHeight+', '+jScrollBarDrag+')', 5);		// slide in scrollbar
		Drag.init(jScrollBar, null, 0, 0, 0, jScrollBarHeight);
		jScrollBar.onDrag = function(x, y) { jScrollText.style.top = -getNewLocation(y, jScrollBarHeight,jScrollDivHeight) + 'px'; }
	
		/* initialize scrollwheel */
		try { if (window.addEventListener) { window.addEventListener('DOMMouseScroll', wheel, false); } } catch (e) {}
		try { window.onmousewheel = document.onmousewheel = wheel;} catch (e) {}
	
	} else { 
		jFadScrollID = setTimeout('fadeScroll("ScrollbarBorder",100)', 100);							// fade away scrollbar
		jScrollText.style.width = jContentScrollWidth+'px';							// allow content text to use hidden scrollbar space
	}
  } catch (e) { }
}


/** This is high-level function; REPLACE IT WITH YOUR CODE.
 * It must react to delta being more/less than zero.
 */
function handle(delta) {
 try { delta<0 ? scrollUpDown(+10) : scrollUpDown(-10); } catch (e) {}
}

function wheel(event){
  try {
	var delta = 0;
	if (!event) event = window.event;
	if (event.wheelDelta) {
		delta = event.wheelDelta/120; 
		if (window.opera) { delta = -delta; }
	} else if (event.detail) { delta = -event.detail/3; }
	if (delta) { handle(delta); }
    if (event.preventDefault) { event.preventDefault(); }
    event.returnValue = false; 
  } catch (e) {}
}


function scrollUpDown(jSpeed) {
  try {
	var jScrollHeight = jGetHeight(document.getElementById("ScrollbarContainer"));
	var jScrollBarHeight = jGetHeight(document.getElementById("Scrollbar"));
	var jContentHeight = jGetHeight(document.getElementById("ContentScroll"));
	var jContentVisible = jScrollHeight+4;

	// calculate how many pixels of scroll (scrollbar) is equal to pixels scroll (content)
	var jScrollableSpace = (jScrollHeight - jScrollBarHeight);
	var jContentSpace = (jContentHeight-jContentVisible);
	var jRatio =  (jContentSpace / jScrollableSpace);

	// calculate new position
	var jScrollbarTop = parseInt(document.getElementById("Scrollbar").style.top);
	if (isNaN(jScrollbarTop)) { jScrollbarTop=0 }
	var jScrollbarNewlocation = jScrollbarTop+jSpeed;
	
	var jContentTop = parseInt(document.getElementById("ContentScroll").style.top);
	if (isNaN(jContentTop)) { jContentTop=0 }
	var jContentNewLocation = (jContentTop)-(jSpeed*jRatio);

	// prevend scrolling over max up
	if (jScrollbarNewlocation<0) { 
		jScrollbarNewlocation=0;  
		jContentNewLocation=0;
	}

	// prevend scrolling over max down
	if (jScrollbarNewlocation>jScrollableSpace) { 
		jScrollbarNewlocation=jScrollableSpace;  
		jContentNewLocation=-(jContentHeight-jContentVisible);
	}

	// do actual move
	document.getElementById("Scrollbar").style.top = Math.round(jScrollbarNewlocation);
	document.getElementById("ContentScroll").style.top = Math.round(jContentNewLocation);
  } catch (e) {}
}

// *****************************************************************************************************
// GOOGLE MAPS SCRIPTS
// *****************************************************************************************************
    var map;
    var gdir;
    var geocoder = null;
    var addressMarker;

    function initGoogleMaps() {
      if (GBrowserIsCompatible()) {      
        map = new GMap2(document.getElementById("map_canvas"));
        gdir = new GDirections(map, document.getElementById("map_directions"));
        GEvent.addListener(gdir, "load", onGDirectionsLoad);
        GEvent.addListener(gdir, "error", handleErrors);
      }
    }
    
    function setDirections(fromAddress, toAddress, locale) {
		gdir.load("from: " + fromAddress + " to: " + toAddress, { "locale": locale });
    }

	function reshowScrollBar() {
		if (checkObject('ScrollbarBorder')) { 
			document.getElementById('ScrollbarBorder').style.display=''; 
			document.getElementById('ScrollbarBorder').style.opacity = 1;
			document.getElementById('ScrollbarBorder').style.filter = 'alpha(opacity=100)';

			try { clearTimeout(jAniScrollID); } catch (e) { alert(e) }
			try { clearTimeout(jFadScrollID); } catch (e) { alert(e) }
			
			initScroll(jCntHght, jCntScrWdth); 
		}
	}


    function handleErrors(){
	   if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
	     alert("Uw adres kan niet gevonden worden.\nVoorbeeld: Leidsestraat 1, Amsterdam");
	   
	   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
	     alert("Er is iets fout gegaan.\n Foutcode: " + gdir.getStatus().code + " (obekende fout)");
	   
	   else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
	     alert("Er is iets fout gegaan.\n Foutcode: " + gdir.getStatus().code + " (fout in URL)");

	   else if (gdir.getStatus().code == G_GEO_BAD_KEY)
	     alert("Er is iets fout gegaan. \n Foutcode: " + gdir.getStatus().code + " (ongeldig domein-key combinatie)");

	   else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
	     alert("Er is iets fout gegaan.\n Foutcode:: " + gdir.getStatus().code + " (fout bij parsen route)");
	    
	   else alert("Uw adres kan niet gevonden worden.\nVoorbeeld: Leidsestraat 1, Amsterdam");
	}

	function onGDirectionsLoad(){ 
      // Use this function to access information about the latest load()
      // results.
		if (checkObject('SiteRouteDiv')) { 
				document.getElementById("SiteRouteDiv").style.width='auto'; 
				document.getElementById("SiteRouteDiv").style.height='auto';
				document.getElementById("SiteRouteDiv").style.overflow='visible';
				}
		setTimeout('reshowScrollBar()', 2000);	// we use a delay to ensure data is loaded
      // e.g.
      // document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
	  // and yada yada yada...
	}

	function getDirections(jLanguage) {
		var jFrom = document.forms[0].from.value;
		var jTo = document.forms[0].to.options[document.forms[0].to.selectedIndex].value;
		if (jFrom.length>0) { setDirections(jFrom, jTo, jLanguage); }
	}


// *****************************************************************************************************
// FORMS SCRIPTS
// *****************************************************************************************************
function checkFormNL(jAction) {
	try {
		var jValue, jType, jMsg="", jRegExp, jCount=0, jFormObj, jMaxError = 5;
		var jColorOK = "#ffffff", jColorNotOK = "#FFB7B7";
		for (var y=0; y<jFields.length; y++) {  
			//alert(jFields[y]);
			eval('jFormObj = document.forms[0].elements["'+jFields[y]+'"]');
			jType = jFormObj.type;
			if  (jType.toUpperCase()=='SELECT') { jValue = jFormObj.options[jFormObj.selectedIndex].value; } else { jValue = jFormObj.value;}
			
			// only validate input if it is required or when it is filled.
			if ((jValue.length>0) || (jMandatory[y].toLowerCase()=="true")) {
				jValue = jValue.replace(/^\s+|\s+$/g,"gi"); jRegExp = new RegExp(jChecks[y],"gi"); 
				if (jRegExp.test(jValue) == false) { 
					jFormObj.style.backgroundColor = jColorNotOK; jCount+=1;
					if (jCount<jMaxError) { jMsg += "- " + jFieldMsg[y] + "\n"; }  
				} else { jFormObj.style.backgroundColor = jColorOK; }
			}
		}

		// normal handling
		if (jCount>=jMaxError) { jMsg += "...\n";  }
		if (jMsg.length> 0) { alert("Niet alle velden zijn correct ingevuld.\n \n"+jMsg+"\n Controleer de ingevulde gegevens en probeer het opnieuw."); return false; }
		if (jMsg.length==0) { 
				document.getElementById("SentButton").disabled=true; 
				//set page action
				document.forms[0].action = jAction.toLowerCase();
				document.forms[0].elements['sendingformallowed'].value = '556d699968986a989a9869986e989a986c709d98989898989b996c986a9869';
		}

	} catch (excp) { alert('Current webbrowser is not supported.\nError: '+excp); return false; }
}


// *****************************************************************************************************
// GALLERY SCRIPTS
// *****************************************************************************************************

/* IMAGE GALLERY */
function initGallery() {
	try {
		if (jImgs.length>0) {
			var jGalleryOutput = '<table id="GalleryTable" border=0 cellspacing=0 cellpadding=2 align=center><tr>';
			for (var i=0; i<jImgs.length; i++ ) { jGalleryOutput+=('<td><img src="' + jImgf + jImgs[i] + 'u.jpg" alt="" onClick="showIt(\''+ i +'\');" onMouseOver="GalleryThumbOver(this)" onMouseOut="GalleryThumbOut(this)"></td>'); }

			// preload images mouseovers
			if (document.images) { jImgLeftOver= new Image(50,80); jImgLeftOver.src="/img/arrow_left_o.png"; 
								   jImgRightOver= new Image(50,80);  jImgRightOver.src="/img/arrow_right_o.png"; 

			// set gallery on screen			
			document.getElementById('GalleryThumbsContainer').style.backgroundImage = 'none';
			document.getElementById('GalleryThumbs').innerHTML = jGalleryOutput+'</tr></table>';
			document.getElementById('ArrLeft').innerHTML = '<img src="/img/arrow_left.png" width="50" height="80" border="0" alt="" onMouseOver="this.src=\'/img/arrow_left_o.png\';ScrollLeft();" onMouseOut="this.src=\'/img/arrow_left.png\';ScrollStop();">';
			document.getElementById('ArrRight').innerHTML = '<img src="/img/arrow_right.png" width="50" height="80" border="0" alt="" onMouseOver="this.src=\'/img/arrow_right_o.png\';ScrollRight();" onMouseOut="this.src=\'/img/arrow_right.png\';ScrollStop();">';
			}
		}
	} catch (e) { }
}

function GalleryThumbOver(jObj) {
	try { jObj.style.opacity = 1;
		  jObj.style.filter = 'alpha(opacity=100)';
		} catch (e) { }
}

function GalleryThumbOut(jObj) {
	try { jObj.style.opacity = 0.75;
		  jObj.style.filter = 'alpha(opacity=75)';
		} catch (e) { }
}

function GalleryNext() {
	jCur=Math.round(jCur)+1 			// show next image
	if (jCur > jImgs.length-1) { jCur=jImgs.length-1 }
	showIt(jCur);
}

function GalleryPrevious() {
	jCur=Math.round(jCur)-1 			// show next image
	if (jCur<0) { jCur=0 };
	showIt(jCur);
}



/* Enlarged image */

function showIt(jID) {
	jCur = jID;
	var defaultWidth = 450;
	var jIL = document.getElementById("GalleryImageLarge");
	var jILwidth = jGetWidth(jIL);
	if (jILwidth>10) { defaultWidth = jILwidth }	// use current width if available

	jIL.innerHTML = '<img src="'+jImgf+jImgs[jID]+'.jpg" id="GalleryImg" border="0" onLoad="resizeIt(this);">';

	var jSC = jGetWidth(document.getElementById("SiteContainer"));
	var jGI = document.getElementById("GalleryImageContainer");
	jGI.style.width = defaultWidth+"px";
	jGI.style.left =  Math.round((jSC-defaultWidth)/2)+"px"; 
	jGI.style.display = '';

	var jSF = document.getElementById("SiteFade");
	jSF.style.width = '100%'; jSF.style.height = '100%';
	jSF.style.display = '';

	//set prvious and next buttons
	var jGP = document.getElementById("GalleryPrevious");
	if (jCur==0) { jGP.style.display='none' } else { jGP.style.display=''; } 

	var jGN = document.getElementById("GalleryNext");
	if (jCur==jImgs.length-1) { jGN.style.display='none' } else { jGN.style.display=''; } 

	// set counter
	var jGCID = document.getElementById("GalleryCurrentID");
	jGCID.innerHTML = (Math.round(jCur)+1) + '' + '/' + '' + (jImgs.length);
}

function hideIt() {	
	var jIL = document.getElementById("GalleryImageLarge");
	jIL.innerHTML = '';
	
	var jIC = document.getElementById("GalleryImageContainer");
	jIC.style.width = "0px"; 
	jIC.style.left = "0px";
	jIC.style.display = 'none';

	var jSF = document.getElementById("SiteFade");
	jSF.style.width = "0px"; jSF.style.height = "0px";
	jSF.style.display = 'none';
}

function resizeIt(jObj) {	//resizes the image enlarge & it's container
	var jSC = jGetWidth(document.getElementById("SiteContainer"));
	var jIW = jGetWidth(jObj);

	var jIC = document.getElementById("GalleryImageContainer");
	jIC.style.left = Math.round((jSC-jIW)/2)+"px";
	jIC.style.width =jIW+"px"; 
	jIC.style.display = '';
	jObj.style.width = jIW+"px";	// set width of Image
}



// SCROLL THUMBS

function ScrollRight() {
	var jWidthCont = jGetWidth(document.getElementById("GalleryThumbsContainer"));
	var jGT = document.getElementById("GalleryThumbs");
	var jWidth = jGetWidth(jGT);
	var jLeft = jGetLeft(jGT) - 3;
	if (jLeft<(jWidthCont-jWidth)) { jLeft = (jWidthCont-jWidth);jGT.style.left = jLeft+"px"; }
	else { jGT.style.left = jLeft+"px"; Ri=setTimeout('ScrollRight()', 5); }
}

function ScrollLeft() {
	var jWidthCont = jGetWidth(document.getElementById("GalleryThumbsContainer"));
	var jGT = document.getElementById("GalleryThumbs");
	var jWidth = jGetWidth(jGT);
	var jLeft = jGetLeft(jGT) + 3;
	if (jLeft>0) { jLeft=0; jGT.style.left = jLeft+"px"; }
	else {jGT.style.left = jLeft+"px"; Le=setTimeout('ScrollLeft()', 5); }
}

function ScrollStop() {
	try { clearTimeout(Ri); } catch (e) { }
	try { clearTimeout(Le); } catch (e) { }
}

function jGetWidth(jObjID) {
	var jGetWidth = jObjID.offsetWidth;
	if (!isNaN(jGetWidth)) { if (jGetWidth<1) { jGetWidth=1 } } else { jGetWidth = 1}
	if (isNaN(jGetWidth)) { jGetWidth = 1 }
	return jGetWidth;
}

function jGetLeft(jObj) {
	var curleft = jObj.offsetLeft;
	if (isNaN(curleft)) { curleft = 0 }
	return curleft;
}

// *****************************************************************************************************
// RESERVERING POPUP SCRIPTS
// *****************************************************************************************************

function openReservering(jID) {
	var jHeight=550, jWidth = 600;
	var jLeft = (screen.width-jWidth) / 2;
	var jTop = (screen.height-jHeight) / 2;
	var myRef = window.open('/reserveer/popup_nl.asp?id='+jID,'Reserveer', 'left='+jLeft+',top='+jTop+',width='+jWidth+',height='+jHeight+',scrollbars=yes,toolbar=no,resizable=no,status=no');
}

// *****************************************************************************************************
// AGENDA SCRIPTS
// *****************************************************************************************************
var showAgendaID = 'Y0M0';
function showAgenda(jID) {
	if (checkObject(showAgendaID)) { document.getElementById(showAgendaID).style.display = 'none'; }
	if (checkObject(jID)) { showAgendaID = jID; document.getElementById(jID).style.display = ''; reshowScrollBar(); }
}

// *****************************************************************************************************
// OTHER SCRIPTS
// *****************************************************************************************************
function checkObject(jID) {
	var o = document.getElementById(jID); if (o) { return true } else { return false }
}

// *****************************************************************************************************
// FLASH VIDEO
// *****************************************************************************************************
function showVideo(jID) {
	for(var i=1;i<5;i++){
		if (checkObject('Video'+i)) { 
			document.getElementById('Video'+i).style.display = 'none';
			document.getElementById('Video'+i+'A').className = '';
		}
	}
	document.getElementById('Video'+jID+'A').className = 'BoldSelected';
	document.getElementById('Video'+jID).style.display = ''; 
	reshowScrollBar();

}

// -----------------------------------------------------------------------------------
// JQUERY INITS
// -----------------------------------------------------------------------------------
var jGlobalHomeId = '';

$(document).ready(function(){ 

	/*GENERAL BACK BUTTON */
	$('#HomeFlash div').hover( function(){ jGlobalHomeId = this.id;	 $('#'+this.id+' div.BoxFade').stop(true,true).fadeTo('slow', 0); },					
							   function(){ $('#'+this.id+' div.BoxFade').stop(true,true).fadeTo('fast', 1, function() { jGlobalHomeId = '' }); }
							);	

	$('#ContentFlash div').hover( function(){ jGlobalHomeId = this.id; $('#'+this.id+' div.BoxFade').stop(true,true).fadeTo('slow', 0) },					
							   function(){ $('#'+this.id+' div.BoxFade').stop(true,true).fadeTo('fast', 1, function() { jGlobalHomeId = '' }); }
							);							

	
	
	/* HOME ANIMATION */
	if (checkObject('HomeFlash')) { animateHome(1); }

 });

function animateHome(jNr) {
	var jFadeIn = 0.4, jFadeOut = 1;

	var jID = 'Home7Box';
	if (jNr==1 && jGlobalHomeId!=jID)	{	$('#'+jID+' div.BoxFade').stop(true,false).fadeTo(1500, jFadeIn, function(){ animateHome(jNr+1) }  ); return;	}
	if (jNr==2 && jGlobalHomeId!=jID)	{	$('#'+jID+' div.BoxFade').fadeTo(1500, jFadeOut, function(){ animateHome(jNr+1) }); return; }	

	jID = 'Home1Box';
	if (jNr==3 && jGlobalHomeId!=jID)	{	$('#'+jID+' div.BoxFade').stop(true,false).fadeTo(1500, jFadeIn, function(){ animateHome(jNr+1) }  ); return;	}
	if (jNr==4 && jGlobalHomeId!=jID)	{	$('#'+jID+' div.BoxFade').fadeTo(1500, jFadeOut, function(){ animateHome(jNr+1) }); return; }	

	jID = 'Home5Box';
	if (jNr==5 && jGlobalHomeId!=jID)	{	$('#'+jID+' div.BoxFade').stop(true,false).fadeTo(1500, jFadeIn, function(){ animateHome(jNr+1) }  ); return;	}
	if (jNr==6 && jGlobalHomeId!=jID)	{	$('#'+jID+' div.BoxFade').fadeTo(1500, jFadeOut, function(){ animateHome(jNr+1) }); return; }	
					
	jID = 'Home9Box';
	if (jNr==7 && jGlobalHomeId!=jID)	{	$('#'+jID+' div.BoxFade').stop(true,false).fadeTo(1500, jFadeIn, function(){ animateHome(jNr+1) }  ); return;	}
	if (jNr==8 && jGlobalHomeId!=jID)	{	$('#'+jID+' div.BoxFade').fadeTo(1500, jFadeOut, function(){ animateHome(jNr+1) }); return; }	

	jID = 'Home2Box';
	if (jNr==9 && jGlobalHomeId!=jID)	{	$('#'+jID+' div.BoxFade').stop(true,false).fadeTo(1500, jFadeIn, function(){ animateHome(jNr+1) }  ); return;	}
	if (jNr==10 && jGlobalHomeId!=jID)	{	$('#'+jID+' div.BoxFade').fadeTo(1500, jFadeOut, function(){ animateHome(jNr+1) }); return; }	

	jID = 'Home6Box';
	if (jNr==11 && jGlobalHomeId!=jID)	{	$('#'+jID+' div.BoxFade').stop(true,false).fadeTo(1500, jFadeIn, function(){ animateHome(jNr+1) }  ); return;	}
	if (jNr==12 && jGlobalHomeId!=jID)	{	$('#'+jID+' div.BoxFade').fadeTo(1500, jFadeOut, function(){ animateHome(jNr+1) }); return; }	

	jID = 'Home8Box';
	if (jNr==13 && jGlobalHomeId!=jID)	{	$('#'+jID+' div.BoxFade').stop(true,false).fadeTo(1500, jFadeIn, function(){ animateHome(jNr+1) }  ); return;	}
	if (jNr==14 && jGlobalHomeId!=jID)	{	$('#'+jID+' div.BoxFade').fadeTo(1500, jFadeOut, function(){ animateHome(jNr+1) }); return; }	

	jID = 'Home3Box';
	if (jNr==15 && jGlobalHomeId!=jID)	{	$('#'+jID+' div.BoxFade').stop(true,false).fadeTo(1500, jFadeIn, function(){ animateHome(jNr+1) }  ); return;	}
	if (jNr==16 && jGlobalHomeId!=jID)	{	$('#'+jID+' div.BoxFade').fadeTo(1500, jFadeOut, function(){ animateHome(jNr+1) }); return; }	

	jID = 'Home4Box';
	if (jNr==17 && jGlobalHomeId!=jID)	{	$('#'+jID+' div.BoxFade').stop(true,false).fadeTo(1500, jFadeIn, function(){ animateHome(jNr+1) }  ); return;	}
	if (jNr==18 && jGlobalHomeId!=jID)	{	$('#'+jID+' div.BoxFade').fadeTo(1500, jFadeOut, function(){ animateHome(jNr+1) }); return; }	

	// fall back
	jNr = jNr + 1;
	if (jNr>18) { jNr=1; }
	animateHome(jNr);
}

