homeon = new Image();

homeon.src = "img/home-on.gif";

homeoff = new Image();

homeoff.src = "img/home.gif";

infoson = new Image();

infoson.src = "img/infos-on.gif";

infosoff = new Image();

infosoff.src = "img/infos.gif";

anmeldenon = new Image();

anmeldenon.src = "img/anmelden-on.gif";

anmeldenoff = new Image();

anmeldenoff.src = "img/anmelden.gif";

agbon = new Image();

agbon.src = "img/agb-on.gif";

agboff = new Image();

agboff.src = "img/agb.gif";

mediadatenon = new Image();

mediadatenon.src = "img/mediadaten-on.gif";

mediadatenoff = new Image();

mediadatenoff.src = "img/mediadaten.gif";

impressumon = new Image();

impressumon.src = "img/impressum-on.gif";

impressumoff = new Image();

impressumoff.src = "img/impressum.gif";

function wechsel(Bildnr,Bildobjekt) {

 window.document.images[Bildnr].src = Bildobjekt.src;

}

function chkValidChar(str, chk) {
  for (var i=0;i<str.length;i++) {
    ok = false;
    for (var j=0;j<chk.length;j++) {
      if (str.charAt(i) == chk.charAt(j)) ok = true;
    }
    if (!ok) return false;
  }
  return true;
}

function chkEMail(obj) {
  erlaubt="0123456789aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ-._@";
  pos_of_at = obj.value.indexOf('@');
  if(pos_of_at == -1) {
    return false;
  }
  if(obj.value.indexOf('.') == -1) {
    return false;
  }
  if (!chkValidChar(obj.value, erlaubt)) {
    return false;
  }
  var teilx = obj.value.substr(0,pos_of_at);
  var teil1 = obj.value.substr(0,pos_of_at-1);
  var teil2 = obj.value.substr(pos_of_at+1,obj.value.length);
  if (teil1.length <= 0) {
    return false;
  }
  if (teil1.charAt(length-1) == '.') {
    return false;
  }
  if (chkValidChar(teil1.charAt(0), '.')) {
    return false;
  }
  if (teil2.indexOf('@') != -1) {
    return false;
  }
  if (teil2.indexOf('.') == -1) {
    return false;
  }
  if (teil2.indexOf('.') < 2) {
    return false;
  }
  if((teilx.indexOf('..') > 0) || (teil2.indexOf('..') > 0)) {
    return false;
  }
  return true;
}


function chkUrl(obj) {
  erlaubt="0123456789aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ-._@";
  punktPos=obj.value.indexOf('.');
  if(punktPos == -1) {
    return false;
  }
  if (!chkValidChar(obj.value, erlaubt)) {
    return false;
  }
  var teil1 = obj.value.substr(0,punktPos);
  if (teil1.length <= 0) {
    return false;
  }
  return true;
}


function chkKFormular()
{
  if (document.kontakt.email.value == "") {
    alert("Bitte geben Sie Ihre eMail-Adresse ein.\n\nHITrotation Team");
    document.kontakt.email.focus();
    return false;
  }
  else {
    if (!chkEMail(window.document.kontakt.email)) {
      alert("Ihre eMail-Adresse scheint ungültig zu sein.\n\nHITrotation Team");
      document.kontakt.email.focus();
      return false;
    }
  }
  if (document.kontakt.homepage.value == "") {
    alert("Bitte geben Sie Ihre URL ein.\n\nHITrotation Team");
    document.kontakt.homepage.focus();
    return false;
  }
  else {
    if (!chkUrl(window.document.kontakt.homepage)) {
      alert("Ihre URL scheint ungültig zu sein.\n\nHITrotation Team");
      document.kontakt.homepage.focus();
      return false;
    }
  }
  if (document.kontakt.msgr.value == "") {
    alert("Bitte geben Sie eine Beschreibung ein.\n\nHITrotation Team");
    document.kontakt.msgr.focus();
    return false;
  }
}


