liltype = function()
{
	this.inherited = null;
}
new liltype();

liltype.stack = null;

liltype.dbg = function(id)
{
	if (id)
	{
		this.id = id;
		this.active = true;
	}
}
new liltype.dbg();

liltype.dbg.prototype.m = function(txt)
{
	var n = liltype.ds(this.id);
	if (this.active && n)
	{
		n.innerHTML += txt+"<br />\n";
	}
}

liltype.push = function(obj)
{
	var wobj;
	wobj = new liltype();
	wobj.next = null;
	wobj.obj = obj;

	if (this.stack === null)
	{
		this.stack = wobj;
	}
	else
	{
		wobj.next = this.stack;
		this.stack = wobj;
	}
}

liltype.top = function()
{
	if (this.stack)
	{
		return this.stack.obj;
	}
}

liltype.pop = function()
{
	var n;
	if (this.stack !== null)
	{
		n = this.stack;
		this.stack = n.next;
		return n.obj;
	}
	return null;
}

liltype.ds = function(id)
{
	return document.getElementById(id);
}


liltype.GPN = function(node, tagName, classMatch, id, nodeType)
{
	var parentNode;
	nodeType = nodeType ? nodeType : 1;
	if (node.parentNode)
	{
		parentNode = node.parentNode;
		if ((parentNode.tagName == tagName) &&
		    (parentNode.nodeType == nodeType))
		{
			if (classMatch && id)
			{
				if (liltype.CNU.match(parentNode.className, classMatch) &&
				    (id == parentNode.id))
				{
					return parentNode;
				}
			}
			else if (classMatch)
			{
				if (liltype.CNU.match(parentNode.className, classMatch))
				{
					return parentNode;
				}
			}
			else if (id)
			{
				if (id == parentNode.id)
				{
					return parentNode;
				}
			}
			else
			{
				return parentNode;
			}
		}
		return this.GPN(parentNode, tagName, classMatch, id, nodeType);
	}
	else
	{
		return null;
	}
}

liltype.xVerseNode = function(root, handler, method)
/* handler is object w/ method handler.handleXVerse(node)
	 - return false to teminate the traversal
	 - true to continue */
{
	var i, c, node;
	method = method ? method : "handleXVerse";

	if (root && root.hasChildNodes())
	{
		for (i = 0, c = root.childNodes.length; i < c; i++)
		{
			node = root.childNodes[i];
			if (node)
			{
				if (handler[method](node))
				{
					this.xVerseNode(node, handler, method);
				}
			}
		}
	}
}


liltype.classNameUtil = new liltype();
liltype.CNU = liltype.classNameUtil;
liltype.classNameUtil.regExpPre = "(^|\\s)";
liltype.classNameUtil.regExpPost = "(\\s|$)";
liltype.classNameUtil.lastRegExp = null;

liltype.classNameUtil.match = function(className, selector)
{
	return new RegExp(this.regExpPre+selector+this.regExpPost).test(className);
}

liltype.classNameUtil.matchNode = function(node, selector)
{
	return this.match(node.className, selector);
}

liltype.classNameUtil.add = function(className, selector)
{
	if (!className)
	{
		return selector;
	}
	else
	{
		if (this.match(className, selector))
		{
			return className;
		}
		else
		{
			return className+" "+selector;
		}
	}
}

liltype.classNameUtil.addToNode = function(node, selector)
{
	node.className = this.add(node.className, selector);
}

liltype.classNameUtil.del = function(className, selector)
{
	var rgs;
	if (!className)
	{
		return "";
	}
	else
	{
		return className.replace(new RegExp(this.regExpPre+"("+selector+")"+this.regExpPost), "$1$3");
	}
}

liltype.classNameUtil.delFromNode = function(node, selector)
{
	node.className = this.del(node.className, selector);
}


liltype.NGC = function(node)
{
	if (liltype.NGC.parent)
	{
		this.inherited = liltype.NGC.parent;
		this.inherited();
		this.classNames = new Array();
		this.nodes = null;
		this.node = node;
		if (arguments.length > 1)
		{
			this.addClassesW(arguments, 1);
		}
		liltype.NGC.actual = this;
	}
}
new liltype.NGC();
liltype.NGC.prototype = new liltype();
liltype.NGC.parent = liltype;
liltype.NGC.actual = null;

