<!--

// Copyright 2000 A Walk Beyond, LLC.  All rights reserved.


function DocObject ( sName )
{
	this.id = FindObject (document, sName);
	this.name = sName;
	
	this.SetVisible = DocObject_SetVisible;
	this.IsVisible = DocObject_IsVisible;
	this.SetOrder = DocObject_SetOrder;
	this.MoveTo = DocObject_MoveTo;
	this.MoveBy = DocObject_MoveBy;
	this.Center = DocObject_Center;
	this.SetClip = DocObject_SetClip;
	this.GetValue = DocObject_GetValue;
	this.SetValue = DocObject_SetValue;

	function DocObject_SetVisible ( bVisible )
	{
		if (this.id)
		{
			if (navigator.appName == "Netscape")
			{
				this.id.visibility = bVisible ? "show" : "hide";
			}
			else
			{
				this.id.style.visibility = bVisible ? "visible" : "hidden";
			}
		}
	}
	
	function DocObject_IsVisible()
	{
		return (document.layers ? (this.id.visibility == "show") : (this.id.style.visibility == "visible"));
	}
	
	function DocObject_SetOrder ( iOrder )
	{
		if (this.id)
		{
			if (navigator.appName == "Netscape")
			{
				this.id.zIndex = iOrder;
			}
			else
			{
				this.id.style.zIndex = iOrder;
			}
		}
	}
	
	function DocObject_MoveTo ( x, y )
	{
		if (this.id)
		{
			if (navigator.appName == "Netscape")
			{
				this.id.moveTo(x,y);
			}
			else
			{
				this.id.style.left = x;
				this.id.style.top = y;
			}
		}
	}
	
	function DocObject_MoveBy ( dx, dy )
	{
		if (this.id)
		{
			if (navigator.appName == "Netscape")
			{
				this.id.moveBy(dx, dy);
			}
			else
			{
				this.id.style.left = this.id.offsetLeft + dx;
				this.id.style.top  = this.id.offsetTop + dy;
			}
		}
	}
	
	function DocObject_Center ( sDirection )
	{
		if (navigator.appName == "Netscape")
		{
			if (this.id)
			{
				var paramLeft = window.innerWidth/2 - this.id.clip.width/2;
				var paramTop = window.innerHeight/2 - this.id.clip.height/2;

				if (sDirection == null || sDirection == "horizontal" || sDirection == "both") this.id.left = paramLeft;
				if (sDirection == null || sDirection == "vertical" || sDirection == "both") this.id.top = paramTop;
			}
		}
		else
		{
			if (this.id)
			{
				var clientWidth = document.body.clientWidth;
				var clientHeight = document.body.clientHeight;
				var scrollLeft = document.body.scrollLeft;
				var scrollTop = document.body.scrollTop;
	
				var paramLeft = clientWidth/2 - this.id.offsetWidth/2 + scrollLeft;
				var paramTop = clientHeight/2 - this.id.offsetHeight/2 + scrollTop;

				if (scrollLeft < clientWidth)
				{
					if (sDirection == null || sDirection == "horizontal" || sDirection == "both") this.id.style.setExpression('left', paramLeft);
				}
				
				if (scrollTop < (document.body.offsetHeight))
				{
					if (sDirection == null || sDirection == "vertical" || sDirection == "both") this.id.style.setExpression('top', paramTop);
				}
			}
		}
	}
	
	function DocObject_SetClip ( nClipTop, nClipRight, nClipBottom, nClipLeft )
	{
		if (this.id)
		{
			if (document.layers)
			{
				this.id.clip.top = nClipTop;
				this.id.clip.right = nClipRight;
				this.id.clip.bottom = nClipBottom;
				this.id.clip.left = nClipLeft;
			}
			else
			{
				var sClip = "rect(" + nClipTop + ", "
									+ nClipRight + ", "
									+ nClipBottom + ", "
									+ nClipLeft + ")";

				this.id.style.clip = sClip;
			}
		}
	}

	function DocObject_GetValue ( sValue )
	{
		var vValue = null;

		if (this.id && typeof(sValue) == "string")
		{
			if (document.layers)
			{
				if (sValue == "top") vValue = this.id.y;
				else if (sValue == "left") vValue = this.id.x;
				else if (sValue == "width") vValue = this.id.clip.width;
				else if (sValue == "height") vValue = this.id.clip.height;
			}
			else
			{
				if (sValue == "top") vValue = this.id.offsetTop;
				else if (sValue == "left") vValue = this.id.offsetLeft;
				else if (sValue == "width") vValue = this.id.offsetWidth;
				else if (sValue == "height") vValue = this.id.offsetHeight;
				else if (sValue == "position") vValue = this.id.style.position;
			}
		}

		return vValue;
	}
	
	function DocObject_SetValue ( sValue, vValue )
	{
		if (this.id && typeof(sValue) == "string")
		{
			if (document.layers)
			{
				if (sValue == "top") this.id.y = vValue;
				else if (sValue == "left") this.id.x = vValue;
				else if (sValue == "width") this.id.clip.width = vValue;
				else if (sValue == "height") this.id.clip.height = vValue;
			}
			else
			{
				if (sValue == "top") this.id.style.top = vValue;
				else if (sValue == "left") this.id.style.left = vValue;
				else if (sValue == "width") this.id.style.width = vValue;
				else if (sValue == "height") this.id.style.height = vValue;
				else if (sValue == "position") this.id.style.position = vValue;
			}
		}
	}
}

