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
  }
  return badEntry
}

function ValidateForm(oForm) {
   var oFocusItem = null; var sMessage = new String;
   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 (oForm.email){
      if (validEmail(oForm.email.value) == true) {
         oForm.email.className += ' invalidfield';
         if ( !oFocusItem ) oFocusItem = oForm.email;
         bPassed = false;
      }
   }
     
   
   
   
   if ( !bPassed && oFocusItem ) oFocusItem.focus();
   return bPassed;
}








function valDrop(val) {
if (val == '') return false;
else return true;
} 





function checkrequired(which) {
var pass=true;
if (document.images) {
	for (i=0;i<which.length;i++) {
		var tempobj=which.elements[i];
			if (tempobj.name.substring(0,8)=="required") {
				if (((tempobj.type=="text"||tempobj.type=="textarea")&&
					tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
					tempobj.selectedIndex==0)) {
					pass=false;
					break;
         		}
     		}
   		}
	}
	if (!pass) {
		shortFieldName=tempobj.name.substring(8,30).toUpperCase();
		alert("U bent vergeten het veld "+shortFieldName+" in te vullen.");
		return false;
	}
	else
	return true;
}








