
// This file will initialize the particular trip tab structure
$(document).ready(function() {
    // First, we want to hide all of the contents   
    $('.content').hide();

    // We want to change the article content when they are pressed
    $.address.externalChange(function(event) {
        var hash = $.address.value();

        hash = hash.replace("#","/");
        if (hash == "/") 
            hash = "/description";
        var hashes = hash.split("/");
        hash = hashes[1];

        // Now, we want to load the requested content
        $('#content').html($('#' + hash + '_content').html());

        // Then, make the requested link the only active link
        $('article .selected').removeClass('selected');
        $('#' + hash + '_li').addClass('selected');

        // Now, if the trip is a boat trip, we want to see if a particular
        // boat element is selected
        if (hash == 'boats') {
            if (hashes.length > 2) {
                // We want to display the selected raft element
                $('#boats_inner_content').html($('#boats_' + hashes[2] + '_content').html());
                $('.boats .selected').removeClass('selected');
                $('#boats_' + hashes[2] + '_li').addClass('selected');
            }
        }
    });

});


