/*
 * jQuery 1.2.1 - New Wave Javascript
 *
 * Copyright (c) 2007 John Resig (jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * $Date: 2007-09-16 23:42:06 -0400 (Sun, 16 Sep 2007) $
 * $Rev: 3353 $
 */

/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example jQuery.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example jQuery.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example jQuery.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example jQuery.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name jQuery.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example jQuery.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name jQuery.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
  if (typeof value != 'undefined')
  {
    // name and value given, set cookie
    options = options || {};
    if (value === null)
    {
      value = '';
      options.expires = -1;
    }
    var expires = '';
    if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString))
    {
      var date;
      if (typeof options.expires == 'number')
      {
        date = new Date();
        date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
      }
      else
      {
        date = options.expires;
      }
      expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
    }
    // CAUTION: Needed to parenthesize options.path and options.domain
    // in the following expressions, otherwise they evaluate to undefined
    // in the packed version for some reason...
    var path = options.path ? '; path=' + (options.path) : '';
    var domain = options.domain ? '; domain=' + (options.domain) : '';
    var secure = options.secure ? '; secure' : '';
    document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
  }
  else
  {
    // only name given, get cookie
    var cookieValue = null;
    if (document.cookie && document.cookie != '')
    {
      var cookies = document.cookie.split(';');
      for (var i = 0; i < cookies.length; i++)
      {
        var cookie = jQuery.trim(cookies[i]);
        // Does this cookie string begin with the name we want?
        if (cookie.substring(0, name.length + 1) == (name + '='))
        {
          cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
          break;
        }
      }
    }
  return cookieValue;
  }
};


/**
 * Name:          document.ready-Funktion
 * Beschreibung:  Wird sofort beim oeffnen einer Seite geladen und ausgefuehrt.
 */
