/* Funktionsbibliothek (c) 2007-2008 Lutz Rodenhauser */
function switchlayer(layer)
{
  window.focus();
  var GECKO = document.getElementById? 1:0 ;
  var NS = document.layers? 1:0 ;
  var IE = document.all? 1:0 ;
  if (GECKO)
   {
    document.getElementById(layer).style.visibility=(document.getElementById(layer).style.visibility=='visible') ? 'hidden' : 'visible';
   }
  else if (NS)
   {
    document.layers[layer].visibility=(document.layers[layer].visibility=='visible') ? 'hidden' : 'visible';
   }
  else if (IE)
   {
    document.all[layer].style.visibility=(document.all[layer].style.visibility=='visible') ? 'hidden' : 'visible';
   }  
}

function mausover(mnum)
{
  var GECKO = document.getElementById? 1:0 ;
  var NS = document.layers? 1:0 ;
  var IE = document.all? 1:0 ;
  if (GECKO)
   {
   document.getElementById(mnum).style.color='#FF3300';
   }
  else if (NS)
   {
   document.layers[mnum].color='#FF3300';
   }
  else if (IE)
   {
   document.all[mnum].style.color='#FF3300';
   }  
}

function mausout(mnum)
{
  var GECKO = document.getElementById? 1:0 ;
  var NS = document.layers? 1:0 ;
  var IE = document.all? 1:0 ;
  if (GECKO)
   {
   document.getElementById(mnum).style.color='#000000';
   }
  else if (NS)
   {
   document.layers[mnum].color='#000000';
   }
  else if (IE)
   {
   document.all[mnum].style.color='#000000';
   }  
}

/* AJAX :: clearNode */
function clearNode(name)
{
 var GECKO = document.getElementById? 1:0 ;
 var NS = document.layers? 1:0 ;
 var IE = document.all? 1:0 ;
 if (GECKO)
 {  
  var Knoten = document.getElementById(name).firstChild;
  while (Knoten != null)
  {
   document.getElementById(name).removeChild(Knoten);
   Knoten = document.getElementById(name).firstChild;
  }
 }
 else if (NS)
 {
  var Knoten = document.layers[name].firstChild;
  while (Knoten != null)
  {
   document.layers[name].removeChild(Knoten);
   Knoten = document.layers[name].firstChild;
  }
 }
 else if (IE)
 {
  var Knoten = document.all[name].firstChild;
  while (Knoten != null)
  {
   document.all[name].removeChild(Knoten);
   Knoten = document.all[name].firstChild;
  }
 }   
}

/* AJAX :: addhtml */
function addhtml(knoten,text)
{
 var GECKO = document.getElementById? 1:0 ;
 var NS = document.layers? 1:0 ;
 var IE = document.all? 1:0 ;
 if (GECKO)
 {  
  document.getElementById(knoten).innerHTML += text;
 }
 else if (NS)
 {
  document.layers[knoten].innerHTML += text;
 }
 else if (IE)
 {
  document.all[knoten].innerHTML += text;
 }  
}

/* AJAX :: LoadXmlDoc */
var req;
function LoadXmlDoc(url)
{
 req = false;
 if(window.XMLHttpRequest)
 {
  try
  {
   req = new XMLHttpRequest();
  }
  catch(e)
  {
   req = false;
  }
 }
 else if(window.ActiveXObject)
 {
  try
  {
   req = new ActiveXObject("Msxml2.XMLHTTP");
  }
  catch(e)
  {
   try
   {
    req = new ActiveXObject("Microsoft.XMLHTTP");
   }
   catch(e)
   {
    req = false;
   }
  }
 }
 if(req)
 {
  req.onreadystatechange = handleReqChange;
  req.open("GET", url, true);
  req.send(null);
 }
 else
 {
  alert('Die Funktion (AJAX::LoadXmlDoc) liefert einen Fehler!');
 }
}

/* AJAX :: handleReqChange */

function handleReqChange()
{
 if (req.readyState == 4)
 {
  if (req.status == 200)
  {
   var response=req.responseText
   request('', response);
  }
  else
  {
   alert('Die Funktion (AJAX::handleReqChance) lieferte einen Fehler!');
  }
 }
}

/* AJAX ::: request */
function request(input, response)
{
 if (response != '')
 {
  clearNode('content');
  addhtml('content',response);
 }
 else
 {
  clearNode('content');
  var ausgabe='<p><img border="0" src="http://www.gruen-as.de/gif/loader.gif" width="32" height="32" alt="Laden"><br>Ressource wird geladen...<\/p>'
  addhtml('content',ausgabe);
  url = 'http://www.gruen-as.de/intern/request.php' + input; 
  LoadXmlDoc(url);
 }
}

function vcard(name)
{
 request('?mode=vcard&suche=' + name,'');
}

function selektierterText()
{
 url=location.href;
  if (window.getSelection)
  {
   text=window.getSelection();
  }
  else if (document.getSelection)
  {
   text=document.getSelection();
  }
  else if (document.selection)
  {
   text=document.selection.createRange().text;
  }
  request('?mode=wort&suche=' + text,'');
}

