function getSectionElement(name) {
    return $(document.getElementById(name.substring(5,name.length)));
}

function changeSection(name) {
    $('#content > div').each(function(index) { this.style.display='none'; });
    $('#sections a').each(function(index) { $(this).removeClass("actual"); });
    $(document.getElementById("open_"+name)).toggleClass("actual");
    document.getElementById(name).style.display='block';
    
}

$(document).ready(function() {
    $('#sections a').click(function() {  
        //If we are seeing this section, don't load it again!
        if ($(this).attr("className") == "actual") { return false; };

        //Change "actual" attribute
    	$('#sections a').each(function() { $(this).removeClass("actual"); });
    	$(this).toggleClass("actual");

        //Hide the non-actual sections
    	$('#content > div').each(function(index) { $(this).hide('slow'); });
    	
        //Show the section
        getSectionElement($(this).attr("id")).show("slow");
    });
});