jQuery(document).ready(function() {

  jQuery("noscript").css({ display: "none" });
  jQuery("noscript a").css({ display: "none" });
  jQuery("noscript img").css({ display: "none" });

  // Auftritte
  jQuery("#auftritt1").hover(function() {
    jQuery("#auftritt1 .auftritt_logo").css({ "background-position": "0 -44px" });
    jQuery("#auftritt1 .auftritt_text1").css({ display: "block" });
  }, function() {
    jQuery("#auftritt1 .auftritt_logo").css({ "background-position": "0 0" });
    jQuery("#auftritt1 .auftritt_text1").css({ display: "none" });
  });

  jQuery("#auftritt2").hover(function() {
    jQuery("#auftritt2 .auftritt_logo").css({ "background-position": "0 -44px" });
    jQuery("#auftritt2 .auftritt_text1").css({ display: "block" });
  }, function() {
    jQuery("#auftritt2 .auftritt_logo").css({ "background-position": "0 0" });
    jQuery("#auftritt2 .auftritt_text1").css({ display: "none" });
  });

  jQuery("#auftritt3").hover(function() {
    jQuery("#auftritt3 .auftritt_logo").css({ "background-position": "0 -44px" });
    jQuery("#auftritt3 .auftritt_text1").css({ display: "block" });
    jQuery("#auftritt3 .auftritt_text2").css({ display: "block" });
  }, function() {
    jQuery("#auftritt3 .auftritt_logo").css({ "background-position": "0 0" });
    jQuery("#auftritt3 .auftritt_text1").css({ display: "none" });
    jQuery("#auftritt3 .auftritt_text2").css({ display: "none" });
  });

  jQuery("#auftritt4").hover(function() {
    jQuery("#auftritt4 .auftritt_logo").css({ "background-position": "0 -44px" });
    jQuery("#auftritt4 .auftritt_text1").css({ display: "block" });
    jQuery("#auftritt4 .auftritt_text2").css({ display: "block" });
  }, function() {
    jQuery("#auftritt4 .auftritt_logo").css({ "background-position": "0 0" });
    jQuery("#auftritt4 .auftritt_text1").css({ display: "none" });
    jQuery("#auftritt4 .auftritt_text2").css({ display: "none" });
  });

  jQuery("#auftritt5").hover(function() {
    jQuery("#auftritt5 .auftritt_logo").css({ "background-position": "0 -44px" });
    jQuery("#auftritt5 .auftritt_text1").css({ display: "block" });
  }, function() {
    jQuery("#auftritt5 .auftritt_logo").css({ "background-position": "0 0" });
    jQuery("#auftritt5 .auftritt_text1").css({ display: "none" });
  });

  jQuery("#auftritt6").hover(function() {
    jQuery("#auftritt6 .auftritt_logo").css({ "background-position": "0 -44px" });
    jQuery("#auftritt6 .auftritt_text1").css({ display: "block" });
  }, function() {
    jQuery("#auftritt6 .auftritt_logo").css({ "background-position": "0 0" });
    jQuery("#auftritt6 .auftritt_text1").css({ display: "none" });
  });

  jQuery("#auftritt7").hover(function() {
    jQuery("#auftritt7 .auftritt_logo").css({ "background-position": "0 -44px" });
    jQuery("#auftritt7 .auftritt_text1").css({ display: "block" });
    jQuery("#auftritt7 .auftritt_text2").css({ display: "block" });
  }, function() {
    jQuery("#auftritt7 .auftritt_logo").css({ "background-position": "0 0" });
    jQuery("#auftritt7 .auftritt_text1").css({ display: "none" });
    jQuery("#auftritt7 .auftritt_text2").css({ display: "none" });
  });

  jQuery("#auftritt8").hover(function() {
    jQuery("#auftritt8 .auftritt_logo").css({ "background-position": "0 -44px" });
    jQuery("#auftritt8 .auftritt_text1").css({ display: "block" });
  }, function() {
    jQuery("#auftritt8 .auftritt_logo").css({ "background-position": "0 0" });
    jQuery("#auftritt8 .auftritt_text1").css({ display: "none" });
  });





  // Sterne beim bewerten hervorheben
  jQuery("#stern1").hover(function() {
    jQuery("#sterne").addClass("sterne10");
  },
  function() {
    jQuery("#sterne").removeAttr("class").addClass(jQuery("#stern1").attr("rel"));
  });


  jQuery("#stern2").hover(function() {
    jQuery("#sterne").addClass("sterne20");
  },
  function() {
    jQuery("#sterne").removeAttr("class").addClass(jQuery("#stern2").attr("rel"));
  });


  jQuery("#stern3").hover(function() {
    jQuery("#sterne").addClass("sterne30");
  },
  function() {
    jQuery("#sterne").removeAttr("class").addClass(jQuery("#stern3").attr("rel"));
  });


  jQuery("#stern4").hover(function() {
    jQuery("#sterne").addClass("sterne40");
  },
  function() {
    jQuery("#sterne").removeAttr("class").addClass(jQuery("#stern4").attr("rel"));
  });


  jQuery("#stern5").hover(function() {
    jQuery("#sterne").addClass("sterne50");
  },
  function() {
    jQuery("#sterne").removeAttr("class").addClass(jQuery("#stern5").attr("rel"));
  });





  // Klappmenue der Hauptnavigation
  jQuery("#mnavi1").hover(function() {
    jQuery("#mnavi1 ul").css({ display: "block" });
    if( jQuery("#mnavi1 a").attr("class") == "act" ) {
      jQuery("#mnavi1 a").css({ "background-position": "0 -102px" });
    } else {
      jQuery("#mnavi1 a").css({ "background-position": "0 -34px" });
    }
  }, function() {
    jQuery("#mnavi1 ul").css({ display: "none" });
    if( jQuery("#mnavi1 a").attr("class") == "act" ) {
      jQuery("#mnavi1 a").css({ "background-position": "0 -68px" });
    } else {
      jQuery("#mnavi1 a").css({ "background-position": "0 0" });
    }
  });

  jQuery("#mnavi2").hover(function() {
    jQuery("#mnavi2 ul").css({ display: "block" });
    if( jQuery("#mnavi2 a").attr("class") == "act" ) {
      jQuery("#mnavi2 a").css({ "background-position": "0 -68px" });
    } else {
      jQuery("#mnavi2 a").css({ "background-position": "0 -34px" });
    }
  }, function() {
    jQuery("#mnavi2 ul").css({ display: "none" });
    if( jQuery("#mnavi2 a").attr("class") == "act" ) {
      jQuery("#mnavi2 a").css({ "background-position": "0 -68px" });
    } else {
      jQuery("#mnavi2 a").css({ "background-position": "0 0" });
    }
  });

  jQuery("#mnavi3").hover(function() {
    jQuery("#mnavi3 ul").css({ display: "block" });
    if( jQuery("#mnavi3 a").attr("class") == "act" ) {
      jQuery("#mnavi3 a").css({ "background-position": "0 -68px" });
    } else {
      jQuery("#mnavi3 a").css({ "background-position": "0 -34px" });
    }
  }, function() {
    jQuery("#mnavi3 ul").css({ display: "none" });
    if( jQuery("#mnavi3 a").attr("class") == "act" ) {
      jQuery("#mnavi3 a").css({ "background-position": "0 -68px" });
    } else {
      jQuery("#mnavi3 a").css({ "background-position": "0 0" });
    }
  });

  jQuery("#mnavi4").hover(function() {
    jQuery("#mnavi4 ul").css({ display: "block" });
    if( jQuery("#mnavi4 a").attr("class") == "act" ) {
      jQuery("#mnavi4 a").css({ "background-position": "0 -68px" });
    } else {
      jQuery("#mnavi4 a").css({ "background-position": "0 -34px" });
    }
  }, function() {
    jQuery("#mnavi4 ul").css({ display: "none" });
    if( jQuery("#mnavi4 a").attr("class") == "act" ) {
      jQuery("#mnavi4 a").css({ "background-position": "0 -68px" });
    } else {
      jQuery("#mnavi4 a").css({ "background-position": "0 0" });
    }
  });

  jQuery("#mnavi5").hover(function() {
    jQuery("#mnavi5 ul").css({ display: "block" });
    if( jQuery("#mnavi5 a").attr("class") == "act" ) {
      jQuery("#mnavi5 a").css({ "background-position": "0 -68px" });
    } else {
      jQuery("#mnavi5 a").css({ "background-position": "0 -34px" });
    }
  }, function() {
    jQuery("#mnavi5 ul").css({ display: "none" });
    if( jQuery("#mnavi5 a").attr("class") == "act" ) {
      jQuery("#mnavi5 a").css({ "background-position": "0 -68px" });
    } else {
      jQuery("#mnavi5 a").css({ "background-position": "0 0" });
    }
  });

  jQuery("#mnavi6").hover(function() {
    jQuery("#mnavi6 ul").css({ display: "block" });
    if( jQuery("#mnavi6 a").attr("class") == "act" ) {
      jQuery("#mnavi6 a").css({ "background-position": "0 -68px" });
    } else {
      jQuery("#mnavi6 a").css({ "background-position": "0 -34px" });
    }
  }, function() {
    jQuery("#mnavi6 ul").css({ display: "none" });
    if( jQuery("#mnavi6 a").attr("class") == "act" ) {
      jQuery("#mnavi6 a").css({ "background-position": "0 -68px" });
    } else {
      jQuery("#mnavi6 a").css({ "background-position": "0 0" });
    }
  });

  jQuery("#mnavi7").hover(function() {
    jQuery("#mnavi7 ul").css({ display: "block" });
    if( jQuery("#mnavi7 a").attr("class") == "act" ) {
      jQuery("#mnavi7 a").css({ "background-position": "0 -102px" });
    } else {
      jQuery("#mnavi7 a").css({ "background-position": "0 -34px" });
    }
  }, function() {
    jQuery("#mnavi7 ul").css({ display: "none" });
    if( jQuery("#mnavi7 a").attr("class") == "act" ) {
      jQuery("#mnavi7 a").css({ "background-position": "0 -68px" });
    } else {
      jQuery("#mnavi7 a").css({ "background-position": "0 0" });
    }
  });





  // Community-Teaser
  // Forenbeitraege ausblenden
  //jQuery("#teaser_forum").hide();
  jQuery("#show_teaser_blog").click(function() {
    jQuery("#teaser_forum").hide();
    jQuery("#teaser_blog").show();
    jQuery("#show_teaser_blog").attr("class", "aktiv1");
    jQuery("#show_teaser_forum").attr("class", "passiv1");
    return false;
  });

  jQuery("#show_teaser_forum").click(function() {
    jQuery("#teaser_blog").hide();
    jQuery("#teaser_forum").show();
    jQuery("#show_teaser_forum").attr("class", "aktiv1");
    jQuery("#show_teaser_blog").attr("class", "passiv1");
    return false;
  });





  /*
   * ALT VON MAX WALTER
   *
  // Highlight-Bereich auf Channel-HOME
  // Touren-Tab ausblenden
  jQuery("#teaser_tour").hide();

  jQuery("#show_teaser_highlight").click(function()
  {
    jQuery("#teaser_tour").hide();
    jQuery("#teaser_highlight").show();
    jQuery("#show_teaser_highlight").attr("class", "aktiv1");
    jQuery("#show_teaser_tour").attr("class", "passiv1");
    return false;
  });

  jQuery("#show_teaser_tour").click(function()
  {
    jQuery("#teaser_highlight").hide();
    jQuery("#teaser_tour").show();
    jQuery("#show_teaser_tour").attr("class", "aktiv1");
    jQuery("#show_teaser_highlight").attr("class", "passiv1");
    return false;
  });
  */

  return;
});





