NG.Shade = function(node, height, disablescroll) {
	if (node == null) node = document.body;
	if (node.shade == null) {
		if (height == null) height = node.offsetHeight;
		node.shade = document.createElement('div');
		NG.addClass(node.shade,'shade');
		node.shade.style.height = height + 'px';
		node.shade.style.left = '0';
		node.shade.style.position = 'absolute';
		node.shade.style.top = '0';
		node.shade.style.width = '100%';
		node.appendChild(node.shade);
	}
	this.oldOverflow = node.style.overflow;
	if (disablescroll == null || disablescroll) {
		node.style.overflow = 'hidden';
		scroll(0,0);
	}
	this.node = node;
	this.setOpacity(75);
}
NG.Shade.prototype.close = function() {
	this.node.style.overflow = this.oldOverflow;
	if (this.node.shade != null) {
		this.node.removeChild(this.node.shade);
		this.node.shade = null;
	}
}
NG.Shade.prototype.setOpacity = function(opacity) {
	this.opacity = opacity;
	this.node.shade.style.filter = 'alpha(opacity=' + (this.opacity) + ')';
	this.node.shade.style.mozOpacity = this.opacity / 100;
	this.node.shade.style.khtmlOpacity = this.opacity / 100;
	this.node.shade.style.opacity = this.opacity / 100;
}

if (!NG.getElementsByClassName) {
	NG.getElementsByClassName = function(node, classname) {
		var results = [];
		if (NG.hasClass(node, classname)) results[results.length] = node;
		for (var i = 0; i < node.childNodes.length; i++) {
			results = results.concat(NG.getElementsByClassName(node.childNodes[i], classname));
		}
		return results;
	}
}

if (!NG.addClass) {
	NG.addClass = function (node, className) {
		var c = (node.className+'').split(/ +/);
		for (var j = 1; j < arguments.length; j++) if (c.search(arguments[j]) == -1) node.className += ' '+arguments[j];
	}
}
if (!NG.delClass) {
	NG.delClass = function (node, className) {
		var i,c = (node.className+'').split(/ +/);
		for (var j = 1; j < arguments.length; j++) {
			if (arguments[j].constructor == RegExp) {
				for (var i = 0; i < c.length; i++) if (className.test(c[i])) { c.splice(i,1); break; }
			} else {
				if ((i = c.search(arguments[j])) >= 0) c.splice(i,1);
			}
		}
		node.className = c.join(' ');
	}
}
if (!NG.replaceClass) {
	NG.replaceClass = function (node, oldClassName, newClassName) {
		var i,c = (node.className+'').split(/ +/);
		if (oldClassName.constructor == RegExp) {
			for (var i = 0; i < c.length; i++) {
				if (oldClassName.test(c[i])) c.splice(i,1);
			}
		} else if ((i = c.search(oldClassName)) >= 0) {
			c.splice(i,1);
		}
		if ((i = c.search(newClassName)) < 0) c.push(newClassName);
		node.className = c.join(' ');
	}
}
if (!NG.hasClass) {
	NG.hasClass = function (node, className) {
		if (node.nodeType != 1) return false;
		var i,c = (node.className+'').split(/ +/);
		for (var j = 1; j < arguments.length; j++) {
			if (arguments[j].constructor == RegExp) {
				for (var i = 0; i < c.length; i++) if (className.test(c[i])) return true;
			} else {
				if ((i = c.search(arguments[j])) >= 0) return true;
			}
		}
		return false;
	}
}