(function($) {$.fn.expandAll = function(options) { var defaults = {expTxt : '[Expand All]',cllpsTxt : '[Collapse All]',cllpsEl : '.collapse', trigger : '.expand', ref : '.expand', showMethod : 'show',hideMethod : 'hide',state : 'hidden', speed : 0,oneSwitch : true }; var o = $.extend({}, defaults, options);var toggleTxt = o.expTxt; if (o.state == 'hidden') {$(this).find(o.cllpsEl).hide();$(this).find(o.trigger + ' > a.open').removeClass('open'); } else {toggleTxt = o.cllpsTxt;} return this.each(function(index) {var referent, $cllps, $tr;if (o.ref) {var container;if (this.id.length) { container = '#' + this.id;} else if (this.className.length) { container = this.tagName.toLowerCase() + '.' + this.className.split(' ').join('.');} else {container = this.tagName.toLowerCase();}referent = $(this).find("'" + o.ref + ":first'");$cllps = $(this).closest(container).find(o.cllpsEl);$tr = $(this).closest(container).find(o.trigger + ' > a');} else {referent = $(this);$cllps = $(this).find(o.cllpsEl);$tr = $(this).find(o.trigger + ' > a');}if (o.oneSwitch) {referent.before('<p class="switch"><a href="#">' + toggleTxt + '</a></p>');} else { referent.before('<p class="switch"><a href="#">' + o.expTxt + '</a>&nbsp;|&nbsp;<a href="#">' + o.cllpsTxt + '</a></p>');}referent.prev('p').find('a').click(function() {if ($(this).text() == o.expTxt) { if (o.oneSwitch) {$(this).text(o.cllpsTxt);} $tr.addClass('open'); $cllps[o.showMethod](o.speed);} else { if (o.oneSwitch) {$(this).text(o.expTxt);} $tr.removeClass('open'); $cllps[o.hideMethod](o.speed);}return false; });});};/* ----Toggler----- */$.fn.toggler = function(options) { var defaults = {cllpsEl : 'div.collapse',method : 'slideToggle',speed : 'slow',container : '', initShow : '.shown'}; var o = $.extend({}, defaults, options); $(this).wrapInner('<a style="display:block" href="#" title="Expand/Collapse" />'); return this.each(function() {var container;(o.container) ? container = o.container : container = 'div';if (o.initShow) {$(this).closest(container).find(o.initShow).show().prev().find('a').addClass('open');}$(this).click(function() { $(this).find('a').toggleClass('open').end() .next(o.cllpsEl)[o.method](o.speed); return false; });});};$.fn.toggleHeight = function(speed, easing, callback) { return this.animate({height: 'toggle'}, speed, easing, callback);};$.fn.fadeToggle = function(speed, easing, callback) { return this.animate({opacity: 'toggle'}, speed, easing, callback);};$.fn.slideFadeToggle = function(speed, easing, callback) { return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback);};})(jQuery);