/**
 * Name:          show_comment
 * Beschreibung:  Oeffnet einen Kommentar.
 */
function show_comment(kommentar_id)
{
  //jQuery(".kommentar_"+ kommentar_id +" .alles").slideDown("slow");
  jQuery(".kommentar_"+ kommentar_id +" .alles").show().css({ display: "inline" });
  jQuery(".kommentar_"+ kommentar_id +" .rechts a").attr({ href: "javascript:hide_comment("+ kommentar_id +");"}).empty().prepend("Meinung schlie&szlig;en").addClass("close");

  return;
}





/**
 * Name:          hide_comment
 * Beschreibung:  Schliesst einen Kommentar.
 */
function hide_comment(kommentar_id)
{
  //jQuery(".kommentar_"+ kommentar_id +" .alles").slideUp("slow");
  jQuery(".kommentar_"+ kommentar_id +" .alles").hide();
  jQuery(".kommentar_"+ kommentar_id +" .rechts a").attr({ href: "javascript:show_comment("+ kommentar_id +");"}).empty().prepend("Ganze Meinung lesen").removeClass("close").addClass("open");

  return;
}





/**
 * Name:          zeige_mehr
 * Beschreibung:  Blendet in einem Katalog alle Sub-Kategorien ein/aus
 */
function zeige_mehr(hauptrubrik_id)
{
  jQuery(".zeige_alle_"+ hauptrubrik_id).css({ display: "inline" });
  jQuery(".mehrlink_"+ hauptrubrik_id).empty().append("&laquo; <a href=\"javascript:zeige_weniger("+ hauptrubrik_id +");\">weniger</a>");

  return;
}





