/* Funktionsbibliothek (c) 2007-2011 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 ::: menueumschaltung */
function jahre(pfad)
{
 clearNode('menu');
 var ausgabe='<h3>Jahrgänge<\/h3>';
 ausgabe=ausgabe+'<a class="jahr" href="'+pfad+'1995/index.html">1995<\/a>';
 ausgabe=ausgabe+'<a class="jahr" href="'+pfad+'1996/index.html">1996<\/a>';
 ausgabe=ausgabe+'<a class="jahr" href="'+pfad+'1997/index.html">1997<\/a>';
 ausgabe=ausgabe+'<a class="jahr" href="'+pfad+'1998/index.html">1998<\/a>';
 ausgabe=ausgabe+'<a class="jahr" href="'+pfad+'1999/index.html">1999<\/a>';
 ausgabe=ausgabe+'<a class="jahr" href="'+pfad+'2000/index.html">2000<\/a>';
 ausgabe=ausgabe+'<a class="jahr" href="'+pfad+'2001/index.html">2001<\/a>';
 ausgabe=ausgabe+'<a class="jahr" href="'+pfad+'2002/index.html">2002<\/a>';
 ausgabe=ausgabe+'<a class="jahr" href="'+pfad+'2003/index.html">2003<\/a>';
 ausgabe=ausgabe+'<a class="jahr" href="'+pfad+'2004/index.html">2004<\/a>';
 ausgabe=ausgabe+'<a class="jahr" href="'+pfad+'2005/index.html">2005<\/a>';
 ausgabe=ausgabe+'<a class="jahr" href="'+pfad+'2006/index.html">2006<\/a>';
 ausgabe=ausgabe+'<a class="jahr" href="'+pfad+'2007/index.html">2007<\/a>';
 ausgabe=ausgabe+'<a class="jahr" href="'+pfad+'2008/index.html">2008<\/a>';
 ausgabe=ausgabe+'<a class="jahr" href="'+pfad+'2009/index.html">2009<\/a>';
 ausgabe=ausgabe+'<a class="jahr" href="'+pfad+'2010/index.html">2010<\/a>';
 ausgabe=ausgabe+'<a class="jahr" href="'+pfad+'2011/index.html">2011<\/a>';
 ausgabe=ausgabe+'<a class="jahr" href="'+pfad+'2012/index.html">2012<\/a>';
 ausgabe=ausgabe+'<br clear=all><br><a class="link" href="javascript:location.reload()">zurück<\/a>';
 addhtml('menu',ausgabe);
}

function archiv(pfad)
{
 clearNode('menu');
 var ausgabe='<h3>Archiv<\/h3>';
 ausgabe=ausgabe+'<a class="link" href="'+pfad+'archiv/stadtumbau.html">Stadtumbau<\/a>';
 ausgabe=ausgabe+'<a class="link" href="'+pfad+'archiv/interviews.html">Interviews &amp; Porträts<\/a>';
 ausgabe=ausgabe+'<a class="link" href="'+pfad+'archiv/jugend.html">Kinder &amp; Jugend<\/a>';
 ausgabe=ausgabe+'<a class="link" href="'+pfad+'archiv/fahrrad.html">Fahrrad<\/a>';
 ausgabe=ausgabe+'<a class="link" href="'+pfad+'archiv/statistik.html">Statistik<\/a>';
 ausgabe=ausgabe+'<a class="link" href="'+pfad+'archiv/wahlen.html">Wahlen<\/a>';
 ausgabe=ausgabe+'<a class="link" href="'+pfad+'archiv/kasek.html">Artikel von Dr. Kasek<\/a>';
 ausgabe=ausgabe+'<br clear=all><br><a class="link" href="'+pfad+'archiv/index.html">Archiv-Übersicht<\/a>';
 ausgabe=ausgabe+'<a class="link" href="#" onclick="javascript:jahre(\''+pfad+'\');\r return false;">Jahrgänge<\/a>';
 ausgabe=ausgabe+'<br clear=all><br><a class="link" href="javascript:location.reload()">zurück<\/a>';
 addhtml('menu',ausgabe);
}

