if(jQuery != 'undefined') {
	$(function(){
		// weitere Funktionen sollten immer innerhalb dieser Funktion ans Ende geschrieben werden (ohne window.onload oder attachEvent!)
		$('body').addClass('jsenabled');
		if(jQuery().supersleight) {
			$('#logo, #b_suche, #nebeninhalt h2:not(#tipps h2), #nebeninhalt2 h2, .buecherauswahl .nav li a, #verlag #hauptinhalt h4,.nav_ergebnisse li a').supersleight();
		}
		if(typeof document.body.style.maxHeight === "undefined") {
    	$('#hauptinhalt #b_suche div:first-child').addClass('first');	
		}
		// default value for text inputs (using jquerydefaultvalue.js)
		if(jQuery().defaultvalue) {
			$('#suchfeld').defaultvalue('Titel, Autor, ISBN oder Stichwort');
			$('#suche_suchergebnis #s_titel').defaultvalue('Titel');
			$('#suche_suchergebnis #s_autor').defaultvalue('Autor');
			$('#suche_suchergebnis #s_isbn').defaultvalue('ISBN');
			$('#suche_suchergebnis #s_tag').defaultvalue('Stichwort');
		}
		// end default value script
		// onchange events for form controls
		$('#auswahl_sortierung, #nebeninhalt2 .nav select').change(function() {
    	$(this).parents("form").submit();
		});
		//end onchange events
		// begin tab script (using jquery tools)
	  $("#nebeninhalt #teasernav").tabs("#hauptinhalt #teaser > div",{
	  	tabs: 'li',
      effect: 'fade', 
      fadeOutSpeed: "normal",
      rotate: true,
      current: 'active' 
	  }).slideshow({
 			autoplay: true,
 			interval: 6000,
 			clickable: false
 		});
	  $('#nebeninhalt #teasernav li').click(function() {
	  	$("#nebeninhalt #teasernav").tabs().stop();
	  });
	  // end tab script
		// begin book tab script
	  $(".buecherauswahl .nav").tabs(".buecherauswahl > div",{
	  	tabs: 'li',
      effect: 'fade', 
      fadeOutSpeed: "normal",
      onBeforeClick: function(event, tabIndex) { 
        this.getCurrentPane().addClass('current');
    	},
    	onClick: function(event, tabIndex) {
    		this.getCurrentPane().removeClass('current');
    	}
	  });
	  // end book tab script
	  // begin book/magazine gallery tooltips
	  $('.buecherauswahl div li > div, .archiv_zeitschriften li > div, #nebeninhalt2 .buchliste li > div').addClass('tooltip');
	  $(".buecherauswahl div .buch img").tooltip({
	  	position: "center right",
	  	effect: 'slide',
	  	relative: true,
	  	tip: ".buch + div",
	  	lazy: false,
	  	offset: [50,-50]
	  }).dynamic({
	  	left: {
	  		bounce: true
	  	}
	  });
	  $(".archiv_zeitschriften .zeitschrift img, #nebeninhalt2 .buchliste .zeitschrift img").tooltip({
	  	position: "center right",
	  	effect: 'slide',
	  	tip: ".zeitschrift + div",
	  	lazy: false,
	  	offset: [50,-50]
	  }).dynamic({
	  	left: {
	  		bounce: true
	  	}
	  });
	  $("#nebeninhalt2 .buchliste .buch img").tooltip({
	  	position: "center right",
	  	effect: 'slide',
	  	tip: ".buch + div",
	  	lazy: false,
	  	offset: [50,-50]
	  }).dynamic({
	  	left: {
	  		bounce: true
	  	}
	  });
	  // end book gallery tooltip
	  // begin “reinlesen” book tooltip
	  /*$("#buch_aktuell .buch > img, #aw_aktuell .zeitschrift > img").tooltip({
	  	position: "top center",
	  	effect: 'slide',
	  	tip: ".reinlesen",
	  	lazy: false,
	  	offset: [60,-27]
	  });
	  $(".liste_uebersicht .buch img").tooltip({
	  	position: "top center",
	  	effect: 'slide',
	  	tip: ".reinlesen",
	  	lazy: false,
	  	relative: true,
	  	offset: [75,-27]
	  });*/
	  // end tooltip
	  // sidebar accordion
	  $("#tipps > h2").click(function(){
			if(false == $(this).next().is(':visible')) {
				$('#tipps > div').slideUp(800);
			}
			else {
				return false;
			}
			$(this).next().slideToggle(800);
			$(this).addClass('active');
			$(this).siblings('h2').removeClass('active');
		});
		$('#tipps > div:eq(0)').slideDown(800);
		$('#tipps > h2:eq(0)').addClass('active');
		// end sidebar accordion
		// news scroller
		if(jQuery().liScroll) {
			$('#nachrichten ul').liScroll({travelocity: 0.03});
		}
		// end news scroller
		if($('.zeitschrift').parent('.bild')) {
			$('.zeitschrift').parent('.bild').addClass('zeitschrift');
		}
		// special workaround for IE z index bug
    if(!(jQuery.support.style)) {
      $(".buecherauswahl li").hover(function() {
      	$(this).addClass('zindex');
      },
      function() {
      	$(this).removeClass('zindex');
      });
      var string = $('blockquote p:first-child').text();
      $('blockquote p:first-child').text('\u201E'+string);
      $('blockquote p:last-child').append('\u201C');
    }
    
    // neue Funktionenen kommen hier hin
	}); // end document ready function
}

