// JavaScript Document
// Portions of this code was take from Dynamic HTML: The Definitive Reference by Danny Goodman (pp. 90-92)
var isNS=false;
var isIE=false;
var isDOM=false;

if (document.layers)
	isNS=true;
else if (document.all)
	isIE=true;
else if (document.getElementById)
	isDOM=true;

function getObject(id)
{
	var theObj;
	if (typeof id == 'string')
	{
		if (isDOM)
			theObj=document.getElementById(id);
		else if (isIE)
			theObj=eval("document.all."+id);
		else if (isNS)
			theObj=document.layers[id];
	}
	else
		theObj=id;

	return theObj;
}
function CObject(id)
{
	this.obj=getObject(id);
	this.move=function(x,y)
	{
		if (isNS)
			this.obj.moveTo(x,y);
		else if (isIE)
		{
			this.obj.style.pixelLeft=x;
			this.obj.style.pixelTop=y;		
		}
		else if (isDOM)
		{
			this.obj.style.left=x;
			this.obj.style.top=y;
		}
	}
	this.show=function()
	{
		if (isIE || isDOM)
			this.obj.style.visibility='visible';
		else if (isNS)
			this.obj.visibility='visible';
	}
	this.hide=function()
	{
		if (isIE || isDOM)
			this.obj.style.visibility='hidden';
		else
			this.obj.visibility='hidden';
	}
	this.left=function()
	{
		if (isNS)
			return this.obj.pageX;
		else if (isIE || isDOM)
			{
			  var x = this.obj.offsetLeft;
			  var parent = this.obj.offsetParent;
			  while(parent && parent!=document.body) {
				x += parent.offsetLeft;
				parent = parent.offsetParent;
			  }
			  return x;
			}
	}
	this.top=function()
	{
		if (isNS)
			return this.obj.pageY;
		else if (isIE || isDOM)
		{
			var y = this.obj.offsetTop;
		  	var parent = this.obj.offsetParent;
		  	while(parent && parent!=document.body) {
				y += parent.offsetTop;
				parent = parent.offsetParent;
		  	}
		  	return y;
		}
	}
	this.height=function()
	{
		if (isNS)
			return this.obj.clip.height;
		else if (isIE) 
			return this.obj.clientHeight;
		else if (isDOM)
			return this.obj.offsetHeight;
	}
	this.width=function()
	{
	if (isNS)
		return this.obj.clip.width;
	else if (isIE)
		return this.obj.clientWidth;
	else if (isDOM)
		return this.obj.offsetWidth;
	}
	this.setBgColor=function(color)
	{
		if (isNS)
			this.obj.bgColor=color;
		else
			this.obj.style.backgroundColor=color;
	}
	this.setVisibility=function(flag)
	{
		var vis=(flag?'visible':'hidden');
		if (isNS)
			this.obj.visibility=vis;
		else
			this.obj.style.visibility=vis;
	}
}
function openWindow(url,name,features)
{
	var hWin=window.open(url,name,features);
}
