function createWin(objId, mouseMove, rightClick)
 {this.id = objId
  this.app = (navigator.appName.indexOf("Microsoft")!=-1)?"ie":(navigator.appName.indexOf("Netscape")!=-1)?"ns":(navigator.appName.indexOf("Opera")!=-1)?"op":(navigator.appName.indexOf("Firefox")!=-1)?"ff":(navigator.appName.indexOf("gecko")!=-1)?"ge":"xx";
  this.ie = (this.app=="ie" || this.app=="op" || this.app=="xx")?1:0;
  this.ns = (this.app=="ns" || this.app=="ff" || this.app=="ge")?1:0;
  this.version = navigator.appVersion
  this.px = (document.childNodes)?'px':0;

  /* window coordinates */
  this.winL = ((document.body.scrollLeft>=0)?"document.body.scrollLeft":(window.scrollX>=0)?"window.scrollX":"window.pageXOffset")+"+"+((document.documentElement.scrollLeft>=0)?"document.documentElement.scrollLeft":"");
  this.winT = ((document.body.scrollTop>=0)?"document.body.scrollTop":(window.scrollY>=0)?"window.scrollY":"window.pageYOffset")+"+"+((document.documentElement.scrollTop>=0)?"document.documentElement.scrollTop":"");
  this.winW = ((document.body.clientWidth>=0)?"document.body.clientWidth":"window.innerWidth")+"+"+((document.documentElement.clientWidth>=0)?"document.documentElement.clientWidth":"");
  this.winH = ((document.body.clientHeight>=0)?"document.body.clientHeight":"window.innerHeight")+"+"+((document.documentElement.clientHeight>=0)?"document.documentElement.clientHeight":"");

  this.offset = new vec(eval(this.winL), eval(this.winT));
  this.dim = new vec(eval(this.winW), eval(this.winH));
  this.onset = new vec(this.offset.x+this.dim.x, this.offset.y+this.dim.y);

  /* mouse coordinates */
  this.eventX = (window.event)?"window.event.clientX":"e.pageX";     //"e.x" : "window.event.offsetX"  (event.clientX)?"event.clientX":
  this.eventY = (window.event)?"window.event.clientY":"e.pageY";     //"e.y" : "window.event.offsetY"  (event.clientY)?"event.clientY":
  this.mouseX = this.winL+"+"+this.eventX;
  this.mouseY = this.winT+"+"+this.eventY;
  this.mouse  = new vec(0, 0);

  /* screen object */
  this.evtObj = (window.event)?"window.event.srcElement":"e.target";
  this.eventElem = null;

  /* drag-drop action */
  this.moveObj = null;
  this.moveOffset = new vec(0, 0);

  /* define multiple object methods calling */
  this.clickCalls  = new Array();
  this.clickRCalls = new Array();
  this.resizeCalls = new Array();
  this.cancelCalls = new Array();

  /* define window events */
  window.document.onclick = new Function("e",this.id+".click(e)");
  window.onresize = new Function(this.id+".resize()");
  window.onunload = new Function(this.id+".cancel()");
  if (mouseMove) {window.document.onmousemove = new Function("e",this.id+".move(e)")}
  if (rightClick) {window.document.oncontextmenu = new Function("return "+this.id+".rightClick()")}
//  window.onerror = function(){return true};

  /* define methods */
  this.resize = function()
    {this.offset.set(eval(this.winL), eval(this.winT))
     this.dim.set(eval(this.winW), eval(this.winH))
     this.onset.set(this.offset.x+this.dim.x, this.offset.y+this.dim.y)
     if (this.resizeCalls.length>0) {for (var i in this.resizeCalls) eval(this.resizeCalls[i]);}
    }

  this.move = function(e)
    {this.mouse.set(eval(this.mouseX), eval(this.mouseY));
    }

  this.key = function(e)
    {key=event.keyCode?event.keyCode:e.keyCode?e.keyCode:e.charCode?e.charCode:e.which?e.which:void 0;
     key=String.fromCharCode(key).toLowerCase();
     return key
    }

  this.click = function(e)
    {this.eventElem = eval(this.evtObj);
     if (this.clickCalls.length>0) {for (var i in this.clickCalls) eval(this.clickCalls[i]);}
    }

  this.rightClick = function()
    {if (this.clickRCalls.length>0) {for (var i in this.clickRCalls) eval(this.clickRCalls[i]);}
     return false;
    }

  this.clickDown = function(e)
    {this.moveObj = (eval(this.evtObj).parentNode);
     this.moveOffset.set(eval(this.eventX), eval(this.eventY));
    }

  this.clickMove = function()
    {if (this.moveObj && this.moveObj.style)
        {if (this.moveObj.style.left)
            {this.moveObj.style.left = (this.mouse.x - this.moveOffset.x) + this.px;
             this.moveObj.style.top  = (this.mouse.y - this.moveOffset.y) + this.px;
            }
           else
            {this.moveObj.moveTo((this.mouse.x-this.moveOffset.x), (this.mouse.y-this.moveOffset.y))}
        }
    }

  this.clickUp = function()
    {this.moveObj = null;
    }

  this.checkBorder = function(objDot, objDim, limitDot, limitDim)
    {if (objDot.x<this.offset.x) objDot.x = (!limitDot)?this.offset.x:(!limitDot.x&&!limitDim.x)?this.offset.x:limitDot.x+limitDim.x;
     if (objDot.x+objDim.x>this.onset.x) objDot.x = ((!limitDot)?this.onset.x:(!limitDot.x)?this.onset.x:limitDot.x) - objDim.x;
     if (objDot.y<this.offset.y) objDot.y = (!limitDot)?this.offset.y:(!limitDot.y&&!limitDim.y)?this.offset.y:limitDot.y+limitDim.y;
     if (objDot.y+objDim.y>this.onset.y) objDot.y = ((!limitDot)?this.onset.y:(!limitDot.y)?this.onset.y:limitDot.y) - objDim.y;
    }

  this.cancel = function()
    {if (this.cancelCalls.length>0) {for (var i in this.cancelCalls) eval(this.cancelCalls[i]);}
     this.id = null;
    }

  this.addBookmark = function(bookmarkTitle)
    {if ((this.version.indexOf("MSIE") > 0) && (parseInt(this.version) >= 4))
       {window.external.AddFavorite(window.location.href, unescape(bookmarkTitle));}
    }

  this.ref = function(refId)
    {if (document.getElementById) {return document.getElementById(refId);}
     if (document.all) {return document.all[refId];}
     if (document[refId]) {return document[refId];}
     if (document.layers) {return document.layers[refId];}
     return false;
    }

  this.open = function(act)
    {window.location.href = act;
    }
 }

function vec(x, y)
 {this.x = x;
  this.y = y;

  /* define methods */
  this.set = function (x, y)
     {this.x = x;
      this.y = y;
     }
 }