$(document).ready(function() {

	// map fade toggle
	$('nav ul li:first').first().click(function(e) {
		e.preventDefault();
		if ( $('#map').css('display') == "none") {
			$('footer').css('margin-top', '40px');
			$(window).scrollTop(441);
		}
		if (jQuery.browser.msie) {
			if ( $('#map').css('display') == "none") {
				$('#map').show();
			}
			else {
				$('#map').hide();
				$('footer').css('margin-top', '300px');
			}
		}	
		else {
			$('#map').fadeToggle('slow', function() {
				if ( $('#map').css('display') == "none") {
					$('footer').css('margin-top', '300px');
				}
			});
		}
	});
	
	// location infoboxes
	$('#map .point a').click(function(e) {
		e.preventDefault();
		var city = $(this).parent().attr('class').split(' ')[1]
		if (jQuery.browser.msie) {
			if ( $('.' + city + ' .infobox').css('display') == "none") {
				$('.' + city + ' .infobox').show();
			}
			else {
				$('.' + city + ' .infobox').hide();
			}
		}	
		else {
			$('.' + city + ' .infobox').fadeToggle('fast', function() { } );
		}
		$('#mapOverlay').show();
		
		
	});
	// close
	$('#map .infobox .close').click(function() {
		$('#map .infobox').hide();
		$('#mapOverlay').hide();
	});
	$('#mapOverlay').click(function() {
		$(this).hide();
		$('#map .infobox').hide();
	});

 });

