avoid using a global variable

Discussion created by on Apr 18, 2012
So I'm creating a graphic on a map that when clicked displays an infowindow.  My infowindow contains radio buttons which I've assigned an onClick function.
Unfortunately, I'm using a global variable to call the widget's function.  How do I avoid using a global variable gShoppingCart?

Here's the pertinent code.

// widget
  startup: function() {
                        // i define my global here
   gShoppingCart = this;

display_browse_symbols2: function(tileIDassocArray){
                                        var title = 'Title';
     var content = '<input checked="checked" type="radio" name="browseRadioGroup" onClick="gShoppingCart.switchBrowse(\'someurl\')" id="Whatever" value="Whatever" />';

   var attrs = {
    "title": title,
    "content": content

   var orthoTileInfo = new esri.Graphic(point, pms, attrs);


  switchBrowse: function(browseUrl){
                   // do stuff here when radio button is clicked