var url = location.href;

// int: location of hash in string.
var hash_location = url.lastIndexOf('#');
var anch = url.substring(hash_location + 1);

$(document).ready(function() {
    
    if (hash_location != -1 && anch != '') {
        $("[title=" + anch + "]").addClass('selected');
        $("#" + anch).show(); 
    } else {
        $('.benefits > .side > ul li a:eq(0)').addClass('selected');
        $('.benefits > .main > div:eq(0)').show();
    }
    
    $('.benefits > .side > ul li a').click(function() {
        $('.selected').removeClass('selected');
        $(this).addClass('selected');
        $('.main > div:visible').hide();
        var section = "#" + $(this).attr('title');
        $(section).show();
        return false;
    });
});
