todo1Input = new Array(); //Melding
todo2Input = new Array(); //Element
todo3Input = new Array(); //Functie
todoIInput = 0;

var missinginfo = '';

function autoval(elm)
{
  var allElements = document.getElementById(elm).getElementsByTagName('*');
  var subset = new Array();
  for(x = 0; x < allElements.length; x++)
  {
    if(allElements[x].type == 'text')
      subset.push(allElements[x]);
    if(allElements[x].type == 'select-one')
      subset.push(allElements[x]);
    if(allElements[x].type == 'checkbox')
      subset.push(allElements[x]);
    if(allElements[x].type == 'hidden')
      subset.push(allElements[x]);
  }
  /*
  var allElements = document.forms[0].elements;
  //allElements = document.getElementById(elm).getElementsByTagName('input');
  var subset = new Array();
  for(x = 0; x < allElements.length; x++)
  {
    if(allElements[x].type == 'text')
      subset.push(allElements[x]);
    if(allElements[x].type == 'select-one')
      subset.push(allElements[x]);
  }
  */
  if(ValidateAll(subset))
    return true;
  else
    return false;
}

function ValidateAll(oObjects)
{
  // elm is een array van alle objecten binnen het form dat we gaan valideren
  total = oObjects.length ;
  current = 0;
  todo1Input = new Array(); //Melding
  todo2Input = new Array(); //Element
  todo3Input = new Array(); //Functie
  todoIInput = 0;
  // missinginfo = "";
    // var elms = findElementsWithClassNameInput();
    // var bodyelm = findBodyElementInput();

    for (i = 0; i < oObjects.length; i++)
    {
      selectLiteral2InputType(oObjects[i],'validateCheck');
      selectLiteral2InputType(oObjects[i],'validateInt');
      selectLiteral2InputType(oObjects[i],'validateDecimal');
      selectLiteral2InputType(oObjects[i],'validateEmpty');
      selectLiteral2InputType(oObjects[i],'validateSelect0');
      selectLiteral2InputType(oObjects[i],'validateSelect');
      selectLiteral2InputType(oObjects[i],'validateDatum');
      selectLiteral2InputType(oObjects[i],'validateIntP');
      selectLiteral2InputType(oObjects[i],'validateDecimalP');
      selectLiteral2InputType(oObjects[i],'validateEmptyP');
      selectLiteral2InputType(oObjects[i],'validateSelect0P');
      selectLiteral2InputType(oObjects[i],'validateDatumP');
      selectLiteral2InputType(oObjects[i],'validateGroup');
      selectLiteral2InputType(oObjects[i],'validateTelefoon');
      selectLiteral2InputType(oObjects[i],'validateTelefoonP');
      selectLiteral2InputType(oObjects[i],'validateTelefoonCustom');
      selectLiteral2InputType(oObjects[i],'validateEmail');
      
    }

  for(n=0;n<todo1Input.length;n++)
    eval(todo3Input[n] + "(document.getElementById('"+todo2Input[n]+"'),'"+todo1Input[n]+"');");
  if (missinginfo!="")
  {
  	missinginfo ="De volgende velden: " +"\n_______________________________\n" +
    missinginfo + "\n_______________________________\n" +
    "zijn niet of niet correct ingevuld.\n";
    alert(missinginfo);
    missinginfo = '';
    return false;
  }
  else
  {
    return true;
  }
}


function findElementsWithClassNameInput()
{
  allspans = document.getElementsByTagName("input");
  elms = [];
  for (i = 0; i < allspans.length; i++) 
  {
    elms[elms.length] = allspans[i];
  }
  return elms;
}

function findBodyElementInput()
{
  allspans = document.getElementsByTagName("body");
  bodyelm = [];
  for (i = 0; i < allspans.length; i++) 
  {
    bodyelm[bodyelm.length] = allspans[i];
  }
  return bodyelm;
}

