////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Waterford Javascript functions
// This file includes a collection of functions for use on the Waterford site
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

$(function()
{
	// toggle navigation rollover
	$('.nav div').hover(show_nav,hide_nav);

	// toggle subnav rollover
	$('.nav div a.sublink img').hover(show_nav,hide_nav);

	if($('#main_slideshow').length > 0) {
		setInterval('main_slideshow()',4500);
	}

});


function show_nav()
{
	$(this).css('opacity','1.0').css('filter','alpha(opacity=100)').css('-moz-opacity','1.0');

}

function hide_nav()
{
	$(this).css('opacity','0.0').css('filter','alpha(opacity=0)').css('-moz-opacity','0.0');
}

function main_slideshow()
{
   var current_image = $('#main_slideshow img:visible');
   var next_image = current_image.next().attr('tagName') != 'IMG' ? current_image.siblings('img:first') : current_image.next();

   current_image.fadeOut(3000);
   next_image.fadeIn(3000);
}