/* Prototype methods */
	liltype.NGC.prototype.addClasses = function()
	{
		this.addClassesW(arguments, 0);
	}
	
	liltype.NGC.prototype.addClassesW = function(args, i)
	{
		var c , j, d;
		for (c = args.length; i < c; i++)
		{
			if (typeof args[i] == "string")
			{
				this.classNames.push(args[i]);
			}
			else
			{
				for (j = 0, d = args[i].length; j < d; j++)
				{
					this.classNames.push(args[i][j]);
				}
			}
		}
	}
	
	liltype.NGC.prototype.addClassesFromObj = function(obj)
	{
		var k;
		for (k in obj)
		{
			this.classNames.push(obj[k]);
		}
	}
	
	liltype.NGC.prototype.handleXVerse = function(node)
	{
		var i, c, className;
		for (i = 0, c = this.classNames.length; i < c; i++)
		{
			if ((node.nodeType == 1) &&
					(liltype.classNameUtil.match(node.className, this.classNames[i])))
	 	 	{
	 	 		className = this.classNames[i];
				if (!this.nodes[className])
				{
					this.nodes[className] = new Array();
				}
				this.nodes[className].push(node);
			}
		}
		return true;
	}
	
	liltype.NGC.prototype.init = function()
	{
		this.nodes = new Array();
		liltype.xVerseNode(this.node, this);
	}
	
	liltype.NGC.prototype.get = function(className, ind)
	{
		var nodes;
		if (this.nodes === null)
		{
			this.init();
		}

		if (nodes = this.nodes[className])
		{
			return nodes;
		}

		return new Array();
	}

	liltype.NGC.prototype.getOne = function(className, ind)
	{
		var nodes;
		if (this.nodes === null)
		{
			this.init();
		}

		if (nodes = this.nodes[className])
		{
			return nodes[ind ? ind : 0];
		}

		return null;
	}
	
	liltype.NGC.prototype.apply = function(className, obj, method)
	{
		var i, c;
		var nodes = this.get(className);
		for (i = 0, c = nodes.length; i < c; i++)
		{
			obj[method](nodes[i]);
		}
	}
	
	liltype.NGC.prototype.setInnerHTML = function(className, html)
	{
		var i, c;
		var nodes = this.get(className);
		for (i = 0, c = nodes.length; i < c; i++)
		{
			nodes[i].innerHTML = html;
		}
	}
	
	liltype.NGC.prototype.setStyle = function(className, att, val)
	{
		var i, c;
		var nodes = this.get(className);
		for (i = 0, c = nodes.length; i < c; i++)
		{
			nodes[i].style[att] = val;
		}
	}

/*
 Convenience class methods
*/
	liltype.NGC.get = function(className)
	{
		this.actual.get(className);
	}
	
	liltype.NGC.setInnerHTML = function(className, html)
	{
		if (arguments[2])
		{
			this.actual.setInnerHTML(className, html, arguments[2]);
		}
		else
		{
			this.actual.setInnerHTML(className, html);
		}
	}


/* 
	Simple rollover
*/
	liltype.simpleOnMouseOver = function()
	{
		var img = this.liltype.simpleRolloverImg;
		img["src"].src = img["over"].src;
	}
	
	liltype.simpleOnMouseOut = function()
	{
		var img = this.liltype.simpleRolloverImg;
		img["src"].src = img["out"].src;
	}
	
	liltype.simpleRollover = function(src, srcOut, srcOver)
	{
		var node, img;
		img = new Array();
		img["over"] = new Image();
		img["over"].src = srcOver;
		img["out"] = new Image();
		img["out"].src = srcOut;
		
		if (typeof src == "string")
		{
			img["src"] = liltype.ds(src);
		}
		else
		{
			img["src"] = src;
		}

		if (!img["src"])
		{
			return;
		}
		
		if (!img["src"].liltype)
		{
			img["src"].liltype = new liltype();
		}
	
		for (node = img["src"].parentNode; node; node = node.parentNode)
		{
			if (node.nodeName == "A")
			{
				if (!node.liltype)
				{
					node.liltype = new liltype();
				}
				node.liltype.simpleRolloverImg = img;
				node.onmouseover = liltype.simpleOnMouseOver;
				node.onmouseout = liltype.simpleOnMouseOut;

				img["src"].liltype.simpleRolloverA = node;
				break;
			}
		}
	}
	
	liltype.simpleRollLast = function(srcOut, srcOver)
	{
		return this.simpleRollover(document.images[document.images.length - 1], srcOut, srcOver);
	}
/*
	Email munger
*/
	liltype.mungeLastMailto = function(name, dom1, dom2, putInnerHTML)
	{
	  return;
		var i, c, a;
		for (i = document.links.length - 1; i > -1; i--)
		{
			a = document.links[i];
			if (a.href.match(/^mailto:/))
			{
				a.href += name+"@"+dom1+"."+dom2;
				if (putInnerHTML)
				{
					a.innerHTML = name+"@"+dom1+"."+dom2;
				}
				return;
			}
		}
	}
