////////////////////////////
// FUNCTION DEFINITIONS
var rvn = {
 obj : function(n)  {return document.getElementById(n)},
 int : function(n)  {return parseInt(n)},
 echo: function(n) {document.write(n)},
 
 rand: function(n,m) {
     return Math.floor((m - n) * Math.random() + n)
 },
 
 dist: function(x1, y1, x2, y2) {
     return Math.round(Math.sqrt(Math.pow(x2-x1, 2) + Math.pow(y2-y1, 2)));
 },
 
 getheight: function(n) {
     if(n.height) return n.height;
     if(n.style && n.style.height)
         return n.style.height;
     if(n.clientHeight) return n.clientHeight;
     if(n.innerHeight)  return n.innerHeight;
     if(n == window && document.body.clientHeight)
         return document.body.clientHeight;
     return false;
 },
 
 getwidth: function(n) {
     if(n.width) return n.width;
     if(n.style && n.style.width)
         return n.style.width;
     if(n.clientWidth) return n.clientWidth;
     if(n.innerWidth)  return n.innerWidth;
     if(n == window && document.body.clientWidth)
         return document.body.clientWidth;
     return false;
 },
 
 topof: function(n) {
     if(n.style && n.style.top)
         return this.int(n.style.top);
     else return false;
 },
 
 leftof: function(n) {
     if(n.style && n.style.left)
         return this.int(n.style.left);
     else return false;
 },
 
 scrollTop: function(n) {
     if(!n) n = document.body;
     return n.scrollTop;
 },
 
 scrollLeft: function(n) {
     if(!n) n = document.body;
     return n.scrollLeft;
 },
 
 /////////////////////////////////
 // USE these functions to get
 // the width and height of an OBJECT
 heightof: function(n){return this.int(this.getheight(n))},
 widthof: function (n){return this.int(this.getwidth(n))},
 
 move: function(n,x,y) {
     if(n == window) window.moveTo(x,y);
     if(n.style) {
         if(n.style.position != 'absolute')
             n.style.position = 'absolute';
         with(n.style) {
             left = x;
             top  = y;
         }
         return true;
     }
     return false;
 },
 
 size: function(n,w,h) {
     if(n == window) window.resizeTo(w,h);
     else if(n.width) n = n;
     else if(n.style) n = n.style;
     else return false;
     if(w > -1) n.width = w;
     if(h > -1) n.height= h;
     return true;
 },
 
 hide: function(n) {
     if(n.style) n.style.display = 'none';
     else return false; return true;
 },
 
 show: function(n) {
     if(n.style) n.style.display = '';
     else return false; return true;
 },
 
 block: function(n) {
     if(n.style) n.style.display = 'block';
     else return false; return true;
 },
 
 inline: function(n) {
     if(n.style) n.style.display = 'inline';
     else return false; return true;
 },
 
 //////////////////
 // browser functions
 ie: function() {
     return (navigator.appName.indexOf('Explorer') > -1) ? true: false;
 },
 
 firefox: function() {
     return (navigator.appName.indexOf('Netscape') > -1) ? true: false;
 },
 
 //////////////////
 // Event functions 
 targetof: function(e) {
     if(e.target) return e.target;
     if(e.srcElement) return e.srcElement;
     return false;
 },
 
 mousex: function(e) {
     if(e.x>=0) return e.x + this.scrollLeft();
     if(e.pageX>=0) return e.pageX;
     return false;
 },
 
 mousey: function(e) {
     if(e.y>=0) return e.y + this.scrollTop();
     if(e.pageY>=0) return e.pageY;
     return false;
 }
}