<!--
// -------------------------------------------------------------------------------
// Methods used to support multiple browser types with different DOMs.
// Routines based on code by Peter-Paul Koch, www.quirksmode.org

var BrowserIncompatibleMessageShown = false

function ElementWrapper(name)
// Class constructor for an element wrapper (Common object to handle browser differences).  
// Properties:
//   obj : the element itself 
//   style : the style property of the element.  (For Netscape DOM this is the element.)

{
//  window.alert('Getting object');
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
  	this.style = this.obj.style;
  }
  else if (document.all)
  {
	  this.obj = document.all[name];
	  this.style = this.obj.style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
  else
  {
    if (!BrowserIncompatibleMessageShown)
    {
      BrowserIncompatibleMessageShown = true;
      window.alert('We are sorry, this site does not support scripting on your browser.');
    }
  }
}

function getElementWrapper (aName)
// Common routine to gain access to a page element in any (supported) browser.
{
  var Wrapper = new ElementWrapper (aName);
  return Wrapper;
}

// -------------------------------------------------------------------------------
function EventTarget(e) {
  // Returns the element that raised the event.
	if (!e) return(null);

	var target;

	if (e.target) 
    target = e.target;  // NS
	else if (e.srcElement) 
    target = e.srcElement;  // MS

	if (target.nodeType == 3) // defeat Safari bug
		target = target.parentNode;
		
  return (target);
}

// -------------------------------------------------------------------------------
function findPosX(obj) {
  // Finds position of an element relative to the page.
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

// -------------------------------------
function findPosY(obj) {
  // Finds position of an element relative to the page.
	var curtop = 0;
	if (obj.offsetParent)	{
		while (obj.offsetParent) {
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

// -------------------------------------------------------------------------------
-->
