try{Typekit.load();}catch(e){}

/*
$(function(){

function calcParallax(tileheight, speedratio, scrollposition) {
  //    by Brett Taylor http://inner.geek.nz/
  //    originally published at http://inner.geek.nz/javascript/parallax/
  //    usable under terms of CC-BY 3.0 licence
  //    http://creativecommons.org/licenses/by/3.0/
  return ((tileheight) - (Math.floor(scrollposition / speedratio) % (tileheight+1)));
}

window.onload = function() {

  window.onscroll = function() {
    var posX = (document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : window.pageXOffset;
    var posY = (document.documentElement.scrollTop) ? document.documentElement.scrollTop : window.pageYOffset;
    
    var ground = document.getElementsByClassName('page-wrapper');
    var groundparallax = calcParallax(53, 8, posY);
    ground.style.backgroundPosition = "0 " + groundparallax + "px"; 

    var clouds = document.getElementsByClassName('clouds-1');
    var cloudsparallax = calcParallax(400, .5, posY);
    clouds.style.backgroundPosition = "0 " + cloudsparallax + "px"; 
  }

  document.getElementsByClassName('content-wrapper').onscroll = function() {
    var posX = (this.scrollLeft) ? this.scrollLeft : this.pageXOffset;
    var j = calcParallax(53, 16, posX);
    console.log('scroll js: '+ j);
    document.getElementByClassName('content-wrapper').style.backgroundPosition = j + "px 0";
  }
}

});
*/

/*
JavaScript for the demo: jQuery Vertical Parallax Background
Demo: jQuery Vertical Parallax Background
Author: Ian Lunn
Author URL: http://www.ianlunn.co.uk/
Demo URL: http://www.ianlunn.co.uk/demos/jquery-vertical-parallax-background/
Tutorial URL: http://www.ianlunn.co.uk/blog/code-tutorials/jquery-vertical-parallax-background/

License: http://creativecommons.org/licenses/by-sa/3.0/ (Attribution Share Alike). Please attribute work to Ian Lunn simply by leaving these comments in the source code or if you'd prefer, place a link on your website to http://www.ianlunn.co.uk/.

Dual licensed under the MIT and GPL licenses:
http://www.opensource.org/licenses/mit-license.php
http://www.gnu.org/licenses/gpl.html
*/

$(document).ready(function() { //when the document is ready
				
		windowHeight = $(window).height(); //get the height of the window
		clouds = windowHeight * 0.125; //create a variable that contains the starting position for the clouds
		
		//change the css of the <html> element to give it multiple backgrounds using CSS3. This contains the variables we just worked out for each individual background
		$('.clouds-1').css({"background" : "url(http://www.boihallsberg.se/images/18.4926558c12ff8d38cff80003087/clouds.png) 0 " + clouds + "px repeat-x"});
		
		
		function Move(){ //set up a function to be called whenever the window is scrolled or resized
			windowHeight = $(window).height(); //get the height of the window
			pos = $(window).scrollTop(); //get the position of the scrollbar
			clouds = windowHeight * 0.125 + pos * 0.7; //create a variable that contains the starting position for the clouds
				
			//change the css of the .clouds-1 element to give it multiple backgrounds using CSS3. The variables contained will change for every pixel the window is resized or scrolled
			$('.clouds-1').css({"background" : "url(http://www.boihallsberg.se/images/18.4926558c12ff8d38cff80003087/clouds.png) 0 " + clouds + "px repeat-x"});
		}
		
	$(window).resize(function(){ //when the window is resized...
		Move(); //call the Move() function
	});		
	
	$(window).bind('scroll', function(){ //when the user is scrolling...
		Move(); //call the Move() function
	});


   $('a[href*=#]').click(function() {

   if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
       && location.hostname == this.hostname) {

           var $target = $(this.hash);

           $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');

           if ($target.length) {

               var targetOffset = $target.offset().top;

               $('html,body').animate({scrollTop: targetOffset}, 1000);

               return false;

           }

       }

   });
   
   jQuery(document).ready(function ($) {
   	if ($(".cycle .slides").length > 0) {
   		$(function () {
   			$(".cycle .slides").cycle({
   				fx: "scrollHorz",
   				timeout: 7000,
   				pause: "true",
   				next: ".cycle-next a", 
   				prev: ".cycle-prev a"
   			});
   		});
   	}
   });
   

	
});
