Is it not a right way to call my obj function?
<p>I have a function which is return a object. in the object i have two function to show the popup and close it. it works within the parent function, but it's not from out side.. is it not a right way to call that.. else how can i call the obj function from out side?</p>

<p>my function :</p>

<pre><code>var popupHandler = function(handler,msg,popUp){

    msg =  msg == "help" ? "help" : "results"
    $(handler).click(function(){
        popObj.showPop(); //works
    })
    $('.cls-how2play').click(function(){
        if(msg == 'help') popObj.closePop(); //works
    });

    var popObj = {
        showPop  : function(){
                    if(!(popUp).is(':visible')) $(popUp).fadeIn().children().find('.'+msg).show().siblings().hide();
                },
        closePop : function(){
                    $(popUp).fadeOut()
                }
    }
    return popObj;
}
</code></pre>

<p>from calling ouside like this :</p>

<pre><code> $('.ui-footer').click( function(){ 
  var closeIt = popupHandler(); 
  closeIt.popObj.closePop() }) //not works.. why?
}
</code></pre>

<p>any one can help me the right way to call the obj functions from outside of the returning function?</p>

<p>thanks.</p>
