function setSidebar() {
	if ( $(window).width() < $("#wrap").width() || $(window).height() < $("#sidebar").height() ) {
		$("#sidebar").css( { "position" : "absolute" } );
	} else {
		$("#sidebar").css( { "position" : "fixed" } );
	}	
}

(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = "http://" + top.location.host.toString() + "/wp-content/themes/fncy/style/images/" + arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery)

WebFont.load({
  typekit: {
    id: 'blt4xvb'
  }
});

$(document).ready(function() {
	jQuery.preLoadImages( "2sq-h.png" );
	if ( screen.width >= 480 )
	{
		setSidebar();
		$(window).resize(function() {
			setSidebar();
		});
	}
	// $("#contentHeader nav a").click(function(e) {
	// 	e.preventDefault();
	// 	$.scrollTo($(this).attr("rel"));
	// });
	$("#contentHeader nav a").click(function(e) {
		var target = $(this).attr("rel");
		var targetOffset = $(target).offset().top;
		$('html,body').animate({scrollTop: targetOffset}, 1000);
		return false;
	});
});
