$(document).ready(function() {	
	if ($('#slideshow').length)
		$('#slideshow').cycle();
});

//before DOM ready for reducing FoUC
var hnInitial = location.pathname.replace(/^.*\/|\..*/g, '');
switch (hnInitial) {
	case 'home':
	case 'contact':
	case 'index':
		hnInitial = '';
}

$(function() {
	/* This is basic - uses default settings */
	var $thumnails = $('a.thumbnail');
	if ($thumnails.length)
		$("a.thumbnail").fancybox({ 
			'zoomSpeedIn': 300, 
			'zoomSpeedOut': 300,
			'overlayShow': true,
			'overlayOpacity': 0.7,
			'transitionIn'	: 'elastic',
				'transitionOut'	: 'fade',
				'overlayColor' : '#000'
		});
	
	var $hn = $('#header-image-nav li')
	.append('<span class="i-n-arrow" />')
	.mouseenter(function() {
		var lastIndex = $hn.stop(true).length - 1, currIndex = 0, i;
		for (i = 0; i < $hn.length; i++)
			if ($hn.get(i) == this) {
				currIndex = i;
				break;
			}
		var fat = 251, thin = 75, marg = 3, space = $hn.parent().width();
		$hn.each(function(j) {
			var $this = $(this);
			$this.animate({
				right:  (j == lastIndex ? 0 : space - (j < currIndex ? (j + 1) * (thin + marg) : j * thin + fat + (j + 1) * marg)) + 'px'
			}, 'fast', undefined, function() {
				if (j == currIndex)
					$(this).addClass('i-n-current');
				else
					$(this).removeClass('i-n-current');
			});
		});
	});
	if (hnInitial)
		$hn.filter('.i-n-i-' + hnInitial).mouseenter();
});

/*
if (typeof console == 'undefined')
	console = {
		log: function() {}
	};
*/


