// jQuery onload
$(document).ready(function(){
	
	// Startseite jCarousel
	if ($('.ct-jcarousel').length > 0) {
		$('.ct-jcarousel').removeClass("noscript");
		$('.jcarousel-prev').remove();
		$('.jcarousel-next').remove();
		$('.ct-jcarousel').addClass("jcarousel-skin-tango");
		$('.ct-jcarousel').jcarousel({
			scroll: 1,
			auto: 7,
      wrap: 'last',
			easing: 'easeInOutExpo',
			initCallback: mycarousel_initCallback
		});
	}
	
	// Startseite Konfigurator
	if ($('#konfigurator').length > 0) {
		$("#konfigurator").click(function () {
			$(".link-konfig-open").toggleClass("link-konfig-close");
			$("#navi-konfigurator").toggle("slow",function() {
					//$.scrollTo('max');
			});
			return false;
		});
	}
	
	// Zusätzlicher Kasten zum schließen
	if ($('#konf_schliessen').length > 0) {
		$("#konf_schliessen").click(function () {
			$(".link-konfig-open").toggleClass("link-konfig-close");
			$("#navi-konfigurator").toggle("slow",function() {
					//$.scrollTo('max');
			});
			return false;
		});
	}
	
	
});

function mycarousel_initCallback(carousel) {
    // Disable autoscrolling if the user clicks the prev or next button.
    /*carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });*/

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
}

$(window).load(function(){
	/*if ($(".ct-accordionbox").length > 0) {
		$(".ct-accordionbox").accordion({ header: 'h4'  });
	}*/
	
	// Da wir �ber TYPO3 keinen Container um die einzelnen Elemente legen k�nnen,
	// muss es per JS gemacht werden!
	
	// Wenn es irgendwo �berhaupt Accordion-Elemente gibt...
	if ($("div.accordionbox").length > 0) {
		
		// ...wrappen wir zuerst die passende Box drumherum...
		$("div.accordionbox").wrapAll('<div class="ct-accordionbox"></div>');
		
		// ...und schlie�lich starten wir das Accordion!
		$(".ct-accordionbox").accordion({ header: 'h4'  });
	}
	
});