function selectLiteral2InputType (element,type)
{
  checkIfGroupboxIsPresent = "0"
  checkIfGroupSelectIsPresent = "0"
  var elm = element;
  //TODO --> 
  //
  //Check of validateGroup = aanwezig
  //  Zo Ja --> Check of waarde van validateGroup gechecked is
  //    Zo ja, dan toevoegen
  //Zo Nee
  //  ==> Toevoegen 

  GroupboxValue=false;
  GroupboxSelect=0;

  if (type=="validateGroup" && elm.getAttribute(type)!=null)
  {
    var attr = elm.getAttribute(type);
    if ((attr.indexOf(',') > -1) && da(attr.split(',')[0]).type == 'select-one' && attr.indexOf('::') == -1)
    {
      var temp = attr.split(',');
      if(temp[1].indexOf('!') > -1)
        GroupboxValue = ((da(temp[0]).value != temp[1].substr(1)) && (da(temp[0]).value != ''));
      else
        GroupboxValue = (da(temp[0]).value == temp[1]);
    }
    else if(attr.indexOf('::') > -1)
    {
      var temp = attr.split(',');
      var validValueMin = temp[1].split('::')[0];
      var validValueMax = temp[1].split('::')[1];
      if(temp[1].indexOf('!') > -1)
        GroupboxValue = ((parseInt(da(temp[0]).value) < validValueMin) || (parseInt(da(temp[0]).value) > validValueMax));
      else
        GroupboxValue = ((parseInt(da(temp[0]).value) >= validValueMin) && (parseInt(da(temp[0]).value) <= validValueMax));
    }
    else
    {
      GroupboxValue = document.getElementById(elm.getAttribute(type)).checked ;
    }
    checkIfGroupboxIsPresent = "1" ;
  }

   
  if (type=="validateSelect" && elm.getAttribute(type)!=null) {
    GroupboxSelect = document.getElementById(elm.getAttribute(type)).selectedIndex ;
    checkIfGroupSelectIsPresent = "1" ;
  }

  var todo;

  if(elm.getAttribute(type) != null && checkIfGroupboxIsPresent == "1" && GroupboxValue)
  {
    todo = elm.getAttribute("msg");
    todo3Input[todoIInput] = "validateEmpty" ;
    todo1Input[todoIInput] = todo ;
    todo2Input[todoIInput] = element.name;
    todoIInput++;
  } else {

    if(elm.getAttribute(type) != null && checkIfGroupSelectIsPresent == "1" && GroupboxSelect!="0" && GroupboxSelect!="") {
      todo = elm.getAttribute("msg");
      todo3Input[todoIInput] = "validateEmpty" ;
      todo1Input[todoIInput] = todo ;
      todo2Input[todoIInput] = element.name;
      todoIInput++;
    } else {
      if (type!="validateGroup" && type!="validateSelect")
      {
        if(elm.getAttribute(type) != null)
        {
          todo = elm.getAttribute(type);
          todo3Input[todoIInput] = type ;

        }
        if(todo != null && todo != "")
        {
          todo1Input[todoIInput] = todo  ;
          todo2Input[todoIInput] = element.name;
          todoIInput++;
        }
      }
    }
  }
}


function validateTelefoon(e,v)
{
  var value = e.value.replace('-', '').replace(' ', '').replace(/\+[\d]{2,2}/, '0');
  if(value.indexOf('00') == 0)
    value = value.replace(/00[\d]{2,2}/, '0');
  if(value.length != 10)
    missinginfo += "\n-  " + v;
}

function validateTelefoonCustom(e,v)
{
  if(document.getElementById('chkHiddenTelefoon').checked && e.value != '')
  {
    var value = e.value.replace(/-/g, '').replace(/ /g, '').replace(/\+[\d]{2,2}/g, '0');
    if(value.indexOf('00') == 0)
      value = value.replace(/00[\d]{2,2}/, '0');
    if(value.length != 10)
      missinginfo += "\n-  " + v;
  }
}

function validateEmail(e,v) {
  str = e.value;
  var at="@"
  var dot="."
  var lat=str.indexOf(at)
  var lstr=str.length
  var ldot=str.indexOf(dot)
  if
  (
    (e.value==null)||(e.value=="") ||
    str.indexOf(at)==-1 ||
    (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) || 
    (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) ||
    (str.indexOf(at,(lat+1))!=-1) ||
    (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) ||
    (str.indexOf(dot,(lat+2))==-1) ||
    (str.indexOf(" ")!=-1)
  ){
    missinginfo += "\n-  " + v;
  }
}

function validateTelefoonP(e,v)
{
  if(document.getElementById('Partner_ja').checked)
    validateTelefoon(e,v);
}


function validateGroup(e,v) {
}

function validateInt(e,v)
{
  e.value = e.value.replace(",","");
  e.value = e.value.replace(".","");
  if 
  (
    ((isNaN(e.value)) && (e.value != "") ||  
    (e.value < 0) && (e.value != ""))
  )
  {
    missinginfo += "\n-  " + v;
	}
}

