function show(ele) {
	var srcElement = document.getElementById(ele);
	if(srcElement != null) {
		if(srcElement.style.display == "block") {
			srcElement.style.display= 'none';
		}else {
			srcElement.style.display='block';
		}
		return false;
	}
}


function validEmail(theEntry) {
  badEntry = false
  invalidChars = " /:,;"
  if (theEntry == "") { 
    badEntry = true
  }
  for (i=0; i < 5; i++)  {
    badChar = invalidChars.charAt(i)
    if (theEntry.indexOf(badChar,0) > -1) {
      badEntry = true
    }
  }  
  atsignLoc = theEntry.indexOf("@",1)
  if (atsignLoc == -1) {
    badEntry = true
  }     
  if (theEntry.indexOf("@",atsignLoc+1) > -1) {
    badEntry = true
  }
  dotLoc = theEntry.indexOf(".",atsignLoc)
  if (dotLoc == -1) {
    badEntry = true
  }
  if (dotLoc+3 > theEntry.length) {
    badEntry = true
  }
  if(badEntry){
  	alert('Email adres is niet juist')
  }
  return badEntry
}

function ValidateForm(oForm) {
	var oFocusItem = null;
	var bPassed = true; 
	var oItems = oForm.elements;
	for (var i = 0; i < oItems.length; i++) {
		if ( (oItems.item(i).className.indexOf('requiredfield') > -1) ) {
			if ( oItems.item(i).value.length < 1) { 
				oItems.item(i).className += ' invalidfield';
				if ( !oFocusItem ){
					oFocusItem = oItems.item(i);
				}
				bPassed = false;
			} else if ( 
				oItems.item(i).className.indexOf(' invalidfield') > -1) {
					oItems.item(i).className = 'requiredfield';
				}
			}
		}
		if(!bPassed){
			alert('Niet alle velden ingevuld');	
		}
		if(bPassed){
			if (oForm.email && (oForm.email.className.indexOf('requiredfield') > -1) && validEmail(oForm.email.value)) {
				oForm.email.className += ' invalidfield';
				if ( !oFocusItem ){
					oFocusItem = oForm.email;
				}
				bPassed = false;
			};
		}
	if ( !bPassed ) {
		if ( oFocusItem ) {
			oFocusItem.focus();
		}
	};
	return bPassed;
}
