ip2 = {};

ip2.clientServices = function() {

  ip2.pollDataQueue();

}

ip2.pollDataQueue = function() {

  $.ajax({
    url: 'http://loopback:60001/EventQueue',
    dataType: "jsonp",
    success: function( data ) {
      //console.log(data);
      if (data.event && data.event == "addTab" && data.parms) {
        var parm =  "";
        var text =  data.parms.text ? data.parms.text : "";  
        var url  =  data.parms.url;
        var hive = (url.indexOf('//') >= 0) ? "" : "menu"; // i.e. http://
        var sep  = (url.indexOf('?') >= 0)  ? "&" : "?"; 
        Ext.getCmp('portfolio-tabpanel').fireEvent('addTab', text , hive ,url + sep + $.param(data.parms));
      }
      ip2.pollDataQueue();
    }
  }); 
}