function social()
{
 clearNode('bookmark');
 var bmurl=encodeURIComponent(document.URL);
 var bmtit=encodeURIComponent(document.title);
 var ausgabe='<b>Social Networking</b><br><a href="http://twitter.com/share?url='+bmurl+'&amp;text='+bmtit+'&amp;via=gruenas&amp;lang=de&amp;related=luroleipzig" ';
 ausgabe=ausgabe+'title="URL zu Twitter hinzufügen"><img src="../../gif/icons/twitter.gif" alt="Twitter" border="0"><\/a> '; 
 ausgabe=ausgabe+'<a href="http://www.google.com/bookmarks/mark?op=add&amp;hl=de&amp;bkmk='+bmurl+'&amp;annotation=&amp;labels=&amp;title='+bmtit+'" ';
 ausgabe=ausgabe+'title="Bei Google bookmarken"><img src="../../gif/icons/google.gif" alt="Google" border="0"><\/a> ';
 ausgabe=ausgabe+'<a href="http://www.studivz.net/Suggest/Selection/?u='+bmurl+'&desc='+bmtit+'&prov=gruen-as.de" ';
 ausgabe=ausgabe+'title="Bei SchuelerVZ/StudiVZ/MeinVZ verteilen"><img src="../../gif/icons/studivz.gif" alt="StudiVZ" border="0"><\/a> ';
 ausgabe=ausgabe+'<a href="http://www.webnews.de/einstellen?url='+bmurl+'&amp;title='+bmtit+'" ';
 ausgabe=ausgabe+'title="Beitrag bei Webnews verlinken"><img src="../../gif/icons/webnews.gif" alt="Webnews" border="0"><\/a> ';
 ausgabe=ausgabe+'<a href="http://www.mister-wong.de/index.php?action=addurl&amp;bm_url='+bmurl+'&amp;bm_description='+bmtit+'" ';
 ausgabe=ausgabe+'title="Seite zu Mister Wong hinzufügen"><img src="../../gif/icons/wong.gif" alt="Mister Wong" border="0"><\/a> ';
 ausgabe=ausgabe+'<a href="http://www.oneview.de/add/?URL='+bmurl+'&title='+bmtit+'" ';
 ausgabe=ausgabe+'title="oneview - das merk ich mir!"><img src="../../gif/icons/oneview.gif" alt="oneview" border="0"><\/a> ';
 ausgabe=ausgabe+'<a href="http://www.folkd.com/submit/'+bmurl+'" ';
 ausgabe=ausgabe+'title="Seite zu folkd hinzufügen"><img src="../../gif/icons/folkd.gif" alt="folkd" border="0"><\/a> ';
 ausgabe=ausgabe+'<a href="http://linkarena.com/bookmarks/addlink/?url='+bmurl+'" ';
 ausgabe=ausgabe+'title="Bei Linkarena sichern"><img src="../../gif/icons/linkarena.gif" alt="Linkarena" border="0"><\/a> ';
 ausgabe=ausgabe+'<a href="http://netselektor.de/speichern/neu?title='+bmtit+'&url='+bmurl+'" ';
 ausgabe=ausgabe+'title="Seite im netselektor speichern"><img src="../../gif/icons/netselektor.gif" alt="netselektor" border="0"><\/a><hr> ';
 ausgabe=ausgabe+'<iframe src="http://www.facebook.com/plugins/like.php?href='+bmurl+'" scrolling="no" frameborder="0" ';
 ausgabe=ausgabe+'style="border:none; width:180px;"><\/iframe><br>';
 ausgabe=ausgabe+'<a href="http://www.gruen-as.de/intern/impressum.html#datenschutz">Datenschutzhinweise<\/a><\/div>';
 addhtml('bookmark',ausgabe);
}

function taganzeige(Satz)
{
var klass;
var uriwort;
Satz = Satz.toLowerCase();
var Woerter = Satz.split(',');
Woerter.sort();
var ausgabe='<div class="taglisttitle">Artikel zum Stichwort<\/div><div class="taglistcontent">';
for (var i = 0; i < Woerter.length; i++)
{
 uriwort= encodeURI(Woerter[i]);
 ausgabe=ausgabe+'<a rel="tag" style="text-decoration:none;" href="#" onclick="javascript:request(\'?mode=tag&amp;suche=' + uriwort + '\',\'\');';
 ausgabe=ausgabe+'return false;">' + Woerter[i] + '<\/a><br>';
}
ausgabe=ausgabe+'<\/div>';
clearNode('taganzeige');
addhtml('taganzeige',ausgabe);
}


