$(function() {
    // hide carrers list
    var currentLocation = window.location.pathname;
    var subNavMenu = $('.sidebar').find('#'+currentLocation[1]+'.ddsmoothmenu-v');
    if(subNavMenu.has('ul') == false){
        $('.careers-sidebar-list').hide();
    }
    
    $('img.lb').parent().lightBox();
    
    // contact info update - image map
    $('.contact-info').detach().appendTo('.sidebar');
    $('.contact-img-map').children().click(function(){
        var ctx = $(this);
        updateContactInfo(ctx);
        return false;
    });
    // contact info update - image
    $('.contact-img').parent().click(function(){
        var ctx = $(this);
        updateContactInfo(ctx);
        return false;
    });
    
    function updateContactInfo(ctx){
        // hide all children of contact containing div
        $('.contact-info').children().hide();
        $('.sidebar_wrap').find('ul#default').hide();
        // get hash of image map area
        var hash = $(ctx).attr('href');
        // show contact info - retunr false
        $(hash).show();
    }
});
