function img(id,onclick,file)
{
 document.write("<img id='"+id+"' alt='' style='position:absolute' onclick='"+onclick+"(this)' />");
 this.obj = document.getElementById(id);
 this.obj.src = file;
 this.obj.this1 = this; // zapewnia dostęp do funkcji i atrybutów elementu z funkcji onclick

 this.id = id;
 this.type = "aimg";
 this.timer = null;
 this.src = function(file) {
  this.obj.src = file;
  }
 this.xy = function(x,y) {
  this.obj.style.left = x;
  this.obj.style.top = y;
  }
 this.axy = function(time,x,y,onend) {
  this.exy = onend;
  this.txy1 = 0;
  this.txy2 = time;
  this.x1 = this.obj.style.left;
  this.y1 = this.obj.style.top;
  this.x2 = x;
  this.y2 = y;
  this.animxy();
  }
 this.wh = function(w,h) {
  this.obj.style.width = w;
  this.obj.style.height = h;
  }
 this.awh = function(time,w,h,onend) {
  this.ewh = onend;
  this.twh1 = 0;
  this.twh2 = time;
  this.w1 = this.obj.style.width;
  this.h1 = this.obj.style.height;
  this.w2 = w;
  this.h2 = h;
  this.animwh();
  }
 this.op = function(opacity) {
  this.opacity = opacity;
  this.obj.style.opacity = opacity/100;
  this.obj.style.filter ="alpha(opacity="+opacity+")";
  }
 this.aop = function(time,opacity,onend) {
  this.eop = onend;
  this.top1 = 0;
  this.top2 = time;
  this.op1 = this.opacity;
  this.op2 = opacity;
  this.animop();
  }
 this.cl = function(x1,x2,y1,y2) {
  this.clip = new Array(x1,x2,y1,y2);
  this.obj.style.clip = "rect("+x1+" "+x2+" "+y1+" "+y2+")";
  }
 this.acl = function(time,x1,x2,y1,y2,onend) {
  this.ecl = onend;
  this.tcl1 = 0;
  this.tcl2 = time;
  this.cl1 = this.clip;
  this.cl2 = new Array(x1,x2,y1,y2);
  this.animcl();
  }
 this.animxy = function() {
  if (this.txy2 != null) {
   if (this.txy1 <= this.txy2) {
    setTimeout(this.id+".animxy()",10);
    this.obj.style.left = parseInt(this.x2) + (parseInt(this.x1) - parseInt(this.x2)) * 
     (parseInt(this.txy2) - parseInt(this.txy1)) / parseInt(this.txy2);
    this.obj.style.top = parseInt(this.y2) + (parseInt(this.y1) - parseInt(this.y2)) * 
     (parseInt(this.txy2) - parseInt(this.txy1)) / parseInt(this.txy2);
    this.txy1 += 10;
    }
   else {
    if (this.exy != null)
     this.exy();
    else {
     this.exy = null;
     this.txy1 = null;
     this.txy2 = null;
     }
    }
   }
  }
 this.animwh = function() {
  if (this.twh2 != null) {
   if (this.twh1 < this.twh2) {
  setTimeout(this.id+".animwh()",10);
    this.obj.style.width = parseInt(this.w2) + (parseInt(this.w1) - parseInt(this.w2)) * 
     (parseInt(this.twh2) - parseInt(this.twh1)) / parseInt(this.twh2);
    this.obj.style.height = parseInt(this.h2) + (parseInt(this.h1) - parseInt(this.h2)) * 
     (parseInt(this.twh2) - parseInt(this.twh1)) / parseInt(this.twh2);
    this.twh1 += 10;
    }
   else {
    if (this.ewh != null)
     this.ewh();
    else {
     this.ewh = null;
     this.twh1 = null;
     this.twh2 = null;
     }
    }
   }
  }
 this.animop = function() {
  if (this.top2 != null) {
   if (this.top1 < this.top2) {
    setTimeout(this.id+".animop()",10);
    this.op(parseInt(this.op2) + (parseInt(this.op1) - parseInt(this.op2)) * 
     (parseInt(this.top2) - parseInt(this.top1)) / parseInt(this.top2));
    this.top1 += 10;
    }
   else {
    if (this.eop != null)
     this.eop();
    else {
     this.eopy = null;
     this.top1 = null;
     this.top2 = null;
     }
    }
   }
  }
 this.animcl = function() {
  if (this.tcl2 != null) {
   if (this.tcl1 < this.tcl2) {
    setTimeout(this.id+".animcl()",10);
    x1 = parseInt(this.cl2[0]) + (parseInt(this.cl1[0]) - parseInt(this.cl2[0])) * 
     (parseInt(this.tcl2) - parseInt(this.tcl1)) / parseInt(this.tcl2);
    x2 = parseInt(this.cl2[1]) + (parseInt(this.cl1[1]) - parseInt(this.cl2[1])) * 
     (parseInt(this.tcl2) - parseInt(this.tcl1)) / parseInt(this.tcl2);
    y1 = parseInt(this.cl2[2]) + (parseInt(this.cl1[2]) - parseInt(this.cl2[2])) * 
     (parseInt(this.tcl2) - parseInt(this.tcl1)) / parseInt(this.tcl2);
    y2 = parseInt(this.cl2[3]) + (parseInt(this.cl1[3]) - parseInt(this.cl2[3])) * 
     (parseInt(this.tcl2) - parseInt(this.tcl1)) / parseInt(this.tcl2);

    this.cl(x1,x2,y1,y2);
    this.tcl1 += 10;
    }
   else {
    if (this.ecl != null)
     this.ecl();
    else {
     this.ecl = null;
     this.tcl1 = null;
     this.tcl2 = null;
     }
    }
   }
  }
}