/**
 * Name:          zeige_weniger
 * Beschreibung:  Blendet in einem Katalog alle Sub-Kategorien ein/aus
 */
function zeige_weniger(hauptrubrik_id)
{
  jQuery(".zeige_alle_"+ hauptrubrik_id).css({ display: "none" });
  jQuery(".mehrlink_"+ hauptrubrik_id).empty().append("<a href=\"javascript:zeige_mehr("+ hauptrubrik_id +");\">mehr</a> &raquo;");

  return;
}





/**
 * Name:          menschlichkeit
 * Beschreibung:  Fuegt bei Klick ein <input> Feld ein. Nur wenn dieses Feld
 *                vorhanden ist, darf das Formular verschickt werden.
 */
function menschlichkeit()
{
  // "#mensch" wurde zu --> "#m"+"ensch", damit es fuer Bots schwerer zu finden
  // und auszufuehren ist.

  // aktueller Wert des <alt>-Attributs ("leer" oder "voll")
  var mensch_wert = jQuery("#m"+"ensch").attr("alt");

  if( mensch_wert == 'leer' )
  {
    jQuery("#m"+"ensch").attr({ src: "http://images.promobil.de/i/checked.gif" }).attr({ alt: "voll" });
    jQuery("#m"+"ensch").parent().append('<input type="hidden" name="mensch" id="human" value="ja"/>');
  }

  if( mensch_wert == 'voll' )
  {
    jQuery("#m"+"ensch").attr({ src: "http://images.promobil.de/i/unchecked.gif" }).attr({ alt: "leer" });
    jQuery("#h"+"uman").remove();
  }

  return;
}





/**
 * Name:          oeffne
 * Beschreibung:  Blendet einen Inhalt ein.
 */
function oeffne(div_wert)
{
  jQuery("#"+ div_wert).removeClass("geschlossen").addClass("offen");
  jQuery("#"+ div_wert +" a").attr({ href: "javascript:schliesse('"+ div_wert +"');" });
  jQuery("#"+ div_wert +"_inhalt").slideDown("slow");

  return;
}





/**
 * Name:          schliesse
 * Beschreibung:  Blendet einen Inhalt aus.
 */
function schliesse(div_wert)
{
  jQuery("#"+ div_wert).removeClass("offen").addClass("geschlossen");
  jQuery("#"+ div_wert +" a").attr({ href: "javascript:oeffne('"+ div_wert +"');" });
  jQuery("#"+ div_wert +"_inhalt").slideUp("slow");

  return;
}





/**
 * Name:          fdw_radio
 * Beschreibung:  Speichert die "Frage der Woche" und zeigt das Ergebnis an.
 *                Diese Funktion ist fuer Radio-Buttons gedacht.
 */
