 $(document).ready(function()
{
	
	var staticURL = location.href;

	if (staticURL.lastIndexOf('//'))
	{
		var relativeURL = staticURL.substr(staticURL.lastIndexOf('//') + 2, staticURL.length);
		relativeURL = relativeURL.substr(relativeURL.indexOf('/'), relativeURL.length);
	}
	
	var primaryNavigationMenu = $('div.menuWrapper ul').html();
	$('div.menuWrapper ul').html("<li><a href='/index.html' class='noBackground'>Home</a></li>" + primaryNavigationMenu);
	$('div.menuWrapper ul li:last-child').addClass('lastItem');						

	if (relativeURL !=  '/index.html')
	{
		
		//Loop through each A tag in the Container.
		$('div.menuWrapper a').each(function() 
		{
			if ($(this).attr('href') != "#" && $(this).attr('href') != "#")
			{
				
				if ($(this).attr('href') == staticURL || $(this).attr('href') == relativeURL)
				{
					$(this).parent().parent().parent().addClass('currentSection');
					$(this).addClass('currentPage');
					
					$('.menuWrapperSecondary').html($(this).parent().parent().parent().html());
				}
			}								
		});
		
		$('.menuWrapperSecondary ul li:first a').addClass('firstItem');
	}
					
	$('div.menuWrapper ul li').hover(
		function() { $('ul', this).css('display', 'block'); },
		function() { $('ul', this).css('display', 'none'); }
	);
});
 




     

// Banner Slideshow Function

$(function() {
	$('#slideshow').cycle();

});

// Tabbed Panel Fucntion

$(function () {
		var tabContainers = $('div.tabs > div');
		tabContainers.hide().filter(':first').show();
		
		$('div.tabs ul.tabNavigation a').click(function () {
				tabContainers.hide();
				$("#flashcontent2").html("");
				so.write("flashcontent2");
				tabContainers.filter(this.hash).show();
				$('div.tabs ul.tabNavigation a').removeClass('selected');
				$(this).addClass('selected');
				return false;
		}).filter(':first').click();
});
