jQuery.extend({//START: jQuery.extend.

    /**
     *  flattenAttrs.
     */
    flattenAttrs : function (o, s)
    {
        var retval = []
        $.each(o||{}, function (k, v)
        {
            retval.push(k+'='+v);
        });
        return retval.join(s||',');

    }//END: flattenAttrs.

});//END: jQuery.extend.

jQuery.fn.extend({//START: jQuery.fn.extend.

    /**
     *  popup.
     */
    popup : function (name, options)
    {
        var settings = {
            'titlebar'      : 'no',
            'resizable'     : 'yes',
            'scrollbars'    : 'yes',
            'left'          : screen.width,
            'top'           : screen.height,
            'width'         : screen.availWidth,
            'height'        : screen.availHeight
        }
        options = jQuery.extend({}, settings, options||{});
        name = name || 'tabikobo';

        return this.filter('a[href]')
        .click(function (evt)
        {
            window
            .open(this.href, name, jQuery.flattenAttrs(options))
            .focus();

            return false;
        })
        .end();

    }//END: popup.

});//END: jQuery.fn.extend.