function fdw_radio()
{
  var id_fragederwoche = jQuery("input[@name=fdw_id]").val();
  var id_fragederwoche_uebersicht = jQuery("input[@name=fdw_id_uebersicht]").val();
  var radio_button = 0;

  for( var i=0; i < jQuery("input[@name=frage]").length; i++ )
  {
    if( jQuery("input[@name=frage]")[i].checked == true )
    {
      radio_button = jQuery("input[@name=frage]")[i].value;
    }
  }

  if( (radio_button != 0) && (radio_button != null) )
  {
    jQuery.ajax({
      type: "GET",
      url: "/php/ajax/frage_der_woche.php?id=" + id_fragederwoche + "&radio=" + radio_button + "&uebersicht="+ id_fragederwoche_uebersicht,
      error: function(ret){
        jQuery("#fdw_fehler").fadeIn(1000);
      },
      complete: function(ret){
        jQuery("#fdw_fehler").remove();
        jQuery("#result form").remove();
        jQuery("#result").append(ret.responseText);
      }
    });
  }
  else
  {
    jQuery("#fdw_fehler").fadeIn(1000);
  }

  return;
}





/**
 * Name:          fdw_checkbox
 * Beschreibung:  Speichert die "Frage der Woche" und zeigt das Ergebnis an.
 *                Diese Funktion ist fuer Radio-Buttons gedacht.
 */
function fdw_checkbox()
{
  var id_fragederwoche = jQuery("input[@name=fdw_id]").val();
  var id_fragederwoche_uebersicht = jQuery("input[@name=fdw_id_uebersicht]").val();
  var string = "";
  var hoch = 0;

  for( var i=1; i <= 10; i++ )
  {
    if( jQuery("#frage_"+ i +":checked").val() !== null )
    {
      if( string == "")
        string += jQuery("#frage_"+i+":checked").val();
      else
        string += ',' + jQuery("#frage_"+ i +":checked").val();

        // zaehlt, ob eine der checkboxen abgehakt wurde
        ++hoch;
    }
    else if( jQuery("#frage_"+ i).val() )
    {
      if( string == "")
        string += "0";
      else
        string += ',' + "0";
    }
  }

  // nur wenn eine der checkboxen abgehakt wurde, ajax ausfuehren, ansonsten nicht
  if( (hoch > 0) && (hoch != null ) )
  {
    jQuery.ajax({
      type: "GET",
      url: "/php/ajax/frage_der_woche.php?id=" + id_fragederwoche + "&checkbox=" + string + "&uebersicht="+ id_fragederwoche_uebersicht,
      error: function(ret){
        jQuery("#fdw_fehler").fadeIn(1000);
      },
      complete: function(ret){
        jQuery("#fdw_fehler").remove();
        jQuery("#result form").remove();
        jQuery("#result").append(ret.responseText);
      }
    });
  }
  else
  {
    jQuery("#fdw_fehler").fadeIn(1000);
  }

  return;
}





/**
 * Name:          wertung
 * Beschreibung:  Schreibt bei Klick auf einen Bewertungsstern ein Hidden-Field
 *                in das HTML.
 *
 * A C H T U N G
 * Diese Funktion scheint im IE6 noch buggy zu sein!
 *
 */
function wertung(anzahl_sterne)
{
  var alte_klasse = jQuery("#sterne").attr("class");
  var neue_klasse = ("sterne"+ anzahl_sterne +"0");

  jQuery("#sterne").removeClass(alte_klasse).addClass(neue_klasse);
  jQuery("#sterne a").attr("rel", neue_klasse);

  jQuery("#sterne").append('<input type="hidden" name="wertung_sterne" id="wertung_sterne" value="'+ anzahl_sterne +'"/>');

  return;
}





/**
 * Name:          weniger_zeigen
 * Beschreibung:  Blendet alle auswaehlbaren Eigenschaften aus.
 */
function weniger_zeigen(eigenschaft_id)
{
  jQuery("#mehrlink_nr_"+ eigenschaft_id).removeClass("weniger_zeigen").addClass("mehr_zeigen");
  jQuery("#mehrlink_nr_"+ eigenschaft_id +" a").attr({ href: "javascript:mehr_zeigen('"+ eigenschaft_id +"');" });
  jQuery("#mehrlink_nr_"+ eigenschaft_id +" a").text("mehr");
  jQuery("#versteckt_"+ eigenschaft_id).slideUp("slow");


  return;
}