function validateIntP(e,v)
{
  if(document.getElementById('Partner_ja').checked)
  {
    e.value = e.value.replace(",","");
    e.value = e.value.replace(".","");
    if 
    (
      ((isNaN(e.value)) && (e.value != "") ||  
      (e.value < 0) && (e.value != ""))
    )
    {
      missinginfo += "\n-  " + v;
    }
  }
}

function validateDecimal(e,v)
{
  e.value = e.value.replace(",",".");
  if ((isNaN(e.value)) && (e.value != ""))
  {
    missinginfo += "\n-  " + v;
	}
}

function validateDecimalP(e,v)
{
  if(document.getElementById('Partner_ja').checked)
  {
    e.value = e.value.replace(",",".");
    if 
    (
      ((isNaN(e.value)) && (e.value != "") ||  
      (e.value < 0) && (e.value != ""))
    )
    {
      missinginfo += "\n-  " + v;
    }
  }
}

function validateDatum(e,v)
{
  if(check_date(e.value) == "InvalidDate" && e.value != "")
  {
    missinginfo += "\n-  " + v;
	}
}

function validateDatumP(e,v)
{
  if(document.getElementById('Partner_ja').checked)
  {
    if(check_date(e.value) == "InvalidDate" && e.value != "")
    {
      missinginfo += "\n-  " + v;
    }
  }
}

function validateEmpty(e,v)
{
  if(e.value == "" )
  {
    missinginfo += "\n-  " + v;
	}
}
function validateSelect0(e,v)
{
  if(e.selectedIndex == 0 )
  {
    missinginfo += "\n-  " + v;
	}
}


function validateSelect0P(e,v)
{
  if(document.getElementById('Partner_ja').checked)
  {
    if(e.selectedIndex == 0 )
    {
      missinginfo += "\n-  " + v;
    }
  }
}
function validateEmptyP(e,v)
{
  if(document.getElementById('Partner_ja').checked)
  {
    if(e.value == "" )
    {
      missinginfo += "\n-  " + v;
    }
  }
}

function validateCheck(e,v)
{
  if(!e.checked)
  {
    missinginfo += "\n-  " + v;
  }
}

function clearVariables()
{
  missinginfo = "";
}

//cleanToCamel
//cleanToCapitalsWithDots
//cleanToHuisnummer
//cleanToUpper
//cleanToLower
//cleanToKenteken
//cleanToGeboortedatum
//cleanToPostcode

//<script>
//window.onload = initializeSanitizing;
//</script>


function cleanToCamel(el)
{
  if(el)
  {
    s = el.value;
    r = "";
    var s = s.split(" ");
    j=0;
    for(i=0;i<s.length;i++)
    {
      waarde = s[i].toLowerCase();
      if
        (
        waarde == "van" ||
        waarde == "der" ||
        waarde == "het" ||
        waarde == "de"
        )
      {
        r += s[i].toLowerCase();
        r += " ";
      }
      else
      {
        r += s[i].substring(0,1).toUpperCase();
        r += s[i].substring(1).toLowerCase();
        r += " ";
      }
    }
    r = r.substring(0,r.length-1);
    el.value = r;
  }
} 

function cleanToCapitalsWithDots(el)
{
  if(el)
  {
    e = el.value;
    r = "";
    var s = new Array();
    for(k=0;k<e.length;k++)
    {
      s[k] = e.substring(k,k+1);
    }
    j=0;
    for(i=0;i<s.length;i++)
    {
      if(s[i] == " " || s[i] == "." || s[i] == "," || s[i] == "_")
      {

      }
      else
      {
        r += s[i].toUpperCase() + ".";
      }
    }
    el.value = r;
  }
} 

function cleanToHuisnummer(el)
{
  if(el)
  {
    e = el.value;
    r = "";
    var s = new Array();
    l = 0;
    for(k=0;k<e.length;k++)
    {
      if(e.substring(k,k+1) != "-" && e.substring(k,k+1) != " ")
      {
        s[l] = e.substring(k,k+1);
        l++;
      }
    }
    j=0;
    for(i=0;i<s.length;i++)
    {
      if(i > 0)
      {
        if( isNaN(s[i]) && !isNaN(s[i-1]))  //1A --> 1 A
        {
          r += " " + s[i];
        }
        else
        {
          r += s[i];
        }
      }
      else
      {
        r += s[i];
      }

    }
    el.value = r.toUpperCase();
  }
} 
function cleanToUpper(el)
{
  if(el)
  {
    e = el.value;
    el.value = e.toUpperCase();
  }
}

