$(document).ready(function() {

//	$('.menu').superfish({ 
//		delay:       1000,                            // one second delay on mouseout 
//		animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
//		speed:       'fast',                          // faster animation speed 
//		autoArrows:  false,                           // disable generation of arrow mark-up 
//		dropShadows: false                            // disable drop shadows 
//	});

	// Slider - Front Page
	var sudoSlider = $("#intro").sudoSlider({ 
		prevNext: false,
		customLink: 'a.intronav',
		fade: true,
		auto: false,
		pause: '10000',
		fadespeed: '500',
		controlsShow: false,
        beforeAniFunc: function(t){
			$(this).find('.entry').hide();
        },
        afterAniFunc: function(t){ 
			$(this).find('.entry').show();
        }
    });



	// Tab Box for Products
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).show(); //Fade in the active content
		return false;
	});



	// Fancybox - Images
	$(".fancygallery, .fancybox").fancybox({
		'titleShow' : 'true',
		'titlePosition' :'over',
		'overlayOpacity' : 0.9,
		'overlayColor' : '#000000',
		'hideOnContentClick' : 'true',
		'transitionIn' : 'elastic',
		'transitionOut' : 'elastic',
		'speedIn' : 600, 
		'speedOut' : 200,
		'titleFromAlt' : 'true',
		'showNavArrows' : 'true'
	});




	// Fancybox - YouTube
	$(".youtube").click(function() {
		$.fancybox({
			'padding' : 0,
			'autoScale' : false,
			'transitionIn' : 'none',
			'transitionOut' : 'none',
			'title' : this.title,
			'width' : 680,
			'height' : 495,
			'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type' : 'swf',
			'swf' : {'wmode' : 'transparent','allowfullscreen'	: 'true'}
		});
		return false;
	});


	// Produktmeny
	$('.sub-menu li ul').hide();
	$('.sub-menu li.current-menu-item').children('ul:hidden').slideDown('fast');
	$('.sub-menu li.current-menu-ancestor').children('ul:hidden').show();

	$('.sub-menu li').click(function() {
		$(this).next('ul:hidden').slideDown('fast');
	})

});
