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;
 }
}  */


/* ********************************************************************* */
/* überprüft, ob die übergebene Variable dem Format ss:mm entspricht     */
function CheckTime( zeit )
{
    if ( zeit.length == 5 )
    {
         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 )
    {
         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;
}
/* ************************************************************************ */


/* ********************************************************************* */
/* überprüft, ob die übergebene Variable dem Format tt.mm.jjjj
oder ttmmjjjj entspricht */
function CheckDate( datum )
{
    var datum;
    var Tag;
    var Monat;
    var Jahr;
    var Laenge;
    var tageMonat;
    var Startjahr;
    var Endjahr;
    var chkD = 1;

    Startjahr = 1600;
    Endjahr   = 2400;

    Laenge = datum.length;


    if ( Laenge == 10 && datum.substring( 2, 3 ) == "." && datum.substring( 5, 6 ) == "." )
    {
            Tag   = parseInt( datum.substring( 0, 2),  10 );
            Monat = parseInt( datum.substring( 3, 5),  10 );
            Jahr  = parseInt( datum.substring( 6, 10), 10 );
    }
    else if ( Laenge == 8 )
    {
            for ( i = 0; i < Laenge; i++ )
       {
             if ( datum.charAt( i ) < "0" || datum.charAt( i ) > "9" )
                       chkD = -1;
            }

            if ( chkD == -1 )
            return false;
       else
       {
                    Tag   = parseInt( datum.substring( 0, 2),  10 );
                    Monat = parseInt( datum.substring( 2, 4),  10 );
                    Jahr  = parseInt( datum.substring( 4, 8),  10 );
       }
    }
    else
             return false;


    if ( Monat == 4 || Monat == 6 || Monat == 9 || Monat == 11 )
    {
             tageMonat = 30;
    }
    else if ( Monat == 1 || Monat == 3 || Monat == 5 || Monat == 7 || Monat == 8 || Monat == 10 || Monat == 12)
    {
             tageMonat = 31;
    }
    else if ( Monat == 2 && Jahr % 4 == 0 && Jahr % 100 != 0 || Jahr % 400 == 0 )
    {
             tageMonat = 29;
    }
    else if ( Monat == 2 && Jahr % 4 != 0 || Jahr % 100 == 0 && Jahr % 400 != 0 )
    {
             tageMonat = 28;
    }

    if ( Tag >= 1 && Tag <= tageMonat && Monat >= 1 && Monat <= 12 && Jahr >= Startjahr && Jahr <= Endjahr )
    {
             return true;
    }
    else
             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
