var Initialisierung = 0;
var Initialisierung2 = 0;
var Ex, Ey, TitelFarbe, TextFarbe, ContentInfo;
var TitelFarbe = "red";
var TextFarbe = "yellow";


function show_kunst()
 {
 document.getElementById("inline_foto").style.display = 'none';
 document.getElementById("inline_kunst").style.display = 'inline';
 }

function show_foto()
 {
 document.getElementById("inline_kunst").style.display = 'none';
 document.getElementById("inline_foto").style.display = 'inline';
 }

function show_sonst()
 {
 document.getElementById("inline_kunst").style.display = 'none';
 document.getElementById("inline_foto").style.display = 'none';
 }


function FeldLeeren(element, text)
  {
  if(document.getElementById(element).value == text)
    {
    document.getElementById(element).value = "";
    document.getElementById(element).focus();
    return false;
    }
  }

function losch(link,nam)
  {
  var Check = confirm(" '" + nam + "' wirklich löschen?");
  if (Check == true) window.location.href = link;
  }


function ToolTipBewegen3(layerName, FromTop, FromLeft, e)
{
  if ((navigator.appName=="Microsoft Internet Explorer") || (navigator.appName=="Netscape"))
    {
    if (navigator.appName=="Microsoft Internet Explorer")
      {
      //alert('IE');
      document.getElementById(layerName).style.top = FromTop;
      document.getElementById(layerName).style.left = FromLeft +15;
      }
    else
      {
      //alert('NS/Mozilla');
      document.getElementById(layerName).style.top = FromTop;
      document.getElementById(layerName).style.left = FromLeft +15;
      }
    }
    else
     {
     //alert('andere');
     document.getElementById(layerName).style.top = FromTop;
     document.getElementById(layerName).style.left = FromLeft +15;
     }
}

function ToolTipBewegen(layerName, FromTop, FromLeft, e)
{
  if ((navigator.appName=="Microsoft Internet Explorer") || (navigator.appName=="Netscape"))
    {
    if (navigator.appName=="Microsoft Internet Explorer")
      {
      //alert('IE');
      document.getElementById(layerName).style.top = FromTop;
      document.getElementById(layerName).style.left = FromLeft +15;
      }
    else
      {
      //alert('NS/Mozilla');
      document.getElementById(layerName).style.top = FromTop;
      document.getElementById(layerName).style.left = FromLeft +15;
      }
    }
    else
     {
     //alert('andere');
     document.getElementById(layerName).style.top = FromTop;
     document.getElementById(layerName).style.left = FromLeft +15;
     }
}

function ToolTipBewegen2(layerName, FromTop, FromLeft, e)
{
  if ((navigator.appName=="Microsoft Internet Explorer") || (navigator.appName=="Netscape"))
    {
    if (navigator.appName=="Microsoft Internet Explorer")
      {
      //alert('IE');
      document.getElementById(layerName).style.top = 450;
      document.getElementById(layerName).style.left = 820;
      }
      else
      {
      //alert('NS/Mozilla');
      document.getElementById(layerName).style.top = FromTop;
      document.getElementById(layerName).style.left = FromLeft +15;
      }
    }
    else
     {
     //alert('andere');
     document.getElementById(layerName).style.top = FromTop;
     document.getElementById(layerName).style.left = FromLeft +15;
     }
}

function Aktivieren()
{
    Initialisierung = 1;
}

function Aktivieren2()
{
    Initialisierung2 = 1;
}

function Deaktivieren()
{
    Initialisierung = 0;
}

function Deaktivieren2()
{
    Initialisierung2 = 0;
}

function Starten(e)
{
    if(Initialisierung)
    {
        Ex = document.all ? (window.event.x + document.body.scrollLeft) : e.pageX;
        Ey = document.all ? (window.event.y + document.body.scrollTop) : e.pageY;

        ToolTipBewegen("ToolTip", Ey, Ex, e);
        ToolTipBewegen2("ToolTip2", Ey, Ex, e);
        document.getElementById('ToolTip').style.visibility = "visible";
        document.getElementById('ToolTip2').style.visibility = "visible";
    }

    else
    {
        ToolTipBewegen("ToolTip", 0, 0);
        ToolTipBewegen2("ToolTip2", 0, 0);
        document.getElementById('ToolTip').style.visibility = "hidden";
        document.getElementById('ToolTip2').style.visibility = "hidden";
    }
}