function cleanToLower(el)
{
  if(el)
  {
    e = el.value;
    el.value = e.toLowerCase();
  }
}

function cleanToKenteken(el)
  {
  if(el)
  {
    if (el.value.length == 6)
    {
      var r = el.value;
      e = r.substring(0,2).toUpperCase() + "-" + r.substring(2,4).toUpperCase() + "-" + r.substring(4,6).toUpperCase();
      el.value = e;
    }
  }
}

function cleanToPostcode(el)
{
  if(el)
  {
    var r = el.value;
    if (el.value.length == 6)
    {
      e = r.substring(0,4) + " " + r.substring(4,6);
      r= e;
    }
    el.value = r.toUpperCase();
  }
}


function cleanToGeboortedatum(el)
{
  if(el)
  {
    if (check_date(el.value) == "InvalidDate" && el.value != "")
    {
      alert("Ongeldige datum");
      el.focus();
    }
    else if (el.value != "")
      el.value = check_date(el.value);
  }
}

function findElementsWithClassName()
{
  allspans = document.getElementsByTagName("input");
  elms = [];
  for (i = 0; i < allspans.length; i++) 
  {
    elms[elms.length] = allspans[i];
  }
  return elms;
}

function findBodyElement()
{
  allspans = document.getElementsByTagName("body");
  bodyelm = [];
  for (i = 0; i < allspans.length; i++) 
  {
    bodyelm[bodyelm.length] = allspans[i];
  }
  return bodyelm;
}

function selectLiteral()
{
  var elm = window.event.srcElement;
  var item = elm.nextSibling;
  todo = elm.getAttribute("sanitize");

  if(todo != null && todo != "")
  {
    eval(todo + "(elm);");
  }
}

todo1 = new Array();
todo2 = new Array();
todoI = 0;
function selectLiteral2(element)
{
  var elm = element;

  var todo;
  if(elm.getAttribute("sanitize") != null)
    todo = elm.getAttribute("sanitize");

  if(todo != null && todo != "")
  {
    todo1[todoI] = todo;
    todo2[todoI] = element.name;
    todoI++;
  }
}

function initializeSanitizing()
{
  var elms = findElementsWithClassName();
  var bodyelm = findBodyElement();
  for (i = 0; i < elms.length; i++)
  {
    elms[i].attachEvent('onfocusout', selectLiteral);
    selectLiteral2(elms[i]);
  }
  for(n=0;n<todo1.length;n++)
    eval(todo1[n] + "(document.getElementById('"+todo2[n]+"'));");
}

/*
missinginfo = "";
function valNotEmpty(el,caption)
{
  if(el)
  {
    if(el.value == "")
      missinginfo  + ="- " + caption + "\n" ;
  }
}
*/
function check_date(datum){
//input: DateTime
//output: string met datum(indien ok), of string met foutmelding
var checkstr = "0123456789";
var DateValue = datum;
var DateTemp = "";
var separator = "-";
var day;
var month;
var year;
var leap = 0;
var err = 0;
var i;
   err = 0;
   var mdy_arr=DateValue.split(separator);
   if( parseInt(mdy_arr[0]) < 10)
	{
	   if(mdy_arr[0].substr(0,1) != "0")
		{
			mdy_arr[0] = "0" + mdy_arr[0];
		}
	}
	if( parseInt(mdy_arr[1]) < 10)
	{
	  if(mdy_arr[1].substr(0,1) != "0")
		{ 
		  mdy_arr[1] = "0" + mdy_arr[1];
		}
	}
	DateValue = mdy_arr[0] + separator + mdy_arr[1] + separator + mdy_arr[2];
   /* Delete all chars except 0..9 */
   for(i = 0; i < DateValue.length; i++) {
	  if(checkstr.indexOf(DateValue.substr(i,1)) >= 0) {
		 DateTemp = DateTemp + DateValue.substr(i,1);
	  }
   }
   DateValue = DateTemp;
   /* Always change date to 8 digits - string*/
   /* if year is entered as 2-digit / always assume 20xx */
   if(DateValue.length == 6) {
	  DateValue = DateValue.substr(0,4) + '20' + DateValue.substr(4,2); }
   if(DateValue.length != 8) {
	  err = 19;}
   /* year is wrong if year = 0000 */
   year = DateValue.substr(4,4);
   if(year == 0) {
	  err = 20;
   }
   /* Validation of month*/
   month = DateValue.substr(2,2);
   if((month < 1) ||(month > 12)) {
	  err = 21;
   }
   /* Validation of day*/
   day = DateValue.substr(0,2);
   if(day < 1) {
	 err = 22;
   }
   /* Validation leap-year / february / day */
   if((year % 4 == 0) ||(year % 100 == 0) ||(year % 400 == 0)) {
	  leap = 1;
   }
   if((month == 2) &&(leap == 1) &&(day > 29)) {
	  err = 23;
   }
   if((month == 2) &&(leap != 1) &&(day > 28)) {
	  err = 24;
   }
   /* Validation of other months */
   if((day > 31) &&((month == "01") ||(month == "03") ||(month == "05") ||(month == "07") ||(month == "08") ||(month == "10") ||(month == "12"))) {
	  err = 25;
   }
   if((day > 30) &&((month == "04") ||(month == "06") ||(month == "09") ||(month == "11"))) {
	  err = 26;
   }
   /* if 00 ist entered, no error, deleting the entry */
   if((day == 0) &&(month == 0) &&(year == 00)) {
	  err = 0; day = ""; month = ""; year = ""; separator = "";
   }
   if(DateValue == "" || DateValue == null){
	   err= 1;
   }
   /* if no error, write the completed date to Input-Field(e.g. 13.12.2001) */
   if(err == 0) {
	 
	  correctDate = day + separator + month + separator + year;
	  return correctDate;
   }
   /* Error-message if err != 0 */
   else 
	 {
	  return "InvalidDate";
   }
}

