function search() {
	document.getElementById('searchForm').submit();
}

function focusZoeken(sbx,zoeken) {
	if (sbx.value==zoeken) { 
		sbx.style.color='#000';
		sbx.value=''; 
	}
}

function exitZoeken(sbx,zoeken) {
	if (sbx.value=='') { 
		sbx.style.color='#cecbcb';
		sbx.value=zoeken; 
	}
}

function resetZoeken(zoeken) {
	if (document.getElementById('zoekBox').value==zoeken) {
		document.getElementById('zoekBox').value="";
	}
}

function isValidEmail(email) {
	var emailValidator="^[0-9a-zA-Z][-_0-9a-zA-Z.]*@[-_0-9a-zA-Z.]+[.][a-zA-Z]+$";
	return validateValue(email,emailValidator);
}

//Pass a value and a regular expression pattern
function validateValue(fv,pattern) {
  var re = new RegExp(pattern);
  return re.test(fv);
}

function submitSolliForm(formname,lang) {
  var f=document.forms[formname];
 	if (validateForm(f)) {
 		//Check of CV en brief in geldig formaat zijn
 		var cv=f.cv.value;
 		var sollicitatiebrief=f.sollicitatiebrief.value
 		if (isValidDocument(cv) && isValidDocument(sollicitatiebrief)) {
 			f.submit();	
 		} else {
 			if (lang=="nl") {
 				alert("Let op! U kunt alleen document in Word of PDF-formaat toevoegen.");
 			} else {
 				alert("Warning: Only Word or PDF documents are allowed.");
 			}
 		}
  }  
}

function isValidDocument(doc) {
	var ext=getFileExtension(doc);
	return (ext=="doc" || ext=="docx" || ext=="pdf");
	
}

function getFileExtension(afile) {
	var pos=afile.lastIndexOf(".");
	if (pos>-1) {
		return afile.substr(pos+1).toLowerCase();
	} else {
		return "";
	}
}