//<?php

function janein (url, indiv)
{
    if (!indiv) {
        var indiv = "Wollen Sie diesen Datensatz tatsächlich und endgültig löschen?";
    } 
    var zeigen = confirm(indiv);
    if (zeigen == true) {
        location = url;
    } else {
        return false;
    } 
} 
var but_off ;
var top;
function showWait ()
{
    if (navigator . userAgent . indexOf ('MSIE') > 0) {
        top = document . documentElement . scrollTop ;
    } else {
        top = window . pageYOffset ;
    } 
    var hoehe = screen . height;
    var breite = screen . width;

    var topPos = top + ((hoehe) / 2)-450;
    var leftPos = (breite-800) / 2;
    // alert (hoehe + " - " + breite +" - "+top+" + "+topPos+" + "+leftPos);
    document . getElementById('warten') . style . display = 'block';
    document . getElementById('warten') . style . top = topPos + 'px';
    document . getElementById('warten') . style . left = leftPos + 'px';
    return true;
} 

function checkRefuse ()
{
   if (!indiv) {
       var indiv = "Möchten Sie diese Bewerbung tatsächlich ablehnen?";
   } 
   var zeigen = confirm(indiv);

   if (zeigen == true) {
       return true;
   } else {
       return false;
   } 
}

   // Datumseingabe wird direkt zu einem syntaktisch richtigem Datum umgewandelt
   function check_date(feld, min, max)
   {
       time_failed = false;

       if (feld . value == '') {
           return true;
       }

       var vormals = feld . value;
       // alle Sonderzeichen werden zum Pumkt umgewandelt
       // muss doppelt ausgeührt werden, da pro Durchgang nur ein Zeichen ersetzt werden

       vormals = vormals . replace(',', '.');
       vormals = vormals . replace(' ', '.');
       vormals = vormals . replace('+', '.');
       vormals = vormals . replace('/', '.');
       vormals = vormals . replace('-', '.');
       vormals = vormals . replace('_', '.');
       vormals = vormals . replace('*', '.');
       vormals = vormals . replace(':', '.');
       vormals = vormals . replace(';', '.');

       vormals = vormals . replace(',', '.');
       vormals = vormals . replace(' ', '.');
       vormals = vormals . replace('+', '.');
       vormals = vormals . replace('/', '.');
       vormals = vormals . replace('-', '.');
       vormals = vormals . replace('_', '.');
       vormals = vormals . replace('*', '.');
       vormals = vormals . replace(':', '.');
       vormals = vormals . replace(';', '.');

       // falls kein Punkt vorhanden ist, werden die Eingaben biei 6 oder 8 Zeichen gesplittet
       if (vormals . indexOf(".") == -1) {
           if (vormals . length == 6 || vormals . length == 8) {
               var tt = vormals . substr(0, 2);
               var mm = vormals . substr(2, 2);
               var yy = vormals . substr(4);
           } else {
               return false;
           }
       } else {
           // falls Punkte vorhanden, werden hier die vorderen Zeichen aufgefüllt mit  NULLEN
           var punkt1 = vormals . indexOf(".");

           var tt = vormals . substr(0, punkt1);
           var mmyy = vormals . substr(1 + punkt1);

           var punkt2 = mmyy . indexOf(".");

           var mm = mmyy . substr(0, punkt2);
           var yy = mmyy . substr(1 + punkt2);

           if (tt . length == 1) {
               tt = '0' + tt;
           }
           if (mm . length == 1) {
               mm = '0' + mm;
           }
           if (yy . length == 1) {
               yy = '0' + yy;
           }
           if (yy . length == 2) {
               if (yy < 10) {
                   yy = '20' + yy;
               } else {
                   yy = '19' + yy;
               }
           }
       }

       if (yy . length == 2) {
           if (yy < 10) {
               yy = '20' + yy;
           } else {
               yy = '19' + yy;
           }
       }

       var b_date = check_valid_date(yy, mm, tt);
       if (b_date == false) {
          return false;
       }
       // neues Datum wird nun wieder ins Feld gesetzt
       document . getElementById(feld . name) . value = tt + "." + mm + "." + yy;
       if (min && min > yy + "-" + mm + "-" + tt ) {
           time_failed = true;
           return false;
       }
       if (max && max < yy + "-" + mm + "-" + tt ) {
           time_failed = true;
           return false;
       }

       return true;
   }

   function check_valid_date(y, m, t)
   {
       // test auf gültiges Datum
       var int_mm = m -1;
       var check_date = new Date(y, int_mm, t);
       // Datum wird anhand von Jahr, Monat und Tag berechnet (Monat fängt bei 0 an zu zählen, deswegen vorher eins abziehen ;-) )
       // danach ermitteln von Jahr, Monat und Tag, wenn alle Angaben mit der Eingabe übereinstimmen, dann ist das Datum gültig
       // (wird zum 32 als Tag eingegeben, rechnet JS automatisch ein Tag im Feb aus - das wäre dann falsch)
       var tag = check_date . getDate();
       var monat = check_date . getMonth();
       var jahr = check_date . getFullYear();
       if (tag != t || monat != int_mm || jahr != y) {
          return false;
       }
       return true;
   }



