var d = document, ie = d.all && !window.opera;
var wochentag = new Array('Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag');
//Shortnewsticker
var tickerwidth = screen.width*0.9;
var tickercolor = '#DDDDDD';
var fontcolor = '#0000FF';
var splitcolor = '#000000';
var fontsize = 11;
var visitedlink = '#800080';
var rollovercolor = '#0000FF';
var font = 'Arial';
var speed = 1;
var sparte = 4;
var rubrik = 13;
var rollover_underline = 1;
var font_underline = 0;
var transparent = 1;
var fontbold = 0;
var tickertyp = 1;
var u_id = 320908;
//Realtime Counter
var design=12;
var idi=13704;
idl=86;
dfg=47;

window.onload =
/**
 * Fixes all quote elements for IE7 or earlier versions by adding proper quotation marks.
 * Note: Leetness level is quite high.
 *
 * @author Chrissyx
 * @copyright (c) 2001 - 2009 by Chrissyx
 * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ Creative Commons 3.0 by-nc-sa
 * @link http://www.chrissyx.de(.vu)/
 * @since 4.0
 * @version 4.0.1
 */
function()
{
 //Check for IE and its version with some nifty regex
 if(ie && (navigator.userAgent.match(/MSIE (\d+)\.\d+/)[1] < 8))
 {
  for(var i=0, quotes, curQuote; i<(quotes = document.getElementsByTagName('q')).length; i++)
   (curQuote = quotes[i].firstChild).nodeValue = '\u201E' + curQuote.nodeValue + '\u201C';
  for(var i=0, first, last, quotes, curQuote, firstElem, lastElem; i<(quotes = document.getElementsByTagName('blockquote')).length; i++)
// Quotes for the first and last p in blockquote _only_ //
  {
   //Reset counters
   first = 0;
   last = (curQuote = quotes[i].childNodes).length-1;
   //Detect first and last <p> element node
   while(curQuote[first].nodeType != 1) first++;
   while(curQuote[last].nodeType != 1) last--;
   //Attach new empty text nodes, if the p of the blockquote does NOT start OR end with some text!
   if((firstElem = curQuote[first]).firstChild.nodeValue == null) firstElem.insertBefore(document.createTextNode(''), firstElem.firstChild);
   if((lastElem = curQuote[last]).lastChild.nodeValue == null) lastElem.appendChild(document.createTextNode(''));
   //Now we can safely add the quotes
   firstElem.firstChild.nodeValue = '\u201E' + firstElem.firstChild.nodeValue;
   lastElem.lastChild.nodeValue += '\u201C';
  }
// Quotes for _every_ p in blockquote //
/*
   //Iterate through each element in <blockquote>
   for(var j=0; j<quotes[i].childNodes.length; j++)
    //Only process <p> element nodes
    if((curQuote = quotes[i].childNodes[j]).nodeType == 1)
    {
     //Attach new empty text nodes, if the p of the blockquote does NOT start OR end with some text!
     if(curQuote.firstChild.nodeValue == null) curQuote.insertBefore(document.createTextNode(''), curQuote.firstChild);
     if(curQuote.lastChild.nodeValue == null) curQuote.appendChild(document.createTextNode(''));
     //Now we can safely add the quotes
     curQuote.firstChild.nodeValue = '\u201E' + curQuote.firstChild.nodeValue;
     curQuote.lastChild.nodeValue += '\u201C';
    }
*/
 }
 //Now generate reference list
 addRefs();
}

/**
 * Generates automatically a new h2 section with a linked ol listing of used references in blockquotes.
 * Note: Leetness level is quite high.
 *
 * @author Chrissyx
 * @copyright (c) 2001 - 2009 by Chrissyx
 * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ Creative Commons 3.0 by-nc-sa
 * @link http://www.chrissyx.de(.vu)/
 * @since 4.0
 * @version 4.0
 */
function addRefs()
{
 var allRefs = new Array(), toAppend;
 //Get all quotes with references
 for(var i=0, j=1, quotes, curQuote, curSUP, curA; i<(quotes = document.getElementsByTagName('blockquote')).length; i++)
  if((curQuote = quotes[i]).cite != '')
  {
   allRefs.push(curQuote.cite);
   //Attach a footnote to the text before the blockquote
   curA = document.createElement('a');
   curA.id = 'quote' + j;
   curA.href = document.location.pathname + '#ref' + j;
   curA.appendChild(document.createTextNode('[' + j++ + ']'));
   curSUP = document.createElement('sup');
   curSUP.className = 'ref';
   curSUP.appendChild(curA);
   curQuote.parentNode.insertBefore(curSUP, curQuote);
  }
 //Proceed if we found at least one
 if(allRefs.length == 0 || (toAppend = document.getElementsByTagName('h2')).length == 0) return;
 else
 {
  //Create new h2 section
  var refH2 = document.createElement('h2');
  refH2.appendChild(document.createTextNode('Quellen'));
  (toAppend = toAppend[toAppend.length-1].parentNode).appendChild(refH2);
  //Create ol list and append each li with a linked reference
  var refOL = document.createElement('ol');
  for(var i=0, curA, curLI; i<allRefs.length; i++)
  {
   curLI = document.createElement('li');
   curLI.id = 'ref' + (i+1);
   //Generate back-reference
   curA = document.createElement('a');
   curA.href = document.location.pathname + '#quote' + (i+1);
   curA.appendChild(document.createTextNode('\u2191'));
   curLI.appendChild(curA);
   //Add space between links
   curLI.appendChild(document.createTextNode(' '));
   //Generate external link
   curA = document.createElement('a');
   curA.href = allRefs[i];
   curA.target = '_blank';
   curA.appendChild(document.createTextNode(allRefs[i]));
   curLI.appendChild(curA);
   //Finally add to list
   refOL.appendChild(curLI);
  }
  toAppend.appendChild(refOL);
 }
}

