
/************************************************************************************************************
(C) www.dhtml.com, November 2005

This is a script from www.dhtml.com. You will find this and a lot of other scripts at our website.	

Terms of use:
You are free to use this script as long as the copyright message is kept intact. However, you may not
redistribute, sell or repost it without our permission.

Thank you!

www.dhtml.com
Alf Magne Kalleland

************************************************************************************************************/

var dhtml_slideSpeed = 10;	// Higher value = faster
var dhtml_timer = 10;	// Lower value = faster

var objectIdToSlideDown = false;
var dhtml_activeId = false;
var dhtml_slideInProgress = false;
function showHideContent(e,inputId)
{
	if(dhtml_slideInProgress)return;
	dhtml_slideInProgress = true;
	if(!inputId)inputId = this.id;
	inputId = inputId + '';
	var numericId = inputId.replace(/[^0-9]/g,'');
	var optieDiv = document.getElementById('dhtml_a' + numericId);

	objectIdToSlideDown = false;
	
	if(!optieDiv.style.display || optieDiv.style.display=='none'){		
		if(dhtml_activeId &&  dhtml_activeId!=numericId){			
			objectIdToSlideDown = numericId;
			slideContent(dhtml_activeId,(dhtml_slideSpeed*-1));
		}else{
			
			optieDiv.style.display='block';
			optieDiv.style.visibility = 'visible';
			
			slideContent(numericId,dhtml_slideSpeed);
		}
	}else{
		slideContent(numericId,(dhtml_slideSpeed*-1));
		dhtml_activeId = false;
	}	
}

function slideContent(inputId,direction)
{
	
	var obj =document.getElementById('dhtml_a' + inputId);
	var contentObj = document.getElementById('dhtml_ac' + inputId);
	height = obj.clientHeight;
	if(height==0)height = obj.offsetHeight;
	height = height + direction;
	rerunFunction = true;
	if(height>contentObj.offsetHeight){
		height = contentObj.offsetHeight;
		rerunFunction = false;
	}
	if(height<=1){
		height = 1;
		rerunFunction = false;
	}

	obj.style.height = height + 'px';
	var topPos = height - contentObj.offsetHeight;
	if(topPos>0)topPos=0;
	contentObj.style.top = topPos + 'px';
	if(rerunFunction){
		setTimeout('slideContent(' + inputId + ',' + direction + ')',dhtml_timer);
	}else{
		if(height<=1){
			obj.style.display='none'; 
			if(objectIdToSlideDown && objectIdToSlideDown!=inputId){
				document.getElementById('dhtml_a' + objectIdToSlideDown).style.display='block';
				document.getElementById('dhtml_a' + objectIdToSlideDown).style.visibility='visible';
				slideContent(objectIdToSlideDown,dhtml_slideSpeed);				
			}else{
				dhtml_slideInProgress = false;
			}
		}else{
			dhtml_activeId = inputId;
			dhtml_slideInProgress = false;
		}
	}
}



function initShowHideDivs()
{
	var divs = document.getElementsByTagName('DIV');
	var divCounter = 1;
	for(var no=0;no<divs.length;no++){
		if(divs[no].className=='dhtml_header'){
			divs[no].onclick = showHideContent;
			divs[no].id = 'dhtml_q'+divCounter;
			var optie = divs[no].nextSibling;
			while(optie && optie.tagName!='DIV'){
				optie = optie.nextSibling;
			}
			optie.id = 'dhtml_a'+divCounter;	
			contentDiv = optie.getElementsByTagName('DIV')[0];
			contentDiv.style.top = 0 - contentDiv.offsetHeight + 'px'; 	
			contentDiv.className='dhtml_optie_content';
			contentDiv.id = 'dhtml_ac' + divCounter;
			optie.style.display='none';
			optie.style.height='1px';
			divCounter++;
		}		
	}	
}



window.onload = initShowHideDivs;



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);

function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
    if(document.layers)	   {  //NN4+ 
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    } else if(document.getElementById)	{  //gecko(NN6) + IE 5+   
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    }  else if(document.all) {// IE 4
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}

  function isNumberKey(evt)
  {
	 var charCode = (evt.which) ? evt.which : event.keyCode
	 if ((charCode > 31 && (charCode < 48 || charCode > 57)) &&(charCode != 46)&&(charCode != 45))
		return false;

	 return true;
  }


function showLevel( _levelId, action ) {// action = "none" or "block"
	var thisLevel = document.getElementById( _levelId ); 
	thisLevel.style.display = action;
}


function element(obj) {
	return document.getElementById(obj);
}

function confirmDelete(delUrl) {
	if (confirm("Weet je zeker dat je dit wilt verwijderen? Dit kan niet worden ongedaan.")) {
		document.location = delUrl;
	}
}


// check nav gedeelte
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 voor het swappen van een plaatje

function SimpleSwap(el,which){
  el.src=el.getAttribute(which || "origsrc");
}

function SimpleSwapSetup(){
  var x = document.getElementsByTagName("img");
  for (var i=0;i<x.length;i++){
    var oversrc = x[i].getAttribute("oversrc");
    if (!oversrc) continue;
      
    // preload image
    // comment the next two lines to disable image pre-loading
    x[i].oversrc_img = new Image();
    x[i].oversrc_img.src=oversrc;
    // set event handlers
    x[i].onmouseover = new Function("SimpleSwap(this,'oversrc');");
    x[i].onmouseout = new Function("SimpleSwap(this);");
    // save original src
    x[i].setAttribute("origsrc",x[i].src);
  }
}

var PreSimpleSwapOnload =(window.onload)? window.onload : function(){};
window.onload = function(){PreSimpleSwapOnload(); SimpleSwapSetup();}


// dit is de email adressen check
function checkformulier() {
	var x = document.forms[0].email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) { 
		//alert('YES! Correct email address');
	} else {
		 alert('Helaas klopte emailadres niet.');
		 return false;
		 document.forms[0].email.focus();
	}
	saikoformulier.submit();
	return true;
}

function checkMail()
{

}


