// JavaScript Document

Cufon.replace('.nav a', {fontFamily:'Futura', hover:{color:'#C31727'}});

$(document).ready(function() {
	
	$('#SlideShow img.slide').hide();
	
	$('.nav a').each(function(index) {
		$(this).hover(function() {
			_overHref = String($(this).attr('href'));
			animateSlides();
			$(this).addClass('current');
			Cufon.refresh('.nav a');
		}, function() {
			$('#SlideShow img.slide').stop().fadeTo('slow', 0).show();
			$('.nav a').removeClass('current');	
			Cufon.refresh('.nav a');
		});	
	});
	
	$('#Map area').each(function(index) {
		$(this).hover(function() {
			_overHref = String($(this).attr('href'));
			animateSlides();
			$('.nav a').each(function(index) {
				if (String($(this).attr('href')) == _overHref) {
					$(this).addClass('current');
					Cufon.refresh('.nav a');
				} else {
					$(this).removeClass('current');	
					Cufon.refresh('.nav a');
				}
			});
		}, function() {
			$('.nav a').removeClass('current');	
			Cufon.refresh('.nav a');
		});	
	});
	
});

function animateSlides() {
	$('#SlideShow img.slide').each(function(index) {
		if ($(this).attr('id') == 'Slide_'+_overHref.replace(/[^a-z0-9]/gi, '')) {
			$(this).stop().fadeTo('slow', 1).show();
		} else {
			$(this).stop().fadeTo('slow', 0).show();
		}
	});	
}

