// apostropheReady is called at domReady
// it hooks into the a_js javascript framework
// it can be used for progressive enhancements at runtime
// such as Cufon text replacement

function apostropheReady()
{

	// top navigation enhancements
	$(".a-nav-main .a-nav-item").hover(function(e){
		e.preventDefault();
		$(this).stop().animate({
	    backgroundColor: "#ccc"
	  }, 125 );
	},function(e){
		e.preventDefault();
		$(this).stop().animate({
	    backgroundColor: "#efefef"
	  }, 250 );
	});

}

function fullSlideshow ()
{
	// sizes green tabs to fit
 	var slideshowTitle = $('div.a-area-full-banner .a-slideshow-title');
  	var slideshowControls = $('div.a-area-full-banner .a-slideshow-controls');

/*	slideshowControls.fadeTo(.0,.5);
	$('div.a-area-full-banner .a-slideshow-title').mouseenter(function(){
		slideshowTitle.fadeTo(100,1.0);
	}).mouseleave(function()
	{
		slideshowTitle.fadeTo(100,.5)
	});

	slideshowControls.hover(function(){
		slideshowTitle.stop();
		slideshowTitle.fadeTo(.0,1.0);
	},function(){
	});*/

	// Inject Vignette Overlay
	//$('div.a-area-full-banner .a-slideshow-image').append('<div class="a-image-overlay"></div>').fadeTo(1000,1);

	// Format Title and
	// Move Description Inside Title Container
	$('div.a-area-full-banner .a-slideshow-title').each(function(){
		$(this).wrapInner('<h3></h3>');
		$(this).append($(this).next().removeClass('a-slideshow-meta'));
		$(this).append('<div class="a-homepage-slideshow-toggle"><a href="#" onclick="return false;">Return Home</a></div>');
		$(this).wrapInner('<div class="a-slideshow-title-padding"></div>');
	})

	var slideshowToggle = $('.a-homepage-slideshow-toggle');

	slideshowToggle.children('a').click(function(event){
		event.preventDefault();
		// Toggle Body Class to Hide / Show the Slideshow controls
		$(document.body).toggleClass('show-slideshow');
		/*if (!$(document.body).hasClass('show-slideshow'))
		{
			// $(this).text('Return Home');  ONLY NEEDED IF TOGGLE IS AT THE TOP OF THE PAGE DURING FS SLIDESHOW
			$('.a-image-overlay').each(function(){
				$(this).fadeOut("fast", function(){
					$(this).hide();
				});
			})
		}
		else
		{
			// $(this).text('Reveal Slideshow');
			$('.a-image-overlay').each(function(){
					$(this).fadeIn("slow", function(){
				});
			})
		}*/
	})

	w = $(window);
	checkWindow();
	w.resize(function(){
		checkWindow();
	});

	function checkWindow()
	{
		if ((w.width()/w.height()) < (4/3)) // Checking window size against image aspect ratio.
		{
			$(document.body).addClass('tall');
		}
		if ((w.width()/w.height()) > (4/3)) // Checking window size against image aspect ratio.
		{
			$(document.body).removeClass('tall');
		}
	}
}
