var r={
  'special':/[\W]/g,
  'puntkomma':/['.'&',']/g,
  'cijfers':/[^\d]/g,
  'letter':/[^A-Za-z]/g,
  'tel':/[^\d&\-&\+]/g,
  'tijd':/[^\d&\:]/g
}



function valid(o,typea,typeb){
  o.value = o.value.replace(r[typea],'');
  if(typeb) {
	  o.value = o.value.replace(r[typeb],'');
  }
}



function Convert(o,type){
  if(type=='upper') {
	  o.value = o.value.toUpperCase();
  }
  if(type=='lower') {
	  o.value = o.value.toLowerCase();
  }
}



<!-- Form check -->
function checkMail(o){
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(o.value) == false){
		alert('Ongeldig emailadres!');
	}
}
<!-- Form check -->



function swap(uit,aan) {
	document.getElementById(uit).className = 'onzichtbaar';
	document.getElementById(aan).className = 'zichtbaar';
}



function formatNr(nr){
	var part;
	if(Math.floor(nr)==nr) {
		return nr+'.00';
	}
	part=Math.floor(nr*100);
	part=part/100;
	nr=part;
	if((part*10-Math.floor(part*10))>0) {
		return nr;
	} else {
		return nr+'0';
	}
}



function popUp(strURL,strType,strHeight,strWidth) {
  var strOptions="";
  if (strType=="console") strOptions="resizable,scrollbars,height="+strHeight+",width="+strWidth;
  if (strType=="fixed") strOptions="scrollbars,height="+strHeight+",width="+strWidth;
  if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
  window.open(strURL, 'newWin', strOptions);
}



var mikExp = /[$\\@\\\#%\^\&\*\>\<\;\:\'\"\(\)\[\]\+\_\{\}\`\~\=\|]/;
function dodacheck(val) {
  var strPass = val.value;
  var strLength = strPass.length;
  var lchar = val.value.charAt((strLength) - 1);
  if(lchar.search(mikExp) != -1) {
    var tst = val.value.substring(0, (strLength) - 1);
    val.value = tst;
  }
}



<!-- Dreamweaver functies -->
// img swap
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;
}
// img preload
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];}}
}
// img swap
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;
}
// img swap
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];}
}
<!-- einde Dreamweaver functies -->


<!-- scriptaculous animaties -->
// -- roept scriptaculous animaties aan
function show_me(div,speed) {
	if (!speed) {
		speed = 0.0;
	}
	Effect.Appear(div, { duration: speed });
}
function hide_me(div,speed) {
	if (!speed) {
		speed = 0.0;
	}
	Effect.Fade(div, { duration: speed });
}
<!-- einde scriptaculous animaties -->



<!-- galerij script --->
function vulfoto_groot(o,div){
	var linkImg = 'bestanden/galerij/';
	var newImage =	'url(\''+linkImg+o+'\')';
	document.getElementById(div).style.backgroundImage = newImage;
}
function vulfoto_fx(foto,div_foto,div_rond){
	hide_me(div_rond, 0.2);
	
	var appear=setTimeout("vulfoto_groot('"+foto+"',div_foto);",200);
	var appear=setTimeout("show_me("+div_rond+", 0.2);",300);
	kleurthumbs(foto);
}
// -- kleuren van thumbs voor galerij script 
function kleurthumbs(foto) {
	var container_div = document.getElementById('galerij_thumbs');
		
    if (container_div) var array_thumbs=container_div.getElementsByTagName('a');
		
		if (array_thumbs) for(var i=0; i<array_thumbs.length; i++) {
			array_thumbs[i].style.borderColor = '#404040';
			array_thumbs[i].style.backgroundColor = '#292929';
		}
		
	$(foto).style.borderColor = '#777';
	$(foto).style.backgroundColor = '#444';
}
<!-- einde galerij script --->



<!-- hoover styling --->
// onblur / onmouseover / onfocus styling
// kan zowat alles op eender welke manier een classnaam geven.
// -- gebruik
// on[actie]="hoover('divnaam', 'actie classnaam')"
// als je alleen  hoover (o,'') meegeeft doet hij de class leegmaken
function hoover (o,classs) {
	$(o).className = classs;
}
<!-- einde hoover styling --->



<!-- klap script -->
// - var selected is de huidige geopende div. onload leeg defineren
var selected = '';
function klik(o,height) {
	// dezelfde klik afvangen
	if (o == selected) {
		sluit(o);
		return;	
	}

	// indien open -> oude huidige div terug morphen
	if (selected) {
		sluit(selected);
	}

	//set selected opnieuw
	selected = o;
	
	var selected_nieuw = $(selected);
	var selected_nieuw_child =  o+'_span';	
	//nieuwe div morphen
	new Effect.Morph(selected_nieuw, {
		style: 'background:#fff; height:'+height+'px;',
		duration: 0.3 
	});
	//footer setten
	footer_div(selected,2);
	// laat de nieuwe div zien.
	new Effect.Appear(selected_nieuw_child, {duration: 0.6 });  
	// scrollen naar de nieuwe div
	var scroll_me = setTimeout("scrollen();",400);
}
function sluit(o) {
	selected_old = $(selected);
	var selected_old_child = o+'_span';
	// uitfaden van de span
	new Effect.Fade(selected_old_child, { duration: 0.1 });
	// dichtmorphen van de div rond de span
	new Effect.Morph(selected_old, {
		style: 'background:#fff; height:0px;',
		duration: 0.3 
	});
	// footer terug op origineel zetten
	footer_div(o,1);
	
	// alles dicht is dicht nu, dus selected weer leeg maken
	// als er op een andere div dan de huidige is geklikt wodt die weer opnieuw gezet.
	// vlak onder de functie die sluit() oproept
	selected = '';
}
var scroll_event = 0;
function scrollen() {
	if($('izi_header') && scroll_event != 1) {
		new Effect.ScrollTo('izi_header', { duration: 0.3 }); 
		scroll_event = 1;
	}
}
function footer_div(o,di) {
	// o is divnaam vanuit de klik functie, di is 1 of 2 die via functie word meegegeven
	var lang = o.length;
	lang = lang-1;
	var xdiv = o.substring(lang);
	var aap = 'footer'+xdiv;
	var naamclass = 'footer_'+di;
	hoover(aap,naamclass);
}
<!-- einde klap script -->



<!-- popup -->
function popUp(strURL,strType,strHeight,strWidth) {
  var strOptions="";
  if (strType=="console") strOptions="resizable,scrollbars,height="+strHeight+",width="+strWidth;
  if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
  if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
  window.open(strURL, 'newWin', strOptions).focus();
}
<!-- einde popup -->