function chkdate(datum1, datum2)
//input: string(dag-maand-jaar), string(dag-maand-jaar)
//output: int(1 wanneer datum2 later is dan datum1), 0 wanneer datums gelijk zijn)
//        int(-1 wanneer datum2 eerder is dan datum1                             )
{
  var separator = "-";
  var mdy_arr = datum1.split(separator);
  var mdy_arr2 = datum2.split(separator);

  dag1 = mdy_arr[0];
  maand1 = mdy_arr[1];
  jaar1 = mdy_arr[2];
  
  dag2 = mdy_arr2[0];
  maand2 = mdy_arr2[1];
  jaar2 = mdy_arr2[2];
  
  if(jaar2 > jaar1)
    return 1;
  else if(jaar2 == jaar1)
  {
    if(maand2 > maand1)
      return 1;
    else if(maand2 == maand1)
    {
      if(dag2 > dag1)
        return 1;
      else if(dag2 == dag1)
        return 0
      else
        return -1;
    }
    else
      return -1;
  }
  else
    return -1;
}




function chktime(tijd1, tijd2)
//input: string(uur:minuut), string(uur:minuut)
//output: int(1 wanneer tijd2 later is dan tijd1), 0 wanneer tijden gelijk zijn)
//        int(-1 wanneer tijd2 eerder is dan tijd1                             )
{
  var separator = ":";
  var mdy_arr = tijd1.split(separator);
  var mdy_arr2 = tijd2.split(separator);

  uur1 = mdy_arr[0];
  if(uur1 < 10)
    uur1 = "0"+uur1;
  minuut1 = mdy_arr[1];
  if(minuut1 < 10)
    minuut1 = "0"+minuut1;
  uur2 = mdy_arr2[0];
  if(uur2 < 10)
    uur2 = "0"+uur2;
  minuut2 = mdy_arr2[1];
  if(minuut2 < 10)
    minuut2 = "0"+minuut2;

  if(uur2 > uur1)
    return 1;
  else if(uur2 == uur1)
  {
    if(minuut2 > minuut1)
      return 1;
    else if(minuut2 == minuut1)
      return 0
    else
      return -1;
  }
  else
    return -1;
}




function checkUurMinuut(uur,minuut)
//input: string, string
//output: string("\n- {Datum Uur | Datum Minuut}" wanneer de input geen geldige uur- en/of minuutwaarde bevat)
//              (                                 of wanneer de input leeg is                                )
{
  text = "";
  if(isNaN(document.getElementById(uur).value))
  {
    text += "\n-  Datum Uur";
  }
  else
  {
    if(document.getElementById(uur).value > 23 || document.getElementById(uur).value < 0 || document.getElementById(uur).value == "")
    {
      text += "\n-  Datum Uur";
    }
  }
  
  if(isNaN(document.getElementById(minuut).value))
  {
    text += "\n-  Datum Minuut";
  }
  else
  {
    if(document.getElementById(minuut).value > 59 || document.getElementById(minuut).value < 0 || document.getElementById(minuut).value == "")
    {
      text += "\n-  Datum Minuut";
    }
  }
  return text;
}

