var DOM=document.getElementById;
    isIE=document.all;
    isIE4=!window.print;
    isMOZ=!document.all;
    isNS4=document.layers;
    isNS=/Netscape/i.test(navigator.userAgent);
    isMAC=/Mac/i.test(navigator.platform);
    transparent=((!isMAC)&&(isNS||isIE))?"transparent":"";
    availWidth=false;
    availHeight=false;
    xMouse=false;
    yMouse=false;

eventHandler=function()
 {
  this.process=new Array;
 }

eventHandler.prototype.add=function(jsCode)
 {
  this.process[this.process.length]=jsCode;
 }

eventHandler.prototype.handler=function(e)
 {
  for(var i=0;i<this.process.length;i++) eval(this.process[i]);
 }

getObject=function(id)
 {
  this.object=(!DOM)?eval("document."+(isMOZ)?id:"all."+id):document.getElementById(id);
 }

getObject.prototype.show=function()
 {
  if(isNS4) this.object.visibility="visible";
  else this.object.style.visibility="visible";
 }

getObject.prototype.hide=function()
 {
  if(isNS4) this.object.visibility="hidden";
  else this.object.style.visibility="hidden";
 }

getObject.prototype.write=function(htmlCode)
 {
  if(isNS4) this.object.document.write(htmlCode);
  else this.object.innerHTML=htmlCode;
 }

getObject.prototype.xPos=function(x)
 {
  if(x)
   {
    if(!DOM)
     if(isMOZ) this.object.left=x;
     else this.object.style.pixelLeft=x;
    else this.object.style.left=x;
   }
  else
   {
    if(!DOM)
     if(isMOZ) x=this.object.left;
     else x=this.object.style.pixelLeft;
    else x=this.object.style.left;
    return x;
   }
 }

getObject.prototype.yPos=function(y)
 {
  if(y)
   {
    if(!DOM)
     if(isMOZ) this.object.top=y;
     else this.object.style.pixelTop=y;
    else this.object.style.top=y;
   }
  else
   {
    if(!DOM)
     if(isMOZ) y=this.object.top;
     else y=this.object.style.pixelTop;
    else y=this.object.style.top;
    return y;
   }
 }

getObject.prototype.move=function(x,y)
 {
  this.xPos(x);
  this.yPos(y);
 }

getObject.prototype.resize=function(width,height)
 {
  if(isNS4)
   {
    if(width) this.object.clip.right=width;
    if(height) this.object.clip.bottom=height;
   }
  else
   {
    if(width)
     {
      this.object.style.width=width;
      if(!isIE4) width="auto";
     }
    else width="auto";
    if(height)
     {
      this.object.style.height=height;
      if(!isIE4) height="auto";
     }
    else height="auto";
    this.object.style.clip="rect(0px,"+width+","+height+",0px)";
   }
 }

getObject.prototype.width=function(width)
 {
  if(width)
   {
    if(isNS4) this.object.clip.right=width;
    else
     {
      this.object.style.width=width;
      if(!isIE4) width="auto";
      this.object.style.clip="rect(0px,"+width+",auto,0px)";
     }
   }
  else
   {
    if(isNS4) width=this.object.clip.right;
    else width=this.object.style.width;
    return width;
   }
 }

getObject.prototype.height=function(height)
 {
  if(height)
   {
    if(isNS4) this.object.clip.bottom=height;
    else
     {
      this.object.style.height=height;
      if(!isIE4) height="auto";
      this.object.style.clip="rect(0px,auto,"+height+",0px)";
     }
   }
  else
   {
    if(isNS4) height=this.object.clip.bottom;
    else height=this.object.style.height;
    return height;
   }
 }

getObject.prototype.scrollWidth=function()
 {
  return (isNS4)?this.object.clip.right:(isIE4)?this.object.scrollWidth:this.object.offsetWidth;
 }

getObject.prototype.scrollHeight=function()
 {
  return (isNS4)?this.object.clip.bottom:(isIE4)?this.object.scrollHeight:this.object.offsetHeight;
 }

getObject.prototype.opacity=function(opacity)
 {
  if(isIE) this.object.style.filter="alpha(opacity="+parseInt(opacity)+")";
  else if(DOM) this.object.style.MozOpacity=parseInt(opacity)+"%";
 }

function getAvailableSize()
 {
  availWidth=(isMOZ)?innerWidth:document.body.clientWidth;
  availHeight=(isMOZ)?innerHeight:document.body.clientHeight;
  if(availHeight==0) availHeight=Math.round(availWidth*5/8);
 }

function getMousePos(e)
 {
  xMouse=(isMOZ)?e.pageX:event.x+document.body.scrollLeft;
  yMouse=(isMOZ)?e.pageY:event.y+document.body.scrollTop;
 }

function preload(fileName)
 {
  image=new Image();
  image.src=fileName;
  return image;
 }

loadEvent=new eventHandler();
window.onload=function(e) { loadEvent.handler(e) };
loadEvent.add("getAvailableSize()");

resizeEvent=new eventHandler();
window.onresize=function(e) { resizeEvent.handler(e) };
resizeEvent.add("getAvailableSize()");

if(isMOZ) document.captureEvents(Event.MOUSEMOVE);
mouseMoveEvent=new eventHandler();
document.onmousemove=function(e) { mouseMoveEvent.handler(e) };
mouseMoveEvent.add("getMousePos(e)");

mouseDownEvent=new eventHandler();
document.onmousedown=function(e) { mouseDownEvent.handler(e) };

mouseUpEvent=new eventHandler();
document.onmouseup=function(e) { mouseUpEvent.handler(e) };
