// Add a "more" link after the target. 
// If the target has a title attribute this will be used as the text for the "more" link.
jQuery.fn.addMoreLink = function () {
    return this.each(function () {
            var target = jQuery(this);
            // create a more link and add it after the target
            var link = jQuery("<p class='readmore'><a href='#'>"+(target.attr('title') || "more")+"</a></p>");
            target.after(link);
            link.click(function() {
                // remove the more link and add it after the target
                link.remove();
                // add a less link 
                target.addLessLink();
                // show the target 
                target.slideDown("slow");
                return false;
                });});
};

// add a "hide" (less) link after the target. 
jQuery.fn.addLessLink = function () {
    return this.each(function () {
            var target = jQuery(this);
            // create a link link and add it after the target
            var link = jQuery("<p class='readless'><a href='#'>hide</a></p>");
            target.after(link);
            link.click(function() {
                link.remove();
                // add a more link 
                target.addMoreLink();
                // hide the target 
                target.slideUp("slow");
                return false;
                });
            });
};