/**
 * Name:          mehr_zeigen
 * Beschreibung:  Blendet alle auswaehlbaren Eigenschaften ein.
 */
function mehr_zeigen(eigenschaft_id)
{
  jQuery("#mehrlink_nr_"+ eigenschaft_id).removeClass("mehr_zeigen").addClass("weniger_zeigen");
  jQuery("#mehrlink_nr_"+ eigenschaft_id +" a").attr({ href: "javascript:weniger_zeigen('"+ eigenschaft_id +"');" });
  jQuery("#mehrlink_nr_"+ eigenschaft_id +" a").text("weniger");
  jQuery("#versteckt_"+ eigenschaft_id).slideDown("slow");


  return;
}





/**
 * Name:          show_plan
 * Beschreibung:  Blendet ueber den PINs Details zum Trainingsplan ein.
 */
function show_plan(id_zelle)
{
  jQuery("#plan_"+ id_zelle +" .inner").css({ display: "none" });
  jQuery("#plan_"+ id_zelle +" .outer").css({ display: "block" });

  return;
}





/**
 * Name:          hide_plan
 * Beschreibung:  Blendet ueber den PINs Details zum Trainingsplan aus.
 */
function hide_plan(id_zelle)
{
  jQuery("#plan_"+ id_zelle +" .inner").css({ display: "block" });
  jQuery("#plan_"+ id_zelle +" .outer").css({ display: "none" });

  return;
}





/**
 * Name:          meinung_bewerten
 * Beschreibung:  Bewertet Usermeinungen.
 */
function meinung_bewerten(id, bewertung)
{
  jQuery.ajax({
    type: "GET",
    url: "/php/ajax/meinung_bewerten.php?id="+ id +"&bewertung=" + bewertung,
    error: function(ret){
      alert("Es ist ein Fehler aufgetreten. Bitte laden Sie die Seite noch einmal.");
    },
    complete: function(ret){
      jQuery("#meinung_bewerten_" + id).slideUp(500);
      jQuery(".kommentar_"+ id +" .links").text(ret.responseText);
    }
  });

  return;
}





/**
 * Name:          kalender_blaettern
 * Beschreibung:  Blaettert einen Monat zurueck
 */
function kalender_blaettern(monat, jahr, root_id)
{
  var dieser_monat = 02;
  var dieses_jahr  = 2009;

  jQuery.ajax({
    type: "GET",
    url: "/sixcms/detail.php?template=d_odc_box_kalender&monat="+ monat +"&jahr="+ jahr +"&root_id="+ root_id,
    //url: "cal_test.php",
    error: function(ret){
      alert("Es ist ein Fehler aufgetreten. Bitte laden Sie die Seite noch einmal.");
    },
    complete: function(ret){
      jQuery("#kalender").empty().append(ret.responseText);

      if( monat == 1 )
      {
        monat_vorher  = 12;
        monat_nachher = (monat + 1);
        jahr_vorher   = (jahr - 1);
        jahr_nachher  = jahr;
      }
      else if( monat == 12 )
      {
        monat_vorher  = (monat - 1);
        monat_nachher = 1;
        jahr_vorher   = jahr;
        jahr_nachher  = (jahr + 1);
      }
      else
      {
        monat_vorher  = (monat - 1);
        monat_nachher = (monat + 1);
        jahr_vorher   = jahr;
        jahr_nachher  = jahr;
      }

      switch(monat)
      {
        case  1: monat_name = "Januar";    break;
        case  2: monat_name = "Februar";   break;
        case  3: monat_name = "M&auml;rz"; break;
        case  4: monat_name = "April";     break;
        case  5: monat_name = "Mai";       break;
        case  6: monat_name = "Juni";      break;
        case  7: monat_name = "Juli";      break;
        case  8: monat_name = "August";    break;
        case  9: monat_name = "September"; break;
        case 10: monat_name = "Oktober";   break;
        case 11: monat_name = "November";  break;
        case 12: monat_name = "Dezember";  break;
        default: monat_name = "Januar";    break;
      }

      if( monat == dieser_monat && jahr == dieses_jahr )
      {
        jQuery("#letzter_monat a").css({ display: "none" });
      }
      else
      {
        jQuery("#letzter_monat a").css({ display: "block" }).attr({ href: "javascript:kalender_blaettern("+ monat_vorher +", "+ jahr_vorher +", "+ root_id +");" });
      }

      jQuery("#name_aktueller_monat strong").empty().append(monat_name +" "+ jahr);
      jQuery("#naechster_monat a").attr({ href: "javascript:kalender_blaettern("+ monat_nachher +", "+ jahr_nachher +", "+ root_id +");" });

    }
  });

  return;
}





