function goPageTop()
{
window.scrollTo(0,0);
}
if (document.layers) document.captureEvents(Event.ONDBCLICK);
document.ondblclick=goPageTop;



var isNav4, isNav, isIE;
var coll = "";
var styleObj = "";
if (parseInt(navigator.appVersion) >= 4) {
 if (navigator.appName == "Netscape") {
  if (parseInt(navigator.appVersion) < 5) {
   isNav4 = true;
  } else {
   isNav = true;
  }
 } else {
  isIE = true;
  coll = "all.";
  styleObj = ".style";
 }
}

var isMac = false;
var isWin = false;
var nav=navigator.userAgent.toLowerCase();

if (nav.indexOf('mac') != -1) isMac = true;
if (nav.indexOf('win') != -1) isWin = true;

var ns4 = (document.layers);
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);


// convert object name string or object reference to a valid object reference
function getObject(obj) {
 var theObj;
 if (isNav) {
   theObj = document.getElementById(obj).style; 
 } else {
   if (typeof obj == "string") {
    theObj = eval("document." + coll + obj + styleObj);
   } else {
    theObj = obj;
   }
 }
 return theObj;
}

function textcol(obj,col) {
 var theObj = getObject(obj);
 if (!ns4) theObj.color = col;
}

// position object at specific coordinates
function shiftTo(obj,x,y) {
 var theObj = getObject(obj);
 if (isNav4) {
  theObj.moveTo(x,y);
 } else {
  theObj.left = x+'px';
  theObj.top = y+'px';
 }
}

// move an object by x,y pixels
function shiftBy(obj,deltaX,deltaY) {
 var theObj = getObject(obj);
 if (isNav4) {
  theObj.moveBy(deltaX,deltaY);
 } else {
  theObj.pixelLeft += deltaX;
  theObj.pixelTop += deltaY;
 }
}

// set z-order of an object
function setZIndex(obj,zOrder) {
 var theObj = getObject(obj);
 theObj.zIndex = zOrder;
}

// set background colour of an object
function setBGColor(obj,col) {
 var theObj = getObject(obj);
 if (isNav4) {
  theObj.bgColor = col;
 } else {
  theObj.backgroundColor = col;
 }
}

// set visibility to visible
function show(obj) {
 var theObj = getObject(obj);
 theObj.visibility = "visible";
 setZIndex(obj,999);
}

// set visibility to hidden
function hide(obj) {
 setZIndex(obj,99);
 var theObj = getObject(obj);
 theObj.visibility = "hidden";
}

// retrieve x coordinate of positionable object
function getObjectX(obj) {
 var theObj = getObject(obj);
 if (isNav4) {
  return theObj.left;
 } else {
  return theObj.pixelLeft;
 }
}

// retrieve y coordinate of positionable object
function getObjectY(obj) {
 var theObj = getObject(obj);
 if (isNav4) {
  return theObj.top;
 } else {
  return theObj.pixelTop;
 }
}


// get browser width
function getWindowWidth() {
 if (isIE) {
  return document.body.clientWidth;
 } else {
  return window.innerWidth;
 }
}

// get browser height
function getWindowHeight() {
 if (isIE) {
  return document.body.clientHeight;
 } else {
  return window.innerHeight;
 }
}


/*
 getObj is used for finding the layer to scroll
*/
function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

/*
 call getObjNested instead of getObj when a layer is nested, otherwise NN4 doesn't find it 
*/

function getObjNested(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
	this.obj = getObjNN4(document,name);
	this.style = this.obj;
  }
}

function getObjNN4(obj,name)
{
	var x = obj.layers;
	var thereturn;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
		 	thereturn = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) thereturn = tmp;
	}
	return thereturn;
}

