if (!ww) ww = {}
ww.exhibitions = function (config) { 
  Ext.apply(this, {
    sources: [], defaultPath: '', images: [],
    init: function () {
      if (this.sSources) {
        eval(this.sSources);
        if (sJSON) this.sources = sJSON
      }
      for (var i in this.sources) {
        var index = this.images.push(new Image()) - 1;
        var img = this.images[index];
        img.src = this.defaultPath + this.sources[i];
      }
    }
  });

  Ext.apply(this, config);
  this.init();
}

var ex_func = {
  opened: [],
  getTabID: function (url) {
    var iReturn = -1;
    for (var i=0; i<ex_func.opened.length; i++) {
      if (url==ex_func.opened[i]) iReturn = i;
    }
    return iReturn;
  },
  loading: {},
  focusImg: null,
  isImageLoaded: function () {
    var img = ex_func.focusImg;
    if (!img.complete) return false;
    if (typeof(img.naturalWidth) != "undefined") {
      if (img.naturalWidth == 0) return false;
    }
    return true;
  },
  waitForImageLoaded: function (url) {
    if (ex_func.focusImg) {
      if (ex_func.isImageLoaded()) ex_func.loadImage(url);
        else ex_func.timer = setTimeout("ex_func.waitForImageLoaded('" + url + "')", 500);
    } else {
      ex_func.loadImage(url);
    }
  },
  loadImage: function (url) {
    ex_func.focusImg.src=url;
    if (ex_func.isImageLoaded()) {
      var ex_win = new Ext.Window({
        title: 'Show Image',
        layout: 'fit',
        width: ex_func.focusImg.width,
        plain: true,
        resizable: false,
        bodyStyle:'padding:5px;',
        animateTarget: 'animTarget',
        html: '<img src="' + url + '" />'
      });
      ex_win.show();
    } else {
      ex_func.waitForImageLoaded(url);
    }
  }
}

Ext.onReady(function(){
  Ext.QuickTips.init();
  exImages = new ww.exhibitions({
    sSources: oParam.FlashVars,
    defaultPath: '/resources/whatsup'
  });
  ex_func.focusImg = document.createElement('img');
})