$(function() {
    //Resolve CSS selectors provided by the page context into jQuery references
    extraDescription    = $(extraDescription);
    expander            = $(expander);
    collapser           = $(collapser);
    lightBoxLinks       = $(lightBoxLinks);

    //Set up the popup lightbox for model images
    lightBoxLinks.fancybox({
       hideOnContentClick: true,
       transitionIn:   'elastic',
       transitionOut:  'elastic',
       easingIn:       'easeOutBack',
       speedOut:       150
    });
    
    //Toggles the state of the extra description field when one of its toggles is clicked
    function toggleExtraDescription(show)
    {
    	$(expander).toggle(!show);
    	$(collapser).toggle(show);
    	if (show)  $(extraDescription).slideDown("fast");
    	else       $(extraDescription).slideUp("fast");
    }
    
    $(expander).click(function()    { toggleExtraDescription(true); return false; });
    $(collapser).click(function()   { toggleExtraDescription(false); return false; });
    
    //Set up initial state of special description
    $(collapser).hide();
    $(extraDescription).hide();
});
