/* Usage 

1:  Get JQuery (jquery.com)
2: Put these lines in your header  ( assuming the name of the jquery here )
	<script type="text/javascript" src="scripts/jquery-1.1.2.js"></script>

	<script type="text/javascript" src="scripts/div_toggler.js"></script>
3: 
	Learn how to use jQuery Selectors ( mostly like CSS )
4:
	<script type="text/javascript">
		$(document).ready(function(){
			$("a.toggler_thing").toggler("div.thing_to_toggle", "toggledClass");
			$("a.toggler_thing").toggler("div.other_thing_to_toggle","other_toggled_class");		
		});
	</script>
*/


jQuery.fn.toggler = function( what, eclass){
	
	jQuery(this).click(function(){
	
		var scope=jQuery(this).parent().parent();
		
		jQuery("."+eclass,scope).addClass('tx');
		
		/* close all open windows */
		jQuery(" ."+eclass).removeClass(eclass);
		
		/* toggle teh chosen one */
		jQuery(what, scope).toggleClass(eclass);
		
		/* kill all tx's */
		var txnode = jQuery('.tx');
		
		txnode.removeClass(eclass);
		txnode.removeClass('tx');
		
		return false;
	});
	
	
	return this;
};

