function SetFocus() {
  if (document.forms.length > 0) {

    for (j=0; j<document.forms.length; j++) {
    
      var field = document.forms[j];
    
      for (i=0; i<field.length; i++) {
        if ( field.elements[i].type == "text" ) {
	  document.forms[j].elements[i].focus();
	  break;
        }

      }
   
    }
  }
}


var resetRolls = new Object(); 
        
function resetimage(src) {
  this.src=src;
  this.confirm=false;
  this.alt="Reset";
  this.write=resetimage_write;
} 

function resetimage_write() {
  document.write('<A ');
  if (this.rollover)
   {
     if (! this.name)
      {
       alert('to create a rollover you must give the image a name');
       return;
      }     
     resetRolls[this.name] = new Object();
     resetRolls[this.name].over = new Image();
     resetRolls[this.name].over.src=this.rollover;
     resetRolls[this.name].out = new Image();
     resetRolls[this.name].out.src=this.src;
     document.write(
       ' onMouseOver="if (document.images)document.images[\'' +
       this.name + '\'].src=resetRolls[\'' + this.name + '\'].over.src"' +
       ' onMouseOut="if (document.images)document.images[\'' +
       this.name + '\'].src=resetRolls[\'' + this.name + '\'].out.src"'
     );
   }
  document.write(' HREF="javascript:');
  if (this.confirm)
    document.write('if(confirm(\'Are you sure you want to reset?\'))');
    document.write('document.forms[' +
    (document.forms.length - 1) + '].reset();void(0);">');
    document.write('<IMG SRC="' + this.src + '" ALT="' + this.alt + '"');
    document.write(' BORDER=0');
  if (this.name)document.write(' NAME="' + this.name + '"');
  if (this.height)document.write(' HEIGHT=' + this.height);
  if (this.width)document.write(' WIDTH=' + this.width);
  if (this.otheratts)document.write(' '+ this.otheratts);
  document.write('></A>');
}

function window_stats(url, name) {
  var infownd = window.open(url, name,
  'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=500');
  infownd.focus();
}

function showfield(field) {
  document.getElementById(field).style.display = "block";
}

function hidefield(field) {
  document.getElementById(field).style.display = "none";
}

/* Indien bij kenteken in een veld de maximale lengte is ingegeven wordt er de focus op het volgende veld gelegd. */
function tabNextField(me)
{
    var maxLength = me.getAttribute('maxLength',5);
    var control;
    if(me.value.length == maxLength)
    {
        switch(me.id){
            case "kenteken_1":
                control=document.getElementById("kenteken_2");
            break;
            case "kenteken_2":
                control=document.getElementById("kenteken_3");
            break;
        }
        if(control) {
            control.focus();
            if (control.createTextRange) {
                var range = control.createTextRange();
                range.collapse(true);
                range.select();
            }
            else if (control.setSelectionRange) {
                control.setSelectionRange(0, 0);
            }
        }
    }
}

/* loading page */
function hideLoadingPage() {
  if (document.getElementById) { // DOM3 = IE5, NS6
    document.getElementById('hidepage').style.visibility = 'hidden';
  } else {
    if (document.layers) { // Netscape 4
      document.hidepage.visibility = 'hidden';
    } else { // IE 4
      document.all.hidepage.style.visibility = 'hidden';
    }
  }
}

function showLoadingPage() {
  if (document.getElementById) { // DOM3 = IE5, NS6
    document.getElementById('hidepage').style.visibility = 'visible';
  } else {
    if (document.layers) { // Netscape 4
      document.hidepage.visibility = 'show';
    } else { // IE 4
      document.all.hidepage.style.visibility = 'visible';
    }
  }
}

