I am having some trouble working with oo javascript. I am creating a new object public and private methods. Now when I am calling the public method, it cannot access the private variable.
I believe I should return the public methods ( the internet ) but dont really know why.
Can someone please explain what I am missing?
function something(){
    var somePanel;  // it is a jquery object to a div
    var createWindow = function(data){
        random.xhr('/chat', 'GET', null, function(res){
            var Container = $("#Container");
            somePanel = $("<div/>").addClass('somePanel').append(res);
            Container.append(somePanel.hide());
        });     
    };
    this.activate = function(){
        somePanel.show().siblings().hide();
    };
    this.init = function(data, fn){
        createWindow(data);
    };
};
connections[data] = new something();  // creates a new something object
connections[data].init(data);   //  which creates just a div object, actually
connections[data].activate();  // has code to show this panel and hide every other panel
When I call the activate() method, it cannot find somePanel. What should I be doing differently? And why?
 
     
    