function setRowID(pRow, pID)
{
  // Diese Funktion sorgt dafür, dass die Spalte, über der der Mauszeiger gerade ist, gehighlightet wird
  var theCells = null;
  var c = null;
  var CellCnt = 0;
  var domDetect = false;

  theCells = pRow.cells;
  CellCnt = theCells.length;

  // Abfrage, ob ein DOM-Fähiger Browser verwendet wird
  if ((typeof(window.opera) == 'undefined') && (typeof(theCells[0].getAttribute) != 'undefined')) 
    domDetect = true;
  else 
    domDetect = false;

  for (c = 0; c < CellCnt; c++)
  {
    if (domDetect) theCells[c].setAttribute('id',pID,0);
    else theCells[c].style.backgroundColor = pID;
  }
}

function setRowClass(pRow, pClass)
{
  pRow.setAttribute('class',pClass,"false");
}

function getCalendarFor(formname, elementname)
{
  var newWindow;
  var urlstring = 'kurse/calendar/calendar.php';
  newWindow = window.open(urlstring + '?formname=' + formname + '&elementname=' + elementname, '', 
    'height=220, width=280, top=300, left=300, toolbar=no, minimize=no, status=no, memubar=no, location=no, scrollbars=no')
}

function printpage()
{ 
  window.print();
}


function decryptMail ( pValue )
/* Entschlüsselt eMail-Adressen */
{
  var i, chars, decrypted = ""; 
  chars = pValue.split(",");
  for (i = 0; i < chars.length; i++)
  {
    decrypted += String.fromCharCode(chars[i] - 13);
  } 
  return decrypted;
}

function encryptMail (pValue)
/* Verschlüsselt eMail-Adressen */
{
  var i;
  var encrpyted = "";
  if (pValue != "") 
  { 
    for (i = 0; i < pValue.length; i++)
    {
      encrpyted += (pValue.charCodeAt(i)+ 13) + ",";
    } 
    encrpyted = encrpyted.substring(0, encrpyted.length-1);
  }
  return encrpyted;
}

function link2CryptedMail (pValue)
/* Ermöglicht "mailto" Links mit verschlüsselten eMail-Adressen */
{
  location.href = 'mailto:' + decryptMail(pValue);
}

function decryptMailByID ( pID )
/* Entschlüsselt den Inhalt aller Tags mit id = pID */
{
  var s;
  s = document.getElementById(pID).firstChild.nodeValue;
  document.getElementById(pID).firstChild.nodeValue = decryptMail(s);
}
