(function ($) {
	$.clickThumb = function(o)
	{
		clearInterval($.sliderIntervalID);
		$.focusThumb(o);
	};
	$.focusThumb = function(o)
	{
		$.enableThumb($("#thumbs li.selected"));
		$("#thumbs li.selected").removeClass('selected');
		o.unbind().addClass('selected').find('img').css('opacity','1');
		$("#photo img").fadeOut(1000,
				function(){
			$("#photo_txt").empty().append(o.find('.photo_txt').html());
			$("#photo img").attr("src",o.find('img').attr("src"));
			$("#photo img").fadeIn();
		});
	};
	$.enableThumb = function(o)
	{
		o.find('img').css('opacity','0.67');
		o.hover(
				function(){$(this).find('img').css('opacity','1')},
				function(){$(this).find('img').css('opacity','0.67')})
				.click(function(){
					$.clickThumb($(this));
					return false;
				});
	};
	$.playSlideShow = function()
	{
		if(!o)
		{

			o = $('#thumbs li:first');
		}else if(o.get(0) == $('#thumbs li:last').get(0)){
			$.focusThumb($('#thumbs li:first'));
			o = $('#thumbs li:first');
		}else{
			$.focusThumb(o.next());
			o = o.next('li');
		}
	};
	$.openCoordinate = function(time)
	{
		if(!time) time = 500;
		if(!$('#coordinate').hasClass('open'))
		{
			$('#coordinate').addClass('open');
			$('#left_menu').css('background','none');
			$('#coordinate').show();
			$.closeAbout();
			$('#coordinate').stop().animate({height: '72%'},time).animate({width: '100%'},time,function(){
				$('#coordinate .inner').show();
				if(!$.sliderIntervalID)
				{
					$('.scroll-pane').jScrollPane();
					$.focusThumb($('#thumbs li:first'));
					o = $('#thumbs li:first');
					$.sliderIntervalID = setInterval(function(){$.playSlideShow();},4000);
				}
			});
		}
	};
	$.closeCoordinate = function(time)
	{
		if(!time) time = 500;
		if($('#coordinate').hasClass('open'))
		{
			$('#coordinate').removeClass('open');
			$('#coordinate .inner').hide();
			$('#coordinate').stop().animate({width: '166px'},time).animate({height: '166px'},time,function(){
				$('#about').show();
				$('#coordinate').hide();
			});
		}else{
			$('#coordinate').hide();
		}
	};
	$.openAbout = function(time)
	{
		if(!time) time = 500;
		if(!$('#about').hasClass('open'))
		{
			$('#about').addClass('open');
			$('#left_menu').css('background','none');
			$('#about').show();
			$.closeCoordinate();
			$('#about').stop().animate({height: '72%'},500).animate({width: '50%'},time,function(){
				$('#about .box').show();
			});
		}
	};
	$.closeAbout = function(time)
	{
		if(!time) time = 500;
		if($('#about').hasClass('open'))
		{
			$('#about .box').hide();
			$('#about').removeClass('open');
			$('#about').stop().animate({width: '166px'},time).animate({height: '166px'},time,function(){
				$('#coordinate').show();
				$('#about').hide();
			});
		}else{
			$('#about').hide();
		}
	};	
})(jQuery);