/* AJAX ::: amazon astore */
function amazon(input)
{
 clearNode('output');
 var link = 'http://astore.amazon.de/grunaunetwork/?node='+input;
 var iframe = '<iframe frameborder="0" border="0" width="790" height="1000" src="' + link + '">';
 iframe=iframe+'<p>Ihr Browser kann keine eingebetteten Frames darstellen. Sie können unseren Shop-Bereich ';
 iframe=iframe+'jedoch <a href="'+link+'" target="_top">hier<\/a> direkt besuchen.<\/p><\/iframe>';
 addhtml('output',iframe);
}

/* AJAX ::: menueumschaltung */
function news(pfad)
{
 clearNode('menu');
 var ausgabe='<h3>News<\/h3>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'index.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/start.gif" align="middle">&nbsp;Startseite<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="#" onclick="javascript:request(\'?mode=rss&amp;suche=gruenas\',\'\');\r return false;"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/news.gif" align="middle">&nbsp;RSS Nachrichten<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="javascript:location.reload()"><img border="0" width="21" height="21" align="middle" src="'+pfad+'gif/icons/close.gif">&nbsp;Men&uuml; schließen<\/a><\/div>';
 addhtml('menu',ausgabe);
}

function jahre(pfad)
{
 clearNode('menu');
 var ausgabe='<h3>Jahrgänge<\/h3>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'1995/index.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/sm.gif" align="middle">&nbsp;Archiv 1995<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'1996/index.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/sm.gif" align="middle">&nbsp;Archiv 1996<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'1997/index.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/sm.gif" align="middle">&nbsp;Archiv 1997<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'1998/index.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/sm.gif" align="middle">&nbsp;Archiv 1998<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'1999/index.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/sm.gif" align="middle">&nbsp;Archiv 1999<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'2000/index.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/sm.gif" align="middle">&nbsp;Archiv 2000<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'2001/index.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/sm.gif" align="middle">&nbsp;Archiv 2001<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'2002/index.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/sm.gif" align="middle">&nbsp;Archiv 2002<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'2003/index.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/sm.gif" align="middle">&nbsp;Archiv 2003<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'2004/index.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/sm.gif" align="middle">&nbsp;Archiv 2004<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'2005/index.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/sm.gif" align="middle">&nbsp;Archiv 2005<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'2006/index.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/sm.gif" align="middle">&nbsp;Archiv 2006<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'2007/index.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/sm.gif" align="middle">&nbsp;Archiv 2007<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'2008/index.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/sm.gif" align="middle">&nbsp;Archiv 2008<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'2009/index.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/sm.gif" align="middle">&nbsp;Archiv 2009<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'2010/index.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/sm.gif" align="middle">&nbsp;Archiv 2010<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="javascript:location.reload()"><img border="0" width="21" height="21" align="middle" src="'+pfad+'gif/icons/close.gif">&nbsp;Men&uuml; schließen<\/a><\/div>';
 addhtml('menu',ausgabe);
}

function archiv(pfad)
{
 clearNode('menu');
 var ausgabe='<h3>Themen<\/h3>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'archiv/stadtumbau.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/stadtumbau.gif" align="middle">&nbsp;Stadtumbau<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'archiv/interviews.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/interviews.gif" align="middle">&nbsp;Interviews &amp; Porträts<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'archiv/jugend.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/jugend.gif" align="middle">&nbsp;Kinder &amp; Jugend<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'archiv/fahrrad.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/fahrrad.gif" align="middle">&nbsp;Fahrrad<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'archiv/weitere.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/serien.gif" align="middle">&nbsp;Aktuelle Serien<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'archiv/statistik.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/statistik.gif" align="middle">&nbsp;Statistik<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'archiv/wahlen.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/statistik.gif" align="middle">&nbsp;Wahlen<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'archiv/kasek.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/kasek.gif" align="middle">&nbsp;Artikel von Dr. Kasek<\/a><\/div>';
 ausgabe=ausgabe+'<br>'
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="'+pfad+'archiv/index.html"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/archiv.gif" align="middle">&nbsp;Übersicht<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="#" onclick="javascript:jahre(\''+pfad+'\');\r return false;"><img border="0" width="16" height="16" src="'+pfad+'gif/icons/archiv.gif" align="middle">&nbsp;Jahrgänge<\/a><\/div>';
 ausgabe=ausgabe+'<div class="menuleft"><a style="text-decoration:none;" href="javascript:location.reload()"><img border="0" width="21" height="21" align="middle" src="'+pfad+'gif/icons/close.gif">&nbsp;Menü schließen<\/a><\/div>';
 addhtml('menu',ausgabe);
}

function taganzeige(Satz)
{
var klass;
var uriwort;
var Satz = Satz.toLowerCase();
var Woerter = Satz.split(',');
Woerter.sort();
document.writeln('<div class="taglist" style="width:190px;"><div class="taglisttitle">Artikel zum Stichwort:<\/div>');
document.writeln('<div class="taglistcontent">');
for (var i = 0; i < Woerter.length; i++)
{
 zufall=Math.ceil(Math.random()*3);
 if(zufall==1)
  klass='ta1';
 if(zufall==2)
  klass='ta2';
 if(zufall>=3)
  klass='ta3';
 uriwort= encodeURI(Woerter[i]);
 document.writeln('<a rel="tag" class="' + klass + '" href="#" onclick="javascript:request(\'?mode=tag&amp;suche=' + uriwort + '\',\'\');');
 document.writeln('return false;">' + Woerter[i] + '<\/a><br>');
}
document.writeln('<\/div><\/div>');
}