function Starten2(e)
{
    if(Initialisierung2)
    {
        Ex = document.all ? (window.event.x +document.body.scrollLeft) : e.pageX;
        Ey = document.all ? (window.event.y +document.body.scrollTop) : e.pageY;

        ToolTipBewegen3("ToolTip3", Ey, Ex, e);
        document.getElementById('ToolTip3').style.visibility = "visible";
    }

    else
    {
        ToolTipBewegen3("ToolTip3", 0, 0);
        document.getElementById('ToolTip3').style.visibility = "hidden";

    }
}

function ToolTip3(layerName, TTitel, TInhalt)
{
}

function ToolTip2(layerName, TTitel, TInhalt)
{
    ContentInfo ='<table border="0" cellspacing="0" cellpadding="0" width="150"><tr><td class="ToolTipInhalt2">'+TInhalt+'</td></tr></table>';
    document.getElementById('ToolTip').innerHTML = '';
    document.getElementById(layerName).innerHTML = ContentInfo;
}

function ToolTip(layerName, TTitel, TInhalt)
{
    ContentInfo ='<table border="0" cellspacing="0" cellpadding="0" width="190"><tr><td class="ToolTipTitel"><nobr>'+TTitel+'</nobr></td></tr><tr><td class="ToolTipInhalt">'+TInhalt+'</td></tr></table>';
    document.getElementById('ToolTip2').innerHTML = '';
    document.getElementById(layerName).innerHTML = ContentInfo;
}

function eintragen(Zeichen) {
  window.document.formular.mytxt.value = window.document.formular.mytxt.value + ' ' + Zeichen;
  }

function eintragen3(Zeichen, Formular, Element) {
  var input = document.forms[Formular].elements[Element];
  input.value = input.value + ' ' + Zeichen;
  }

function eintragen2(Zeichen) {
  window.document.formular.mytxt.value += '[quote]' + document.getElementById(Zeichen).innerHTML + '[/quote]';
}

function sucheon() {
 document.getElementById("expsuche").style.display = 'inline';
 document.getElementById("suchbutton1").style.display = 'none';
 document.getElementById("suchbutton2").style.display = 'inline';
}

function sucheoff() {
 document.getElementById("expsuche").style.display = 'none';
 document.getElementById("suchbutton1").style.display = 'inline';
 document.getElementById("suchbutton2").style.display = 'none';
}

function kontrolle(){
var x = document.formular.my_titel.value;
if( x.length > 200 ) x = x.substring( 0, 200 );
document.formular.my_titel.value = x;
}

function kontrolle2(wo, wert){
var x = document.forms['formular'].elements[wo].value;
var focpos = document.forms['formular'].elements[wo].scrollTop;
if( x.length > wert ) x = x.substring( 0, wert );
document.forms['formular'].elements[wo].value = x;
document.forms['formular'].elements[wo].scrollTop = focpos;
}

function insert2(aTag, eTag, formularname, elementname) {
  var input = document.forms[formularname].elements[elementname];
  var focpos = input.scrollTop;

  input.focus();
  /* für Internet Explorer */
  if(typeof document.selection != 'undefined')
    {
    /* Einfügen des Formatierungscodes */
    var range = document.selection.createRange();
    var insText = range.text;
    range.text = aTag + insText + eTag;
    /* Anpassen der Cursorposition */
    range = document.selection.createRange();
    if (insText.length == 0) {
      range.move('character', -eTag.length);
    } else {
      range.moveStart('character', aTag.length + insText.length + eTag.length);
    }
    range.select();
  }
  /* für neuere auf Gecko basierende Browser */
  else
//  if (input.selectionStart || input.selectionStart == '0')
  if(typeof input.selectionStart != 'undefined')
  {
    /* Einfügen des Formatierungscodes */
    var start = input.selectionStart;
    var end = input.selectionEnd;
    var insText = input.value.substring(start, end);
    input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
    /* Anpassen der Cursorposition */
    var pos;
    if (insText.length == 0) {
      pos = start + aTag.length;
    } else {
      pos = start + aTag.length + insText.length + eTag.length;
    }
    input.selectionStart = pos;
    input.selectionEnd = pos;
    input.scrollTop = focpos;
  }
  else
  {
    var pos;
    pos = input.value.length;
    input.value = input.value.substr(0, pos) + aTag + eTag + input.value.substr(pos);
  }
}