function wai_aria() {
 if (document.getElementById('content')) document.getElementById('content').setAttribute('role', 'main');
 if (document.getElementById('navi')) document.getElementById('navi').setAttribute('role', 'navigation');
 if (document.getElementById('suche')) document.getElementById('suche').setAttribute('role', 'search');
 
 if (document.getElementById('Name')) document.getElementById('Name').setAttribute('aria-required', 'true');
 if (document.getElementById('Email')) document.getElementById('Email').setAttribute('aria-required', 'true');
 if (document.getElementById('Homepage')) document.getElementById('Homepage').setAttribute('aria-required', 'true');
 if (document.getElementById('Nachricht')) document.getElementById('Nachricht').setAttribute('aria-required', 'true');
 }

function removeOldAlert()
  {
    var oldAlert = document.getElementById("alert");
    if (oldAlert)
      document.body.removeChild(oldAlert);
  }

function addAlert(aMsg)
  {
    removeOldAlert();
    var newAlert = document.createElement("div");
    newAlert.setAttribute("role", "alert");
    newAlert.setAttribute("id", "alert");
    var msg = document.createTextNode(aMsg);
    newAlert.appendChild(msg);
    document.body.appendChild(newAlert);
  }

function checkValidity(aID, aSearchTerm, aMsg)
  {
    var elem = document.getElementById(aID);
    var invalid = (elem.value.indexOf(aSearchTerm) < 0);
    if (invalid) {
      elem.setAttribute("aria-invalid", "true");
      addAlert(aMsg);
    } else {
      elem.setAttribute("aria-invalid", "false");
      removeOldAlert();
    }
  }
  
 
 window.onload=function()
{
 Highlight();
 wai_aria();
}