/**
 * Name:          show_loginbox
 * Beschreibung:  Zeigt die Loginbox oder, wenn die entsprechenden Cookies
 *                gesetzt sind die Eingeloggt-Box.
 */
function show_loginbox( forumlink )
{
  if( jQuery.cookie('vB_uname') != null && jQuery.cookie('vB_uid') != null )
  {
    var username = 'Sie sind angemeldet als '+ jQuery.cookie('vB_uname');
    var profillink = ' <a href="'+ forumlink +'usercp.php">Mein Profil</a>';
    var logoutlink = ' <a href="'+ forumlink +'login.php?do=logout&logouthash='+ jQuery.cookie('vB_logouthash') +'">abmelden</a>';
    jQuery('#loginbox').html( username + logoutlink );
  }
}





/**
 * Name:          set_redirectcookie
 * Beschreibung:  Setzt das Redirect cookie
 */
function set_redirectcookie( cookiedomain )
{
  if( jQuery.cookie('vB_uname') == null && jQuery.cookie('vB_uid') == null )
  {
    jQuery.cookie('vB_redirect', location.href, { expires: 7, path: '/', domain: cookiedomain } );
  }
}





/**
 * Name:          show_userinfo
 * Beschreibung:  Zeigt die Benutzerbegruessung auf der Community-Startseite
 */
function show_userinfo( forumlink )
{
  if( jQuery.cookie('vB_uname') != null && jQuery.cookie('vB_uid') != null )
  {
    var username = 'Hallo '+ jQuery.cookie('vB_uname') + '<br />';
    var lastlogin = 'Letzter Login: ' + jQuery.cookie('vB_lastlogin') + '<br />';
    var profillink = ' <a href="'+ forumlink +'usercp.php">Mein Profil</a><br />';
    var messagelink = ' <a href="'+ forumlink +'private.php">Meine Nachrichten</a><br />';
    var logoutlink = ' <span><a href="'+ forumlink +'login.php?do=logout&logouthash='+ jQuery.cookie('vB_logouthash') +'">abmelden</a> &raquo;</span>';
    jQuery('#userinfo').html( '<p>' + username + lastlogin + profillink + messagelink + logoutlink + '</p>' );
  }
}





/**
 * Name:          ajax_usermeinungen
 * Beschreibung:  Laed die einzelnen Seiten der Usermeinungen nach
 */
function ajax_usermeinungen(elem)
{
  jQuery.ajax({
    url: jQuery(elem).attr("href"),
    success: function(html)
    {
      jQuery("#meinungen_ajax").html(html);
      writeStatistik();
    }
  });
  return false
}





/**
 * Name:          base64_encode
 * Beschreibung:  POT
 */
function base64_encode(decStr)
{
  var base64s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  var bits;
  var dual;
  var i = 0;
  var encOut = '';

  while(decStr.length >= i + 3)
  {
    bits = (decStr.charCodeAt(i++) & 0xff) <<16 |
           (decStr.charCodeAt(i++) & 0xff) <<8 |
            decStr.charCodeAt(i++) & 0xff;

    encOut += base64s.charAt((bits & 0x00fc0000) >>18) +
              base64s.charAt((bits & 0x0003f000) >>12) +
              base64s.charAt((bits & 0x00000fc0) >> 6) +
              base64s.charAt((bits & 0x0000003f));
  }

  if(decStr.length -i > 0 && decStr.length -i < 3)
  {
    dual = Boolean(decStr.length -i -1);

    bits = ((decStr.charCodeAt(i++) & 0xff) <<16) | (dual ? (decStr.charCodeAt(i) & 0xff) <<8 : 0);

    encOut += base64s.charAt((bits & 0x00fc0000) >>18) +
              base64s.charAt((bits & 0x0003f000) >>12) +
              (dual ? base64s.charAt((bits & 0x00000fc0) >>6) : '=') +
              '=';
  }
  return(encOut);
}





/**
 * Name:          forum_last_posts
 * Beschreibung:  Last Posts aus Forum ermitteln -> teaser
 */
