function initInhaltHoehe() {
	var hoeheInhalt = jQuery("#height").outerHeight() + 200;
	
	if(hoeheInhalt < 350){
			jQuery("#inhalt_mehr").css("display", "none");
	}
	
	jQuery("#inhalt_mehr").click(function(){
			// jQuery("#buchdetail #inhalt").css("max-height", hoeheInhalt);
			jQuery('#buchdetail #inhalt').animate({
				maxHeight: hoeheInhalt // BTN wird ausgeblendet, wenn Ende erreicht
			}, 1000);
			jQuery(this).css("display", "none");
	})
}
// TopSlider

function initListSlider() {

  var LI = jQuery("DIV#topslider:last LI");

  var maxWidth = 737;

  var int = 1;

  var activeIndex = 0;

  var width = new Array();

  var userEvent = 0;

  jQuery("#topslider").mouseenter(function(){ userEvent = 1; }).mouseleave(function(){ userEvent = 0; });

  var setWidth = function() {
    var restCheck = 0;
    for(var i=0;i<width.length;i++){
      if ( i <= activeIndex && i != 0 ) {
        width[i] += 60;
        if ( width[i] > maxWidth ) width[i] = maxWidth;
      } else {
        width[i] -= 60;
        if ( width[i] < 0 ) width[i] = 0;
        restCheck += width[i];
      }
      var x = Math.round((width[i]/maxWidth)*100)/100;
      var y = Math.sin(Math.PI/-2+Math.PI*x);
      var outputWidth = Math.round((y+1)/2*maxWidth);
      if(i==0){
      } else {
        LI.eq(i).css("margin-right",-737+outputWidth).css("margin-left",outputWidth*(-1));
      }
    }
    if ( width[activeIndex] >= maxWidth && restCheck == 0 ) {
      window.clearInterval(int);
      int = 1;
    }
  }

 

  var startInterval = function() {
    if ( int != 1 ) {
      window.clearInterval(int);
      int = 1;
    }
    setWidth();
    int = setInterval(function(){
      setWidth();
    },15);
  }

 

  LI.each(function(){
    var index = LI.index(jQuery(this));
    if ( jQuery(this).hasClass("active") ) {
      width.push(737);
    } else {
      width.push(0);
    }
    jQuery(this).mouseover(function(){ 
      activeIndex = index;
      startInterval();
    });
  });

  setInterval(function(){
    if ( userEvent == 0 ) {
      LI.removeClass();
      activeIndex++;
      if ( activeIndex >= LI.length ) activeIndex = 0;
      LI.eq(activeIndex).addClass("active");
      startInterval();
    }
  },7500000);

  LI.each(function(){
    var index = LI.index(jQuery(this));
    if ( jQuery(this).hasClass("active") ) {
      width.push(420);
    } else {
      width.push(0);
    }
    jQuery(this).mouseover(function(){ 
      activeIndex = index;
      startInterval();
    });
  });

  setInterval(function(){
    if ( userEvent == 0 ) {
      LI.removeClass();
      activeIndex++;
      if ( activeIndex >= LI.length ) activeIndex = 0;
      LI.eq(activeIndex).addClass("active");
      startInterval();
    }
  },7000);

}


	function artikelUebersicht() {

			var DIVs = jQuery("UL#shop_uebersicht li");
				for ( var i=1; i<DIVs.length; i+=2 ) {
				  DIVs.eq(i).css("background","#daebc7");
				}
		}
		
		
		
		
			function initKarussel() {
			
			var woBinIch = "0";
			var liste = jQuery("#karussell UL");
			var anzahlElemente = liste.eq(woBinIch).children().length; 
			var anzahlElementeMinusEins = Math.round (anzahlElemente -1 );
			var userEvent = "0";

			jQuery("#karussell UL LI:first").clone(true).insertAfter("#karussell UL LI:last"); // erstes Element wird geklont und hinten dran gehängt
			
			 
			 
			 window.setInterval(function(){
			
			// jQuery("#iphone").mouseenter(function(){ userEvent = 1; }).mouseleave(function(){ userEvent = 0; });
			 
			 
			// if ( 1 == userEvent ){
			//	alert("userEvent == 1");
			// }
			 
			// if ( 0 == userEvent){ 
			
			  if(woBinIch < anzahlElementeMinusEins ){
				woBinIch++;
				jQuery('#karussell UL').animate({
				  marginLeft: '-=150',
				}, 1200);
//			  alert(woBinIch);
//				alert(woBinIch + "--" + anzahlElementeMinusEins)
			  } else if (woBinIch == anzahlElementeMinusEins){
				  woBinIch = 0;
				  jQuery('#karussell UL').animate({
					marginLeft: '-=150',
				   }, 1200, function() {
					jQuery('#karussell UL').css("marginLeft","0")
					});
				 }
			//    }
			 },1600);
			}


			function neueBuecher() {
					jQuery("DIV#neuimshop UL LI").hover(
					function () {
						jQuery(this).find("div").css('display','inline');
					},
					function () {
						jQuery(this).find("div").css('display','none');
					});
			}

