function checkForm(){
	tel=0;
	var color= '#AA0000';
	var normalcolor='#656565';
	if (document.getElementById("naam").value =='') {				
		tel++;		
		document.getElementById("naam").className = 'formTextfieldWrong';
	} else	{ 
		document.getElementById("naam").className = 'formTextfield';
	}
	if (document.getElementById("opmerkingen").value =='') {	
		tel++;		
		document.getElementById("opmerkingen").className = 'formTextAreaWrong';
	} else	{ 
		document.getElementById("opmerkingen").className = 'formTextArea';
	}
	if (document.getElementById("contactdata").value =='') {	
		tel++;		
		document.getElementById("contactdata").className = 'formTextAreaWrong';
	} else	{ 
		document.getElementById("contactdata").className = 'formTextArea';
	}
	if (document.getElementById("email").value =='' || !checkEmail(document.getElementById("email").value)) {
		tel++;		
		document.getElementById("email").className = 'formTextfieldWrong';		
	} else	{ 
		document.getElementById("email").className = 'formTextfield';
	}
	if(tel==0){					
		return true;
	} else {
		document.getElementById("formMelding").innerHTML = '<b><font color="#FF0000">* Please fill out all required fields [' + tel + ']</font></b>';
		document.getElementById("formMelding").style.display = '';
		return false;
	}	
}
function startSearch(variable){
	if(typeof(variable) != "undefined") {
		select = document.getElementById('selectsearch');
		window.location= siteurl + "search/" + URLEncode(document.getElementById(variable).value) + "/" + select.options[select.selectedIndex].value +"/";
	} else {
		window.location= siteurl + "search/" + URLEncode(document.getElementById("search").value) + "/";
	}

}
function checkInput(input, was, wordt){
	if(input.value==was){
		input.value=wordt;
	}
}
function URLEncode (clearString) {
  var output = '';
  var x = 0;
  clearString = clearString.toString();
  var regex = /(^[a-zA-Z0-9_.]*)/;
  while (x < clearString.length) {
    var match = regex.exec(clearString.substr(x));
    if (match != null && match.length > 1 && match[1] != '') {
    	output += match[1];
      x += match[1].length;
    } else {
      if (clearString[x] == ' ')
        output += '-';
      else {
        var charCode = clearString.charCodeAt(x);
        var hexVal = charCode.toString(16);
        tmp= '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
		if (tmp = '%20'){
		output += '-';
		}
      }
      x++;
    }
  }
  return output;
}