/**
 * @author <a href="http://www.devshare.de/profile.php?id=780">matho</a>
 * @copyright (c) 2004 by matho
 * @link http://www.devshare.de/viewtopic.php?pid=42335#p42335
 * @since 2.5
 * @version 1.0
 */
/*onload = function()
         {
          for(var i = 0, a; i < (a = d.getElementsByTagName('a')).length; i++)
          {
           if(a[i].onclick)
           {
            a[i].o = a[i].onclick.toString().match(/\{((?:[\r\n]|.)+)$/)[1].replace(/\}\s*$/,'');
            a[i].onclick = function(o)
                           {
                            ie ? event.cancelBubble = true : (o.stopPropagation(), o.preventDefault());
                            eval(this.o);
                           };
           };
          };
         };
*/

/**
 * Switches the display status of an element.
 * 
 * @author <a href="http://www.devshare.de/profile.php?id=780">matho</a>
 * @copyright (c) 2004 by matho
 * @link http://www.devshare.de/viewtopic.php?pid=42335#p42335
 * @since 2.5
 * @version 1.0
 */
function expand(t)
{
 (t = d.getElementById(t).style).display = t.display == 'none' ? '' : 'none';
}

/**
 * Switches between + and - images.
 * 
 * @author <a href="http://www.devshare.de/profile.php?id=780">matho</a>
 * @copyright (c) 2004 by matho
 * @link http://www.devshare.de/viewtopic.php?pid=42335#p42335
 * @since 2.5
 * @version 1.0
 */
function change(s)
{
 s.src = s.src.match(/plus/) ? 'images/minus.gif' : 'images/plus.gif';
}

/**
 * Quakes the browser window. e.g.: quake(6, 2);
 * 
 * @author Chrissyx
 * @copyright (c) 2001 - 2009 by Chrissyx
 * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ Creative Commons 3.0 by-nc-sa
 * @link http://www.chrissyx.de(.vu)/
 * @since 3.0
 * @version 4.0
 */
function quake(anz, speed)
{
 for(i=anz; i>0; i-=speed)
  for(j=anz; j>0; j-=speed)
  {
   window.moveBy(0, i);
   window.moveBy(i, 0);
   window.moveBy(0, -i);
   window.moveBy(-i, 0);
  }
}

/**
 * Sets the current time with a welcome message in the statusbar of the browser.
 * 
 * @author Chrissyx
 * @copyright (c) 2001 - 2009 by Chrissyx
 * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ Creative Commons 3.0 by-nc-sa
 * @link http://www.chrissyx.de(.vu)/
 * @since 2.X
 * @version 4.0.0.1
 */
function chsClock()
{
 var zeit = new Date();
 window.status = 'Willkommen auf meiner Seite! Heute ist ' + wochentag[zeit.getDay()] + ', der ' + (zeit.getDate() < 10 ? '0' : '') + zeit.getDate() + (zeit.getMonth() < 9 ? '.0' : '.') + (zeit.getMonth()+1) + '.' + zeit.getFullYear() + ' und es ist genau ' + (zeit.getHours() < 10 ? '0' : '') + zeit.getHours() + (zeit.getMinutes() < 10 ? ':0' : ':') + zeit.getMinutes() + (zeit.getSeconds() < 10 ? ':0' : ':') + zeit.getSeconds() + ' Uhr!';
//+ (zeit.getMilliseconds() < 100 ? ':0' : ':') + zeit.getMilliseconds();
 window.setTimeout('chsClock()', 1000);
}

/**
 * Displays time left until the next weekend in a prepared div box.
 * 
 * @author Chrissyx
 * @copyright (c) 2001 - 2009 by Chrissyx
 * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ Creative Commons 3.0 by-nc-sa
 * @link http://www.chrissyx.de(.vu)/
 * @since 3.0
 * @version 4.0
 */
function weCounter()
{
 var zeit = new Date();
 document.getElementById('wecounter').firstChild.nodeValue = zeit.getDay() == 6 || zeit.getDay() == 0 ? 'Es ist WE!' : 'Noch ' + (5 - zeit.getDay()) + ' Tag(e), ' + (23 - zeit.getHours()) + ' Stunde(n) und ' + (59 - zeit.getMinutes()) + ' Minute(n) bis zum nächsten WE!';
// + (60 - zeit.getSeconds()) + ' Sekunde(n) bis zum WE!';
 window.setTimeout('weCounter()', 50000); //Alle 50 Sekunden
}

/**
 * Activates the submit button, depending on the stated name.
 * 
 * @author Chrissyx
 * @copyright (c) 2001 - 2009 by Chrissyx
 * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ Creative Commons 3.0 by-nc-sa
 * @link http://www.chrissyx.de(.vu)/
 * @since 0.9
 * @version 1.0
 */
function canShout()
{
 (sbform = document.getElementById('shoutboxform')).shout.disabled = sbform.name.value.length != 0 ? false : true;
}

/**
 * Adds a smilie-string to the textbox.
 * 
 * @author Chrissyx
 * @copyright (c) 2001 - 2009 by Chrissyx
 * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ Creative Commons 3.0 by-nc-sa
 * @link http://www.chrissyx.de(.vu)/
 * @since 0.9
 * @version 1.0
 */
function setShoutSmilie(smilie)
{
 (sbbox = document.getElementById('shoutboxform').shoutbox).value += smilie;
 sbbox.focus();
}