Refactoring first functions to work with parameters?!

Refactoring first functions to work with parameters?!

Hello everyone!

Well, I'm new to JavaScript and jQuery and after my initial successes I'd now like to refactor my tiny bit of code to make it more generally usable.

Therefore I'd like to use parameters and use those for the functions. But I'm a bit lost there.
I've programmed in JAVA before and I don't really get how to pass parameters in jQuery.

This is my code so far:

  1. // Ajax - Here be dragons!
    /**
     * Login Popup
     * Ajaxiness ftw!
     */
    $(document).ready(function() {
        $('a.login-link').click(function(e) {
            e.preventDefault();       
            $('#embedded-login').center().fadeIn(500);
           
            $('body').append('<div id="eclipse"></div>');
    //        $('body').append('<div id="embedded-login"></div>');
            $('#eclipse').fadeIn(300);
           
            $('#embedded-login .content').load('..form');
            return false;
        });
       
        // Cancel - Fade out
        $('.cancel').live('click', function() {
            $('#eclipse, #embedded-login').fadeOut(300, function() {
                $('#eclipse').remove();
            });
            return false;
        });
       
        // Outside *click* - Fade out
        $(document).mouseup(function(e) {
            var container = $('#embedded-login');
            if(!container.is(e.target) && container.has(e.target).length === 0) {
                $('#eclipse, #embedded-login').fadeOut(300, function() {
                    $('#eclipse').remove();
                });
            }   
        });
    });




































How can I make it so, that I can use these functions for different elements, specified by parameters?

I appreciate any help!

Kindest regards,
Ohoram