Reuse function without global variables?
===

A couple of days ago I have learned on my own example how bad global variables and functions are. So apparently the best solution is NOT to use them, however SOONER or LATTER I will need to reuse my variables and functions over and over again. <br/><br/>So my question is : <i>Can I reuse my functions and variables without declaring them globally? Can it be done?</i> THX!!
<br/><br/>For example I want to reuse my <b>alertBox</b> function and my <b>containsP</b> variable couple of times :
<br/><a href="http://jsfiddle.net/ajmyZ/">FIDDLE HERE</a>
   

    $(document).ready(function(){
    //I am BAD GLOBAL FUNCTION inside var 
    //But I am reusable!!! 
    
    var alertBox = function(){
    alert("Hey I am BAD function!!")
    }

    //I am BAD GLOBAL var 
    //But I am reusable TOO!!! 
    
    var containsP = $("div p:first");


    containsP.click(function(){
    alert("Hi BAD var HERE!!");
    });

    $("p").eq(1).click(function(){
    alertBox();
    });

    //I am the NICEST function here
    //but I am NOT reusable :(
    
    $("p").eq(2).click(function(){
    alert("I am the NICEST function here!!");

    });

    });