
function img(){

  var w = EL({parentNode:document.body, id:'imgWin', 
    close:function(){
      this.parentNode.removeChild(this);
      document.body.onclick = null;
    }
  });


  var h = EL({parentNode:w, className:'h', innerHTML:this.title});
  EL({parentNode:h, className:'closeBtn', onclick:function(){ w.close(); } });
  var c = EL({parentNode:w, className:'c'});
  var size = this.getAttribute("size").split(",");
  EL({
    tagName:'img', 
    parentNode:c, 
    width:size[0],
    height:size[1],
    src:this.src.replace(/\.(small|fr)\./, '.large.') 
  });
  var descr = this.getAttribute("descr");
  if (descr){
    EL({parentNode:c, innerHTML:descr, className:'descr'})
  }
  setTimeout(function(){
    document.body.onclick = function(){ w.close(); }
  },1);

}


function $(el) {return (typeof el == 'string') ? document.getElementById(el) : el;}
function EL(o){
  var el = document.createElement(o.tagName||'div');
  for (var i in o){
    switch (i) {
      case 'parentNode': 
      case 'tagName': break;
      
      case 'style': 
        for (var p in o.style) el.style[p] = o.style[p];
        break;
      
      default: 
        el[i] = o[i];
    }
  }
  if (o.parentNode) o.parentNode.appendChild(el);
  for (var m in Element.Methods) el[m] = Element.Methods[m];
  return el;
};

if (!window.Element) var Element = {};
Element.Methods = {
  addClassName: function(cl){ 
    if (!this.className.match(new RegExp("\\b"+cl+"\\b"))) this.className += ' '+cl; 
  },
  removeClassName: function(cl){ 
    this.className = this.className.replace((new RegExp("\\b"+cl+"\\b")), '');
  },
  replaceClassName: function(a, b){
    this.className = this.className.replace((new RegExp("\\b"+a+"\\b")), b);
  }
};

if (!Array.prototype.forEach)
{
  Array.prototype.forEach = function(fun /*, thisp*/)
  {
    var len = this.length;
    if (typeof fun != "function")
      throw new TypeError();

    var thisp = arguments[1];
    for (var i = 0; i < len; i++)
    {
      if (i in this)
        fun.call(thisp, this[i], i, this);
    }
  };
}
