(function($){

    /* Current Selection */
    function show_dependents(_this, _event){
	    var current = $('select option[value=' + $(_this).val() + ']').attr("class");
	    if(current.length > 0){
	        var temp = $(_this).closest('label, li, div, fieldset').attr("class").split(' ');
	        for(var i = 0; i < temp.length; i++){
		        if(temp[i].search("group-") >= 0){
			        temp = "." + temp[i] + "." + "dependent";
			        $(temp).find('label, input, select, li, div, fieldset').not('.' + current).fadeOut(function(){
				        $(temp).find('label, input, select, li, div, fieldset').not('.' + current).hide();
			        });
			        $(temp).find('.' + current).removeAttr('disabled').fadeIn();		
		        }
	        }
	    }
    }

	$.fn.rlmforms = function(options){
		/*
		var defaults = {
			dParent: '.has-dependents',
			dChild: '.dependent',
			dGroup: 'group-'
		};
		var options = $.extend(defaults, options);
		*/
		
		return this.each(function(){
		
			$(this).bind('change.current', 
			    function(e){
			        show_dependents(this, e);
			    }
			);			
			$(this).trigger('change.current');
		}); // this.each()
	} // $.fn.rlmforms = function(options)

})(jQuery);
