function demo()
{
 alert ("Vorgang in der DEMO leider nicht möglich...");
 return false;
}




/* ################################################################################## */
/* Sicherheitsabfrage beim Löschen eines Datensatzes */
/*
Zur Information:
Die Form muß den Namen form2 (case-sensetiv) haben
<form action="(Dateiname)" name="form2" method="POST" target="">

Der vorhandene Submit-button wird ausgetauscht:
  <input type="button" onClick="JavaScript:deleteMessage('entfernen')" value="entfernen">
  (submit)
  <input type="hidden" name="txtCommand" value="">
  (zusatz)

Im Head Bereich muß das JavaScript eingebunden werden:
<script language="JavaScript" src="..\..\inc\JavaScriptDelete.js" type="text/javascript"></script>
*/
function deleteMessage(String)
{

        check = confirm("Wollen Sie wirklich löschen ?");
        if (check==true)
        {
                show_work_layer(1);
                document.form2.txtCommand.value = String;
                document.form2.submit();
        }
        else
        {
            return;
        }
}


        function checkMessage(String, Info)
        {
                check = confirm(Info);
                if (check==true)
                {
                        show_work_layer(1);
                        document.form2.txtCommand.value = String;
                        document.form2.submit();
                }
                else
                {
                        return;
                }
        }

/* ################################################################################## */
/* ################################################################################## */
/* ################################################################################## */
/* Beispiel-Aufruf von zwei CheckTime und einmal CheckDate und anschliessend show_work_layer() :
Die Daten time_from und time_to werden an die CheckTime-Funktion in browser_info.js. übergeben
und überprüft, ob die Eingabe dem Format ss:mm entspricht. Es wird true oder false zurückgegeben.
Sollte der Rückgabewert false sein, wird der Cursor auf das jeweilige Eingabefeld fokussiert.
Sind alle Eigaben korrekt, wird der Work_Layer über die Funktion show_work_layer(1) angezeigt

function NAME()
{

 if (CheckDate(document.Formular.Belegung_am.value)   == false )
 {
      alert ("Keine korrekten Datumsangaben!");
      document.Formular.Belegung_am.focus();
      return false;
 }

 else
 {
     if (CheckTime(document.Formular.time_to.value)   == false )
     {
        alert ("Keine korrekten Zeitangaben!");
        document.Formular.time_to.focus();
        return false;
     }

     else
     {
         if (CheckTime(document.Formular.time_from.value) == false )
         {
            alert ("Keine korrekten Zeitangaben!");
            document.Formular.time_from.focus();
            return false;
         }
         else
         {
             show_work_layer();
             return true;
         }
     }
 }
}

function CheckNewDate()
{
 if (CheckDate(document.Form1.Belegung_am.value) == false )
 {
      alert ("Keine korrekten Datumsangaben!");
      document.Form1.Belegung_am.focus();
      return false;
 }
}  */


/* übergeben wird eine Variable im einem Zeitformat: entweder - ss:mm ODER ssmm       */
function CheckTime(zeit)
{
    if (zeit.length == 5)  /* wenn string 5 zeichen lang */
    {
         var hour    = (zeit.substring(0,2));
         var minute  = (zeit.substring(3,5));

         /* Kontrolle, ob SS kleiner gleich 24 und minute kleiner gleich 59 */
         if ((hour > 24) || (minute > 59)) return false;

         /* Kontrolle, ob : vorhanden */
         if ((zeit.indexOf(':') == -1)  && (zeit.indexOf('.') == -1)) return false;

         /* Kontrolle, ob SS auch wirklich nur Ziffern beinhaltet */
         var chkH = 1;
         for(i=0;i<=1;++i)
           if(zeit.charAt(i) < "0" || zeit.charAt(i) > "9")
              chkH = -1;
         if(chkH == -1) return false;

         /* Kontrolle, ob MM auch wirklich nur Ziffern beinhaltet */
         var chkM = 1;
         for(i=3;i<=4;++i)
           if(zeit.charAt(i) < "0" || zeit.charAt(i) > "9")
             chkM = -1;
         if(chkM == -1) return false;
    }

    if (zeit.length == 4)  /* wenn string 4 zeichen lang */
    {
         var hour    = (zeit.substring(0,2));
         var minute  = (zeit.substring(2,4));

         /* Kontrolle, ob SS kleiner gleich 24 und minute kleiner gleich 59 */
         if ((hour > 24) || (minute > 59)) return false;

         /* Kontrolle, ob SS auch wirklich nur Ziffern beinhaltet */
         var chkA = 1;
         for(i=0;i<=3;++i)
           if(zeit.charAt(i) < "0" || zeit.charAt(i) > "9")
             chkA = -1;
         if(chkA == -1)  return false;
    }

    if (( zeit.length < 4 ) || ( zeit.length > 5 )) return false;
}

