///// Formular Checker
///// formularOK(formularname, Pflichtfeld-Name1, Pflichtfeld-Name2 ... submit [opt])
/////


function FormularOK() {
   var check = new Array();
   for (var i=0; i<FormularOK.arguments.length; i++) check[i]=FormularOK.arguments[i];


  for (var i=1; i<check.length; i++) 
  {
  
  switch (check[i]) {
   case "eMail":
    if (document.forms[check[0]].eMail && document.forms[check[0]].eMail.value.indexOf('@')==-1
        ||document.forms[check[0]].eMail.value.indexOf('.')==-1)
        {
            alert ("Emailadresse muss  \n '@' (At-Zeichen) und einen '.' (Punkt)\n enthalten.");
            document.forms[check[0]].eMail.focus();
            return false
        }
   break;
  
   case "Name":
    if (document.forms[check[0]].Name && document.forms[check[0]].Name.value == "")
        {
            alert("Bitte den Namen eintragen");
            document.forms[check[0]].Name.focus();
            return false
        }
   break;
    
   case "Vorname":
    if (document.forms[check[0]].Vorname && document.forms[check[0]].Vorname.value == "")
        {
            alert("Bitte den Vornamen angeben");
            document.forms[check[0]].Vorname.focus();
            return false
        }
   break;
  
   case "Anrede":
    if (document.forms[check[0]].Anrede && document.forms[check[0]].Anrede.value == "")
        {
            alert("Bitte eine Anrede w&#228;hlen");
            document.forms[check[0]].Anrede.focus();
            return false
        }
   break;
    
   case "Strasse":
    if (document.forms[check[0]].Strasse && document.forms[check[0]].Strasse.value == "")
        {
            alert("Bitte die Strasse angeben");
            document.forms[check[0]].Strasse.focus();
            return false
        }
   break;
 
   case "HausNr":
    if (document.forms[check[0]].HausNr && document.forms[check[0]].HausNr.value == "")
        {
            alert("Bitte die Hausnummer angeben");
            document.forms[check[0]].HausNr.focus();
            return false
        }
   break;
   
   case "PLZ":
    if (document.forms[check[0]].PLZ && document.forms[check[0]].PLZ.value == "")
        {
            alert("Bitte die Postleitzahl angeben");
            document.forms[check[0]].PLZ.focus();
            return false
        }
   break;
   
   case "Ort":
    if (document.forms[check[0]].Ort && document.forms[check[0]].Ort.value == "")
        {
            alert("Bitte den Wohnort angeben");
            document.forms[check[0]].Ort.focus();
            return false
        }
   break;
 
   case "Land":
    if (document.forms[check[0]].Land && document.forms[check[0]].Land.value == "")
        {
            alert("Bitte das Land angeben");
            document.forms[check[0]].Land.focus();
            return false
        }
   break;
   
      case "Tel":
    if (document.forms[check[0]].Tel && document.forms[check[0]].Tel.value == "")
        {
            alert("Bitte die Telefonnummer angeben");
            document.forms[check[0]].Tel.focus();
            return false
        }
   break;
   
      case "Fax":
    if (document.forms[check[0]].Fax && document.forms[check[0]].Fax.value == "")
        {
            alert("Bitte die Faxnummer angeben");
            document.forms[check[0]].Fax.focus();
            return false
        }
   break;
 
   case "Mitteilung":
    if(document.forms[check[0]].Mitteilung && document.forms[check[0]].Mitteilung.value == "")
        {
            alert("Bitte Mitteilung verfassen");
            document.forms[check[0]].Mitteilung.focus();
            return false
        }
   break;
    
   case "Kontoinhaber":
    if(document.forms[check[0]].Kontoinhaber && document.forms[check[0]].Kontoinhaber.value == "")
        {
            alert("Bitte Kontoinhaber angeben");
            document.forms[check[0]].Kontoinhaber.focus();
            return false
        }
   break;
    
   case "Kontonummer":
    if(document.forms[check[0]].Kontonummer && document.forms[check[0]].Kontonummer.value == "")
        {
            alert("Bitte Kontonummer angeben");
            document.forms[check[0]].Kontonummer.focus();
            return false
        }
   break;
    
   case "Bankleitzahl":
    if(document.forms[check[0]].Bankleitzahl && document.forms[check[0]].Bankleitzahl.value == "")
        {
            alert("Bitte Bankleitzahl angeben");
            document.forms[check[0]].Bankleitzahl.focus();
            return false
        }
   break;

   case "Bankinstitut":
    if(document.forms[check[0]].Bankinstitut && document.forms[check[0]].Bankinstitut.value == "")
        {
            alert("Bitte Bankinstitut angeben");
            document.forms[check[0]].Bankinstitut.focus();
            return false
        }
    break; 
   
   case "Benutzernummer":
       if(document.forms[check[0]].Benutzernummer && document.forms[check[0]].Benutzernummer.value == "")
           {
               alert("Bitte Benutzernummer angeben");
               document.forms[check[0]].Benutzernummer.focus();
               return false
           }
    break; 
   
   case "submit":
   document.forms[check[0]].submit();           
}}

return true}


