$(document).ready(function(){

	/* Scroll to Specific Place on Page */
	var scrollDuration = 1000; // 1000 = 1 second
	var scrollGap = 0; // in Pixels, the gap left above the scroll to point
	
	$('a.jumper').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 - scrollGap;
				$('html,body').animate
					(
					{scrollTop: targetOffset}, 
					scrollDuration
					);
				
				// Remove all "active" classes
				$("a").removeClass("active");
				
				// Set "active" class on clicked item
				$(this).addClass("active");
								
				return false;
			}
		}
	});
	
	/*  Scroll to top */
	$().UItoTop({ easingType: 'easeOutQuart' });
	
	/*  Tooltips */
	$('.tooltip').tipsy({gravity: 's',fade: true}); // n | s | e | w
	
	/* FancyBox for Vimeo Videos */
	$("#vimeo").fancybox({
		'padding'		: 0,
		'autoScale'		: false,
		'transitionIn'	: 'none',
		'transitionOut'	: 'none',
		'width'			: 600,
		'height'		: 398,
		'href'			: '',
		'type'			: 'swf'
	});
	
	/* Fancybox for Youtube Videos */
	$("#youtube").click(function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'			: 600,
			'height'		: 398,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	 'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});

		return false;
	});
	
	/*  Fancybox for Other Videos or Pages - iFrame */
	$("#iframe").fancybox({
		'width'				: 600,
		'height'			: 398,
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
	
	/* Fade in when Hovered*/
	$(document).ready(function(){
		$(".fade-in").fadeTo("slow", 0.6); // This sets the opacity of the thumbs to fade down to 60% when the page loads

		$(".fade-in").hover(function(){
			$(this).fadeTo("slow", 1.0); // This should set the opacity to 100% on hover
		},function(){
			$(this).fadeTo("slow", 0.6); // This should set the opacity back to 60% on mouseout
		});
	});
	
	/* Fade out when Hovered */
	$(document).ready(function(){
		$(".fade-out").fadeTo("slow", 1.0); // This sets the opacity of the images to 100% when the page loads

		$(".fade-out").hover(function(){
			$(this).fadeTo("slow", 0.6); // Image will fade to 60% on hover
		},function(){
			$(this).fadeTo("slow", 1.0); // Image opacity back to 100% on mouseout
		});
	});
	
	
	
	
	
}); // end document.ready
