Something like;

```
var count = 0;
if (wmsLayers.length > 0) {
    Ext.each(wmsLayers, function(layer, index, all) {
        if (layer.params.QUERYABLE == true && layer.getVisibility()) {
            count++;
            if (layer.metadata.units == undefined && layer.isNcwms()) {
                // populate unit information now
                this._setMetadataFirst(layer);
            }
            else {
                this._requestFeatureInfo(layer);
            }

            if (!resized) {
                this.setSize(this.appConfig.popupWidth, this.appConfig.popupHeight);
                resized = true;
            }
        }
    }, this);
}
if (count == 0) {
    this.setTitle(OpenLayers.i18n('noDataCollectionTitle'));
    this.depthInfoPanel.update("");
}
```