var CommonClass = function(){

  this.popup = function(url, params){
    var props = $H({width:550,height:600,status:0,directories:0,hotkeys:1,location:0,menubar:0,resizable:1,scrollbars:0,toolbar:0}).
                merge($H(params)).
                map(function(pair){return pair.join('='); }).
                join(','); 

    var win = window.open(url,'pop',props);
    win.focus();
    return win;
  }

	this.changeImg = function(el, src){
    var clone = function(counter){
      if (ref.complete){
        if( ref.width>0 && ref.height>0 ){
          el.src     = ref.src;
          el.width   = ref.width;
          el.height  = ref.height;
        } 
      } else {
        if (typeof(counter) != 'Number'){ counter=1; } else { counter++;  }
        if (counter < 20) { setTimeout(function(){ clone(counter)},200); } 
      }
    }
    var ref = new Image();
    ref.src = src+"?"+Math.random();
    clone(ref); 
  }

};

var Common = new CommonClass();
