  function lib_browsercheck() {
      this.ie = (document.all) ? 1:0;
      this.ns = (document.layers) ? 1:0;
      this.dom = (document.getElementById) ? 1:0;
      this.lib = (this.ie||this.ns||this.dom);
      return this;
  }
  libbrowser = new lib_browsercheck();
  function lib_obj(id,parent) {
      this.id = id + "Object"; eval(this.id + "=this");
      this.parent = parent;
      if(libbrowser.dom) { this.obj = document.getElementById(id); }
      if(libbrowser.ie) { this.obj = document.all[id]; }
      if(libbrowser.ns) { this.obj = eval(this.parent + 'document.layers.' + id); }
      this.css = (libbrowser.dom || libbrowser.ie) ? this.obj.style : this.obj;
      this.ref = (libbrowser.dom || libbrowser.ie) ? document : this.css.document;
      this.x = parseInt(this.css.left)||parseInt(this.css.pixelLeft)||parseInt(this.obj.offsetLeft)||0;
      this.y = parseInt(this.css.top)||parseInt(this.css.pixelTop)||parseInt(this.obj.offsetTop)||0;
      this.z = parseInt(this.css.zIndex);
      this.width = this.obj.offsetWidth||this.css.clip.width||this.obj.width||this.css.pixelWidth||0;
      this.height = this.obj.offsetHeight||this.css.clip.height||this.obj.height||this.css.pixelHeight||0;
      this.rectclip = 0;
      if((libbrowser.dom || libbrowser.ie) && this.css.clip) {
         this.rectclip = this.css.clip;
         this.rectclip = this.rectclip.slice(5,this.rectclip.length-1);
         this.rectclip = this.rectclip.split(' ');
         for(var i=0;i < 4;i++) { this.rectclip[i] = parseInt(this.rectclip[i]); }
      }
      this.clipt = this.css.clip.top || this.rectclip[0] || 0;
      this.clipr = this.css.clip.right || this.rectclip[1] || this.width||0;
      this.clipb = this.css.clip.bottom || this.rectclip[2] || this.height ||0;
      this.clipl = this.css.clip.left || this.rectclip[3] || 0;
      this.visibility = this.css.visibility;
      this.moveactive = 0;
      this.clipactive = 0;
      this.mover = 0;
      this.mclick = 0;
      this.mmove = 0;
      this.mdrag = 0;

      return this;
  }

  //visibility **********
  lib_obj.prototype.hideIt = function() {
      this.visibility = "hidden";
      this.css.visibility = this.visibility;
  }
  lib_obj.prototype.showIt = function() {
      this.visibility = "visible";
      this.css.visibility = this.visibility;
  }
  lib_obj.prototype.switchIt = function() {
      this.visibility == "hidden" ? this.showIt() : this.hideIt();
  }

  lib_obj.prototype.getProperty = function(styleid) {
      return this.css['' + styleid];
  }
  lib_obj.prototype.setProperty = function(styleid,wert) {
      this.css['' + styleid] = wert;
  }

  //background **********
  lib_obj.prototype.setBackground = function(color) {
      if(libbrowser.dom || libbrowser.ie4) {
         this.css.backgroundColor = color;
      } else if(libbrowser.ns) {
         this.css.bgColor = color;
      }
  }

  //moving **********
  lib_obj.prototype.moveTo = function(x,y) {
      this.x = x;
      this.y = y;
      this.css.left = this.x;
      this.css.top = this.y;
  }
  lib_obj.prototype.moveBy = function(x,y) {
      this.css.left = (this.x+=x);
      this.css.top = (this.y+=y);
  }
  lib_obj.prototype.moveIt = function(endx,endy,inc,speed,fn,wh) {
      if(!this.moveactive) {
         var disx = endx - this.x;
         var disy = endy - this.y;
         var num = Math.sqrt(Math.pow(disx,2)+Math.pow(disy,2))/inc;
         var dx = disx/num;
         var dy = disy/num;
         this.moveactive = 1;
         if(!wh) { wh=0; }
         if(!fn) { fn=0; }
         this.move(dx,dy,endx,endy,speed,fn,wh);
     }
  }
  lib_obj.prototype.move = function(dx,dy,endx,endy,speed,fn,wh) {
      if(this.moveactive && (Math.floor(Math.abs(dx)) < Math.floor(Math.abs(endx-this.x)) || Math.floor(Math.abs(dy))<Math.floor(Math.abs(endy-this.y)))) {
        this.moveBy(dx,dy);
        if(wh) { eval(wh); };
        setTimeout(this.id + ".move("+dx+","+dy+","+endx+","+endy+","+speed+",'"+fn+"','"+wh+"')",speed);
      }else{
        this.moveactive = 0;
        this.moveTo(endx,endy);
        if(fn) { eval(fn); }
      }
  }

  lib_obj.prototype.circleIt = function(rad,ainc,a,enda,xc,yc,speed,fn) {
        if((Math.abs(ainc) < Math.abs(enda-a))) {
           a += ainc;
           var x = xc + rad*Math.cos(a*Math.PI/180);
           var y = yc - rad*Math.sin(a*Math.PI/180);
           this.moveTo(x,y);
           setTimeout(this.id + ".circleIt("+rad+","+ainc+","+a+","+enda+","+xc+","+yc+","+speed+",'"+fn+"')",speed);
        }else if(fn && fn != "undefined") {
           eval(fn);
        }
  }

  //write **********
  lib_obj.prototype.writeIt = function(text) {
      if(libbrowser.ns) {
        this.ref.open("text/html");
        this.ref.write(text);
        this.ref.close();
      } else {
        this.obj.innerHTML=text;
      }
  }

  //cliping **********
  lib_obj.prototype.clipTo = function(clipt,clipr,clipb,clipl,setwidth) {
      if(clipt < 0) { this.clipt = 0 } else { this.clipt = clipt; }
      if(clipr < 0) { this.clipr = 0 } else { this.clipr = clipr; }
      if(clipb < 0) { this.clipb = 0 } else { this.clipb = clipb; }
      if(clipl < 0) { this.clipl = 0 } else { this.clipl = clipl; }
      if(libbrowser.ns) {
         this.css.clip.top = clipt;
         this.css.clip.right = clipr
         this.css.clip.bottom = clipb;
         this.css.clip.left = clipl;
      } else {
         this.css.clip="rect("+clipt+","+clipr+","+clipb+","+clipl+")";
         if(setwidth) {
            this.width = clipr;
            this.height = clipr;
            this.css.pixelWidth = this.css.width = this.width;
            this.css.pixelHeight = this.css.height = this.height;
         }
      }
  }
  lib_obj.prototype.clipBy = function(clipt,clipr,clipb,clipl,setwidth) {
      this.clipTo(this.clipt+clipt,this.clipr+clipr,this.clipb+clipb,this.clipl+clipl,setwidth);
  }
  lib_obj.prototype.clipIt = function(t,r,b,l,step,fn,wh){
      tstep = Math.max(Math.max(Math.abs((t-this.clipt)/step),Math.abs((r-this.clipr)/step)),Math.max(Math.abs((b-this.clipb)/step),Math.abs((l-this.clipl)/step)))
      if(!this.clipactive){
         this.clipactive=1;
         if(!wh) { wh=0; }
         if(!fn) { fn=0; }
         this.clip(t,r,b,l,(t-this.clipt)/tstep,(r-this.clipr)/tstep,(b-this.clipb)/tstep,(l-this.clipl)/tstep,tstep,0,fn,wh);
      }
  }
  lib_obj.prototype.clip = function(t,r,b,l,ts,rs,bs,ls,tstep,astep,fn,wh) {
      if(astep < tstep){
         if(wh) { eval(wh); }
         astep++
         this.clipBy(ts,rs,bs,ls,1);
         setTimeout(this.id+".clip("+t+","+r+","+b+","+l+","+ts+","+rs+","+bs+","+ls+","+tstep+","+astep+",'"+fn+"','"+wh+"')",50)
      } else {
         this.clipactive=0;
         this.clipTo(t,r,b,l,1);
         if(fn) { eval(fn); }
      }
  }
