var timeout;

function changeMenu(state)
{
    clearTimeout(timeout);    
    document.getElementById('subMenu').style.display = state;
}

function submitter(form)
{
  this.form = document.getElementById(form);
  this.inputs = this.form.getElementsByTagName('input');
  this.error = '';
  for(i=0;i<this.inputs.length;i++)
  {
    if(this.inputs[i].type=='text')
    {
        //document.getElementById('error['+i+']').innerHTML = '';
        if(this.inputs[i].value=='')
        {
          this.inputs[i].style.background = '#cccccc';
          this.error+= this.inputs[i].name;
        }
    }
  }  
  if(this.error=='')
  {
    this.form.submit();
  }
  else
  {
    alert('U heeft niet alle benodigde velden ingevuld. Vul de gearceerde velden alsnog in.');
  }
}

function engelssubmitter(form)
{
  this.form = document.getElementById(form);
  this.inputs = this.form.getElementsByTagName('input');
  this.error = '';
  for(i=0;i<this.inputs.length;i++)
  {
    if(this.inputs[i].type=='text')
    {
        //document.getElementById('error['+i+']').innerHTML = '';
        if(this.inputs[i].value=='')
        {
          this.inputs[i].style.background = '#cccccc';
          this.error+= this.inputs[i].name;
        }
    }
  }  
  if(this.error=='')
  {
    this.form.submit();
  }
  else
  {
    alert('You didn\'t fill in all the required fields.\r\nPlease fill in the marked fields.');
  }
}

