$(function() {   

        /*var theWindow        = $(window),
            $bg              = $("#bg"),
            aspectRatio      = $bg.width() / $bg.height();

        function resizeBg() {

                if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
                    $bg
                        .removeClass()
                        .addClass('bgheight');
                } else {
                    $bg
                        .removeClass()
                        .addClass('bgwidth');
                }

        }

        theWindow.resize(function() {
                resizeBg();
        }).trigger("resize");*/
        
        
        
        // SLIDESHOW by Juri
        
        var slideImages;
        
        switch(currentPage)
        {
        	case 'index':
        		slideImages = [
        			"http://stjarnfall.fi/wp-content/themes/stjarnfall/images/bgslides/04.jpg",
        			"http://stjarnfall.fi/wp-content/themes/stjarnfall/images/bgslides/05.jpg",
        			"http://stjarnfall.fi/wp-content/themes/stjarnfall/images/bgslides/06.jpg",
        			"http://stjarnfall.fi/wp-content/themes/stjarnfall/images/bgslides/07.jpg",
        			"http://stjarnfall.fi/wp-content/themes/stjarnfall/images/bgslides/08.jpg",
        			"http://stjarnfall.fi/wp-content/themes/stjarnfall/images/bgslides/09.jpg",
        			"http://stjarnfall.fi/wp-content/themes/stjarnfall/images/bgslides/10.jpg",
        			"http://stjarnfall.fi/wp-content/themes/stjarnfall/images/bgslides/11.jpg",
        			"http://stjarnfall.fi/wp-content/themes/stjarnfall/images/bgslides/12.jpg",
        			"http://stjarnfall.fi/wp-content/themes/stjarnfall/images/bgslides/13.jpg",
        			"http://stjarnfall.fi/wp-content/themes/stjarnfall/images/bgslides/14.jpg",
        		];
        	break;
        	
        	case 'teatern':
        		slideImages = [
        			"http://stjarnfall.fi/wp-content/themes/stjarnfall/images/bgslides/02.jpg",
        		];
        	break;
        	
        	case 'vem':
        		slideImages = [
        			"http://stjarnfall.fi/wp-content/themes/stjarnfall/images/bgslides/06.jpg",
        		];
        	break;
        	
        	case 'aktuellt':
        		slideImages = [
        			"http://stjarnfall.fi/wp-content/themes/stjarnfall/images/bgslides/04.jpg",
        		];
        	break;
        	
        	case 'kontakt':
        		slideImages = [
        			"http://stjarnfall.fi/wp-content/themes/stjarnfall/images/bgslides/01.jpg",
        		];
        	break;
        	
        }
        		
        
        $('#slides').backgroundSlides(
        	slideImages,
        	{
        		startWidth: 1600,
        		startHeight: 1200,
        		showLoading: false,
        		interval: 3500,
        		fadetime: 1500,
        		random: true,
        	}
        );
        
        
        $("#vem ul li div").hover(function(){
        $(this).stop().fadeTo("100", 1.0); // This should set the opacity to 100% on hover
        
        },function(){
        	$(this).stop().fadeTo("500", 0); // This should set the opacity back to 60% on mouseout
        });
        
        

});



  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-5751641-28']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

