fnsetwaarde = function(veldnaam,veldtype,waarde,tekstwaarde,schermnaam){
	var a1 = document.forms["productdata"].elements["data"].value,a2,ok=false,a3=[]
	var str=veldnaam+"|"+veldtype+"|"+waarde+"|"+tekstwaarde+"|"+schermnaam
		a1=a1.split(";")
		for(var i=0;i<a1.length;i++){
        	a2 = a1[i].split("|")
			if(a2[0]==veldnaam){ok=true
				if(waarde==""||typeof waarde=="undefined"){continue}
				// automatische unieke waarden NIET teruggeven in request
				if(a2[1]==0){continue}
				a3[a3.length]=str
			}else{
				if(a2[1]==0){continue}
				a3[a3.length]=a1[i]
			}
        }
		if(!ok&&typeof waarde!="undefined"){a3[a3.length]=str}
	document.forms["productdata"].elements["data"].value = a3.join(";").replace(/;+/g,";")
}
fnselect=function(veldnaam,veldtype,waarde,tekstwaarde,schermnaam){
	fnsetwaarde(veldnaam,veldtype,waarde,tekstwaarde,schermnaam)
	fnselect2(veldnaam,veldtype,waarde,tekstwaarde,schermnaam)
	document.forms["productdata"].submit()
}
fnselect2=function(veldnaam,veldtype,waarde,tekstwaarde,schermnaam){}

// ga naar productgegevens
fnproduct=function(id){}
// vraag een waarde op
fnwaarde=function(veldnaam,or){
	var a1 = document.forms["productdata"].elements["data"].value
		a1=a1.split(";")
		for(var i=0;i<a1.length;i++){
        	a2 = a1[i].split("|")
			if(a2[4]==veldnaam){return a2[3]}
        }return or||null
}
var toonafb=function(src,title){
	try{popimgfnwin.close()}catch(e){};
	popimg=new Image();
	popimg.onload=function(){
		var x,y,w,h,s=0
		//status = this.width+ " "+screen.width +" "+this.height+" "+screen.height
		if(this.width+50>=screen.width){
			x=25;w=screen.width-50;s=1
		}else{
			x=(((screen.width-30)/2)-this.width/2)
			w=this.width
		}
		if(this.height+50>=screen.height){
			y=25;h=screen.height-100;s=1
		}else{
			y=(((screen.height-10)/2)-this.height/2)
			h=this.height
		}
		title=title||""
		popimgfnwin=window.open('','','scrollbars='+s+',top='+y+',left='+x+',width='+w+',height='+h);
		popimgfnwin.document.open();
		popimgfnwin.document.write('<html><head><title>'
		+title+'</title></head><body  leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" onClick="self.close()"><img src="'+this.src+'"></body></html>');
		popimgfnwin.document.close()
	};
	popimg.src=src
}
var tooninfo=function(url){
	try{popimgfnwin.close()}catch(e){}
	try{popdocwin.close()}catch(e){}
	popimgfnwin=window.open(url,'','scrollbars=1,resizable=1,width=400,height=300,left='+(((screen.width-10)/2)-200)+',top='+(((screen.height-30)/2)-150))

}

 var tooninfo=function(url){
		try{popimgfnwin.close()}catch(e){}
		try{popdocwin.close()}catch(e){}
		popimgfnwin=window.open(url,'','scrollbars=1,resizable=1,width=400,height=300,left='+
		(((screen.width-10)/2)-200)+',top='+(((screen.height-30)/2)-150))
	}
	var searchfocus = function(elm){
		if(elm.value=="zoeken..."){
			elm.value=""
		}
	}
	var searchblur = function(elm){
		if(elm.value==""){
			elm.value="zoeken..."
			return
		}
	}
	var fnsearch=function(){
		var elm = document.getElementById("searchbox"),val
		if(elm&&elm.value&&elm.value!="zoeken..."){
			val = elm.value
			// controleer hier nog de tekst
			val = val.replace(/[\`\~\!\@\#\$\%\^\*\(\)\-\+\.\<\>\{\[\]\}\:\;]/g,"")
			val = val.replace(research,"")
			// maximaal 25 tekens
			val = val.substr(0,50)
			val = val.toLowerCase()
			elm.value = val
			//document.location = "search.asp?searchbox="+val
			document.forms["searchform"].submit()
		}
	}
	
	$(document).ready(function() {
		var tmp = ""
		var tmp2=""
		
		$('#voorpagina-themas-content .box').each(function(index) {
			tmp +=  $(this).html().replace(/[\n]+/g,"").replace(/[ 	]+/g," ").replace(/\> \</g,"><")
			
			if(index%2){
				//alert(index + ': ' + $(this).html());
				tmp2+="<div class='box'>"+tmp+"</div>"
				tmp=""
			}
			else{
				tmp+= "<div class='divider-themas'></div>"
			}
			
		});

		
		$('#voorpagina-themas-content').html(tmp2)
		$('#voorpagina-themas-content').innerfade({ 
			speed: 'slow', 
			timeout: 7000, 
			type: 'sequence', 
			containerheight: '300px'
		});

		$("img[src*=.ashx]").each(function() {  
			if ($(this).parent().attr("href")){
				return;
			}
			
			var imgTitle	= $(this).attr('title');
			if((typeof imgTitle == "undefined") || (imgTitle == "")) {
				imgTitle	= $(this).attr('alt');
			}
			var imgSrc		= $(this).attr('src');
			var maxW		= '800';
			var maxH		= '800';
			
			var vars = imgSrc.split(/[;&]/);
	 		for (var i = 0; i < vars.length; i++) {
				var pair = vars[i].split('=');
				if (pair[0] == 'w'){
					pair[1] = maxW;
				}
				if (pair[0] == 'h'){
					pair[1] = maxH;
				}
				vars[i] = pair.join('=');
			}

			var newImgSrc = vars[0];
			$(this).wrap('<a class="fancy" title="'+ imgTitle +'" href="'+ newImgSrc +'"></a>');
		});
	
		$(".fancy").fancybox({
			'zoomOpacity'			: false,
			'overlayShow'			: true,
			'zoomSpeedIn'			: 500,
			'zoomSpeedOut'			: 500,
			'imageScale'			: true,
			'hideOnContentClick'	: true
		});
	}); 




