<!-- FANCYBOX FUNCTIONS -->
<script type="text/javascript">
$(document).ready(function() {

	/* This is basic - uses default settings */
	
        $("a#single_image").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn' : 600, 
		'speedOut' : 200,
                'titlePosition' : 'inside',
                'autoScale' : true
	});
	
	$("a#inline").fancybox({
		'hideOnContentClick': true,
		'transitionIn'	:	'fade',
		'transitionOut'	:	'fade',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
                'titlePosition' : 'inside',
                'autoScale' : true,
                'overlayColor'  :  '#000',
                'overlayOpacity'  :  0.7
	});

	/* Apply fancybox to multiple items */
	
	$("a.group").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	false,
                'titlePosition' : 'inside',
                'autoScale' : true
	});
	
});
</script>



<!-- PERSISTANT HEADER -->
<script type="text/javascript">
$(document).ready(function() {
  (function() {
    //settings
    var fadeSpeed = 200, fadeTo = 0.9, topDistance = 30;
    var topbarME = function() { $('#header-wrapper').fadeTo(fadeSpeed,1); }, topbarML = function() { $('#header-wrapper').fadeTo(fadeSpeed,fadeTo); };
    var inside = false;
    //do
    $(window).scroll(function() {
      position = $(window).scrollTop();
      if(position > topDistance && !inside) {
        //add events
        topbarML();
        $('#header-wrapper').bind('mouseenter',topbarME);
        $('#header-wrapper').bind('mouseleave',topbarML);
        inside = true;
      }
      else if (position < topDistance){
        topbarME();
        $('#header-wrapper').unbind('mouseenter',topbarME);
        $('#header-wrapper').unbind('mouseleave',topbarML);
        inside = false;
      }
    });
  })();
});
</script>



<!-- SOCIAL FLOAT -->
<script type="text/javascript">
jQuery(function () {
    var msie6 = jQuery.browser == 'msie' && jQuery.browser.version < 7;
    if (!msie6 && jQuery('#share_buttons_single_page').length != 0) {
        var top = jQuery('#share_buttons_single_page').offset().top - parseFloat(jQuery('#share_buttons_single_page').css('margin-top').replace(/auto/, 0));

        jQuery(window).scroll(function (event) {

            // what the y position of the scroll is

            var y = jQuery(this).scrollTop();
// whether that's below the form
            if (y >= top-20) {
                // if so, ad the fixed class
                jQuery('#share_buttons_single_page').addClass('fixed');
            } else {
                // otherwise remove it
                jQuery('#share_buttons_single_page').removeClass('fixed');
            }
        });
    }
});
</script>


<!-- FACEBOOK SHARE -->
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) {return;}
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=178820002196461";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
