/*
*	Toggle
*	A JS class for simple toggled content areas.
*	
*	Requires Trapeze jQuery library
*	
*	Jonathan McClare (jmcclare at trapeze dot com) - July 10, 2009
*
*	Usage:
*	Create a container element and pass its selector to the class when
*	instantiating it.
*
*	Make an anchor inside the container element with an href pointing to the ID
*	of the element you want to toggle. Tha container element is preferably
*	hidden by default by the stylesheet to keep non-JavaScript enabled browsers
*	from seeing it. The anchor's target is preferably displayed by default in
*	the stylesheet for non-JavaScript enabled browsers. The class will hide
*	the target when it initializes.
*/


$.namespace("trapeze.Toggle");

trapeze.Toggle = $.Class.extend({

    container : null,

    toggle_content : function() {
        
        $(this.container.find('a').attr('href')).toggle('slow');
        // return false to cancel the normal anchor action.
        return false;
    },

    init : function(activator_container) {

        this.container = $(activator_container);

        this.container.show();
        this.container.find("a").show();
        $(this.container.find('a').attr('href')).hide();

        this.container.find("a").bind('click', this.toggle_content.bind(this));
    }
});
