efficient coding for plugin

efficient coding for plugin

hello everyone,

i'm working with a plugin called simpleTip for creating hovertip effects.

i just had a general question about proper and efficient coding since i find myself repeating a lot of the same lines.

my JS script in my HTML header is:

<script type="text/javascript">
        $(document).ready(function() {
           
            function setupDemo(){
               
            $("JQUERY NAME").simpletip({
                fixed:true,
                position:["210", "-200"],
                content : 'fuck you',
               
                showEffect: 'custom',
                hideEffect: 'custom',
                showCustom: function(){
                    $(this).animate({
                        width: '150px',
                        height: '50px',
                        opacity: 1,
                        display: 'block'
                    }, 400);
                },
                hideCustom: function(){
                    $(this).animate({
                        width: '50px',
                        height: '0px',
                        opacity: 0,
                        display: 'none'
                    }, 400);
                }
               
            });
        });
    </script>

i have to make several JQUERY calls, and within each call, there exists the same section of code. how do i take that piece of the code (represented in red below) create a function, and just call that function instead?
i tried making a new function just above the JQUERY call
function REPEAT()
{
 repeated code in here.....
}




and then calling REPEAT(); but this doesn't work. dreamweaver just tells me that i have a syntax error at that line when i try that.

i'm sure its something really easy. would appreciate any help. thanks!