jQuery(document).ready(function($)  {

	$('#gallery-showcase').jcarousel();
	
	//EXTERNAL LINKS
	$('a.externallink').click(function(){
		window.open(this.href);
		return false;
	});
	
	//TABLE STRIPING
	$('table tr:even').addClass('evenrow');
	$('table tr:odd').addClass('oddrow');
	
	$('.thumb:first-child').css('border-left','3px solid #fcfcfc');
	
	//SIFR TITLES				
	$('h1').sifr({path: 'font/', font: 'geosanslight', roY: -5, color:'#63B6E2', textTransform: 'uppercase'});
	$('span.caption').sifr({path: 'font/', font: 'AvantGarde Bk BT', roY: 0, color:'#fcfcfc'});
	$('th').sifr({path: 'font/', font: 'AvantGarde Bk BT', roY: 0, color:'#005879'});
	
	//FANCYBOX
	$("a.img-zoom").fancybox({
		'overlayShow': true,
		'overlayOpacity': 0.8					   
	});
	$("a.video-zoom").fancybox({ 
		'hideOnContentClick': true,
		'frameWidth': 640,
		'frameHeight': 400,
		'overlayShow': true,
		'overlayOpacity': 0.8
	}); 
	
	
	/**
	 * Most jQuery.localScroll's settings, actually belong to jQuery.ScrollTo, check it's demo for an example of each option.
	 * @see http://flesler.demos.com/jquery/scrollTo/
	 * You can use EVERY single setting of jQuery.ScrollTo, in the settings hash you send to jQuery.LocalScroll.
	 */
	
	/**
	 * Restart the scroll position to ( 0, 0 ) (Firefox doesn't reset it)
	 * could use $(target).scrollTo( 0, {axis:'xy'));
	 * but this needs to be quick(synchronous), to reset before $.localScroll.hash() begins
	 */
	$('#viewport').attr({scrollTop:0,scrollLeft:0});
	
	// Scroll initially if there's a hash (#something) in the url 
	$.localScroll.hash({
		target: '#viewport', //could be a selector or a jQuery object too.
		axis:'xy',//the default is 'y'
		queue:true,
		duration:1500
	});

	var $last = $([]);//save the last link
	
	/**
	 * NOTE: I use $.localScroll instead of $('#navigation').localScroll() so I
	 * also affect the >> and << links. I want every link in the page to scroll.
	 */
	$('#gallery-controls').localScroll({
		target: '#viewport', //could be a selector or a jQuery object too.
		axis:'xy', //the default is 'y'
		queue:true,
		duration:1500,
		hash:false,
		easing: 'easeOutQuad',
		onBefore:function( e, anchor, $target ){//'this' is the clicked link
			$last.removeClass('scrolling');
			$last = $(this).addClass('scrolling');
			if( this.blur )
				this.blur();//remove the awful outline
		},
		onAfter:function( anchor ){
			$last.removeClass('scrolling');
		}
	});	
	

	
	
	
});
