/*-------------------------------------------------------*/
/* File:   links/sect/_os/sys/backlink.js                */
/* Author: Hans-Rudolf Wernli, webmaster@transfair.ch    */
/* Create: 12-APR-2003  -  Udate: 13-APR-2003/hrh        */
/*-------------------------------------------------------*/


var PassCnt = 4;  // counts tries for entry delete


// Function checks whether window was opened by direct
// access and opens transfair main index, if so.
// Otherwise, the window is closed so that the transfair
// main page becomes the focus.
//-------------------------------------------------------

function ExitSect(lvl)
{
  if(!opener)
  {
    backurl = "../../../index.html";          // /links/sect/_os
    if(lvl == 1)
    {
      backurl = "../../../../index.html";     // /links/sect/_os/sys
    }
    window.document.location.href = backurl;
  }
  else
    self.close();
}


// Function checks whether all fields are
// filled in for guestbook. Alerts if not,
// if all ok, submits data entry, after all
// hard newlines have been replaced.
//----------------------------------------

function ChkGB(gbIn)
{
  with(document.gbIn)
  {
    if (xname.value == "")
    {
      alert("Bitte geben Sie Ihren Namen an!");
      return;
    }
    if (xemail.value == "")
    {
      alert("Bitte geben Sie Ihre E-Mail an!");
      return;
    }
    if (xcomment.value == "")
    {
      alert("Sie haben keinen Kommentar eingegeben!");
      return;
    }
    stripped = xcomment.value.replace(/\n/,"");
    xcomment.value = stripped;
		submit();
  }
}


// Function checks whether all fields are
// filled in for entry deletion. After 3
// unsuccessful tries, routine seizes up,
// else submits to process.
//----------------------------------------

function ChkDel(gbDel)
{
  PassCnt--;
  if(PassCnt > 0)
  {
    with(document.gbDel)
    {
      if (zname.value == "")
      {
        alert("Bitte geben Sie Ihren Namen an!");
        return;
      }
      if (zpass.value == "")
      {
        alert("Bitte geben Sie Ihr Passwort ein!");
        return;
      }
      if (zid.value == "")
      {
        alert("Kein Eintrag-Nummer eingegeben!");
        return;
      }
		  submit();
    }
  }
  if(PassCnt <= 0)
  {
    alert("Sie haben keine Berechtigung\neinen Eintrag zu löschen!\n\nGehen Sie zurück zur Homepage.");
  }
}

/*-------------End of Script-------------------*/