function whichRadioChecked(e)
//input: string(GroupName van een radioButton groep)
//output: int(-1 als er geen radioButton is geselecteerd, anders de index van de radioButton in de groep)
{
  whichChecked = -1;
  aantal = document.getElementById(e).length;
  for(i=0; i< aantal; i++)
  {
    if(document.getElementById(e)[i].checked)
      whichChecked = i;
  }
  return whichChecked;
}

function brk()
{
  if(navigator.appName != "Microsoft Internet Explorer")
  {
    document.write("<br>");
  }
}

function wait(millis) 
{
  date = new Date();
  var curDate = null;

  do
  {
    var curDate = new Date();
  } 
  while(curDate-date < millis);
}

//Maatschappij && Hypotheek vorm
function dd_FirstDDL(id, firstDDL){
	this.id = id;
	this.firstDDL = firstDDL;
}

function dd_SecDDL(id, id_firstDDL, secDDL){
	this.id = id;
	this.id_firstDDL = id_firstDDL;
	this.secDDL = secDDL;
}

function initDDLS(sel_firstDDL, sel_secDDL,firstDDL,secDLL){
	document.getElementById(firstDDL).options[0]	= new Option("--Kies--");
	document.getElementById(secDLL).options[0] = new Option("--Kies--");
	for(i = 1; i <= firstDDLArr.length; i++){
		document.getElementById(firstDDL).options[i]	= new Option(firstDDLArr[i-1].firstDDL, firstDDLArr[i-1].id);
		if(firstDDLArr[i-1].id == sel_firstDDL)
			document.getElementById(firstDDL).options[i].selected = true;
	}
	dd_OnChange(sel_secDDL,firstDDL,secDLL);
}

function dd_OnChange(sel_secDDL,firstDDL,secDLL){
	sel_firstDDL_index = document.getElementById(firstDDL).selectedIndex;
	sel_firstDDL_value = parseInt(document.getElementById(firstDDL)[sel_firstDDL_index].value);
	for(i = document.getElementById(secDLL).length - 1; i > 0; i--)
		document.getElementById(secDLL).options[i]	= null;
	j=1;
	for(i = 1; i <= secDDLArr.length; i++){
		if(secDDLArr[i-1].id_firstDDL == sel_firstDDL_value){
			document.getElementById(secDLL).options[j]	= new Option(secDDLArr[i-1].secDDL, secDDLArr[i-1].id);
			if(secDDLArr[i-1].id == sel_secDDL)	document.getElementById(secDLL).options[j].selected = true;
			j++;
		}
	}
}

function addZero(o)
{
  if(o.length == 1 && o >= 0 && o <= 9)
    return "0" + o;
  else
    return o;
}

function disableAllButtons()
{
  allButtons = document.getElementsByTagName("input");
  elms = [];

  for(i = 0; i < allButtons.length; i++) 
  {
    elms[elms.length] = allButtons[i];
  }
  

  for(i = 0; i < elms.length; i++)
  {
    if(elms[i])
    {
      if(elms[i].type == 'submit')
        elms[i].disabled = true;
      
      if(elms[i].type == 'button')
        elms[i].disabled = true;
    }
  }
}

function updateCheckboxDiv(o,d)
//o = object, d = div om te tonen / verbergen
{
  if(document.getElementById(o))
  {
    if(document.getElementById(o).checked)
    {
      showNode(d);
    }
    else
    {
      HideNode(d);
      // Maak alle onderliggende elementen leeg
      Removevalues(d);
    }
  }
}

function updateDropdownDiv(o,v,d)
//o = object, v = geselecteerde value, d = div om te tonen / verbergen
{
  if(document.getElementById(o))
  {
    if(document.getElementById(o)[document.getElementById(o).selectedIndex].value == v)
      showNode(d);
    else
      HideNode(d);
  }
}


function Replace(v, f, t)
{
out = f; // replace this
add = t; // with this
temp = "" + v; // temporary holder

  while (temp.indexOf(out)>-1) {
  pos= temp.indexOf(out);
  temp = "" + (temp.substring(0, pos) + add + 
  temp.substring((pos + out.length), temp.length));
  }
return temp;
}
