$(document).ready(function()
{

$('#gallery img').hide();
$('#gallery img:nth(0)').show();
$('#gallery-menu img').css('opacity' , '0.6');

$('#gallery-menu img').hover(function()
	{
		$(this).removeAttr('style');
		
	},function()
	{
		$(this).css('opacity' , '0.6');
	});
	
$('#gallery-menu a').live('click' ,function() 
	{
		var i = $('#gallery-menu a').index(this);
		$('#gallery-menu img').removeClass('current');
		$(this).find('>img').addClass('current');
		
		
		if (i >=4)
		
		{
			if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) 
				{
					var $target = $(this.hash);
					var t = $(this).text();
					$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
					if ($target.length) 
					{
						var targetOffset = $target.offset().top;
						$('html,body').animate({scrollTop: targetOffset}, 500);
						return false;
					}
				}
		}
		
		else
		{
			return false;
		}
		
	});

$('#gallery-menu img').click(function()
	{
		var thisImage = $('#gallery-menu img').index(this);
		var thisImageNumber = thisImage+1;
		$('#gallery img').hide();
		$('#gallery img:nth('+ thisImage +')').show();
		
	});
	
	$('#catwalk-inner').css('paddingLeft' , 0);
	
	$('#catwalk-inner li').live('click', function()
		{
			var i = $('#catwalk-inner li').index(this);
			$('#fullsize-menu img:visible').hide();
			$('#fullsize-menu img:nth('+i+')').fadeIn(500).css('margin' , 0);
		});

	$('#catwalk-inner').jcarousel(
		{
			scroll: 8,
			wrap: 'both'
		});
		
		$('#gallery img').css({visibility: visible, opacity: 0.1}).fadeTo({500, 1})
});
