// Dynamic HTML JavaScript Library
// project
// Author: ker
// Copyright: 2001, alva & phoenix GmbH

var bDHTML = (document.getElementById || document.all ? true : false);
var bNS = (document.layers ? true : false);
var bNS6 = (document.getElementById && !document.all ? true : false);

function dynLayer(id, parent)
{
	this.name = id;
	if (bDHTML && document.getElementById)
		this.obj = document.getElementById(id);
	else if (bDHTML && document.all)
		this.obj = document.all[id];
	
	if (bNS)
	{
		if (parent)
			this.obj = parent.obj.document.layers[id];
		else
			this.obj = document.layers[id];
	}
	this.event = this.obj;
	this.isNull = eval("this.obj == null");
	
	this.left = dynLeft;
	this.top = dynTop;
	this.pos = dynPos;
	this.width = dynWidth;
	this.height = dynHeight;
	this.setHTML = dynSetHTML;
	this.vis = dynVis;
	this.toggleVis = dynToggleVis;
	this.zIndex = dynZIndex;
	this.clip = dynClip;
	this.bg = dynBG;
}

function dynLeft(newLeft)
{
	if (newLeft != null)
	{
		if (bDHTML)
			this.obj.style.left = newLeft;
		if (bNS)
			this.obj.left = newLeft;
	}
	else
	{
		if (bDHTML)
			return this.obj.offsetLeft;
		if (bNS)
			return this.obj.left;
	}
}

function dynTop(newTop)
{
	if (newTop != null)
	{
		if (bDHTML)
			this.obj.style.top = newTop;
		if (bNS)
			this.obj.top = newTop;
	}
	else
	{
		if (bDHTML)
			return this.obj.offsetTop;
		if (bNS)
			return this.obj.top;
	}
}

function dynPos(newX, newY)
{
	this.left(newX);
	this.top(newY);
}

function dynWidth(newWidth)
{
	if (newWidth != null)
	{
		if (bDHTML)
			this.obj.style.pixelWidth = newWidth;
		if (bNS)
			this.obj./*document.*/width = newWidth;
	}
	else
	{
		if (bDHTML)
			return this.obj.offsetWidth;
		if (bNS)
			return this.obj./*document.*/width;
	}
}

function dynHeight(newHeight)
{
	if (newHeight != null)
	{
		if (bDHTML)
			this.obj.style.height = newHeight;
		if (bNS)
			this.obj.document.height = newHeight;
	}
	else
	{
		if (bDHTML)
			return this.obj.offsetHeight;
		if (bNS)
			return this.obj.document.height;
	}
}

function dynSetHTML(newHTML)
{
	if (bDHTML)
		this.obj.innerHTML = newHTML;
	if (bNS)
	{
		this.obj.document.open();
		this.obj.document.write(newHTML);
		this.obj.document.close();
	}
}

function dynVis(bShow)
{
	if (bShow != null)
	{
		if (bDHTML)
			this.obj.style.visibility = (bShow ? "visible" : "hidden");
		if (bNS)
			this.obj.visibility = (bShow ? "show" : "hide");
	}
	else
	{
		if (bDHTML)
			return (this.obj.style.visibility != "hidden");
		if (bNS)
			return (this.obj.visibility != "hide");
	}
}

function dynToggleVis()
{
	this.vis(!this.vis());
}

function dynZIndex(newZIndex)
{
	if (newZIndex != null)
	{
		if (bDHTML)
			this.obj.style.zIndex = newZIndex;
		if (bNS)
			this.obj.zIndex = newZIndex;
	}
	else
	{
		if (bDHTML)
			return this.obj.style.zIndex;
		if (bNS)
			return this.obj.zIndex;
	}
}

function dynClip(x, y, width, height)
{
	if (x != null && y != null && width != null && height != null)
	{
		if (bDHTML)
			this.obj.style.clip = "rect(" + y + " " + (x + width) + " " + (y + height) + " " + x + ")";
		if (bNS)
		{
			this.obj.clip.left = x;
			this.obj.clip.top = y;
			this.obj.clip.width = width;
			this.obj.clip.height = height;
		}
	}
	else
	{
		if (bDHTML)
			this.obj.style.clip = "rect(auto auto auto auto)";
		if (bNS)
		{
			this.obj.clip.left = 0;
			this.obj.clip.top = 0;
			this.obj.clip.width = this.obj.document.width;
			this.obj.clip.height = this.obj.document.height;
		}
	}
}

function dynBG(src)
{
	if (src != null)
	{
		if (bDHTML)
			this.obj.style.background = src;
		if (bNS)
			this.obj.background.src = src;
	}
	else
	{
		if (bDHTML)
			return this.obj.style.background;
		if (bNS)
			return this.obj.background.src;
	}
}


// doc Object

function doc()
{
	this.width = docWidth;
	this.height = docHeight;
	this.clientWidth = docClientWidth;
	this.clientHeight = docClientHeight;
	this.bodyWidth = docBodyWidth;
	this.bodyHeight = docBodyHeight;
}

function docBodyWidth()
{
	if (bNS6)
	{
		var temp = document.width;
		return document.body.offsetWidth;
	}
	if (bDHTML)
		return document.body.scrollWidth;
	if (bNS)
		return Math.max(document.width, window.innerWidth);
}

function docBodyHeight()
{
	if (bNS6)
	{
		var temp = document.height;
		return document.body.offsetHeight;
	}
	if (bDHTML)
		return document.body.scrollHeight;
	if (bNS)
		return Math.max(document.height, window.innerHeight);
}

function docWidth()
{
	if (bNS6)
		return document.body.offsetWidth;
	if (bDHTML)
		return document.body.offsetWidth;
	if (bNS)
		return document.width;
}

function docHeight()
{
	if (bNS6)
		return document.body.offsetHeight;
	if (bDHTML)
		return document.body.offsetHeight;
	if (bNS)
		return document.height;
}

function docClientWidth()
{
	if (bNS6)
		return document.width;
	if (bDHTML)
		return document.body.scrollWidth;
	if (bNS)
		return window.innerWidth;
}

function docClientHeight()
{
	if (bNS6)
		return document.height;
	if (bDHTML)
		return document.body.scrollHeight;
	if (bNS)
		return window.innerHeight;
}

