// JavaScript Document

function swap(id, new_src) {
	var x = document.getElementById(id);
	x.src = new_src;
}

/*function setColumnHeights() {
	
	var rc = document.getElementById('right_column');
	var cc = document.getElementById('center_column');
	var lc = document.getElementById('left_column');
	
	var rch = rc.clientHeight;
	var cch = cc.clientHeight;
	var lch = lc.clientHeight;
	
	lc.style.height = rch + 'px';
	
	if(cch < rch) {
		cc.style.height = rch + 'px';
	} 
}
*/



// MAIN VISUAL SWAP
	currentMvz='mvz0';

function swapMvz(no) {

	// hide former active visual -> display:none
	document.getElementById(currentMvz).style.display = "none";
	currentMvz='mvz'+no;
		
	// display chosen visual -> display:block
	document.getElementById('mvz'+no).style.display = "block";
		
	// voor de goede weergave moet sIFR her-uitgevoerd worden
	try	{ goSIFR();	} catch(e) { }

}





	function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	
	function MM_preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	
	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	
	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	
	function switchto(q){
		if (q){
			document.getElementById('passwordtext').className="txt_hide";
			document.getElementById('password').className="txt";
			document.getElementById('password').focus();
		} else {
			document.getElementById('password').className="txt_hide";
			document.getElementById('passwordtext').className="txt";
		}
	}


//Slide Show Home Main Visual
var slideshowAutomaticCurrent = 0;
var tid;

function Init() {
	aligndivs();
}


function slideshowAutomaticInit() {
	swapMvz(slideshowAutomaticCurrent);	
	tid = setTimeout('slideshowAutomaticForward();', slideshowAutomaticDelayBetweenSlides*1000);
}

// Show next slide
function slideshowAutomaticForward(p) {
	if (!p && p!=0){slideshowAutomaticCurrent++;}else{slideshowAutomaticCurrent=p++;}
	if (slideshowAutomaticCurrent == 3) slideshowAutomaticCurrent = 0;
	tid = setTimeout('slideshowAutomaticForward();', slideshowAutomaticDelayBetweenSlides*1000);
	swapMvz(slideshowAutomaticCurrent);
}

// Pause SlideShow
function pauseslideshow(q){
	slideshowAutomaticCurrent = q;
	clearTimeout(tid);
}


// Align divs
function aligndivs()
{
	if (document.getElementById('content_container')) {content_o=document.getElementById('content_container'); } else { content_o=''; }
	if (document.getElementById('left')) {left_o=document.getElementById('left'); } else { left_o=''; }
	if (document.getElementById('right')) {right_o=document.getElementById('right'); } else { right_o=''; }
	if (document.getElementById('ds_right')) {ds_right_o=document.getElementById('ds_right'); } else { ds_right_o=''; }
	content_h=content_o.offsetHeight;
	left_h=left_o.offsetHeight;
	right_h=right_o.offsetHeight;
	ds_right_h=ds_right_o.offsetHeight;
	
	var browser=navigator.appName;
	
	if(content_h<511)
	{
		content_h="510";
		content_o.style.height=510+'px';
		if (right_o) right_o.style.height=(content_h-375)+'px';
		if (left_o) left_o.style.height=(content_h-327)+'px';
		if (ds_right_o) ds_right_o.style.height=(content_h-11)+'px';
	}
	else
	{
		if (right_o) right_o.style.height=(content_h-373)+'px';
		if (browser == "Microsoft Internet Explorer"){
			if (left_o) left_o.style.height=(content_h-300)+'px';
		} else {
			if (left_o) left_o.style.height=(content_h-325)+'px';
		}
		if (ds_right_o) ds_right_o.style.height=(content_h-10)+'px';
	}
}




// dropdown menu
var cssmenuids=["cssmenu1"] //Enter id(s) of CSS Horizontal UL menus, separated by commas
var csssubmenuoffset=0 //Offset of submenus from main menu. Default is 0 pixels.

function createcssmenu2(){
for (var i=0; i<cssmenuids.length; i++){
  var ultags=document.getElementById(cssmenuids[i]).getElementsByTagName("ul")
    for (var t=0; t<ultags.length; t++){
			ultags[t].style.top=ultags[t].parentNode.offsetHeight+csssubmenuoffset+"px"
    	var spanref=document.createElement("span")
			spanref.className="arrowdiv"
			spanref.innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;"
			ultags[t].parentNode.getElementsByTagName("a")[0].appendChild(spanref)
    	ultags[t].parentNode.onmouseover=function(){
					this.style.zIndex=100
					this.className="over";
    				this.getElementsByTagName("ul")[0].style.visibility="visible"
					this.getElementsByTagName("ul")[0].style.zIndex=0
    	}
    	ultags[t].parentNode.onmouseout=function(){
					this.style.zIndex=0
					this.className="";
					this.getElementsByTagName("ul")[0].style.visibility="hidden"
					this.getElementsByTagName("ul")[0].style.zIndex=100
    	}
    }
}
}

if (window.addEventListener)
{window.addEventListener("load", createcssmenu2, false)}
else if (window.attachEvent)
{window.attachEvent("onload", createcssmenu2)}




function route(){
	var straat = document.getElementById('straat');
	var plaats = document.getElementById('plaats');
	var straatError = document.getElementById('straatError');
	var plaatsError = document.getElementById('plaatsError');
	straatError.value = 'Vul aub een straatnaam in';
	plaatsError.value = 'Vul aub een plaatsnaam in';

	if(straat.value.length == 0 && plaats.value.length == 0){
		straatError.style.display = 'block';
		straat.focus(); // set the focus to this input
		plaatsError.style.display = 'block';
	} else if(straat.value.length == 0 && plaats.value.length != 0){
		straatError.style.display = 'block';
		straat.focus(); // set the focus to this input
		plaatsError.style.display = 'none';
	} else if(straat.value.length != 0 && plaats.value.length == 0){
		straatError.style.display = 'none';
		plaatsError.style.display = 'block';
		plaats.focus(); // set the focus to this input
	} else if(straat.value.length != 0 && plaats.value.length != 0){
		straatError.style.display = 'none';
		plaatsError.style.display = 'none';
		window.open('http://maps.google.nl/maps?f=d&source=s_d&saddr=' + straat.value + ',+' + plaats.value + '&daddr=nieuwe+gracht+74,+haarlem&hl=nl&geocode=&mra=ls&sll=52.385088,4.63701&sspn=0.009338,0.019312&g=nieuwe+gracht+74,+haarlem&ie=UTF8&ll=52.357151,4.998779&spn=1.196007,2.471924');
	}
}