function CenterObject (sObject, sDirection)
{
	var oObject = FindObject (document, sObject);
	
	if (navigator.appName == "Netscape")
	{
		if (oObject)
		{
			var paramLeft = window.innerWidth/2 - oObject.clip.width/2;
			var paramTop = window.innerHeight/2 - oObject.clip.height/2;

			if (sDirection == null || sDirection == "horizontal" || sDirection == "both") oObject.left = paramLeft;
			if (sDirection == null || sDirection == "vertical" || sDirection == "both") oObject.top = paramTop;
		}
	}
	else
	{
		if (oObject)
		{
			var clientWidth = document.body.clientWidth;
			var clientHeight = document.body.clientHeight;
			var scrollLeft = document.body.scrollLeft;
			var scrollTop = document.body.scrollTop;
	
			var paramLeft = clientWidth/2 - oObject.offsetWidth/2 + scrollLeft;
			var paramTop = clientHeight/2 - oObject.offsetHeight/2 + scrollTop;

			if (scrollLeft < clientWidth)
			{
				if (sDirection == null || sDirection == "horizontal" || sDirection == "both") oObject.style.setExpression('left', paramLeft);
			}
			
			if (scrollTop < (document.body.offsetHeight))
			{
				if (sDirection == null || sDirection == "vertical" || sDirection == "both") oObject.style.setExpression('top', paramTop);
			}
		}
	}
}


function PlaceObject (sObject, left, top)
{
	var oObject = FindObject (document, sObject);
	var t, l, h, w;

	if (navigator.appName == "Netscape")
	{
		if (oObject)
		{
			t = top + window.pageYOffset;
			l = left + window.pageXOffset;
			h = t + oObject.clip.height;
			w = l + oObject.clip.width;

			oObject.top = (h < document.height) ? t : document.height - oObject.clip.height - 1;
			oObject.left = (w < document.width) ? l : document.width - oObject.clip.width - 1;
		}
	}
	else
	{
		if (oObject)
		{
			t = top + document.body.scrollTop;
			l = left + document.body.scrollLeft;
			h = t + oObject.offsetHeight;
			w = l + oObject.offsetWidth;

			if (h > document.all.body_section.height) t = document.body.scrollHeight - oObject.offsetHeight;
			if (l > document.all.body_section.width) l = document.body.scrollWidth - oObject.offsetWidth;
			if (t >= 0) oObject.style.top = t;
			if (l >= 0) oObject.style.left = l;
		}
	}
}

function FindObject ( oDoc, sName )
{
	elementID = null;

	if (oDoc.all)
	{
		if (elementID == null) elementID = oDoc.all[sName];
	}
	else if (navigator.appName == "Netscape")
	{
		if (elementID == null) elementID = oDoc[sName];
		if (elementID == null) elementID = oDoc.images[sName];
		if (elementID == null) elementID = oDoc.forms[sName];
		if (elementID == null) elementID = oDoc.embeds[sName];
		if (elementID == null) elementID = oDoc.layers[sName];

		if (oDoc.layers && elementID == null)
		{
			for (var i=0; elementID == null && i < oDoc.layers.length; i++)
			{
				if (oDoc.layers[i] != null)	elementID = FindObject (oDoc.layers[i].document, sName);
			}
		}
	}

	return elementID;
}

//-->