function popup(img, btext){
var scrollb="no";
var resizb="no";
foto= new Image();
foto.src=(img);
bildtext="Gro&#223;ansicht";
if (btext.length>0) {
bildtext=btext;
} 

ControlFoto(img);
}

function ControlFoto(img){
if((foto.width!=0)&&(foto.height!=0)){
ViewFoto(img);
}
else{
interval_a="ControlFoto('"+img+"')";
interval_b=setTimeout(interval_a,20);
}
}
function ViewFoto(img){
bwidth=foto.width; bheight=foto.height;


if (foto.width<400) {width=420;} else {width=bwidth+20;}

height=bheight+65+(parseInt(bildtext.length/((parseInt(width/100)*2-2)*7))+1)*15; 

if ((height>700) || (width>800))  {scrollb="yes"; resizb="yes";} else {scrollb="no"; resizb="no";};

try {
if (output.closed == false) throw "offen";
}
catch (e) {
if (e=="offen") {
output.close();
}
}
output=window.open("","output","left=40,top=40,width="+width+",height="+height+",location=no,toolbar=no,menubar=no,status=no,scrollbars="+scrollb+",resizable="+resizb);
output.document.writeln("<html><head><title>Gro&#223;ansicht<\/title>");
output.document.writeln("<style type=\"text/css\">");
output.document.writeln("a:link \{ color:\#333333; \}");
output.document.writeln("a:visited \{ color:\#333333; \}");
output.document.writeln("a:hover \{ color:\#000000; \}");
output.document.writeln("<\/style>");
output.document.writeln("<\/head>");
output.document.writeln("<body bgcolor=\"white\" leftmargin=\"0\" marginwidth=\"0\" topmargin=\"0\" marginheight=\"0\">");
 
output.document.writeln("<div style=\"MARGIN: 10px\">");
output.document.writeln("<p><img src=\""+img+"\" width=\""+bwidth+"\" alt=\""+bildtext+"\" height=\""+bheight+"\" border=\"0\"><\/p>");
output.document.writeln("<\/div>");

output.document.writeln("<div style=\"clear:both; MARGIN: 10px; text-align: right; font-size:0.7em; color: #333333; font-family: Verdana, Arial, Helvetica, sans-serif;\">");
output.document.writeln("<span style=\"text-align:left; DISPLAY: inline;WIDTH: 50%; float:left\">"+bildtext+"<\/span><span  style=\"DISPLAY: inline;WIDTH: 50%; text-align:right\"><a  href=\"javascript:self.close()\">Fenster schlie&#223;en<\/a><\/span>");
output.document.writeln("<\/div>");

output.document.writeln("<\/body><\/html>");
output.focus();
return;
}


