function setheight() {
	if (navigator.userAgent.indexOf("MSIE")!=-1) { 
		document.getElementById('main').style.height=document.body.offsetHeight-165;
	}
}
function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
}

function isarray(varname) {
	if (typeof(varname) != "object") return false; 
	if (typeof(varname.length) == "undefined") return false; 
	return true; 
}

function isarray(varname) {
	if (typeof(varname) != "object") return false; 
	if (typeof(varname.length) == "undefined") return false; 
	return true; 
}

function frmempty(frm, frmfields) {
	frmvalid = true;
	strError = "";
	
	for (ix=0; ix<frmfields.length; ix=ix+2) {
		if (isarray(eval('frm.'+frmfields[ix]))) { 
			if (typeof(eval('frm.'+frmfields[ix]+'.selectedIndex'))=="undefined") { // = groep van radiobuttons..
				checkmark = 0;
				for (iy=0; iy<eval('frm.'+frmfields[ix]+'.length'); iy++) {
					if (eval('frm.'+frmfields[ix]+'[iy].checked')) {
						checkmark = 1;
						break;
					}
				}
				if (checkmark == 0) {
					strError += frmfields[ix+1]+" is niet gekozen.\n";
					frmvalid = false;
				}
			} else { // = groep van dropdowns..
				if (eval('frm.'+frmfields[ix]+'.selectedIndex')==0) {
					strError += frmfields[ix+1]+" is niet gekozen.\n";
					frmvalid = false;
				}
			}
		} else {
			if (typeof(eval('frm.'+frmfields[ix]+'.value')) == "string") {
				if (frmfields[ix]=="pwd1") {
					if (frm.pwd1.value=="") {
						strError += "Wachtwoord is niet ingevuld.\n";
						frmvalid = false;
					} else {
						if (frm.pwd1.value!="" || frm.pwd2.value!="") {
							if ((frm.pwd1.value!="" && frm.pwd2.value=="") || (frm.pwd1.value=="" && frm.pwd2.value!="")) {
								strError += "Wachtwoord is niet herhaald.\n";
								frmvalid = false;
							} else {
								if (frm.pwd1.value.length<5) {
									strError += "Wachtwoord moet minimaal 5 tekens lang zijn.\n";
									frmvalid = false;
								} else {
									if (frm.pwd1.value!=frm.pwd2.value) {
										strError += "Wachtwoorden komen niet overeen.\n";
										frmvalid = false;
									}
								}
							}
						}
					}
				} else {
					if (trim(eval('frm.'+frmfields[ix]+'.value')) == "" || eval('frm.'+frmfields[ix]+'.value') == null) {
						strError += frmfields[ix+1]+" is niet ingevuld.\n";
						frmvalid = false;
					}
					if ((frmfields[ix] == "emailadres" || frmfields[ix] == "email") && trim(eval('frm.'+frmfields[ix]+'.value')) != "") {
						email=eval('frm.'+frmfields[ix]+'.value');
						var filter=/^.+@.+\..{2,4}$/;
						if (!filter.test(email)) {
							strError += frmfields[ix+1]+" is niet waarschijnlijk niet geldig.\n";
							frmvalid = false;
						}
					}
				}
			}
		}
	}
	if (!frmvalid) {
		alert(strError);
	}
	return frmvalid;
}
