/**
 * jQuery Markup First and Last Plugin
 * 
 * Copyright 2009, nojimage (http://php-tips.com/)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 * 
 * @filesource 
 * @version    1.0
 * @author     nojimage <nojimage at gmail.com>
 * @copyright  2009 nojimage
 * @license    http://www.opensource.org/licenses/mit-license.php The MIT License
 * @link       http://php-tips.com/
 * @modifiedby nojimage <nojimage at gmail.com>
 * 
 * Usage:
 * 
 * <script type="text/javascript" src="js/jquery.markup_first_last.js" charset="utf-8"></script>
 * <script type="text/javascript">
 * //<!CDATA[
 * $(document).ready(function(){
 *     $.firstLast();
 *     // or
 *     $('selector').firstLast();
 * });
 * //]]>
 * </script>
 * 
 */
(function($)
{
    jQuery.fn.firstLast = function()
    {
        jQuery(this).children(':first').addClass('first');
        jQuery(this).children(':last').addClass('last');
    }

    jQuery.extend( {
        "firstLast" : function(selector)
        {
            if (typeof selector == "undefined") {
                selector = 'ul,ol';
            }
            
            jQuery(selector).each(function()
            {
                jQuery(this).firstLast();
            });
        }
    });
})(jQuery);