function forum_last_posts( forumURL )
{
  var content = '';
  for( x=0; x<3; x++ )
  {
    if( typeof(threads[x]) != "undefined" )
    {
//    if( forumURL == 'http://www.radsport-aktiv.de/forum/forum.php' )
      if( forumURL == 'http://forum.roadbike.de/forum/' )
      {
        content += '<p class="datum">' + threads[x].threaddate + ' - ' + threads[x].threadtime + '</p><h6><a href="' + threads[x].threadid + '" title="Forumsbeitrag: ' + threads[x].title + '">' + threads[x].title + '</a></h6>';
      }
      else
      {
        content += '<p class="datum">' + threads[x].threaddate + ' - ' + threads[x].threadtime + '</p><h6><a href="' + forumURL + 'showthread.php?t=' + threads[x].threadid + '" title="Forumsbeitrag: ' + threads[x].title + '">' + threads[x].title + '</a></h6>';
      }
    }
  }
  jQuery("#teaser_forum").html( content );

  return;
}


/**
 * Name:          forum_new_entries
 * Beschreibung:  Neuste Eintraege aus Forum ermitteln -> links
 */
function forum_new_entries( forumURL )
{
  var content = '';
  for( x=0; x < 10; x++ )
  {
    if( typeof(threads[x]) != "undefined" )
    {
//    if( forumURL == 'http://www.radsport-aktiv.de/forum/forum.php' )
      if( forumURL == 'http://forum.roadbike.de/forum/' )
      {
        content += '<li><a href="' + threads[x].threadid + '" title="Forumsbeitrag: ' + threads[x].title + '">' + threads[x].title + '</a> ' + threads[x].threaddate + ' - ' + threads[x].threadtime + '</li>';
      }
      else
      {
        content += '<li><a href="' + forumURL + 'showthread.php?t=' + threads[x].threadid + '" title="Forumsbeitrag: ' + threads[x].title + '">' + threads[x].title + '</a> ' + threads[x].threaddate + ' - ' + threads[x].threadtime + ' | Autor: ' + threads[x].poster + '</li>';
      }
    }
  }
  document.writeln( content );

  return;
}




/**
 * Name:          show_tab
 * Beschreibung:  Blendet auf den Startseiten bei Klick auf Tabs um zwischen
 *                Highlights und Touren.
 */
function show_tab(id_des_reiters)
{
  if( id_des_reiters == 'teaser_highlight' )
  {
    jQuery("#show_teaser_highlight").addClass("vorne_a").removeClass("vorne_p");
    jQuery("#show_teaser_tour").addClass("hinten_p").removeClass("hinten_a");
    jQuery("#teaser_highlight").css({ display: "" });
    jQuery("#teaser_tour").css({ display: "none" });
  }
  else
  {
    jQuery("#show_teaser_highlight").addClass("vorne_p").removeClass("vorne_a");
    jQuery("#show_teaser_tour").addClass("hinten_a").removeClass("hinten_p");
    jQuery("#teaser_highlight").css({ display: "none" });
    jQuery("#teaser_tour").css({ display: "" });
  }

  return;
}




/**
 * Name:          show_termine
 * Beschreibung:  Blendet beim Kalender beim ueberfahren eines Datums die
 *                Termine ein, falls es an dem Tag Termin gibt.
 */
function show_termine(datum)
{
  jQuery("#tag_"+ datum +" .posrel").show();

  return;
}




/**
 * Name:          hide_termine
 * Beschreibung:  Blendet beim Kalender beim ueberfahren eines Datums die
 *                Termine aus, falls es an dem Tag Termin gibt.
 */
function hide_termine(datum)
{
  jQuery("#tag_"+ datum +" .posrel").hide();

  return;
}




/**
 * Name:          show_lexikon
 * Beschreibung:  Blendet beim Lexikon bei Klick auf einen Begriff die
 *                Erklaerung ein.
 */
function show_lexikon(id_begriff)
{
  jQuery("li.begriff_"+ id_begriff +" h2").removeClass("closed").addClass("open");
  jQuery("li.begriff_"+ id_begriff +" h2 a").attr({ "href": "javascript:hide_lexikon('"+ id_begriff +"');" });
  jQuery("li.begriff_"+ id_begriff +" p").slideDown();

  return;
}





/**
 * Name:          hide_lexikon
 * Beschreibung:  Blendet beim Lexikon bei Klick auf einen Begriff die
 *                Erklaerung aus.
 */
function hide_lexikon(id_begriff)
{
  jQuery("li.begriff_"+ id_begriff +" h2").removeClass("open").addClass("closed");
  jQuery("li.begriff_"+ id_begriff +" h2 a").attr({ "href": "javascript:show_lexikon('"+ id_begriff +"');" });
  jQuery("li.begriff_"+ id_begriff +" p").slideUp();

  return;
}
/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("jQueryversion").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

