function urlRandomizer() {
	var strChars = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";			
	var minLength = 30;
	var maxLength = 30;
	var diffLength = maxLength - minLength		
	var thisLength = Math.round((Math.random() * diffLength)+minLength);		
	var outLoop = 0; var strGen = '';			
	while(outLoop<thisLength)	{
		strGen += strChars.charAt(Math.round(Math.random() * strChars.length));
		outLoop++;
	}			
	return(strGen);
}
	
function validateEmail(email){
	 if (email.length == 0) return false; 
	 var splitted = email.match("^(.+)@(.+)$");
	 if(splitted == null) return false;
	 if(splitted[1] != null )
	 {
		var regexp_user=/^\"?[\w-_\.]*\"?$/;
		if(splitted[1].match(regexp_user) == null) return false;
	 }
	 if(splitted[2] != null)
	 {
		var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
		if(splitted[2].match(regexp_domain) == null) 
		{
		 var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
		 if(splitted[2].match(regexp_ip) == null) return false;
		}// if
		return true;
	 }
	return false;
}	

function spinner(divId){
	$(divId).update('<img src="/img/spinner.gif" width="18" height="18" style="margin-left:10px" /> Even geduld aub....');
}

function subnavSelect(subset,area){
	$('subset_a').hide();$('subset_b').hide();$('subset_c').hide();$('subset_d').hide();
	$('subset_'+subset).show();
	if(area=='gehuwd'){
		$('subnav_chan_a').className='';$('subnav_chan_b').className='';$('subnav_chan_c').className='';$('subnav_chan_d').className='';
		$('subnav_chan_'+subset).className='active';
	} else {
		$('subnav_chan_a_b').className='';$('subnav_chan_b_b').className='';$('subnav_chan_c_b').className='';$('subnav_chan_d_b').className='';
		$('subnav_chan_'+subset+'_b').className='active';
	}
	if(subset=='a'){brdrColor = '#4a0000';} else if (subset=='b'){brdrColor = '#08062c';} else if (subset=='c'){brdrColor = '#29122b';}else{brdrColor = '#142b12';}
	$('subnav_chan_tabs').style.borderBottom = '2px solid '+brdrColor;
	$('subnav_chan_subs').style.borderBottom = '2px solid '+brdrColor;
	
}

function parseContactForm() {		
	if($('firstname').value == '') {
		alert('U heeft nog geen voornaam ingevuld.');
		$('firstname').focus();
		return false;
	}
	if($('lastname').value == '') {
		alert('U heeft nog geen achternaam ingevuld.');
		$('lastname').focus();
		return false;
	}
	if($('email').value == '') {
		alert('U heeft nog geen e-mail adres ingevuld.');
		$('name').focus();
		return false;
	}
	if(!validateEmail($('email').value)) {
		alert('U heeft een ongeldig e-mail adres ingevuld.');
		$('email').select();
		return false;
	}
	if($('question').value == '') {
		alert('U heeft nog geen vraag ingevuld.');
		$('question').focus();
		return false;
	}

	qstr = "firstname="+$('firstname').value+"&middlename="+$('middlename').value+"&lastname="+$('lastname').value+"&email="+$('email').value+"&question="+$('question').value;

	spinner('updateme');
	new Ajax.Updater('updateme','/content/ajax/doContactForm.asp?'+qstr, {evalScripts:true});
}

function gotoColumn(){
	columnLink = $('columnArchive')[$('columnArchive').selectedIndex].value;
	document.location.href=columnLink;
}

function toggleLyr(lyr,strProv) {
	arrProvs=new Array("geo_drenthe","geo_flevoland","geo_friesland","geo_gelderland","geo_groningen","geo_limburg","geo_nb","geo_nh","geo_overijssel","geo_utrecht","geo_zeeland","geo_zh")
	
	for(x=0;x<arrProvs.length;x++){
	    //$(arrProvs[x]).style.display='none';
	}
	
	if ($('geo_' + lyr).style.display == 'block') {
	    arrSelectedProvs = ($('theProv').value).split("#");
	    var strSelectedProv = "";
	    arrNewProvs = new Array();
	    z = 0;
	    for (y = 0; y < arrSelectedProvs.length; y++) {
	        if ( arrSelectedProvs[y] != strProv && arrSelectedProvs[y].length != 0 ) {
	            arrNewProvs[z] = arrSelectedProvs[y];
	            z++;
	        }

	    }
	    $('geo_' + lyr).style.display = 'none';

	    $('theProv').value = arrNewProvs.join("#");
        $('theProv').value += "#";
	}
	else {
	    $('geo_' + lyr).style.display = 'block';
	    
	    $('theProv').value += strProv + "#";
	}
}

function show(prov) {
	spinner('officeresults');
	new Ajax.Updater('officeresults','/content/ajax/getOffices.asp?p='+prov, {evalScripts:true});
}

function submitPoll(chan,vote){
	divHgt = $('poll_content').offsetHeight;
	$('poll_content').style.height=divHgt+'px'
	spinner('poll_content');
	new Ajax.Updater('poll_content','/content/ajax/doPoll.asp?chan='+chan+'&vote='+vote, {evalScripts:true});
}

var upTimer =0;
function itemUpInit(objNm){
	upTimer = setTimeout("itemUp('"+objNm+"')",50);
}

function killUpTimer(){
	upTimer = clearTimeout(upTimer);
}

function itemUp(objNm){
killUpTimer();
	if($(objNm).offsetHeight==124){
		Effect.BlindUp(objNm,{duration:0.3});		
	} else {
		setTimeout("itemUp('"+objNm+"')",100);
	}
}

function itemDown(objNm){
	if($(objNm).offsetHeight==0){
		Effect.BlindDown(objNm,{duration:0.3});
	}
}