function launchWindow(doct,popW,popH)
{
  var w
  var h;

  var x,y;
  if (self.innerHeight) // all except Explorer
  {
    w = self.innerWidth;
    h = self.innerHeight;
  }
  else if (document.documentElement && document.documentElement.clientHeight)
    // Explorer 6 Strict Mode
  {
    w = document.documentElement.clientWidth;
    h = document.documentElement.clientHeight;
  }
  else if (document.body) // other Explorers
  {
    w = document.body.clientWidth;
    h = document.body.clientHeight;
  }

  // var popW = 700, popH = 675;

  var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  window.open( doct,"","width=" + popW + ",height=" + popH + ",top=5,left=5,menubar=no,locationbar=no,statusbar=no,resizable=yes,toolbar=no,dependent=yes,scrollbars=no").focus();
}



 function Go(x)
 {
  if(x == "nothing")
  {
    document.forms[0].reset();
    document.forms[0].elements[0].blur();
    return;
  }
  else
   {
    document.location.href = x;
   }
 }




  function showclock()
  {
    if (document.getElementById)
      document.getElementById("LadeInhalt").style.display = "block";
    return true;
  }



function highlightWord(node,word) {
    
    var wert=false;
    var wordfound=false;
    
    if (node.hasChildNodes) {
        var hi_cn;
        for (hi_cn=0;hi_cn<node.childNodes.length;hi_cn++) {
            wert=highlightWord(node.childNodes[hi_cn],word);
            if (wert) {wordfound=true;}
        }
    }
    
    
    if (node.nodeType == 3) {  
        tempNodeVal = node.nodeValue.toLowerCase();
        tempWordVal = word.toLowerCase();
        if (tempNodeVal.indexOf(tempWordVal) != -1) {
            pn = node.parentNode;
             
            checkn = pn;
            while (checkn.nodeType != 9 && 
            checkn.nodeName.toLowerCase() != 'body') { 
           
                if (checkn.className.match(/\bnosearchhi\b/)) { return; }
                checkn = checkn.parentNode;
                            
            }
            if (pn.className != "searchword") {
                nv = node.nodeValue;
                ni = tempNodeVal.indexOf(tempWordVal);
                before = document.createTextNode(nv.substr(0,ni));
                wordfound=true;
                
                docWordVal = nv.substr(ni,word.length);
                after = document.createTextNode(nv.substr(ni+word.length));
                hiwordtext = document.createTextNode(docWordVal);
                hiword = document.createElement("span");
                hiword.className = "searchword";
                hiword.appendChild(hiwordtext);
                pn.insertBefore(before,node);
                pn.insertBefore(hiword,node);
                pn.insertBefore(after,node);
                pn.removeChild(node);
 		
            }
        }
    }
    
    
      
return wordfound;
}



var ToggleHead = Class.create({
  initialize: function(elH1,elT1) {
   elH=elH1;
   elT=elT1;

   this.showEvent();

  },


showEvent: function() {

function SearchHighlight(el) {

    if (!document.createElement || !window.location.search) return;
   var url = window.location.search;
   var surl= url.substr(url.indexOf("?")+1);
   var args = surl.split("&");
    for(i = 0; i < args.length; i++) {
    if (args[i].indexOf("QUERYSTRING=") > -1 ){
    var a = args[i].split("=");
    if(a[1]!="") {var gefunden=highlightWord(el, a[1]);}
}}  return gefunden;};




elH.each(function (elLink, intIdx) {
    var wert=false;
    wert=SearchHighlight(elT[intIdx]);
    if (!wert) { elT[intIdx].toggle()};


    elLink.observe('click', function () {
	 Effect.toggle(elT[intIdx], 'appear', {duration:0.6});
	 elH[intIdx].toggleClassName('boxlinkexpand');
    });

    });
}






});


