(function($) {
$.fn.extend({
Expandable: function() {
this.each(function() {
var $this = $(this),
text,
config = {
handle: ".handle",
content: ".content",
showText: "Show",
hideText: "Hide"
},
exts = $this.ParseClass();

for (var key in exts) {
config[key] = exts[key];
}

$(config.handle, $this).click(function(e) {
if ($this.hasClass("hide")) {
text = $(config.handle, $this).html();
text = text.replace(config.showText, config.hideText);
$(config.handle, $this).html(text);
$this.addClass("show").removeClass("hide");
$(config.content, $this).show('blind', {}, 500, function() {
$(config.content, $this).css({display:""});
});
} else {
$(config.content, $this).hide('blind', {}, 500, function() {
text = $(config.handle, $this).html();
text = text.replace(config.hideText, config.showText);
$(config.handle, $this).html(text);
$(config.content, $this).css({display:""});
$this.addClass("hide").removeClass("show");
});
}
e.preventDefault();
});
});
}
});

$(document).ready(function() {
$(".expandable").Expandable();
});
})(jQuery);
