		// Set up Sliders
		// **************
		$(function(){

			$('#slider1').anythingSlider({
				startStopped    : true, // If autoPlay is on, this can force it to start stopped
				autoPlay		: false,
				width           : 900,   // Override the default CSS width
				height			: 400,
				theme           : 'cs-portfolio',
				animationTime	: 600,
				buildNavigation	: false,
//				autoPlayLocked  : true,  // If true, user changing slides will not stop the slideshow
//				resumeDelay     : 10000, // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds).
				onSlideComplete : function(slider){
					// alert('Welcome to Slide #' + slider.currentPage);
				}
			});

			$('#slider2').anythingSlider({
				startStopped    : true, // If autoPlay is on, this can force it to start stopped
				autoPlay		: false,
				width           : 294,   // Override the default CSS width
				height			: 350,
				theme           : 'cs-portfolio',
				buildArrows		: false,
				animationTime	: 600,
//				autoPlayLocked  : true,  // If true, user changing slides will not stop the slideshow
//				resumeDelay     : 10000, // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds).
				onSlideComplete : function(slider){
					// alert('Welcome to Slide #' + slider.currentPage);
				}
			});
			
			$("#bnext").click(function(){
  				$('#slider1').data('AnythingSlider').goForward(),
  				$('#slider2').data('AnythingSlider').goForward();
			});

			$("#bprev").click(function(){
  				$('#slider1').data('AnythingSlider').goBack(),
  				$('#slider2').data('AnythingSlider').goBack();
			});

		});
		
		
		
		
$(document).ready(function() {

	/* Apply fancybox to multiple items */
	
	$(".fancy").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'scrolling'		: 	'no',
		'titleShow'		: 	false,
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	false
	});
	
});

$(document).ready(function(){
	$(".iframe").fancybox({
		 'width' : '100%',
		 'height' : '100%',
		 'autoScale' : true,
		 'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		 'titleShow'	: 	false,
		 'type' : 'iframe'
	 });
});

$(document).ready(function(){
	$(".form").fancybox({
		 'width' : '25%',
		 'height' : '95%',
		 'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		 'titleShow'	: 	false,
		 'type' : 'iframe'
	 });
});

$(document).ready(function(){
	$(".new_form").fancybox({
		 'width' : 671,
		 'height' : 337,
		 'scrolling': 'no', 
		 'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		 'titleShow'	: 	false,
		 'type' : 'iframe'
	 });
});

$(document).ready(function(){
	$(".fancy_video").fancybox({
		 'width' : 900,
		 'height' : 506,
		 'scrolling': 'no', 
		 'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		 'titleShow'	: 	false,
		 'type' : 'iframe'
	 });
});



$(document).ready(function(){

	"use strict";
	
	$("ul.menu").find("ul").hide();
	
	var duration_time_var = 200, ani_distance = 100, base_pos_of_parent_link = 85, position, paddingleft_parent, paddingleft_child, padding_difference, inorout;
	
	function fadeItem(Object, inorout) {
	
		paddingleft_parent = $(Object).find('a').css('paddingLeft'); paddingleft_child = $(Object).find(">ul").find('li').find('a').css('paddingLeft'); padding_difference = parseFloat(paddingleft_parent) - parseFloat(paddingleft_child); position = $(Object).position(); base_pos_of_parent_link = position.left+padding_difference;
		
		if (inorout === 'in') {
				
			$('.sub-menu').hide();
			$(Object).find(">ul").css('margin-left', (base_pos_of_parent_link+ani_distance)+'px').animate({ marginLeft: '-='+ani_distance}, {queue: false, duration: duration_time_var});
			$(Object).find(">ul").fadeIn(duration_time_var);
			
		}
		
		if (inorout === 'out') {
		
			$(Object).find(">ul").animate({ marginLeft: '-='+ani_distance}, {queue: false, duration: duration_time_var});
			$(Object).find(">ul").fadeOut(duration_time_var);
		
		}
	
	}
	
	function moveSubMenu(Object, inorout) {
		
		if ($(Object).children().children().length > 0) {
				
			if (inorout === 'in') {
	
				if ($(Object).find(">ul").css('display') === 'none') {
			
					fadeItem(Object, 'in');
				
				}
			
			}
			
			if (inorout === 'out') {
			
				if ((!$(Object).hasClass('current-menu-item')) && (!$(Object).hasClass('current-menu-ancestor'))) {
						
					fadeItem(Object, 'out');
					fadeItem($('.current-menu-item'), 'in');
					fadeItem($('.current-menu-ancestor'), 'in');
					
				}
					
			}
		
		}
	
	}
	
	$("ul.menu").find("li").hover(function(){
			
			moveSubMenu($(this), 'in');	 //Mouseover
		
		}, function () { 
	
			moveSubMenu($(this), 'out');	//Mouseout		
	
	}); //Slut på hover
	
	
	//Om det finns en current-page, visa undermenyn
	$('.sub-menu').each( function() {
		if ($(this).parent().hasClass('current-menu-item')) {
			moveSubMenu($(this).parent(), 'in');
		}
		if ($(this).parent().hasClass('current-menu-ancestor')) {
			moveSubMenu($(this).parent(), 'in');
		}
	});
	    
});
