Hello all!
First time posting here, and really... first time really looking into JS, so please be indulgent

I am creating a simple corporate page, visible at http://theimagists.com/clientspace/uneac/uneac2.

When clicking on each element of the nav, I managed to make it toggle the corresponding div/paragraph.
Problem is, unless you close the paragraph before clicking on the next nav element, you end up with a mess within seconds.

I am looking for someone who could help me tweak my .js file so it closes all other visible divs before opening a new one. There is a change it is ridiculously easy, but as I mentioned I started playing with this this morning for the first time, and am trying to understand as I go

The full .js file is here: http://theimagists.com/clientspace/u...neac2/uneac.js.
Not sure if I should post the whole code here or if clicking my link will be sufficient for you. A billion thanks to whomever will decide to help!

Here is the .js code I have for now:

Code:
$(document).ready(function() {

// VISION fade toggle
$('#link1').first().click(function(e) {
e.preventDefault();
if ( $('#map').css('display') == "none") {
$('footer').css('margin-top', '50px');
}
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');
}
});
}
});



// FILMS fade toggle



$('#link2').first().click(function(e) {
e.preventDefault();
if ( $('#map2').css('display') == "none") {
$('footer').css('margin-top', '50px');
}

if (jQuery.browser.msie) {
if ( $('#map2').css('display') == "none") {
$('#map2').show();


}

else {
$('#map2').hide();
$('footer').css('margin-top', '300px');
}
}
else {
$('#map2').fadeToggle('slow', function() {
if ( $('#map2').css('display') == "none") {
$('footer').css('margin-top', '300px');
}
});
}
});



// INITIATIVES fade toggle
$('#link3').first().click(function(e) {
e.preventDefault();
if ( $('#map3').css('display') == "none") {
$('footer').css('margin-top', '50px');
}
if (jQuery.browser.msie) {
if ( $('#map3').css('display') == "none") {
$('#map3').show();

}
else {
$('#map3').hide();
$('footer').css('margin-top', '300px');
}
}
else {
$('#map3').fadeToggle('slow', function() {
if ( $('#map3').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();
});

});

Here is the HTML for the nav and the divs:

Code:
<section id="content">

<nav>
<ul>
<div id="link1" style="display:inline"><li><a href="#/" rel="nofollow" target="_blank">VISION</a></li></div>
<div id="link2" style="display:inline"><li><a href="#/" rel="nofollow" target="_blank">FILMS</a></li></div>
<div id="link3" style="display:inline"><li><a href="#/" rel="nofollow" target="_blank">INITIATIVE</a></li></div>
</ul>
</nav>


<div id="mapOverlay"></div>

<div id="map">
<h3>UNEAC VISION</h3>
<p>We value our integrity as a production company that produces compelling, entertaining feature films that advocate social action. Our aspiration to bring about progressive change for the global community inspires the choices we make when deciding to produce a film.</p>


</div>




<div id="map2">
<h3>UNEAC FILMS</h3>
<p>UNEAC Films*is a subsidiary within UNEAC Entertainment that serves as a financial arm to ensure that our productions come to life and are commercially viable. While our artistic freedom is our utmost priority, we are conscious of the importance of creating films that resonate economically with the current marketplace. Keeping those considerations in mind allows us to select, develop and market successful films.
</p>

</div>




<div id="map3">