/* ################################################################################## */
/* ################################################################################## */
/* übergeben wird ein datum im Formar:  tt.mm.jjjj  ODER ttmmjjjj */
function CheckDate(datum)
{
 if ( datum.length == 10 )
 {
     var tage    = (datum.substring(0,2));
     var monat   = (datum.substring(3,5));
     var jahr    = (datum.substring(6,10));

     /* Kontrolle, ob SS kleiner gleich 24 und minute kleiner gleich 59 */
     if ((tage > 31) || (monat > 12) || (jahr < 2000)) return false;

     /* Kontrolle, ob : vorhanden */
     if ((datum.charAt(2) != '.' )&& (datum.charAt(2) != ':' )) return false;
     if ((datum.charAt(5) != '.' )&& (datum.charAt(5) != ':' )) return false;

     /* Kontrolle, ob SS auch wirklich nur Ziffern beinhaltet */
     var chkT = 1;
     for(i=0;i<2;++i)
       if(datum.charAt(i) < "0" || datum.charAt(i) > "9")
         chkT = -1;
     if(chkT == -1) return false;

     /* Kontrolle, ob MM auch wirklich nur Ziffern beinhaltet */
     var chkM = 1;
     for(i=3;i<4;++i)
       if(datum.charAt(i) < "0" || datum.charAt(i) > "9")
         chkM = -1;
     if(chkM == -1) return false;

     /* Kontrolle, ob MM auch wirklich nur Ziffern beinhaltet */
     var chkJ = 1;
     for(i=6;i<9;++i)
       if(datum.charAt(i) < "0" || datum.charAt(i) > "9")
         chkJ = -1;
     if(chkJ == -1) return false;
    }

 if ( datum.length == 8 )
 {
     var tage    = (datum.substring(0,2));
     var monat   = (datum.substring(2,4));
     var jahr    = (datum.substring(4,8));

     /* Kontrolle, ob SS kleiner gleich 24 und minute kleiner gleich 59 */
     if ((tage > 31) || (monat > 12) || (jahr < 2000)) return false;

     /* Kontrolle, ob der string auch wirklich nur Ziffern beinhaltet */
     var chkM = 1;
     for(i=0;i<=7;++i)
       if(datum.charAt(i) < "0" || datum.charAt(i) > "9")
         chkM = -1;
     if(chkM == -1) return false;
 }
 if ( datum.length < 8  || datum.length > 10  || datum.length == 9 ) return false;
}
/* ************************************************************************ */


/*  Überprüft, ob mail nicht leer ist, ein @ und ein Punkt vorkommt */
function CheckMail(mail)
{
  if( mail == "")  return false;
  if( mail.indexOf('@') == -1) return false;
  if( mail.indexOf('.') == -1) return false;
}

/* ################################################################################## */
/* ################################################################################## */
/* ################################################################################## */

/* **********************************************************************************
Öffnet Fenster: Übergabewerte: breite,höhe,scrollbar (yes/no), resizable (yes,no)  */
function OpenWindow(file,width,height,scroll,res)
{
window.open(file,"","scrollbars=" + scroll + ",resizable= " + res + ",width=" + width + ",height=" + height + "")
}
/* ******************************************************************************* */


/* **********************************************************************************
Öffnet Fenster: Übergabewerte: breite,höhe,scrollbar (yes/no), resizable (yes,no), x- und y-position  */
function OpenWindow2(file,width,height,scroll,res,xpos,ypos)
{
window.open(file,"","scrollbars=" + scroll + ",resizable= " + res + ",width=" + width + ",height=" + height + ",screenX=" + xpos + ",screenY=" + ypos + ",top=" + ypos +" ,left=" + xpos )
}
/* ******************************************************************************* */


/* ******************************************************************************* */
/* ******************************************************************************* */
function OpenWindow3(file,width,height,scroll,res)
{
  aktiv = window.setInterval("CheckOpen1()",1000);
  win1 = open(file,"Fenster1","width=" + width + ",height=" + height + ", scrollbars=" + scroll + ",resizable= " + res );
  win1.focus();
}

function CheckOpen1()
{
  if(win1.closed == true)
  {
      var rest;
      var oldpath;

      if(window.location.search != "") /* kontrolliert, ob es in der URL noch Ergänzungen z.b. nach xyz.php gibt wie ?id=3&name=egon  */
      {
          rest = (window.location.search);
          oldpath = (window.location.pathname);
          window.location.replace(oldpath + rest);
          window.clearInterval(aktiv);
      }
      else
      {
          window.location.replace(window.location.pathname);
          window.clearInterval(aktiv);
      }
  }
}
/* ******************************************************************************* */
/* *******************************************************************************
Function, bei der eine REFERENZ mit übergeben werden muss */
function OpenWindowRef(file,ref,width,height,scroll,res)
{
  temp = ref;
  aktiv = window.setInterval("CheckOpenRef()",1000);
  win1 = open(file,"Fenster1","width=" + width + ",height=" + height + ", scrollbars=" + scroll + ",resizable= " + res );
  win1.focus();
}

function CheckOpenRef()
{
  if(win1.closed == true)
  {
      var oldpath;
      oldpath = (window.location.pathname);
      window.location.replace(oldpath + temp);
      window.clearInterval(aktiv);
  }
}
/* ******************************************************************************* */

/* **********************************************************************************
Öffnet Fenster: Übergabewerte: breite,höhe,scrollbar (yes/no), resizable (yes,no)  */
function OpenWindow4(file,width,height,scroll,res)
{
var wstat;
wstat = window.open(file,"","scrollbars=" + scroll + ",resizable= " + res + ",width=" + width + ",height=" + height + "")
}
/* ******************************************************************************* */



/**
 * Sets/unsets the pointer in browse mode
 *
 * @param   object   the table row
 * @param   object   the color to use for this row
 * @param   object   the background color
 *
 * @return  boolean  whether pointer is set or not
 */
function setPointer(theRow, thePointerColor, theNormalBgColor)
{
    var theCells = null;

    if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    var rowCellsCnt  = theCells.length;
    var currentColor = null;
    var newColor     = null;
    // Opera does not return valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined' && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
                     ? theNormalBgColor
                     : thePointerColor;
        for (var c = 0; c < rowCellsCnt; c++) {
            theCells[c].setAttribute('bgcolor', newColor, 0);
        } // end for
    }
    else {
        currentColor = theCells[0].style.backgroundColor;
        newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
                     ? theNormalBgColor
                     : thePointerColor;
        for (var c = 0; c < rowCellsCnt; c++) {
            theCells[c].style.backgroundColor = newColor;
        }
    }

    return true;
} // end of the 'setPointer()' function