// Standard JavaScript **********************************************

root_path = '/schwarzenberg/';
root_directory = root_path;  // u.a. für drucken

function ie()
{
  if(navigator.appName == "Microsoft Internet Explorer") return true;
  else return false;
}

ie()

function bookmark()
{
  if(ie())
  {
    window.external.AddFavorite(window.location.href,this.document.title);
  }
  else
  {
    alert("Diese Funktionalität ist in Netscape Browsern derzeit noch nicht verfügbar!");
  }
}

function popup(link)
{
  hoehe  = 600;   // (screen.height/2.5-20);
  breite = 550;   // (screen.width/2);
  win    = window.open(link, "window", 'toolbar=0,scrollbars=1,location=0,directories=0,status=0,menubar=0,resizable=1,dependent=yes,Width='+breite+',Height='+hoehe+',left='+(screen.width-(breite+15))+',top=0');
}

function start(link,target,breite,hoehe,x,y,scb)
{
  if((typeof x) == "undefined") x = 0;
  if((typeof y) == "undefined") y = 0;
  if((typeof scb) == "undefined") scb = 1;
//win = window.open(link,target,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars='+scb+',resizable=1,Width='+breite+',Height='+hoehe+',left='+x+',top='+y+'');
  win = window.open(link,target,'toolbar=0,location=1,directories=0,status=1,menubar=0,scrollbars='+scb+',resizable=1,Width='+breite+',Height='+hoehe+',left='+x+',top='+y+'');
  if(win) win.focus();
}

function start_cal(path,form,cont,targ,w,h,x,y)
{
  start(path + "_includes/work/cal.php?f=" + form + "&div=" + cont,targ,w,h,x,y,1);
}

function obj_rem(type,href)
{
  if(confirm("Wollen Sie dies" + type + " von der Seite entfernen?\n(Das Objekt an sich bleibt dabei erhalten.)\n\nWenn ja, dann drücken Sie jetzt OK.")) window.location.href = href;
}

function Title() {
    alt = window.document.all.title.innerText;
    document.all.admin_infos.innerHTML = "<br><b><font color=red>ACHTUNG: SEITE NOCH <u>NICHT</u> GESPEICHERT!</b></font>";
    document.all.admin_infos.innerHTML.blink();
    Check = prompt("Geben Sie Titel dieser Seite ein",window.document.all.title.innerText);
    if(Check != window.document.all.title.innerText){
        window.document.all.title.innerText = Check;
        document.f_page.f_title.value = Check;
        document.f_page.f_flag.value = 1;
    } else {
        window.document.all.title.innerText = alt;
    }
    if (Check == null) window.document.all.title.innerText = alt;
}

function suche()
{
  if(document.allsearch.vt_search.value.length < 1)
  {
    alert("Bitte einen Suchbegriff eingeben!");
    document.allsearch.vt_search.focus();
  }
  else
  {
    document.allsearch.submit();
  }
}

function ausdrucken()
{
  window.print();
}

function drucken()
{
  if(ie())
  {
    win= window.open(root_directory+'leer.html','', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0, Width=695,Height=460,left=0,top=0');
    var Icon  = '<a href="JavaScript:ausdrucken();"><img src="'+root_directory+'_images/gif/druck.gif" width="18" height="18" border="0" alt="Diese Seite ausdrucken"></a>&nbsp;&nbsp;<a href="JavaScript:window.close();"><img src="'+root_directory+'_images/gif/close.gif" width="18" height="18" border="0" onmouseover="src=\''+root_directory+'_images/gif/close.gif\'; return true;" onmouseout="src=\''+root_directory+'_images/gif/close.gif\'; return true;" alt="Fenster schliessen"></a>';
    var Kopf  = '<html><head><script language="JavaScript" src="'+root_directory+'_includes/js/std.js"></SCRIPT><link rel="STYLESHEET" href="'+root_directory+'_includes/style/_style.css" type="text/css"><title>'+document.title+'</title></head><body class=druckbody><table width="100%" cellpadding="0" border="0"><tr><td valign="bottom" class="kl"width="100%">Druckversion von '+document.location.href+'</td><td width="55">'+Icon+'</td></tr><tr><td width="100%" colspan="2"><img src="'+root_directory+'_images/gif/gra_pix.gif" width="100%" height="1"></td></tr></table><br>';
    var Mitte = '<br><center>';
    var Fuss  = '</center><br><table border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td colspan="2" width="100%" ><img src="'+root_directory+'_images/gif/gra_pix.gif" width="100%" height="1"></td></tr><tr><td height="3" colspan="2" width="100%" ></td></tr><tr><td valign="top" width="100%" class="kl"></td><td align="right" width="55">'+Icon+'</td></tr></table></body></html>';
    win.document.open("text/html");
    win.document.write(Kopf+document.all.title.outerHTML+Mitte+document.all.nurdruck.outerHTML+Fuss);
    win.document.close();
  }
  else
  {
    window.print();
  }
}

function lZ(strTxt)
{
  if (strTxt == '' || !strTxt) strTxt = 'Einen kleinen Moment bitte...'
  if (document.all.ladeLayer)
  {
    with (document.all.ladeLayer.style)
    {
      left = (document.body.clientWidth - 200) / 2;
      top = (document.body.clientHeight - 100) / 2 + document.body.scrollTop;
      visibility = "visible";
    }
    document.all.lT.innerHTML = strTxt;
  }
  return true

}

function hide_lZ()
{
  if (document.all.ladeLayer)
  {
    with (document.all.ladeLayer.style)
    {
      visibility = "hidden";
    }
  }
  return
}

function ohide_lZ()
{
  if (opener.document.all.ladeLayer)
  {
    with (opener.document.all.ladeLayer.style)
    {
      visibility = "hidden";
    }
  }
  return
}

function count_this(size,feld,form)
{
  if(form == undefined)
  {
    form = 'EditFormular';
  }
  str = eval('document.' + form + '.' + feld + '.value');
  len = size - str.length;
  if(len < 0)
  {
    alert("ACHTUNG:\n\nDie maximale Länge von " + size + " Zeichen für dieses Feld ist erreicht.\nAlle weiteren Zeichen werden nicht gespeichert.");
    fitting_str = str.slice(0, size);
    if(fitting_str.charCodeAt(fitting_str.length - 1) == 13)
    {
      fitting_str = str.slice(0, size - 1);
    }
    eval('document.' + form + '.'   + feld +   '.value = fitting_str');
    eval('document.' + form + '.__' + feld + '_c.value = (size - fitting_str.length)');
  }
  else
  {
    eval('document.' + form + '.__' + feld + '_c.value = len');
  }
}

function count_this_cms(size,feld,form)
{
  form = document.forms[form];
  str = eval("form." + feld + ".value");
  len = size - str.length;
  if(len < 0)
  {
    alert("ACHTUNG:\n\nDie maximale Länge von " + size + " Zeichen für dieses Feld ist erreicht.\nAlle weiteren Zeichen werden nicht gespeichert.");
    fitting_str = str.slice(0, size);
    if(fitting_str.charCodeAt(fitting_str.length - 1) == 13)
    {
      fitting_str = str.slice(0, size - 1);
    }
    eval("form." + feld +    ".value =         fitting_str");
    eval("form." + feld + "_ct.value = (size - fitting_str.length)");
  }
  else
  {
    eval("form." + feld + "_ct.value = len");
  }
}
