$(document).ready(function(){	

	/* Navi
	/////////////////////////////////////////////////////////////////*/
	$('.mainbtn').click(function () {
		$(this).parent().parent().children('li').not(this).children('ul').hide();
						
		$(this).parent().children('ul').fadeIn();
		
		$('.mainbtn').css({backgroundPosition: '0 0px'}); 
		$(this).css({backgroundPosition: '0 0px'}).hide().css({backgroundPosition: '0 -84px'}).fadeIn("slow"); 
		
		
		return false;
    });
	


	/* Sortiment Slider
	/////////////////////////////////////////////////////////////////*/
	$('.details').hide();
	$('.linkhide').hide();
	$('.slider .button h5, .slider .button .detaillink').click(function () {
		$(this).parent().children('.detaillink').toggle();
     	$(this).parent().next('.details').slideToggle(800);
		return false;
    });
	$(document.location.hash).children('.detaillink').toggle();
	$(document.location.hash).next('.details').slideToggle(800);
	
	/* Navigation
	/////////////////////////////////////////////////////////////////*/
	$('#navigation ul li.active ul').show();
	
	/* Flash Messages
	/////////////////////////////////////////////////////////////////*/
	$('#flashMessage').toggle();
	$('.error-message').toggle();
	
	$('#flashMessage').fadeIn(2000);
	$('.error-message').fadeIn(2000);
	
	/* PrettyGallery Index
	/////////////////////////////////////////////////////////////////*/
	$('#teasers > li').mouseover(function(){
		$(this).animate({ 
			width: "115px"
			}, 300 );
	})
	$('#teasers > li').mouseout(function(){
		$(this).animate({ 
			width: "100px"
			}, 300 );
	})
	$('#events > li').hide();
	$('#teasers > li > a').click(function(){
		$('#events > li').hide();
		var id = $(this).attr('href');
		$(id).fadeIn('slow');
		return false;
	})
	var id = $('#teasers > li.next > a').attr('href');
	$(id).fadeIn('slow');
	var id = $('#teasers > li.latest > a').attr('href');
	$(id).fadeIn('slow');
	
	/* PrettyPhoto Gallery
	/////////////////////////////////////////////////////////////////*/
	$("a[rel^='prettyOverlay'],a[rel^='prettyPhoto']").prettyPhoto({
		animationSpeed: 'slow', /* fast/slow/normal */
		padding: 40, /* padding for each side of the picture */
		opacity: 0.6, /* Value betwee 0 and 1 */
		showTitle: false, /* true/false */
		allowresize: true, /* true/false */
		counter_separator_label: '/' /* The separator for the gallery counter 1 "of" 2 */
	});
	/* jCarouselLite
	/////////////////////////////////////////////////////////////////*/
	$("#carousel #jcarousel").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
		auto: 4000,
    	speed: 500
    });
	$("#carousel").css({visibility:'visible'});
});